Skip to content

Commit 5ff4e3d

Browse files
committed
check config
1 parent 1cc8a34 commit 5ff4e3d

File tree

10 files changed

+72
-15
lines changed

10 files changed

+72
-15
lines changed

src/app/groups/group-tabs/feature-tabs/latest-pipelines/pipeline-status-tabs/pipeline-table/pipeline-table-branch/pipeline-table-branch.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@
4646
} @else { - }
4747
</td>
4848
<td>
49-
@if (data.pipeline; as pipeline) {
49+
@if (data.pipeline; as pipeline) { @if(showWriteActions()) {
5050
<gcd-write-actions-icon
5151
[projectId]="pipeline.project_id"
5252
[pipelineId]="pipeline.id"
5353
[branch]="data.branch.name"
5454
/>
55+
}
5556
<button (click)="onActionClick($event, pipeline)" nz-tooltip nzTooltipTitle="Open in Gitlab" nz-button>
5657
<span nz-icon nzType="gitlab"></span>
5758
</button>

src/app/groups/group-tabs/feature-tabs/latest-pipelines/pipeline-status-tabs/pipeline-table/pipeline-table-branch/pipeline-table-branch.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { filterString } from '$groups/util/filter'
88
import { statusToScope } from '$groups/util/status-scope'
99
import { Header } from '$groups/util/table'
1010
import { CommonModule } from '@angular/common'
11-
import { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core'
11+
import { ChangeDetectionStrategy, Component, computed, inject, input, Signal, signal } from '@angular/core'
1212
import { NzBadgeModule } from 'ng-zorro-antd/badge'
1313
import { NzButtonModule } from 'ng-zorro-antd/button'
1414
import { NzI18nService } from 'ng-zorro-antd/i18n'
@@ -17,6 +17,7 @@ import { NzTableModule } from 'ng-zorro-antd/table'
1717
import { NzToolTipModule } from 'ng-zorro-antd/tooltip'
1818
import { WriteActionsIconComponent } from '../../../../components/write-actions-icon/write-actions-icon.component'
1919
import { LatestBranchFilterComponent } from './latest-branch-filter/latest-branch-filter.component'
20+
import { ConfigService } from '$service/config.service'
2021

2122
const headers: Header<BranchPipeline>[] = [
2223
{ title: 'Branch', sortable: true, compare: (a, b) => compareString(a.branch.name, b.branch.name) },
@@ -57,6 +58,7 @@ const headers: Header<BranchPipeline>[] = [
5758
})
5859
export class PipelineTableBranchComponent {
5960
private i18n = inject(NzI18nService)
61+
private config = inject(ConfigService)
6062

6163
branchPipelines = input.required<BranchPipeline[]>()
6264
loading = input.required<boolean>()
@@ -70,6 +72,10 @@ export class PipelineTableBranchComponent {
7072

7173
headers: Header<BranchPipeline>[] = headers
7274

75+
get showWriteActions(): Signal<boolean> {
76+
return computed(() => !this.config.hideWriteActions())
77+
}
78+
7379
get locale(): string {
7480
const { locale } = this.i18n.getLocale()
7581
return locale

src/app/groups/group-tabs/feature-tabs/latest-pipelines/pipeline-status-tabs/pipeline-table/pipeline-table.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
} @else { - }
3434
</td>
3535
<td>
36-
@if (data.pipeline; as pipeline) {
36+
@if (data.pipeline; as pipeline) { @if(showWriteActions()) {
3737
<gcd-write-actions-icon [projectId]="data.project.id" [pipelineId]="pipeline.id" [branch]="pipeline.ref" />
38+
}
3839

3940
<button (click)="onActionClick($event, pipeline)" nz-tooltip nzTooltipTitle="Open in Gitlab" nz-button>
4041
<span nz-icon nzType="gitlab"></span>

src/app/groups/group-tabs/feature-tabs/latest-pipelines/pipeline-status-tabs/pipeline-table/pipeline-table.component.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@ import { compareString, compareStringDate } from '$groups/util/compare'
99
import { statusToScope } from '$groups/util/status-scope'
1010
import { Header } from '$groups/util/table'
1111
import { CommonModule } from '@angular/common'
12-
import { ChangeDetectionStrategy, Component, DestroyRef, inject, input, OnDestroy, signal } from '@angular/core'
12+
import {
13+
ChangeDetectionStrategy,
14+
Component,
15+
computed,
16+
DestroyRef,
17+
inject,
18+
input,
19+
OnDestroy,
20+
Signal,
21+
signal
22+
} from '@angular/core'
1323
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'
1424
import { NzButtonModule } from 'ng-zorro-antd/button'
1525
import { NzI18nService } from 'ng-zorro-antd/i18n'
@@ -21,7 +31,8 @@ import { finalize, interval, Subscription, switchMap } from 'rxjs'
2131
import { WriteActionsIconComponent } from '../../../components/write-actions-icon/write-actions-icon.component'
2232
import { LatestPipelineService } from '../../service/latest-pipeline.service'
2333
import { PipelineTableBranchComponent } from './pipeline-table-branch/pipeline-table-branch.component'
24-
import { DownloadArtifactsIconComponent } from "../../../components/download-artifacts-icon/download-artifacts-icon.component";
34+
import { DownloadArtifactsIconComponent } from '../../../components/download-artifacts-icon/download-artifacts-icon.component'
35+
import { ConfigService } from '$service/config.service'
2536

2637
const headers: Header<ProjectPipeline>[] = [
2738
{ title: 'Project', sortable: true, compare: (a, b) => compareString(a.project.name, b.project.name) },
@@ -61,7 +72,7 @@ const headers: Header<ProjectPipeline>[] = [
6172
FavoritesIconComponent,
6273
WriteActionsIconComponent,
6374
DownloadArtifactsIconComponent
64-
],
75+
],
6576
templateUrl: './pipeline-table.component.html',
6677
styleUrls: ['./pipeline-table.component.scss'],
6778
changeDetection: ChangeDetectionStrategy.OnPush
@@ -70,6 +81,7 @@ export class PipelineTableComponent implements OnDestroy {
7081
private i18n = inject(NzI18nService)
7182
private latestPipelineService = inject(LatestPipelineService)
7283
private destroyRef = inject(DestroyRef)
84+
private config = inject(ConfigService)
7385

7486
private refreshSubscription?: Subscription
7587

@@ -86,6 +98,10 @@ export class PipelineTableComponent implements OnDestroy {
8698
this.refreshSubscription?.unsubscribe()
8799
}
88100

101+
get showWriteActions(): Signal<boolean> {
102+
return computed(() => !this.config.hideWriteActions())
103+
}
104+
89105
get locale(): string {
90106
const { locale } = this.i18n.getLocale()
91107
return locale

src/app/groups/group-tabs/feature-tabs/pipelines/pipeline-table/pipeline-table.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
</td>
4949
<td>
5050
@if (data.pipeline; as pipeline) {
51-
<gcd-write-actions-icon [projectId]="data.project.id" [pipelineId]="pipeline.id" [branch]="data.pipeline.ref"/>
51+
@if(showWriteActions()){
52+
<gcd-write-actions-icon [projectId]="data.project.id" [pipelineId]="pipeline.id" [branch]="data.pipeline.ref"/>
53+
}
5254

5355
<button
5456
(click)="onActionClick($event, pipeline)"

src/app/groups/group-tabs/feature-tabs/pipelines/pipeline-table/pipeline-table.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import { Status } from '$groups/model/status'
55
import { compareString, compareStringDate } from '$groups/util/compare'
66
import { statusToScope } from '$groups/util/status-scope'
77
import { Header } from '$groups/util/table'
8+
import { ConfigService } from '$service/config.service'
89
import { CommonModule } from '@angular/common'
9-
import { ChangeDetectionStrategy, Component, inject, input, model } from '@angular/core'
10+
import { ChangeDetectionStrategy, Component, computed, inject, input, model, Signal } from '@angular/core'
1011
import { NzBadgeModule } from 'ng-zorro-antd/badge'
1112
import { NzButtonModule } from 'ng-zorro-antd/button'
1213
import { NzI18nService } from 'ng-zorro-antd/i18n'
@@ -70,12 +71,17 @@ const semverRegex =
7071
})
7172
export class PipelineTableComponent {
7273
private i18n = inject(NzI18nService)
74+
private config = inject(ConfigService)
7375

7476
projectPipelines = input.required<ProjectPipeline[]>()
7577
pinnedPipelines = model.required<PipelineId[]>()
7678

7779
headers: Header<ProjectPipeline>[] = headers
7880

81+
get showWriteActions(): Signal<boolean> {
82+
return computed(() => !this.config.hideWriteActions())
83+
}
84+
7985
get locale(): string {
8086
const { locale } = this.i18n.getLocale()
8187
return locale

src/app/groups/group-tabs/feature-tabs/schedules/schedule-table/schedule-pipeline-table/schedule-pipeline-table.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
<gcd-jobs [projectId]="pipeline.project_id" [pipelineId]="pipeline.id" [scope]="getScope(pipeline.status)" />
2929
</td>
3030
<td>
31+
@if(showWriteActions()){
3132
<gcd-write-actions-icon [projectId]="pipeline.project_id" [pipelineId]="pipeline.id" [branch]="pipeline.ref" />
33+
}
3234
<button (click)="onClick($event, pipeline)" nz-tooltip nzTooltipTitle="Open in Gitlab" nz-button>
3335
<span nz-icon nzType="gitlab"></span>
3436
</button>

src/app/groups/group-tabs/feature-tabs/schedules/schedule-table/schedule-pipeline-table/schedule-pipeline-table.component.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@ import { Status } from '$groups/model/status'
55
import { compareString, compareStringDate } from '$groups/util/compare'
66
import { statusToScope } from '$groups/util/status-scope'
77
import { Header } from '$groups/util/table'
8+
import { ConfigService } from '$service/config.service'
89
import { CommonModule } from '@angular/common'
9-
import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core'
10+
import { ChangeDetectionStrategy, Component, computed, inject, input, Signal } from '@angular/core'
1011
import { NzBadgeModule } from 'ng-zorro-antd/badge'
1112
import { NzButtonModule } from 'ng-zorro-antd/button'
1213
import { NzI18nService } from 'ng-zorro-antd/i18n'
1314
import { NzIconModule } from 'ng-zorro-antd/icon'
1415
import { NzTableModule } from 'ng-zorro-antd/table'
1516
import { NzToolTipModule } from 'ng-zorro-antd/tooltip'
17+
import { DownloadArtifactsIconComponent } from '../../../components/download-artifacts-icon/download-artifacts-icon.component'
1618
import { WriteActionsIconComponent } from '../../../components/write-actions-icon/write-actions-icon.component'
17-
import { DownloadArtifactsIconComponent } from "../../../components/download-artifacts-icon/download-artifacts-icon.component";
1819

1920
const headers: Header<Pipeline>[] = [
2021
{
@@ -52,19 +53,24 @@ const headers: Header<Pipeline>[] = [
5253
JobsComponent,
5354
WriteActionsIconComponent,
5455
DownloadArtifactsIconComponent
55-
],
56+
],
5657
templateUrl: './schedule-pipeline-table.component.html',
5758
styleUrls: ['./schedule-pipeline-table.component.scss'],
5859
changeDetection: ChangeDetectionStrategy.OnPush
5960
})
6061
export class SchedulePipelineTableComponent {
6162
private i18n = inject(NzI18nService)
63+
private config = inject(ConfigService)
6264

6365
pipelines = input.required<Pipeline[]>()
6466
loading = input.required<boolean>()
6567

6668
headers: Header<Pipeline>[] = headers
6769

70+
get showWriteActions(): Signal<boolean> {
71+
return computed(() => !this.config.hideWriteActions())
72+
}
73+
6874
get locale(): string {
6975
const { locale } = this.i18n.getLocale()
7076
return locale

src/app/groups/group-tabs/feature-tabs/schedules/schedule-table/schedule-table.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@
5959
} @else { - }
6060
</td>
6161
<td>
62-
@if (data.pipeline; as pipeline) {
62+
@if (data.pipeline; as pipeline) { @if(showWriteActions()){
6363
<gcd-write-actions-icon [projectId]="data.project.id" [pipelineId]="pipeline.id" [branch]="pipeline.ref" />
64+
}
6465

6566
<button (click)="onPipelineClick($event, pipeline)" nz-tooltip nzTooltipTitle="Open in Gitlab" nz-button>
6667
<span nz-icon nzType="gitlab"></span>

src/app/groups/group-tabs/feature-tabs/schedules/schedule-table/schedule-table.component.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,19 @@ import { Status } from '$groups/model/status'
88
import { compareString, compareStringDate } from '$groups/util/compare'
99
import { statusToScope } from '$groups/util/status-scope'
1010
import { Header } from '$groups/util/table'
11+
import { ConfigService } from '$service/config.service'
1112
import { CommonModule } from '@angular/common'
12-
import { ChangeDetectionStrategy, Component, DestroyRef, inject, input, OnDestroy, signal } from '@angular/core'
13+
import {
14+
ChangeDetectionStrategy,
15+
Component,
16+
computed,
17+
DestroyRef,
18+
inject,
19+
input,
20+
OnDestroy,
21+
Signal,
22+
signal
23+
} from '@angular/core'
1324
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'
1425
import { NzBadgeModule } from 'ng-zorro-antd/badge'
1526
import { NzButtonModule } from 'ng-zorro-antd/button'
@@ -18,12 +29,12 @@ import { NzIconModule } from 'ng-zorro-antd/icon'
1829
import { NzTableModule } from 'ng-zorro-antd/table'
1930
import { NzToolTipModule } from 'ng-zorro-antd/tooltip'
2031
import { finalize, interval, map, Subscription, switchMap } from 'rxjs'
32+
import { DownloadArtifactsIconComponent } from '../../components/download-artifacts-icon/download-artifacts-icon.component'
2133
import { JobsComponent } from '../../components/jobs/jobs.component'
2234
import { WriteActionsIconComponent } from '../../components/write-actions-icon/write-actions-icon.component'
2335
import { PipelinesService } from '../../pipelines/service/pipelines.service'
2436
import { NextRunAtPipe } from './pipes/next-run-at.pipe'
2537
import { SchedulePipelineTableComponent } from './schedule-pipeline-table/schedule-pipeline-table.component'
26-
import { DownloadArtifactsIconComponent } from "../../components/download-artifacts-icon/download-artifacts-icon.component";
2738

2839
const headers: Header<ScheduleProjectPipeline>[] = [
2940
{ title: 'Project', sortable: true, compare: (a, b) => compareString(a.project.name, b.project.name) },
@@ -71,7 +82,7 @@ const headers: Header<ScheduleProjectPipeline>[] = [
7182
SchedulePipelineTableComponent,
7283
WriteActionsIconComponent,
7384
DownloadArtifactsIconComponent
74-
],
85+
],
7586
templateUrl: './schedule-table.component.html',
7687
styleUrls: ['./schedule-table.component.scss'],
7788
changeDetection: ChangeDetectionStrategy.OnPush
@@ -80,6 +91,7 @@ export class ScheduleTableComponent implements OnDestroy {
8091
private i18n = inject(NzI18nService)
8192
private pipelinesService = inject(PipelinesService)
8293
private destroyRef = inject(DestroyRef)
94+
private config = inject(ConfigService)
8395

8496
private refreshSubscription?: Subscription
8597

@@ -95,6 +107,10 @@ export class ScheduleTableComponent implements OnDestroy {
95107
this.refreshSubscription?.unsubscribe()
96108
}
97109

110+
get showWriteActions(): Signal<boolean> {
111+
return computed(() => !this.config.hideWriteActions())
112+
}
113+
98114
get locale(): string {
99115
const { locale } = this.i18n.getLocale()
100116
return locale

0 commit comments

Comments
 (0)