Skip to content

Commit

Permalink
fix: remove deprecated modules
Browse files Browse the repository at this point in the history
  • Loading branch information
thielpa committed Dec 17, 2024
1 parent 914116a commit ab496d4
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 114 deletions.
6 changes: 3 additions & 3 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
"@angular/platform-browser": "^19.0.4",
"@angular/platform-browser-dynamic": "^19.0.4",
"@angular/router": "^19.0.4",
"@tanstack/angular-query-experimental": "^5.60.5",
"@primeng/themes": "19.0.0-rc.1",
"@tanstack/angular-query-experimental": "^5.60.5",
"angular-tabler-icons": "^3.1.0",
"eslint-config-prettier": "^9.1.0",
"marked": "^15.0.3",
"primeicons": "^7.0.0",
"primeng": "19.0.0-rc.1",
"rxjs": "~7.8.0",
"tailwindcss-primeui": "^0.3.4",
"tslib": "^2.3.0"
},
"devDependencies": {
Expand Down Expand Up @@ -56,6 +55,7 @@
"postcss": "^8.4.48",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.14",
"tailwindcss-primeui": "^0.3.4",
"typescript": "~5.6.2"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<div class="flex flex-col gap-2">
<label for="installed-apps">Installed Apps</label>
<p-chips id="installed-apps" formControlName="installedApps"></p-chips>
<p-autoComplete id="installed-apps" formControlName="installedApps" [multiple]="true" [minLength]="1" fluid [typeahead]="false"> </p-autoComplete>
</div>

<p-button type="submit">Update</p-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { EnvironmentControllerService } from '@app/core/modules/openapi/api/envi
import { EnvironmentDTO } from '@app/core/modules/openapi';
import { catchError, tap } from 'rxjs';
import { CommonModule } from '@angular/common';
import { ChipsModule } from 'primeng/chips';
import { AutoCompleteModule } from 'primeng/autocomplete';

@Component({
selector: 'app-environment-edit-form',
imports: [CommonModule, ReactiveFormsModule, InputTextModule, InputSwitchModule, ButtonModule, ChipsModule],
imports: [CommonModule, ReactiveFormsModule, InputTextModule, InputSwitchModule, ButtonModule, AutoCompleteModule],
templateUrl: './environment-edit-form.component.html',
styleUrls: ['./environment-edit-form.component.css'],
})
Expand All @@ -28,7 +28,7 @@ export class EnvironmentEditFormComponent implements OnInit {
description: '',
installedApps: [] as string[],
});
environmentForm!: FormGroup;
environmentForm!: FormGroup;

ngOnInit(): void {
if (!this.id) {
Expand All @@ -49,7 +49,7 @@ export class EnvironmentEditFormComponent implements OnInit {
this.environment = data;
this.environmentForm.patchValue(this.environment);
}),
catchError((error) => {
catchError((error) => {
alert('Environment not found');
window.location.href = 'project/projectId/environment/list'; // Redirect to environment list
return [];
Expand All @@ -59,7 +59,7 @@ export class EnvironmentEditFormComponent implements OnInit {

submitForm = () => {
if (this.environmentForm && this.environmentForm.valid) {
this.environmentService.updateEnvironment(this.environment.id, this.environmentForm.value).subscribe();
this.environmentService.updateEnvironment(this.environment.id, this.environmentForm.value).subscribe();
window.location.href = 'project/projectId/environment/list'; // Redirect to environment list
}
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,85 +1,84 @@
@if (isLoading()) {
<p-table [value]="[1, 2, 3, 4, 5]">
<ng-template pTemplate="header">
<tr>
<th>Title</th>
<th>Draft</th>
<th>Status</th>
<th>Author</th>
<th>Assignee</th>
<th>Created</th>
</tr>
</ng-template>
<ng-template pTemplate="body">
<tr>
<td><p-skeleton></p-skeleton></td>
<td></td>
<td><p-skeleton></p-skeleton></td>
<td><p-skeleton></p-skeleton></td>
<td><p-skeleton></p-skeleton></td>
<td><p-skeleton></p-skeleton></td>
</tr>
</ng-template>
</p-table>
<p-table [value]="[1, 2, 3, 4, 5]">
<ng-template pTemplate="header">
<tr>
<th>Title</th>
<th>Draft</th>
<th>Status</th>
<th>Author</th>
<th>Assignee</th>
<th>Created</th>
</tr>
</ng-template>
<ng-template pTemplate="body">
<tr>
<td><p-skeleton></p-skeleton></td>
<td></td>
<td><p-skeleton></p-skeleton></td>
<td><p-skeleton></p-skeleton></td>
<td><p-skeleton></p-skeleton></td>
<td><p-skeleton></p-skeleton></td>
</tr>
</ng-template>
</p-table>
} @else {
@if (isError()) {
<p>Error occurred while fetching pull requests.</p>
} @else {
@if (isEmpty()) {
<p>No pull requests found.</p>
} @else {
<p-table [rowHover]="true" [value]="pullRequestStore.pullRequests()" [paginator]="true" [rows]="20">
<ng-template pTemplate="header">
<tr>
<th>Title</th>
<th>Draft</th>
<th>Status</th>
<th>Author</th>
<th>Assignee</th>
<th>Created</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-pr>
<tr class="cursor-pointer" (click)="openPR(pr)">
<td>
<div class="flex align-items-center gap-2">
<i-tabler name="git-pull-request"></i-tabler>
<span class="font-bold"><span [innerHTML]="pr.title | markdown"></span></span>
<button pButton class="p-button-text p-button-sm" (click)="openPRExternal(pr)"><i-tabler
name="external-link"></i-tabler></button>
</div>
</td>
<td>
@if (pr.isDraft) {
<p-tag value="Draft" severity="secondary"></p-tag>
}
</td>
<td>
<p-tag [value]="getStatus(pr)" [severity]="getStatusSeverity(pr)"></p-tag>
</td>
<td>
<div class="flex align-items-center gap-2">
<p-avatar [image]="pr.author.avatarUrl" shape="circle" size="normal"></p-avatar>
<span>{{ pr.author.name }}</span>
</div>
</td>
<td>
@if (pr.assignees?.length) {
<div class="flex align-items-center gap-2">
<p-avatarGroup>
@for (assignee of pr.assignees; track assignee) {
<p-avatar [image]="assignee.avatarUrl" [pTooltip]="assignee.name" shape="circle" size="normal"></p-avatar>
}
</p-avatarGroup>
</div>
}
</td>
<td>
{{ formatDate(pr.createdAt) }}
</td>
</tr>
</ng-template>
</p-table>
}
@if (isError()) {
<p>Error occurred while fetching pull requests.</p>
} @else {
@if (isEmpty()) {
<p>No pull requests found.</p>
} @else {
<p-table [rowHover]="true" [value]="pullRequestStore.pullRequests()" [paginator]="true" [rows]="20">
<ng-template pTemplate="header">
<tr>
<th>Title</th>
<th>Draft</th>
<th>Status</th>
<th>Author</th>
<th>Assignee</th>
<th>Created</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-pr>
<tr class="cursor-pointer" (click)="openPR(pr)">
<td>
<div class="flex items-center gap-2">
<i-tabler name="git-pull-request"></i-tabler>
<span class="font-bold"><span [innerHTML]="pr.title | markdown"></span></span>
<p-button [link]="true" (click)="openPRExternal(pr)"><i-tabler name="external-link"></i-tabler></p-button>
</div>
</td>
<td>
@if (pr.isDraft) {
<p-tag value="Draft" severity="secondary"></p-tag>
}
</td>
<td>
<p-tag [value]="getStatus(pr)" [severity]="getStatusSeverity(pr)"></p-tag>
</td>
<td>
<div class="flex align-items-center gap-2">
<p-avatar [image]="pr.author.avatarUrl" shape="circle" size="normal"></p-avatar>
<span>{{ pr.author.name }}</span>
</div>
</td>
<td>
@if (pr.assignees?.length) {
<div class="flex align-items-center gap-2">
<p-avatarGroup>
@for (assignee of pr.assignees; track assignee) {
<p-avatar [image]="assignee.avatarUrl" [pTooltip]="assignee.name" shape="circle" size="normal"></p-avatar>
}
</p-avatarGroup>
</div>
}
</td>
<td>
{{ formatDate(pr.createdAt) }}
</td>
</tr>
</ng-template>
</p-table>
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import { catchError, tap } from 'rxjs';
import { IconsModule } from 'icons.module';
import { SkeletonModule } from 'primeng/skeleton';
import { Router } from '@angular/router';
import { ButtonModule } from 'primeng/button';


@Component({
selector: 'app-pull-request-table',
imports: [TableModule, AvatarModule, TagModule, IconsModule, SkeletonModule, AvatarGroupModule, TooltipModule, MarkdownPipe],
imports: [TableModule, AvatarModule, TagModule, IconsModule, SkeletonModule, AvatarGroupModule, TooltipModule, MarkdownPipe, ButtonModule],
templateUrl: './pull-request-table.component.html',
styles: [`
:host ::ng-deep {
Expand Down
8 changes: 5 additions & 3 deletions client/src/app/pages/ci-cd/ci-cd.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<!-- TODO: IMPROVE THIS TO <p-tabs> WHEN NAVIGATION IS READY-->

<p-tabMenu [model]="tabs()" [activeItem]="activeTab()" (activeItemChange)="onTabChange($event)"></p-tabMenu>

@if (isTabActive('pr')) {
<app-pull-request-table />
<app-pull-request-table />
}
@if (isTabActive('branches')) {
<app-branches-table />
}
<app-branches-table />
}
7 changes: 4 additions & 3 deletions client/src/app/pages/ci-cd/ci-cd.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import { BranchTableComponent } from '@app/components/branches-table/branches-ta
import { PullRequestTableComponent } from '@app/components/pull-request-table/pull-request-table.component';
import { MenuItem } from 'primeng/api';
import { TabMenuModule } from 'primeng/tabmenu';
import { TabsModule } from 'primeng/tabs';
@Component({
selector: 'app-ci-cd',
imports: [PullRequestTableComponent, BranchTableComponent, TabMenuModule],
imports: [PullRequestTableComponent, BranchTableComponent, TabMenuModule, TabsModule],
templateUrl: './ci-cd.component.html',
styleUrl: './ci-cd.component.css'
})
export class CiCdComponent {
tabs = signal<MenuItem[]>([
tabs = signal<{label: string, id: string}[]>([
{ label: 'Pull Requests', id: 'pr' },
{ label: 'Branches', id: 'branches' }
]);
Expand Down Expand Up @@ -47,4 +48,4 @@ export class CiCdStateService {
getActiveTab() {
return this.activeTabId;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<h2 class="text-3xl">Artemis</h2>
<h3 class="text-2xl">Test Environments</h3>
<p-accordion [multiple]="true">
<p-accordionTab *ngFor="let environment of environments()">
<ng-template pTemplate="header">
<p-accordion-panel *ngFor="let environment of environments()">
<p-accordion-header>
<ng-template #toggleicon let-active="active">
@if (active) {
<i class="pi pi-minus"></i>
} @else {
<i class="pi pi-plus"></i>
}
</ng-template>
<div class="flex gap-2 items-center w-full">
<span>{{ environment.name }}</span>
<!-- TODO: Refactor after adding lock functionality -->
Expand All @@ -12,23 +19,25 @@ <h3 class="text-2xl">Test Environments</h3>
<!-- <a *ngIf="environment.locked" [href]="environment.url" class="p-button p-button-danger p-2"><i-tabler-->
<!-- name="lock-open" class="mr-1" />Unlock</a>-->
<!-- }-->
<a [href]="getFullUrl(environment.serverUrl)" target="_blank" class="p-button p-button-secondary p-2" (click)="$event.stopPropagation()">
<a [href]="getFullUrl(environment.serverUrl || '')" target="_blank" class="p-button p-2 flex items-center" (click)="$event.stopPropagation()">
<i-tabler name="external-link" class="mr-1"></i-tabler>Open
</a>
<a icon [routerLink]="'/project/projectId/environment/' + environment.id + '/edit'" class="p-button p-button-secondary p-2"><i-tabler name="pencil" /></a>
</div>
</ng-template>
<app-environment-commit-info [environmentId]="environment.id" />
<div class="flex gap-4 items-center justify-between">
<div class="flex gap-1 mt-2 items-center">
<a icon [routerLink]="['/project', 'projectid', 'environment', environment.id, 'history']" class="p-button p-button-text text-gray-500 p-2"
><i-tabler class="mr-1" name="history" />View History</a
>
<a icon [routerLink]="'/project/projectId/environment/' + environment.id + '/edit'" class="p-button p-button-icon p-2"><i-tabler name="pencil" /></a>
</div>
</p-accordion-header>
<p-accordion-content>
<app-environment-commit-info [environmentId]="environment.id" />
<div class="flex gap-4 items-center justify-between">
<div class="flex gap-1 mt-2 items-center">
<a icon [routerLink]="['/project', 'projectid', 'environment', environment.id, 'history']" class="p-button p-button-text text-gray-500 p-2"
><i-tabler class="mr-1" name="history" />View History</a
>
</div>

<div class="flex gap-1">
<p-tag *ngFor="let installedApp of environment.installedApps"> {{ installedApp }}</p-tag>
<div class="flex gap-1">
<p-tag *ngFor="let installedApp of environment.installedApps"> {{ installedApp }}</p-tag>
</div>
</div>
</div>
</p-accordionTab>
</p-accordion-content>
</p-accordion-panel>
</p-accordion>
2 changes: 2 additions & 0 deletions client/src/icons.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
IconChevronDown,
IconChevronUp,
IconChevronLeft,
IconQuestionMark,
} from 'angular-tabler-icons/icons';

// Select some icons (use an object, not an array)
Expand Down Expand Up @@ -60,6 +61,7 @@ const icons = {
IconChevronDown,
IconChevronUp,
IconChevronLeft,
IconQuestionMark,
};

@NgModule({
Expand Down

0 comments on commit ab496d4

Please sign in to comment.