Skip to content

Commit

Permalink
♻️ : refactor stack page considering new job workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cdubuisson committed Aug 30, 2019
1 parent 5f4e076 commit 1cc8526
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 44 deletions.
22 changes: 9 additions & 13 deletions src/main/resources/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1813,19 +1813,19 @@ button.main_bt {
/* border-left-color: #ff9800;*/
/*}*/

.job_list li.RUNNING {
.job_list li[class*=STARTED] {
border-left-color: #2196f3;
}

/*.job_list li:nth-child(3) {*/
/* border-left-color: #673ab7;*/
/*}*/

.job_list li.FAILED {
.job_list li[class*=FAILED] {
border-left-color: #e91e63;
}

.job_list li.FINISHED {
.job_list li[class*=FINISHED] {
border-left-color: #1ed085;
}

Expand Down Expand Up @@ -1862,27 +1862,23 @@ button.main_bt {
margin-left: 5px;
}

.job_list .job .job_attr_value.FINISHED {
color: #1ed085;
}

.job_list .job .job_attr_value.RUNNING {
.job_list .job .job_attr_value[class*=STARTED] {
color: #2196f3;
}

.job_list .job .job_attr_value.FAILED {
color: #e91e63;
.job_list .job .job_attr_value[class*=FINISHED] {
color: #1ed085;
}

.job_list .job .job_attr_value.PREVIEW {
color: #17a2b8;
.job_list .job .job_attr_value[class*=FAILED] {
color: #dc3545;
}

.job_list .job .job_attr_value.RUN {
color: #007bff;
}

.job_list .job .job_attr_value.STOP {
.job_list .job .job_attr_value.DESTROY {
color: #dc3545;
}

Expand Down
46 changes: 15 additions & 31 deletions src/main/resources/templates/stack.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@
<b-button variant="primary" @click="saveStack" :disabled="!formValid"><i class="far fa-save"></i> Save</b-button>
<b-button varian="primary" @click="runStack" :disabled="!formValid" v-if="stack.state === 'NEW' || stack.state === 'STOPPED'"><i class="fas fa-rocket"></i> Run</b-button>
<b-button variant="warning" @click="runStack" :disabled="!formValid" v-if="stack.state === 'TO_UPDATE'"><i class="fas fa-upload"></i> Update</b-button>

<b-button variant="info" @click="previewStack" :disabled="!formValid" v-if="stack.state !== 'RUNNING'"><i class="fas fa-binoculars"></i> Preview</b-button>

<b-button variant="danger" @click="stopStack" :disabled="!formValid" v-if="stack.state === 'RUNNING' || stack.state === 'TO_UPDATE'"><i class="fas fa-stop-circle"></i> Stop</b-button>
<b-button variant="danger" @click="stopStack" :disabled="!formValid" v-if="stack.state === 'RUNNING' || stack.state === 'TO_UPDATE'"><i class="fas fa-stop-circle"></i> Destroy</b-button>
</div>
</template>

Expand Down Expand Up @@ -272,32 +269,6 @@ <h2><span><i class="fas fa-history"></i> Job history</span></h2>
}),
template: "#stack-controls",
methods: {
previewStack: function() {
let current_stack = JSON.stringify(this.stack);
if (current_stack === stack_backup) {
window.location = `/stacks/${this.stack.id}/preview`;
} else {
this.confirmDialog('Preview request', 'Modifications must be saved before. Continue?')
.then(value => {
if (value) {
return this.saveStack().then(_ => window.location = `/stacks/${this.stack.id}/preview`);
}
})
}
},
runStack: function () {
let current_stack = JSON.stringify(this.stack);
if (current_stack === stack_backup) {
window.location = `/stacks/${this.stack.id}/apply`;
} else {
this.confirmDialog('Run request', 'Modifications must be saved before. Continue?')
.then(value => {
if (value) {
return this.saveStack().then(_ => window.location = `/stacks/${this.stack.id}/apply`);
}
})
}
},
saveStack: function(){
const message = Messenger().post({
type: "info",
Expand All @@ -319,13 +290,26 @@ <h2><span><i class="fas fa-history"></i> Job history</span></h2>
}
});
},
runStack: function () {
let current_stack = JSON.stringify(this.stack);
if (current_stack === stack_backup) {
window.location = `/stacks/${this.stack.id}/RUN`;
} else {
this.confirmDialog('Run request', 'Modifications must be saved before. Continue?')
.then(value => {
if (value) {
return this.saveStack().then(_ => window.location = `/stacks/${this.stack.id}/RUN`);
}
})
}
},
stopStack: function () {
// ask for confirmation
this.confirmDialog('Stop request', 'This will completely stop the stack. Continue?')
.then(value => {
if (value) {
// redirect
window.location = `/stacks/${this.stack.id}/stop`;
window.location = `/stacks/${this.stack.id}/DESTROY`;
}
});
},
Expand Down

0 comments on commit 1cc8526

Please sign in to comment.