Skip to content

Commit 1fd51ed

Browse files
authored
fix(ui): allow to edit a non ascode workflow from template (#5187)
1 parent 35db63f commit 1fd51ed

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

ui/src/app/shared/ascode/events/ascode.event.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="asCodeEvents">
22
<p>
3-
<span *ngIf="workflow.from_repository">{{ 'pipeline_from_repository' | translate: {repo: repo} }}</span>
3+
<span *ngIf="workflow.from_repository">{{ 'pipeline_from_repository' | translate: {repo: workflow.from_repository} }}</span>
44
<span *ngIf="!workflow.from_repository">{{ 'workflow_from_repository_pending' | translate }}</span>
55
</p>
66
<ul>

ui/src/app/shared/workflow/menu/edit-node/menu.edit.node.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class WorkflowWNodeMenuEditComponent implements OnInit {
5151
this.workflowrun = state.workflowRun;
5252
this.noderun = state.workflowNodeRun;
5353
this.node = state.node;
54-
this.readonly = !state.canEdit || !!this.workflow.from_template;
54+
this.readonly = !state.canEdit || (!!this.workflow.from_template && !!this.workflow.from_repository);
5555

5656
this.runnable = this.getCanBeRun();
5757
this._cd.markForCheck();

ui/src/app/shared/workflow/modal/node-edit/node.edit.modal.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class WorkflowNodeEditModalComponent implements AfterViewInit {
6363
readonly = true;
6464

6565
constructor(private _modalService: SuiModalService, private _store: Store, private _cd: ChangeDetectorRef,
66-
private _translate: TranslateService, private _toast: ToastService) {
66+
private _translate: TranslateService, private _toast: ToastService) {
6767
this.projectSubscriber = this._store.select(ProjectState)
6868
.subscribe((projState: ProjectStateModel) => {
6969
this.project = projState.project;
@@ -110,7 +110,7 @@ export class WorkflowNodeEditModalComponent implements AfterViewInit {
110110
this.currentNodeName = stateSnap.node.name;
111111
this.currentNodeType = stateSnap.node.type;
112112
this.groups = cloneDeep(stateSnap.node.groups);
113-
this.readonly = !stateSnap.canEdit || !!this.workflow.from_template;
113+
this.readonly = !stateSnap.canEdit || (!!this.workflow.from_template && !!this.workflow.from_repository);
114114
if (stateSnap.hook) {
115115
this.hookSelected = true;
116116
}
@@ -209,7 +209,7 @@ export class WorkflowNodeEditModalComponent implements AfterViewInit {
209209

210210
changeView(newView: string): void {
211211
if (this.selected === newView) {
212-
return;
212+
return;
213213
}
214214
if (this.hasModification) {
215215
if (confirm(this._translate.instant('workflow_modal_change_view_confirm'))) {

ui/src/app/shared/workflow/wnode/hook/hook.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class WorkflowNodeHookComponent implements OnInit {
4949
) {
5050
this.projectKey = this._store.selectSnapshot(ProjectState.projectSnapshot).key;
5151
let workflow = this._store.selectSnapshot(WorkflowState.workflowSnapshot);
52-
this.isReadOnly = !workflow.permissions.writable || !!workflow.from_template;
52+
this.isReadOnly = !workflow.permissions.writable || (!!workflow.from_template && !!workflow.from_repository);
5353
}
5454

5555
ngOnInit(): void {

ui/src/app/views/pipeline/show/pipeline.show.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<a class="ui label small basic"
99
[class.green]="pipeline && pipeline.from_repository && (!pipeline.ascode_events || pipeline.ascode_events.length ===0)"
1010
[class.orange]="pipeline && pipeline.from_repository && pipeline?.ascode_events?.length > 0"
11+
[class.grey]="pipeline && !pipeline.from_repository && (!pipeline.as_code_events || pipeline.as_code_events.length === 0)"
1112
suiPopup [popupTemplate]="popupFromRepository" popupPlacement="bottom right"
1213
popupTrigger="outsideClick" #popup="suiPopup">
1314
<i class="code icon"></i>as code

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class WorkflowShowComponent implements OnInit {
9090
this.detailedWorkflow = s.workflow;
9191
}
9292
if (this.detailedWorkflow) {
93-
this.isReadOnly = !!this.detailedWorkflow.from_template;
93+
this.isReadOnly = !!this.detailedWorkflow.from_template && !!this.detailedWorkflow.from_repository;
9494
let from_repository = this.detailedWorkflow.from_repository;
9595
this.previewWorkflow = this.detailedWorkflow.preview;
9696
this.groups = cloneDeep(this.detailedWorkflow.groups);

0 commit comments

Comments
 (0)