From b72de398edc85c9e2fe909382a5426daa51390e2 Mon Sep 17 00:00:00 2001 From: Paul Thiel Date: Mon, 23 Dec 2024 02:48:56 +0100 Subject: [PATCH] fix: migrate to v19 --- client/src/app/app.config.ts | 19 +- client/src/app/app.routes.ts | 35 ++- .../branches-table.component.ts | 3 +- .../deployment-state-tag.component.html | 2 +- .../environment-list-view.component.html | 42 +-- .../pull-request-table.component.html | 4 - .../branch-list/branch-list.component.html | 1 + .../branch-list/branch-list.component.spec.ts | 23 ++ .../branch-list/branch-list.component.ts | 11 + .../src/app/pages/ci-cd/ci-cd.component.html | 19 +- client/src/app/pages/ci-cd/ci-cd.component.ts | 42 +-- .../project-settings.component.html | 280 ++++++++---------- .../pull-request-details.component.html | 2 +- .../pull-request-list.component.html | 1 + .../pull-request-list.component.spec.ts | 23 ++ .../pull-request-list.component.ts | 11 + 16 files changed, 273 insertions(+), 245 deletions(-) create mode 100644 client/src/app/pages/branch-list/branch-list.component.html create mode 100644 client/src/app/pages/branch-list/branch-list.component.spec.ts create mode 100644 client/src/app/pages/branch-list/branch-list.component.ts create mode 100644 client/src/app/pages/pull-request-list/pull-request-list.component.html create mode 100644 client/src/app/pages/pull-request-list/pull-request-list.component.spec.ts create mode 100644 client/src/app/pages/pull-request-list/pull-request-list.component.ts diff --git a/client/src/app/app.config.ts b/client/src/app/app.config.ts index bc0cd07c..9a5901b2 100644 --- a/client/src/app/app.config.ts +++ b/client/src/app/app.config.ts @@ -3,6 +3,7 @@ import { provideRouter, withComponentInputBinding, withRouterConfig } from '@ang import { provideQueryClient, provideTanStackQuery, QueryClient } from '@tanstack/angular-query-experimental'; import { provideAnimationsAsync } from '@angular/platform-browser/animations/async'; import { providePrimeNG } from 'primeng/config'; +import { definePreset } from '@primeng/themes'; import Aura from '@primeng/themes/aura'; import { routes } from './app.routes'; @@ -31,7 +32,23 @@ export const appConfig: ApplicationConfig = { DatePipe, providePrimeNG({ theme: { - preset: Aura, + preset: definePreset(Aura, { + semantic: { + primary: { + 50: '{gray.50}', + 100: '{gray.100}', + 200: '{gray.200}', + 300: '{gray.300}', + 400: '{gray.400}', + 500: '{gray.500}', + 600: '{gray.600}', + 700: '{gray.700}', + 800: '{gray.800}', + 900: '{gray.900}', + 950: '{gray.950}' + } + } + }), options: { darkModeSelector: '.dark-selector', cssLayer: { diff --git a/client/src/app/app.routes.ts b/client/src/app/app.routes.ts index b80d5b2b..867f701b 100644 --- a/client/src/app/app.routes.ts +++ b/client/src/app/app.routes.ts @@ -21,18 +21,6 @@ export const routes: Routes = [ loadComponent: () => import('./pages/main-layout/main-layout.component').then(m => m.MainLayoutComponent), children: [ { path: '', loadComponent: () => import('./pages/ci-cd/ci-cd.component').then(m => m.CiCdComponent) }, - { - path: 'pr', - children: [ - { path: ':pullRequestNumber', loadComponent: () => import('./pages/pull-request-details/pull-request-details.component').then(m => m.PullRequestDetailsComponent) }, - ] - }, - { - path: 'branch', - children: [ - { path: ':branchName', loadComponent: () => import('./pages/branch-details/branch-details.component').then(m => m.BranchDetailsComponent) }, - ] - }, { path: '', redirectTo: 'ci-cd', @@ -53,7 +41,28 @@ export const routes: Routes = [ }, { path: 'ci-cd', - loadComponent: () => import('./pages/ci-cd/ci-cd.component').then(m => m.CiCdComponent) + loadComponent: () => import('./pages/ci-cd/ci-cd.component').then(m => m.CiCdComponent), + children: [ + { + path: '', + redirectTo: 'pr', + pathMatch: 'full', + }, + { + path: 'pr', + children: [ + { path: '', loadComponent: () => import('./pages/pull-request-list/pull-request-list.component').then(m => m.PullRequestListComponent), }, + { path: ':pullRequestNumber', loadComponent: () => import('./pages/pull-request-details/pull-request-details.component').then(m => m.PullRequestDetailsComponent) }, + ] + }, + { + path: 'branch', + children: [ + { path: '', loadComponent: () => import('./pages/branch-list/branch-list.component').then(m => m.BranchListComponent),}, + { path: ':branchName', loadComponent: () => import('./pages/branch-details/branch-details.component').then(m => m.BranchDetailsComponent) }, + ] + }, + ] }, { path: 'settings', diff --git a/client/src/app/components/branches-table/branches-table.component.ts b/client/src/app/components/branches-table/branches-table.component.ts index c5f12783..b20f0535 100644 --- a/client/src/app/components/branches-table/branches-table.component.ts +++ b/client/src/app/components/branches-table/branches-table.component.ts @@ -85,7 +85,7 @@ export class BranchTableComponent { } openBranch(branch: BranchInfoDTO): void { - this.router.navigate(['repo', branch.repository?.id, 'branch', branch.name]); + this.router.navigate(['repo', branch.repository?.id, 'ci-cd', 'branch', branch.name]); } convertBranchesToTreeNodes(branches: BranchInfoWithLink[]): TreeNode[] { @@ -133,7 +133,6 @@ export class BranchTableComponent { } }); }); - console.log("root nodes", JSON.stringify(rootNodes, null, 2)); return rootNodes; } diff --git a/client/src/app/components/environments/deployment-state-tag/deployment-state-tag.component.html b/client/src/app/components/environments/deployment-state-tag/deployment-state-tag.component.html index 68f02749..49aadac2 100644 --- a/client/src/app/components/environments/deployment-state-tag/deployment-state-tag.component.html +++ b/client/src/app/components/environments/deployment-state-tag/deployment-state-tag.component.html @@ -25,7 +25,7 @@ @case ('QUEUED') { - + Deployment queued diff --git a/client/src/app/components/environments/environment-list/environment-list-view.component.html b/client/src/app/components/environments/environment-list/environment-list-view.component.html index c6749219..a48b127d 100644 --- a/client/src/app/components/environments/environment-list/environment-list-view.component.html +++ b/client/src/app/components/environments/environment-list/environment-list-view.component.html @@ -1,7 +1,7 @@
@if (!hideLinkToList()) { - Manage environments + Manage environments }
@@ -17,8 +17,8 @@ } @for (environment of filteredEnvironments(); track environment.id) { - - + +
{{ environment.name }} @@ -52,26 +52,28 @@ > } +
-
+ + + @if (environment.latestDeployment; as deployment) { + + } - @if (environment.latestDeployment; as deployment) { - - } +
+ -
- - -
- @for (installedApp of environment.installedApps; track installedApp) { - {{ installedApp }} - } +
+ @for (installedApp of environment.installedApps; track installedApp) { + {{ installedApp }} + } +
-
- + + } diff --git a/client/src/app/components/pull-request-table/pull-request-table.component.html b/client/src/app/components/pull-request-table/pull-request-table.component.html index 411c960b..f9519cce 100644 --- a/client/src/app/components/pull-request-table/pull-request-table.component.html +++ b/client/src/app/components/pull-request-table/pull-request-table.component.html @@ -74,11 +74,7 @@ } - <<<<<<< HEAD {{ dateService.formatDate(pr.createdAt, 'd. MMM y') }} - ======= - {{ formatDate(pr.createdAt) }} - >>>>>>> ab496d4 (fix: remove deprecated modules) diff --git a/client/src/app/pages/branch-list/branch-list.component.html b/client/src/app/pages/branch-list/branch-list.component.html new file mode 100644 index 00000000..b59daba8 --- /dev/null +++ b/client/src/app/pages/branch-list/branch-list.component.html @@ -0,0 +1 @@ + diff --git a/client/src/app/pages/branch-list/branch-list.component.spec.ts b/client/src/app/pages/branch-list/branch-list.component.spec.ts new file mode 100644 index 00000000..c8bee3fe --- /dev/null +++ b/client/src/app/pages/branch-list/branch-list.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BranchListComponent } from './branch-list.component'; + +describe('BranchListComponent', () => { + let component: BranchListComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [BranchListComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(BranchListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/client/src/app/pages/branch-list/branch-list.component.ts b/client/src/app/pages/branch-list/branch-list.component.ts new file mode 100644 index 00000000..149c5533 --- /dev/null +++ b/client/src/app/pages/branch-list/branch-list.component.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core'; +import { BranchTableComponent } from "../../components/branches-table/branches-table.component"; + +@Component({ + selector: 'app-branch-list', + imports: [BranchTableComponent], + templateUrl: './branch-list.component.html', +}) +export class BranchListComponent { + +} diff --git a/client/src/app/pages/ci-cd/ci-cd.component.html b/client/src/app/pages/ci-cd/ci-cd.component.html index d50215f8..6b7afd4e 100644 --- a/client/src/app/pages/ci-cd/ci-cd.component.html +++ b/client/src/app/pages/ci-cd/ci-cd.component.html @@ -1,10 +1,11 @@ - + + + @for (tab of tabs(); track tab.id) { + + {{ tab.label }} + + } + + - - -@if (isTabActive('pr')) { - -} -@if (isTabActive('branches')) { - -} + diff --git a/client/src/app/pages/ci-cd/ci-cd.component.ts b/client/src/app/pages/ci-cd/ci-cd.component.ts index b3480f79..72d6f37e 100644 --- a/client/src/app/pages/ci-cd/ci-cd.component.ts +++ b/client/src/app/pages/ci-cd/ci-cd.component.ts @@ -1,50 +1,26 @@ import { Component, computed, Injectable, signal, inject } from '@angular/core'; -import { BranchTableComponent } from '@app/components/branches-table/branches-table.component'; -import { PullRequestTableComponent } from '@app/components/pull-request-table/pull-request-table.component'; +import { ActivatedRoute, NavigationEnd, Router, RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router'; import { MenuItem } from 'primeng/api'; import { TabMenuModule } from 'primeng/tabmenu'; import { TabsModule } from 'primeng/tabs'; +import { filter, last, map } from 'rxjs'; @Component({ selector: 'app-ci-cd', - imports: [PullRequestTableComponent, BranchTableComponent, TabMenuModule, TabsModule], + imports: [RouterLink, RouterOutlet, TabMenuModule, TabsModule], templateUrl: './ci-cd.component.html', }) export class CiCdComponent { - private stateService = inject(CiCdStateService); + private route = inject(ActivatedRoute); + private router = inject(Router); tabs = signal<{label: string, id: string}[]>([ { label: 'Pull Requests', id: 'pr' }, - { label: 'Branches', id: 'branches' } + { label: 'Branches', id: 'branch' } ]); - activeTab = computed(() => { - const activeTabId = this.stateService.getActiveTab()(); - return this.tabs().find(tab => tab.id === activeTabId) || this.tabs()[0]; - }); + activeTabId = this.tabs()[0].id; - onTabChange(event: MenuItem) { - if (event.id) { - this.stateService.setActiveTab(event.id); - } - } - - isTabActive(tabId: string): boolean { - return this.activeTab()?.id === tabId; - } -} - - -@Injectable({ - providedIn: 'root' -}) -export class CiCdStateService { - private activeTabId = signal('pr'); - - setActiveTab(tabId: string) { - this.activeTabId.set(tabId); - } - - getActiveTab() { - return this.activeTabId; + ngOnInit() { + this.activeTabId = this.route.snapshot.firstChild?.url[0].path || this.tabs()[0].id; } } diff --git a/client/src/app/pages/project-settings/project-settings.component.html b/client/src/app/pages/project-settings/project-settings.component.html index 6240ca19..ca2d91fa 100644 --- a/client/src/app/pages/project-settings/project-settings.component.html +++ b/client/src/app/pages/project-settings/project-settings.component.html @@ -1,174 +1,132 @@ +{{ repositoryId() }}
- -
-

Project Settings

- @if (!isLoading() && !isError()) { -
- - -
- } -
- - - @if (isError()) { -

{{ errorMessage() }}

+ +
+

Project Settings

+ @if (!isLoading() && !isError()) { +
+ + +
} +
- @if (isLoading()) { -

Loading settings...

- } + + @if (isError()) { +

{{ errorMessage() }}

+ } - - @if (!isLoading() && !isError()) { - -

Grouped Workflows

+ @if (isLoading()) { +

Loading settings...

+ } - - @if (groupedWorkflowsArray().length > 0) { -

- Drag and drop the groups to reorder them. -

- } + + @if (!isLoading() && !isError()) { + +

Grouped Workflows

- @if (groupedWorkflowsArray().length > 0) { -
- @for (group of localGroupedWorkflowsArray(); track group.groupName; let gIndex = $index) { -
- - -
- @for (wf of group.workflows; track wf.id) { -
- - {{ wf.name }} -
- } - - @if (group.workflows.length === 0) { - - } -
-
+ + @if (groupedWorkflowsArray().length > 0) { +

Drag and drop the groups to reorder them.

+ } - - @if (group !== localGroupedWorkflowsArray()[localGroupedWorkflowsArray().length - 1]) { -
- } -
+ @if (groupedWorkflowsArray().length > 0) { +
+ @for (group of localGroupedWorkflowsArray(); track group.groupName; let gIndex = $index) { +
+ + +
+ @for (wf of group.workflows; track wf.id) { +
+ + {{ wf.name }} +
} -
- } @else { - -
- -

No workflows are currently grouped.

-

Click "Add New Group" to create a new group.

-

And then assign workflows to the group.

-
-
- } - - - - - - Workflow ID - Status - File Name - Workflow Name - Assign Group - Label - - - - - {{ workflow.id }} - {{ workflow.state }} - {{ workflow.fileNameWithExtension }} - {{ workflow.name }} - - - - - - + + @if (group.workflows.length === 0) { + + } +
+ - - - + + @if (group !== localGroupedWorkflowsArray()[localGroupedWorkflowsArray().length - 1]) { +
+ } +
+ } +
+ } @else { + +
+ +

No workflows are currently grouped.

+

Click "Add New Group" to create a new group.

+

And then assign workflows to the group.

+
+
} - - -
- - + + + + + Workflow ID + Status + File Name + Workflow Name + Assign Group + Label + + + + + {{ workflow.id }} + {{ workflow.state }} + {{ workflow.fileNameWithExtension }} + {{ workflow.name }} + + + + + + + + + + } + + + +
+ + -
- - -
-
-
+
+ + +
+
+
diff --git a/client/src/app/pages/pull-request-details/pull-request-details.component.html b/client/src/app/pages/pull-request-details/pull-request-details.component.html index 14d785e3..e10a462f 100644 --- a/client/src/app/pages/pull-request-details/pull-request-details.component.html +++ b/client/src/app/pages/pull-request-details/pull-request-details.component.html @@ -9,7 +9,7 @@

{{ pr.state }} @if (pr.isDraft) { - DRAFT + DRAFT } @if (pr.isMerged) { MERGED diff --git a/client/src/app/pages/pull-request-list/pull-request-list.component.html b/client/src/app/pages/pull-request-list/pull-request-list.component.html new file mode 100644 index 00000000..1e3f0956 --- /dev/null +++ b/client/src/app/pages/pull-request-list/pull-request-list.component.html @@ -0,0 +1 @@ + diff --git a/client/src/app/pages/pull-request-list/pull-request-list.component.spec.ts b/client/src/app/pages/pull-request-list/pull-request-list.component.spec.ts new file mode 100644 index 00000000..bcccaec8 --- /dev/null +++ b/client/src/app/pages/pull-request-list/pull-request-list.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PullRequestListComponent } from './pull-request-list.component'; + +describe('PullRequestListComponent', () => { + let component: PullRequestListComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [PullRequestListComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(PullRequestListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/client/src/app/pages/pull-request-list/pull-request-list.component.ts b/client/src/app/pages/pull-request-list/pull-request-list.component.ts new file mode 100644 index 00000000..1dcca8a8 --- /dev/null +++ b/client/src/app/pages/pull-request-list/pull-request-list.component.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core'; +import { PullRequestTableComponent } from "../../components/pull-request-table/pull-request-table.component"; + +@Component({ + selector: 'app-pull-request-list', + imports: [PullRequestTableComponent], + templateUrl: './pull-request-list.component.html', +}) +export class PullRequestListComponent { + +}