Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FOGL-8036: Added functionality to rename control pipeline #320

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<i class="far fa-question-circle"></i>
</span> -->
<div class="column">
<div [hidden]="editMode" class="field is-horizontal">
<div class="field is-horizontal">
<div class="field-label">
<label class="label label-name">Name</label>
</div>
Expand Down Expand Up @@ -288,7 +288,7 @@
</p>
<p class="control">
<button (click)="onSubmit(pipelineForm)" type="submit" class="button is-small is-link"
[disabled]="pipelineForm?.invalid || (!checkControlPipelineChange() && !unsavedChangesInFilterForm) ">Save</button>
[disabled]="pipelineForm?.invalid || (!checkControlPipelineChange(name.value) && !unsavedChangesInFilterForm) ">Save</button>
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,9 @@ export class AddControlPipelineComponent implements OnInit {
return false;
}

checkControlPipelineChange() {
checkControlPipelineChange(name) {
const changedCPValues: ControlPipeline = {
name: name,
execution: this.selectedExecution,
source: { "type": this.selectedSourceType.name, "name": this.selectedSourceName },
destination: { "type": this.selectedDestinationType.name, "name": this.selectedDestinationName },
Expand All @@ -556,7 +557,6 @@ export class AddControlPipelineComponent implements OnInit {
}
if (this.controlPipeline) {
delete this.controlPipeline.id;
delete this.controlPipeline.name;
this.controlPipeline.filters = this.changeFilterNameInPipeline(this.controlPipeline.filters);
}
return !isEqual(this.controlPipeline, changedCPValues);
Expand All @@ -566,6 +566,7 @@ export class AddControlPipelineComponent implements OnInit {
const formData = cloneDeep(form.value);
let { name } = formData;
const payload: ControlPipeline = {
name: name.trim(),
execution: this.selectedExecution,
source: { "type": this.selectedSourceType.cpsid, "name": this.selectedSourceName },
destination: { "type": this.selectedDestinationType.cpdid, "name": this.selectedDestinationName },
Expand All @@ -578,17 +579,14 @@ export class AddControlPipelineComponent implements OnInit {
this.toast.error("Source and Destination can't be same.");
return;
}
if (!this.editMode) {
payload['name'] = name.trim();
}

if (this.unsavedChangesInFilterForm) {
this.filtersListComponent?.update();
this.unsavedChangesInFilterForm = false;
}

if (this.editMode) {
if (this.checkControlPipelineChange()) {
if (this.checkControlPipelineChange(payload.name)) {
this.updateControlPipeline(payload);
}
this.navigateOnControlPipelineListPage();
Expand Down