From 2e33e6b6658cd899ef41cef0b5abd2d95eadbf8b Mon Sep 17 00:00:00 2001 From: Pavel Gnedov Date: Mon, 27 Mar 2023 12:02:34 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BF=D1=80=D0=B5=D0=B4=D1=81=D1=82=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B7=D0=B0=D0=B4=D0=B0=D1=87?= =?UTF-8?q?=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=B0=D0=BC=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D1=82=D0=B5=D0=B3=D0=B0=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.module.ts | 2 + .../simple-issues-list.controller.ts | 34 ++++++ views/simple-issues-list.hbs | 114 ++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 src/dashboards/simple-issues-list.controller.ts create mode 100644 views/simple-issues-list.hbs diff --git a/src/app.module.ts b/src/app.module.ts index 6f28444..04c5bd6 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -45,6 +45,7 @@ import { SimpleKanbanBoardController } from './dashboards/simple-kanban-board.co import { IssueUrlEnhancer } from '@app/event-emitter/issue-enhancers/issue-url-enhancer'; import { IssuesByTagsWidgetService } from './dashboards/widgets/issues-by-tags.widget.service'; import { CategoryMergeToTagsEnhancer } from './issue-enhancers/category-merge-to-tags-enhancer'; +import { SimpleIssuesListController } from './dashboards/simple-issues-list.controller'; @Module({ imports: [ @@ -63,6 +64,7 @@ import { CategoryMergeToTagsEnhancer } from './issue-enhancers/category-merge-to CurrentIssuesEccmReportController, DailyEccmReportController, SimpleKanbanBoardController, + SimpleIssuesListController, ], providers: [ AppService, diff --git a/src/dashboards/simple-issues-list.controller.ts b/src/dashboards/simple-issues-list.controller.ts new file mode 100644 index 0000000..5a91041 --- /dev/null +++ b/src/dashboards/simple-issues-list.controller.ts @@ -0,0 +1,34 @@ +import { DynamicLoader } from '@app/event-emitter/configs/dynamic-loader'; +import { Controller, Get, Param, Render } from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; +import { IssuesByTagsWidgetService } from './widgets/issues-by-tags.widget.service'; +import { parse } from 'jsonc-parser'; + +@Controller('simple-issues-list') +export class SimpleIssuesListController { + private path: string; + + constructor( + private issuesByTagsWidgetService: IssuesByTagsWidgetService, + private dynamicLoader: DynamicLoader, + private configService: ConfigService, + ) { + this.path = this.configService.get('simpleKanbanBoard.path'); + } + + @Get('/by-tags/:name/raw') + async getByTagsRawData(@Param('name') name: string): Promise { + const cfg = this.dynamicLoader.load(name, { + path: this.path, + ext: 'jsonc', + parser: parse, + }); + return await this.issuesByTagsWidgetService.render(cfg); + } + + @Get('/by-tags/:name') + @Render('simple-issues-list') + async getByTags(@Param('name') name: string): Promise { + return await this.getByTagsRawData(name); + } +} diff --git a/views/simple-issues-list.hbs b/views/simple-issues-list.hbs new file mode 100644 index 0000000..6fe5b00 --- /dev/null +++ b/views/simple-issues-list.hbs @@ -0,0 +1,114 @@ + + + + + + Simple Issues List + + + + + {{#each this}} + {{#if this.metainfo}} +

{{this.metainfo.title}} #

+
+ {{#each this.data}} + + {{#each this.issues}} +
+
+ + {{this.tracker.name}} #{{this.id}} - {{this.subject}} + | {{this.status.name}} + | {{this.total_spent_hours}} / {{this.total_estimated_hours}} +
+
+ {{#if this.styledTags}} + {{#each this.styledTags}} + {{this.tag}} + {{/each}} + {{/if}} +
+
+ {{/each}} + + {{/each}} +
+ {{/if}} + {{/each}} + + + \ No newline at end of file