Skip to content

Commit

Permalink
Adds "execute after saving" checkbox to configuration wizard
Browse files Browse the repository at this point in the history
Change-Id: I9cb55a1558d90c758af7783928a92f6e25f8de86
  • Loading branch information
frague committed May 18, 2017
1 parent e6c1668 commit 4c397ba
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 34 deletions.
7 changes: 6 additions & 1 deletion ui/app/configurations/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ export class ConfigurationsComponent implements OnInit {
_.omit(configuration, ['playbook_id', 'cluster_id', 'name', 'server_ids', 'hints'])
);
this.model = pureConfig;
this.refreshConfigurations(this.pagedData.page);

if (_.get(configuration, 'data.created_execution_id')) {
this.router.navigate(['/executions']);
} else {
this.refreshConfigurations(this.pagedData.page);
}
}
)
.catch(
Expand Down
1 change: 1 addition & 0 deletions ui/app/configurations/wizard_steps/playbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class PlaybookStep extends WizardStepBase {
init() {
this.selectedPlaybook = null;
this.initModelProperty('data.playbook_id', '');
this.initModelProperty('data.run', false);
}

constructor(wizard: WizardService, private data: DataService) {
Expand Down
6 changes: 6 additions & 0 deletions ui/app/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,12 @@ longdata {
border-color: inherit;
}
}
.single-row {
margin: 0 -15px 15px -15px;
input[type='checkbox'] {
margin-right: 4px;
}
}
}

#confirm.modal {
Expand Down
6 changes: 6 additions & 0 deletions ui/app/styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -7912,6 +7912,12 @@ longdata ul li {
.wizard-step .has-error .form-control.ng-untouched {
border-color: inherit;
}
.wizard-step .single-row {
margin: 0 -15px 15px -15px;
}
.wizard-step .single-row input[type='checkbox'] {
margin-right: 4px;
}
.login-background {
position: absolute;
top: 0;
Expand Down
4 changes: 4 additions & 0 deletions ui/app/templates/wizard_step.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div *ngIf="isSelected()" class="wizard-step">
<h1>{{title}}</h1>
<ng-content></ng-content>
</div>
11 changes: 11 additions & 0 deletions ui/app/templates/wizard_steps/hints.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,15 @@
[submits]="['#next', '#save']"
></hint>
</div>

<div class="single-row col-xs-12">
<label>
<input
id="execute"
name="execute"
type="checkbox"
[(ngModel)]="model.data.run"
> Execute after saving
</label>
</div>
</step>
14 changes: 13 additions & 1 deletion ui/app/templates/wizard_steps/playbook.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<step [title]="'Playbook'">
<div class="col-xs-12 grid">
<div class="col-xs-12 grid long-content">
<div class="grid-line table-help">
<div class="col-xs-9">Name</div>
<div class="col-xs-3 text-right">Servers Required</div>
Expand Down Expand Up @@ -31,4 +31,16 @@
required
>
</div>

<div class="single-row col-xs-12">
<label>
<input
id="execute"
name="execute"
type="checkbox"
[(ngModel)]="model.data.run"
> Execute after saving
</label>
</div>

</step>
71 changes: 40 additions & 31 deletions ui/app/templates/wizard_steps/servers.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,47 @@
<step [title]="'Servers'">
<div>
<div class="col-xs-12 grid long-content">
<div class="grid-line table-help">
<div class="col-xs-11 name">
<label>
<input
id="select_all"
name="select_all"
(click)="toggleSelectAll(this)"
[checked]="areAllServersSelected()"
type="checkbox"
required
> SELECT ALL
</label>
</div>
<div class="col-xs-1 text-right">Info</div>
<div class="col-xs-12 grid long-content">
<div class="grid-line table-help">
<div class="col-xs-11 name">
<label>
<input
id="select_all"
name="select_all"
(click)="toggleSelectAll(this)"
[checked]="areAllServersSelected()"
type="checkbox"
required
> SELECT ALL
</label>
</div>
<div class="col-xs-1 text-right">Info</div>
</div>

<div class="grid-line" *ngFor="let server of getPolicyServers()">
<div class="col-xs-11 name">
<label>
<input
type="checkbox"
(change)="toggleServer(server)"
[checked]="isServerSelected(server)"
[submits]="'#save'"
required
> {{server.data.name|trim_by:60}}
</label>
</div>
<div class="col-xs-1 icon">
<span class="glyphicon glyphicon-info-sign"></span>
</div>
<div class="grid-line" *ngFor="let server of getPolicyServers()">
<div class="col-xs-11 name">
<label>
<input
type="checkbox"
(change)="toggleServer(server)"
[checked]="isServerSelected(server)"
[submits]="'#save'"
required
> {{server.data.name|trim_by:60}}
</label>
</div>
<div class="col-xs-1 icon">
<span class="glyphicon glyphicon-info-sign"></span>
</div>
</div>
</div>

<div class="single-row col-xs-12">
<label>
<input
id="execute"
name="execute"
type="checkbox"
[(ngModel)]="model.data.run"
> Execute after saving
</label>
</div>
</step>
2 changes: 1 addition & 1 deletion ui/app/wizard_step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { BaseModel } from './models';
// Every wizard step should be wrapped into the <step> tag
@Component({
selector: 'step',
template: `<div *ngIf="isSelected()" class="wizard-step"><h1>{{title}}</h1><ng-content></ng-content></div>`
templateUrl: './app/templates/wizard_step.html'
})
export class WizardStepContainer {
id = Math.random();
Expand Down

0 comments on commit 4c397ba

Please sign in to comment.