Skip to content
Snippets Groups Projects
Commit de36b8d6 authored by kelly.nguyen's avatar kelly.nguyen
Browse files

display data with data - assignment list

parent e0fbaa86
No related branches found
No related tags found
No related merge requests found
Pipeline #29952 failed
......@@ -14,6 +14,7 @@
"axios": "^1.6.5",
"boxen": "^5.1.2",
"chalk": "^4.1.2",
"cli-table3": "^0.6.3",
"commander": "^11.1.0",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
......@@ -1588,6 +1589,29 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/cli-table3": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz",
"integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==",
"dependencies": {
"string-width": "^4.2.0"
},
"engines": {
"node": "10.* || >= 12.*"
},
"optionalDependencies": {
"@colors/colors": "1.5.0"
}
},
"node_modules/cli-table3/node_modules/@colors/colors": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
"integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==",
"optional": true,
"engines": {
"node": ">=0.1.90"
}
},
"node_modules/cli-width": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz",
......
{
"name" : "dojo_cli",
"description" : "CLI of the Dojo project",
"version" : "3.5.0",
"license" : "AGPLv3",
"author" : "Michaël Minelli <dojo@minelli.me>",
"main" : "dist/app.js",
"bin" : {
"name": "dojo_cli",
"description": "CLI of the Dojo project",
"version": "3.5.0",
"license": "AGPLv3",
"author": "Michaël Minelli <dojo@minelli.me>",
"main": "dist/app.js",
"bin": {
"dojo": "./dist/app.js"
},
"pkg" : {
"pkg": {
"scripts": [],
"assets" : [
"assets": [
"node_modules/axios/dist/node/axios.cjs",
".env",
"assets/**/*"
......@@ -24,51 +24,52 @@
"node18-win-x86"
]
},
"scripts" : {
"scripts": {
"dotenv:build": "npx dotenv-vault local build",
"lint" : "npx eslint .",
"genversion" : "npx genversion -s -e src/config/Version.ts",
"build" : "npm run genversion; npx tsc",
"start:dev" : "npm run genversion; npm run lint; npx ts-node src/app.ts",
"test" : "echo \"Error: no test specified\" && exit 1"
"lint": "npx eslint .",
"genversion": "npx genversion -s -e src/config/Version.ts",
"build": "npm run genversion; npx tsc",
"start:dev": "npm run genversion; npm run lint; npx ts-node src/app.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies" : {
"@gitbeaker/rest" : "^39.34.3",
"appdata-path" : "^1.0.0",
"axios" : "^1.6.5",
"boxen" : "^5.1.2",
"chalk" : "^4.1.2",
"commander" : "^11.1.0",
"dotenv" : "^16.3.1",
"dotenv-expand" : "^10.0.0",
"fs-extra" : "^11.2.0",
"http-status-codes" : "^2.3.0",
"inquirer" : "^8.2.6",
"json5" : "^2.2.3",
"jsonwebtoken" : "^8.5.1",
"open" : "^8.4.2",
"ora" : "^5.4.1",
"semver" : "^7.5.4",
"tar-stream" : "^3.1.6",
"winston" : "^3.11.0",
"yaml" : "^2.3.4",
"zod" : "^3.22.4",
"dependencies": {
"@gitbeaker/rest": "^39.34.3",
"appdata-path": "^1.0.0",
"axios": "^1.6.5",
"boxen": "^5.1.2",
"chalk": "^4.1.2",
"cli-table3": "^0.6.3",
"commander": "^11.1.0",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
"fs-extra": "^11.2.0",
"http-status-codes": "^2.3.0",
"inquirer": "^8.2.6",
"json5": "^2.2.3",
"jsonwebtoken": "^8.5.1",
"open": "^8.4.2",
"ora": "^5.4.1",
"semver": "^7.5.4",
"tar-stream": "^3.1.6",
"winston": "^3.11.0",
"yaml": "^2.3.4",
"zod": "^3.22.4",
"zod-validation-error": "^3.0.0"
},
"devDependencies": {
"@types/fs-extra" : "^11.0.4",
"@types/inquirer" : "^8.2.10",
"@types/jsonwebtoken" : "^8.5.9",
"@types/node" : "^18.19.2",
"@types/semver" : "^7.5.6",
"@types/tar-stream" : "^3.1.3",
"@types/fs-extra": "^11.0.4",
"@types/inquirer": "^8.2.10",
"@types/jsonwebtoken": "^8.5.9",
"@types/node": "^18.19.2",
"@types/semver": "^7.5.6",
"@types/tar-stream": "^3.1.3",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser" : "^6.18.1",
"dotenv-vault" : "^1.25.0",
"genversion" : "^3.2.0",
"pkg" : "^5.8.1",
"tiny-typed-emitter" : "^2.1.0",
"ts-node" : "^10.9.2",
"typescript" : "^5.3.3"
"@typescript-eslint/parser": "^6.18.1",
"dotenv-vault": "^1.25.0",
"genversion": "^3.2.0",
"pkg": "^5.8.1",
"tiny-typed-emitter": "^2.1.0",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
}
}
......@@ -21,12 +21,12 @@ class AssignmentDeleteCommand extends CommanderCommand {
{
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();
};
// const oraInfo = (message: string) => {
// ora({
// text: message,
// indent: 4
// }).start().info();
// };
console.log(assign)
// assign.forEach(a => {
// oraInfo(`${chalk.magenta('ID :')} ${a.gitlabId}`);
......
......@@ -4,6 +4,8 @@ import DojoBackendManager from "../../../managers/DojoBackendManager";
import ora from "ora";
import User from "../../../sharedByClients/models/User";
import SessionManager from "../../../managers/SessionManager";
import Table from 'cli-table3';
import Assignment from "../../../sharedByClients/models/Assignment";
class AssignmentListCommand extends CommanderCommand {
protected commandName : string = 'list';
......@@ -40,15 +42,22 @@ class AssignmentListCommand extends CommanderCommand {
oraInfo(`${chalk.magenta('Name :')} ${user.gitlabUsername}`);
oraInfo(`${chalk.magenta('Role :')} ${user.role}`);
console.log();
user.assignments?.forEach(assign => {
const d = new Date(assign.gitlabCreationInfo.last_activity_at).toDateString();
oraInfo(`${chalk.magenta(`Assignment ${assign.gitlabId}: `)} ${assign.name}`);
oraInfo(`${chalk.magenta(`Last Activity : `)} ${d}`);
oraInfo(`${chalk.magenta(`Link :`)} ${assign.gitlabLink}`);
});
this.display(user.assignments);
}
}
private display(assign: Assignment[] | undefined) {
const table = new Table({
head: ['#', 'Assignment', 'Last Activity', 'Link']
});
assign?.forEach((a, index) => {
const d = new Date(a.gitlabCreationInfo.last_activity_at).toDateString();
table.push([index + 1, a.name, d, a.gitlabLink])
})
console.log(table.toString());
}
}
export default new AssignmentListCommand();
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment