Skip to content

Commit 9b7a4c3

Browse files
authored
fix(ui): disabled button, displaytag (#5122)
1 parent d55dc71 commit 9b7a4c3

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

ui/src/app/shared/parameter/list/parameter.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { ParameterService } from 'app/service/parameter/parameter.service';
1414
import { ParameterEvent } from 'app/shared/parameter/parameter.event.model';
1515
import { SharedService } from 'app/shared/shared.service';
1616
import { Table } from 'app/shared/table/table';
17+
import { cloneDeep } from 'lodash-es';
1718
import { finalize } from 'rxjs/operators';
1819

1920
@Component({
@@ -27,6 +28,7 @@ export class ParameterListComponent extends Table<Parameter> implements OnInit {
2728
set parameters(newP: Array<Parameter>) {
2829
if (Array.isArray(newP)) {
2930
this._parameters = newP.map((d) => {
31+
d = cloneDeep(d);
3032
d.previousName = d.name;
3133
return d;
3234
});

ui/src/app/shared/workflow/node/run/node.run.param.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,16 @@ <h3>{{ 'pipeline_parent_commit_to_deploy' | translate}}</h3>
5252
<div class="actions">
5353
<button class="ui button" [disabled]="loading"
5454
(click)="modal.approve(false)">{{'common_cancel' | translate}}</button>
55-
<div class="ui green buttons" [class.loading]="loading" [class.disabled]="loading" >
56-
<div class="ui button" (click)="run(false, false)" autofocus>{{'common_run' | translate}}</div>
55+
<div class="ui green buttons">
56+
<div class="ui button" [class.loading]="loading" [class.disabled]="loading"
57+
(click)="run(false, false)" autofocus>{{'common_run' | translate}}</div>
5758
<div class="ui floating dropdown icon button" suiDropdown>
5859
<i class="dropdown icon"></i>
5960
<div class="menu" suiDropdownMenu>
60-
<div class="item" [class.disabled]="!currentNodeRun" (click)="run(true, false)" suiPopup [popupText]="'workflow_run_resync_help' | translate">
61+
<div class="item" [class.disabled]="!currentNodeRun || loading || workflow.from_repository" (click)="run(true, false)" suiPopup [popupText]="'workflow_run_resync_help' | translate">
6162
<i class="sync icon"></i>{{'workflow_resync' | translate }}
6263
</div>
63-
<div class="item" [class.disabled]="!currentNodeRun || currentNodeRun.status !== 'Fail'" (click)="run(false, true)"><i class="bug icon"></i>{{'workflow_run_only_failed' | translate }}</div>
64+
<div class="item" [class.disabled]="loading || !currentNodeRun || currentNodeRun.status !== 'Fail'" (click)="run(false, true)"><i class="bug icon"></i>{{'workflow_run_only_failed' | translate }}</div>
6465
</div>
6566
</div>
6667
</div>

ui/src/app/shared/workflow/sidebar/run-list/workflow.sidebar.run.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { WorkflowRun, WorkflowRunTags } from 'app/model/workflow.run.model';
1616
import { WorkflowRunService } from 'app/service/workflow/run/workflow.run.service';
1717
import { AutoUnsubscribe } from 'app/shared/decorator/autoUnsubscribe';
1818
import { DurationService } from 'app/shared/duration/duration.service';
19+
import { ProjectState } from 'app/store/project.state';
1920
import { CleanWorkflowRun, GetWorkflowRuns } from 'app/store/workflow.action';
2021
import { WorkflowState } from 'app/store/workflow.state';
2122
import { Observable, Subscription } from 'rxjs';
@@ -31,15 +32,15 @@ import { finalize, first } from 'rxjs/operators';
3132
export class WorkflowSidebarRunListComponent implements OnDestroy {
3233
@ViewChild('tagsList', {static: false}) tagsList: ElementRef;
3334

34-
@Input() project: Project;
35-
3635
workflowRuns = new Array<WorkflowRun>();
3736
_workflow: Workflow;
3837
@Input('workflow')
3938
set workflow(data: Workflow) {
4039
if (data) {
4140
if (!this._workflow || this._workflow.id !== data.id) {
41+
this.filteredTags = {};
4242
this._workflow = data;
43+
this.deleteInterval();
4344
this.initSelectableTags();
4445
}
4546
this._workflow = data;
@@ -55,6 +56,8 @@ export class WorkflowSidebarRunListComponent implements OnDestroy {
5556
@Select(WorkflowState.getRunSidebarFilters()) filters$: Observable<{}>;
5657
filtersSubs: Subscription;
5758

59+
project: Project;
60+
5861
// search part
5962
selectedTags: Array<string>;
6063
tagsSelectable: Array<string>;
@@ -77,6 +80,7 @@ export class WorkflowSidebarRunListComponent implements OnDestroy {
7780
private _store: Store,
7881
private _cd: ChangeDetectorRef
7982
) {
83+
this.project = this._store.selectSnapshot(ProjectState.projectSnapshot);
8084
this._routerActivated.params.subscribe(p => {
8185
if (p['number']) {
8286
this.currentWorkflowRunNumber = p['number'];
@@ -88,7 +92,7 @@ export class WorkflowSidebarRunListComponent implements OnDestroy {
8892
return;
8993
}
9094
this.workflowRuns = runs;
91-
if (!this.durationIntervalID && this.workflowRuns && this.workflow && this.workflowRuns.length > 0) {
95+
if (this.workflowRuns && this.workflow && this.workflowRuns.length > 0) {
9296
this.refreshRun();
9397
}
9498
this._cd.markForCheck();

ui/src/app/views/workflow/workflow.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ export class WorkflowComponent implements OnInit {
9898
this.projectSubscription = this._store.select(ProjectState)
9999
.subscribe((projectState: ProjectStateModel) => {
100100
this.project = projectState.project;
101+
if (this.project && this.workflow && this.project.key !== this.workflow.project_key) {
102+
delete this.workflow;
103+
}
101104
this._cd.detectChanges();
102105
});
103106

ui/src/app/views/workflow/workflow.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,10 @@
9797
</app-workflow-sidebar-hook>
9898
</ng-container>
9999
<ng-container *ngIf="sidebarMode === sidebarModes.RUNS">
100-
<app-workflow-sidebar-run-list [project]="project" [workflow]="workflow">
101-
</app-workflow-sidebar-run-list>
100+
<app-workflow-sidebar-run-list [workflow]="workflow"></app-workflow-sidebar-run-list>
102101
</ng-container>
103102
<ng-container *ngIf="sidebarMode === sidebarModes.RUN_HOOK" >
104-
<app-workflow-sidebar-run-hook [project]="project" [wname]="workflow.name">
105-
</app-workflow-sidebar-run-hook>
103+
<app-workflow-sidebar-run-hook [project]="project" [wname]="workflow.name"></app-workflow-sidebar-run-hook>
106104
</ng-container>
107105
<ng-container *ngIf="sidebarMode === sidebarModes.RUN_NODE" >
108106
<app-workflow-sidebar-run-node></app-workflow-sidebar-run-node>

0 commit comments

Comments
 (0)