-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added changing branch sequences values
- Loading branch information
Showing
11 changed files
with
239 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!-- change branch names dialog --> | ||
<p-dialog header="Change sequence value" [(visible)]="changeSeqDlgVisible" [style]="{width: '30rem'}"> | ||
<div class="field grid" *ngIf="selectedSeq"> | ||
<label for="sequenceVal" class="col-fixed" style="width: 10rem;">New Value</label> | ||
<div class="col"> | ||
<p-inputNumber inputId="sequenceVal" [(ngModel)]="selectedSeq.value" mode="decimal" [min]="-1"> | ||
</p-inputNumber> | ||
</div> | ||
</div> | ||
|
||
<p-footer> | ||
<button type="button" (click)="cancelChangeSeqValue()" pButton icon="pi pi-times" label="Cancel" class="p-button-outlined p-button-secondary"></button> | ||
<button type="button" (click)="changeSeqValue()" pButton icon="pi pi-check" label="Set"></button> | ||
</p-footer> | ||
</p-dialog> | ||
|
||
<div> | ||
<table class="seqs-table"> | ||
<tr> | ||
<th>Sequence Type</th> | ||
<th>Stage</th> | ||
<th>Value</th> | ||
<th>Change</th> | ||
</tr> | ||
<tr *ngFor="let s of sequences"> | ||
<td style="text-align: right;"> | ||
{{ getSeqTypeName(s) }} | ||
</td> | ||
<td> | ||
{{ s.stage_name ? s.stage_name : '' }} | ||
</td> | ||
<td style="text-align: right;"> | ||
{{ s.value }} | ||
</td> | ||
<td> | ||
<button pButton type="button" icon="pi pi-pencil" class="p-button-sm" (click)="showSeqChangeDlg(s)"></button> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// sequences table | ||
table.seqs-table | ||
border-collapse: collapse | ||
|
||
|
||
.seqs-table table, th, td | ||
border: 1px solid black | ||
|
||
.seqs-table th, td | ||
padding: 7px 15px |
23 changes: 23 additions & 0 deletions
23
ui/src/app/sequences-panel/sequences-panel.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { SequencesPanelComponent } from './sequences-panel.component'; | ||
|
||
describe('SequencesPanelComponent', () => { | ||
let component: SequencesPanelComponent; | ||
let fixture: ComponentFixture<SequencesPanelComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ SequencesPanelComponent ] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(SequencesPanelComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { Component, OnInit, OnDestroy, Input } from '@angular/core'; | ||
|
||
import { Subscription } from 'rxjs' | ||
|
||
import { MessageService } from 'primeng/api' | ||
|
||
import { ManagementService } from '../backend/api/management.service' | ||
import { showErrorBox } from '../utils' | ||
|
||
|
||
@Component({ | ||
selector: 'app-sequences-panel', | ||
templateUrl: './sequences-panel.component.html', | ||
styleUrls: ['./sequences-panel.component.sass'] | ||
}) | ||
export class SequencesPanelComponent implements OnInit, OnDestroy { | ||
@Input() branchId: number | ||
|
||
sequences = [] | ||
selectedSeq: any = null | ||
|
||
changeSeqDlgVisible = false | ||
|
||
private subs: Subscription = new Subscription() | ||
|
||
constructor( | ||
protected managementService: ManagementService, | ||
private msgSrv: MessageService | ||
) { } | ||
|
||
ngOnInit(): void { | ||
this.subs.add( | ||
this.managementService | ||
.getBranchSequences(this.branchId) | ||
.subscribe((data) => { | ||
this.sequences = data.items | ||
}) | ||
) | ||
} | ||
|
||
ngOnDestroy() { | ||
this.subs.unsubscribe() | ||
} | ||
|
||
getSeqTypeName(seq) { | ||
switch (seq.kind) { | ||
case 0: | ||
return 'flow' | ||
case 1: | ||
return 'CI flow' | ||
case 2: | ||
return 'DEV flow' | ||
case 3: | ||
return 'run' | ||
case 4: | ||
return 'CI run' | ||
case 5: | ||
return 'DEV run' | ||
} | ||
return 'unknown' | ||
} | ||
|
||
showSeqChangeDlg(seq) { | ||
this.selectedSeq = seq | ||
this.changeSeqDlgVisible = true | ||
} | ||
|
||
cancelChangeSeqValue() { | ||
this.changeSeqDlgVisible = false | ||
} | ||
|
||
changeSeqValue() { | ||
this.subs.add( | ||
this.managementService | ||
.updateBranchSequence(this.selectedSeq.id, {value: this.selectedSeq.value}) | ||
.subscribe( | ||
(data) => { | ||
this.changeSeqDlgVisible = false | ||
this.msgSrv.add({ | ||
severity: 'success', | ||
summary: 'Update of branch sequence value succeeded', | ||
detail: 'Update of branch sequence value succeeded.', | ||
}) | ||
}, | ||
(err) => { | ||
this.changeSeqDlgVisible = false | ||
showErrorBox( | ||
this.msgSrv, | ||
err, | ||
'Updating branch sequence value erred' | ||
) | ||
} | ||
) | ||
) | ||
} | ||
} |