Skip to content

Commit a4c5143

Browse files
authored
Merge pull request #26 from AcalephStorage/release/0.1.3
Release/0.1.3
2 parents 82c15f5 + 230274d commit a4c5143

File tree

10 files changed

+136
-15
lines changed

10 files changed

+136
-15
lines changed

Caddyfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
regexp .*
66
ext /
77
to /index.html
8-
}
8+
}
99
log stdout
10+
tls /secrets/ssl/cert /secrets/ssl/key
1011
}

app/adapters/stage.js

+42-2
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,59 @@
11
import ApplicationAdapter from './application';
22
import Ember from 'ember';
3+
import QueryString from 'torii/lib/query-string';
4+
35

46
export default ApplicationAdapter.extend({
57

6-
urlForQueryRecord: function(query, modelName) {
8+
updateRecord(store, type, snapshot) {
9+
var data = {},
10+
url = this.buildURL(type.modelName, null, snapshot, 'updateRecord');
11+
12+
var serializer = store.serializerFor(type.modelName);
13+
serializer.serializeIntoHash(data, type, snapshot);
14+
15+
if (data.type === 'wait') {
16+
let qs = QueryString.create({
17+
provider: { continue: 'yes' },
18+
requiredParams: ['continue']
19+
});
20+
url = [url, qs.toString()].join('?');
21+
}
22+
23+
return this.ajax(url, 'POST', { data: {} });
24+
},
25+
26+
urlForQueryRecord(query, modelName) {
727
var urlParts = this._buildURL(modelName).split('/');
828

929
if (Ember.isPresent(query.owner) && Ember.isPresent(query.repo) && Ember.isPresent(query.buildNumber) && Ember.isPresent(query.stageIndex)) {
10-
urlParts.push('pipelines', query.owner, query.repo, 'builds', query.buildNumber, 'stages', query.stageIndex);
30+
urlParts.push('pipelines', query.owner, query.repo);
31+
urlParts.push('builds', query.buildNumber);
32+
urlParts.push('stages', query.stageIndex);
1133
delete query.owner;
1234
delete query.repo;
1335
delete query.buildNumber;
1436
delete query.stageIndex;
1537
}
38+
1639
return urlParts.join('/');
1740
},
1841

42+
urlForUpdateRecord(id, modelName, snapshot) {
43+
var urlParts = this._buildURL(modelName).split('/');
44+
urlParts.removeObject(this.pathForType(modelName));
45+
46+
let pipelineName = snapshot.record.get('build.pipeline.name'),
47+
buildNumber = snapshot.record.get('build.number'),
48+
index = snapshot.record.get('index');
49+
50+
if (Ember.isPresent(pipelineName) && Ember.isPresent(buildNumber) && Ember.isPresent(index)) {
51+
urlParts.push('pipelines', pipelineName);
52+
urlParts.push('builds', buildNumber);
53+
urlParts.push('stages', index);
54+
}
55+
56+
return urlParts.join('/');
57+
}
58+
1959
});

app/components/build-stage.js

+15-3
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,28 @@ export default Ember.Component.extend({
1414
'command': 'terminal',
1515
'docker_build': 'legal',
1616
'docker_publish': 'upload',
17+
'wait': 'pause',
18+
'wait_done': 'right arrow',
1719
},
1820
statusIcon: Ember.computed('model.type', function() {
1921
let type = this.get('model.type');
22+
let status = this.get('model.status');
23+
24+
if (type === 'wait' && status === 'SUCCESS') {
25+
type = 'wait_done';
26+
}
2027
return this.iconClassMap[type] || this.defaultStatusIcon;
2128
}),
2229
isRunning: Ember.computed.equal('model.status', 'RUNNING'),
2330

2431
click() {
25-
this.fetchLogs();
26-
this.sendAction('selectStage', this.get('model'));
32+
let stage = this.get('model');
33+
if (stage.get('type') === 'wait' && stage.get('status') === 'WAITING') {
34+
this.sendAction('promptWaitStageMessage', stage);
35+
} else {
36+
this.fetchLogs();
37+
this.sendAction('selectStage', stage);
38+
}
2739
},
2840

2941
willDestroyElement() {
@@ -50,7 +62,7 @@ export default Ember.Component.extend({
5062
},
5163

5264
logFetcher: task(function*(stage) {
53-
if (stage.get('status') !== 'PENDING') {
65+
if (stage.get('status') !== 'PENDING' && stage.get('type') != 'wait') {
5466
let logFiles = yield this.getStageLogs(stage);
5567
return logFiles;
5668
}

app/components/pipeline-build.js

+28-7
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@ export default Ember.Component.extend({
9191
});
9292
}).drop(),
9393

94+
stageStatusUpdater: task(function * (stage) {
95+
let b = this.get('model');
96+
Ember.assign(stage, { build: b });
97+
stage.save()
98+
.finally(() => {
99+
this.get('buildFetcher').cancelAll();
100+
this.get('buildFetcher').perform();
101+
});
102+
}).drop(),
103+
94104
buildsPoller: task(function*() {
95105
while(true) {
96106
yield this.get('pipeline.builds').reload();
@@ -101,23 +111,25 @@ export default Ember.Component.extend({
101111
stagesPoller: task(function*() {
102112
while(true) {
103113
this.get('buildFetcher').perform();
104-
yield timeout(5000); // 5-second interval
114+
yield timeout(3000); // 3-second interval
105115
}
106116
}).drop(),
107117

118+
closeInfoBox() {
119+
this.send('unselectStage');
120+
this.send('closePipelineDetails');
121+
this.send('closePipelineEditor');
122+
},
123+
108124
actions: {
109125
historyHide() {
110126
return Ember.isPresent(this.get('model'));
111127
},
112128
selectBuild() {
113-
this.send('unselectStage');
114-
this.send('closePipelineDetails');
115-
this.send('closePipelineEditor');
129+
this.closeInfoBox();
116130
},
117131
confirmCreateBuild() {
118-
this.send('unselectStage');
119-
this.send('closePipelineDetails');
120-
this.send('closePipelineEditor');
132+
this.closeInfoBox();
121133
this.$('.ui.modal.create-build-confirmation').modal('show');
122134
},
123135
createBuild() {
@@ -131,6 +143,15 @@ export default Ember.Component.extend({
131143
unselectStage() {
132144
this.set('selectedStage', null);
133145
},
146+
promptWaitStageMessage(stage) {
147+
this.closeInfoBox();
148+
this.set('selectedWaitStage', stage);
149+
this.$('.ui.modal.wait-stage-prompt').modal('show');
150+
},
151+
startWaitStage() {
152+
let stage = this.get('selectedWaitStage');
153+
this.get('stageStatusUpdater').perform(stage);
154+
},
134155
viewPipelineDetails() {
135156
this.send('unselectStage');
136157
this.send('closePipelineEditor');

app/models/stage.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Model from 'ember-data/model';
22
import attr from 'ember-data/attr';
3+
import {belongsTo} from 'ember-data/relationships';
34

45
export default Model.extend({
56
name: attr('string'),
@@ -12,5 +13,6 @@ export default Model.extend({
1213
status: attr('string'),
1314
pod_namespace: attr('string'),
1415
job_name: attr('string'),
15-
pod_name: attr('string')
16+
pod_name: attr('string'),
17+
build: belongsTo('build')
1618
});

app/styles/app.less

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
@colorRunning : #99D6EA;
1414
@colorRunningDark : #AAE3F7;
1515
@colorRunningGlow : #D8F5FF;
16+
@colorWaiting : #FFB209;
1617

1718
@lrMargin: 2em;
1819

app/styles/pipeline.less

+8
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@
8989
.pipeline-build ul .stage.FAIL {
9090
border-color: @colorFail;
9191
}
92+
.pipeline-build ul .stage.WAITING::before,
93+
.pipeline-build ul .stage.WAITING {
94+
border-color: @colorWaiting;
95+
}
9296
@-webkit-keyframes sk-scaleout {
9397
0% {
9498
-webkit-transform: scale(0);
@@ -143,6 +147,10 @@
143147
background-color: @colorRunning;
144148
border-color: @colorRunning;
145149
}
150+
.ui.WAITING.label {
151+
background-color: @colorWaiting;
152+
border-color: @colorWaiting;
153+
}
146154

147155
/*******************
148156
** info-box

app/styles/pipelines.less

+6
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@
2929
.FAIL.ui.card > .content .status.icon {
3030
color: @colorFail;
3131
}
32+
.WAITING.ui.card > .extra {
33+
background: @colorWaiting;
34+
}
35+
.WAITING.ui.card > .content .status.icon {
36+
color: @colorWaiting;
37+
}

app/templates/components/pipeline-build.hbs

+12-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{{#if model.stages}}
3838
<ul class="stages">
3939
{{#each model.stages as |stage|}}
40-
{{build-stage model=stage build=model pipeline=pipeline selectStage=(action 'selectStage')}}
40+
{{build-stage model=stage build=model pipeline=pipeline selectStage=(action 'selectStage') promptWaitStageMessage=(action 'promptWaitStageMessage')}}
4141
{{/each}}
4242
</ul>
4343
{{else}}
@@ -113,3 +113,14 @@
113113
<div class="ui positive right labeled icon small button">Yes<i class="checkmark icon"></i></div>
114114
</div>
115115
{{/ui-modal}}
116+
117+
{{#ui-modal name="wait-stage-prompt" class="small wait-stage-prompt" closable=false onApprove=(action "startWaitStage") }}
118+
<div class="header">Wait</div>
119+
<div class="content">{{selectedWaitStage.params.message}}</div>
120+
<div class="actions">
121+
<div class="ui negative small button">No</div>
122+
<div class="ui positive right labeled icon small button">Yes<i class="right arrow icon"></i></div>
123+
</div>
124+
{{/ui-modal}}
125+
126+

kontinuous-ui.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ spec:
1717
app: kontinuous-ui
1818
type: dashboard
1919

20+
---
21+
apiVersion: v1
22+
kind: Secret
23+
metadata:
24+
name: ssl-secret
25+
namespace: acaleph
26+
data:
27+
cert:
28+
key:
29+
2030
---
2131
apiVersion: v1
2232
kind: ReplicationController
@@ -38,6 +48,10 @@ spec:
3848
type: dashboard
3949
name: kontinuous-ui
4050
namespace: acaleph
51+
volumes:
52+
- name: ssl
53+
secret:
54+
secretName: ssl-secret
4155
spec:
4256
containers:
4357
- env:
@@ -54,3 +68,8 @@ spec:
5468
- containerPort: 5000
5569
name: dashboard
5670
protocol: TCP
71+
volumeMounts:
72+
- name: ssl
73+
readOnly: true
74+
mountPath: /secrets/ssl
75+

0 commit comments

Comments
 (0)