Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoCLI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dojo_Project_Nguyen
UI
DojoCLI
Commits
44842d8b
Commit
44842d8b
authored
9 months ago
by
kelly.nguyen
Browse files
Options
Downloads
Patches
Plain Diff
move delete cmd to right branch
parent
595387ae
No related branches found
No related tags found
No related merge requests found
Pipeline
#33691
failed
9 months ago
Stage: code_quality
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
NodeApp/src/commander/assignment/subcommands/AssignmentDeleteCommand.ts
+25
-33
25 additions, 33 deletions
...mmander/assignment/subcommands/AssignmentDeleteCommand.ts
with
25 additions
and
33 deletions
NodeApp/src/commander/assignment/subcommands/AssignmentDeleteCommand.ts
+
25
−
33
View file @
44842d8b
import
chalk
from
"
chalk
"
;
import
CommanderCommand
from
"
../../
CommanderCommand
"
;
import
DojoBackendManag
er
from
"
../../../
managers/DojoBackendManag
er
"
;
import
Assignment
from
"
../../../sharedByClients/models/Assignment
"
;
import
CommanderCommand
from
'
../../CommanderCommand
'
;
import
DojoBackendManager
from
'
../../
../managers/DojoBackendManager
'
;
import
AccessesHelp
er
from
'
../../../
helpers/AccessesHelp
er
'
;
import
ora
from
'
ora
'
;
class
AssignmentDeleteCommand
extends
CommanderCommand
{
protected
commandName
:
string
=
'
delete
'
;
protected
commandName
:
string
=
'
delete
'
;
protected
defineCommand
()
:
void
{
protected
defineCommand
()
{
this
.
command
.
description
(
'
delete an assignment
'
)
.
argument
(
'
<assignmentName>
'
,
'
name of the assignment
'
)
.
option
(
'
-v, --verbose
'
,
'
verbose mode - display principal container output in live
'
)
.
arguments
(
'
<name>
'
)
.
action
(
this
.
commandAction
.
bind
(
this
));
}
protected
async
commandAction
(
assignmentName
:
string
):
Promise
<
void
>
{
let
assign
:
Assignment
[]
=
[];
protected
async
commandAction
(
name
:
string
):
Promise
<
void
>
{
{
console
.
log
(
chalk
.
cyan
(
'
Please wait while we are retrieving the users...
'
));
assign
=
await
DojoBackendManager
.
delAssignment
(
assignmentName
);
// const oraInfo = (message: string) => {
// ora({
// text: message,
// indent: 4
// }).start().info();
// };
console
.
log
(
assign
)
// assign.forEach(a => {
// oraInfo(`${chalk.magenta('ID :')} ${a.gitlabId}`);
// oraInfo(`${chalk.magenta('Assignment :')} ${a.name}`);
// a.staff.forEach( s => {
// oraInfo(`${chalk.magenta('Info :')} ${s.gitlabLastInfo}`);
// oraInfo(`${chalk.magenta('Staff :')} ${s.gitlabUsername}`);
// })
// console.log()
// })
// assign.exercises.forEach( ex => {
// oraInfo(`${chalk.magenta('Exercice :')} ${ex.assignmentName}`);
// })
if
(
!
await
AccessesHelper
.
checkTeachingStaff
())
{
return
;
}
}
{
const
spinner
=
ora
({
text
:
'
Deleting assignment
'
,
indent
:
4
}).
start
();
try
{
await
DojoBackendManager
.
delAssignment
(
name
);
spinner
.
succeed
(
'
Assignment deleted
'
);
}
catch
(
error
)
{
spinner
.
fail
(
'
Error while trying to deleting the assignment
'
);
}
}
}
}
export
default
new
AssignmentDeleteCommand
();
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment