ignore invalid linear workflow sections that are after the current section
This commit is contained in:
parent
ff07533d80
commit
ea9d47ba75
6 changed files with 42 additions and 12 deletions
|
@ -23,7 +23,7 @@
|
|||
<td>
|
||||
<!-- Next sections -->
|
||||
<div class="upcoming"
|
||||
ng-if="$ctrl.currentSection.index != $ctrl.sections.length - 1">
|
||||
ng-if="$ctrl.currentSection.index < $ctrl.sections.length - 1">
|
||||
<b>Next:</b>
|
||||
<ul>
|
||||
<li ng-repeat="section in $ctrl.sections"
|
||||
|
|
|
@ -89,12 +89,21 @@ describe("LinearWorkflowComponent", () => {
|
|||
new LinearWorkflowSectionComponent(),
|
||||
];
|
||||
sections.forEach((section) => {
|
||||
section.sectionVisible = true;
|
||||
section.isCurrentSection = true;
|
||||
section.sectionVisible = false;
|
||||
section.isCurrentSection = false;
|
||||
component.addSection(section);
|
||||
});
|
||||
});
|
||||
|
||||
it("does nothing if invalid section is after the current section", () => {
|
||||
sections[sections.length - 1].sectionValid = false;
|
||||
sections[sections.length - 1].sectionId = "Some Section";
|
||||
component.onSectionInvalid(sections[sections.length - 1].sectionId);
|
||||
|
||||
expect(sections[sections.length - 1].isCurrentSection).toBe(false);
|
||||
expect(sections[sections.length - 1].sectionVisible).toBe(false);
|
||||
});
|
||||
|
||||
it("sets the section with the given id to be the current section", () => {
|
||||
component.onSectionInvalid(invalidSection.sectionId);
|
||||
|
||||
|
@ -102,6 +111,11 @@ describe("LinearWorkflowComponent", () => {
|
|||
});
|
||||
|
||||
it("hides all sections after the section with the given id", () => {
|
||||
sections.forEach((section) => {
|
||||
section.sectionVisible = true;
|
||||
section.isCurrentSection = true;
|
||||
component.addSection(section);
|
||||
});
|
||||
component.onSectionInvalid(invalidSection.sectionId);
|
||||
|
||||
sections.forEach((section) => {
|
||||
|
|
|
@ -45,14 +45,16 @@ export class LinearWorkflowComponent implements ng.IComponentController {
|
|||
|
||||
public onSectionInvalid(sectionId: string): void {
|
||||
var invalidSection = this.sections.filter(section => section.component.sectionId == sectionId)[0];
|
||||
invalidSection.component.isCurrentSection = true;
|
||||
this.currentSection = invalidSection;
|
||||
this.sections.forEach((section) => {
|
||||
if (section.index > invalidSection.index) {
|
||||
section.component.sectionVisible = false;
|
||||
section.component.isCurrentSection = false;
|
||||
}
|
||||
});
|
||||
if (invalidSection.index <= this.currentSection.index) {
|
||||
invalidSection.component.isCurrentSection = true;
|
||||
this.currentSection = invalidSection;
|
||||
this.sections.forEach((section) => {
|
||||
if (section.index > invalidSection.index) {
|
||||
section.component.sectionVisible = false;
|
||||
section.component.isCurrentSection = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<linear-workflow
|
||||
workflow-state="$ctrl.currentState"
|
||||
done-title="Create Trigger"
|
||||
workflow-complete="$ctrl.activateTrigger({'config': $ctrl.config})">
|
||||
on-workflow-complete="$ctrl.activateTrigger({'config': $ctrl.config})">
|
||||
<!-- Section: Repository -->
|
||||
<linear-workflow-section class="row"
|
||||
section-id="repo"
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import { ManageTriggerCustomGitComponent } from './manage-trigger-custom-git.component';
|
||||
|
||||
|
||||
describe("ManageTriggerCustomGitComponent", () => {
|
||||
var component: ManageTriggerCustomGitComponent;
|
||||
|
||||
beforeEach(() => {
|
||||
component = new ManageTriggerCustomGitComponent();
|
||||
});
|
||||
|
||||
describe("$onChanges", () => {
|
||||
|
||||
});
|
||||
});
|
Binary file not shown.
Reference in a new issue