Commit 3fff93ca authored by Regis's avatar Regis

use Object.assign instead of Vue.set - change duration to computed prop

parent ec90700c
...@@ -25,11 +25,11 @@ ...@@ -25,11 +25,11 @@
this.$http.get(`${url}?scope=${apiScope}&page=${pageNum}`) this.$http.get(`${url}?scope=${apiScope}&page=${pageNum}`)
.then((response) => { .then((response) => {
const pageInfo = pageValues(response.headers); const pageInfo = pageValues(response.headers);
Vue.set(this, 'pageInfo', pageInfo); this.pageInfo = Object.assign({}, this.pageInfo, pageInfo);
const res = JSON.parse(response.body); const res = JSON.parse(response.body);
Vue.set(this, 'pipelines', res.pipelines); this.count = Object.assign({}, this.count, res.count);
Vue.set(this, 'count', res.count); this.pipelines = Object.assign([], this.pipelines, res.pipelines);
updatePipelineNums(this.count); updatePipelineNums(this.count);
this.pageRequest = false; this.pageRequest = false;
......
...@@ -29,23 +29,23 @@ ...@@ -29,23 +29,23 @@
if (!finished && changeTime) return false; if (!finished && changeTime) return false;
return ({ words: this.timeAgo.format(finished) }); return ({ words: this.timeAgo.format(finished) });
}, },
},
methods: {
duration() { duration() {
const { duration } = this.pipeline.details; const { duration } = this.pipeline.details;
if (duration === 0) return '00:00:00'; if (duration === 0) return '00:00:00';
if (duration !== null) return duration; if (duration !== null) return duration;
return false; return false;
}, },
},
methods: {
changeTime() { changeTime() {
this.currentTime = new Date(); this.currentTime = new Date();
}, },
}, },
template: ` template: `
<td> <td>
<p class="duration" v-if='duration()'> <p class="duration" v-if='duration'>
<span v-html='svgs.iconTimer'></span> <span v-html='svgs.iconTimer'></span>
{{duration()}} {{duration}}
</p> </p>
<p class="finished-at" v-if='timeStopped'> <p class="finished-at" v-if='timeStopped'>
<i class="fa fa-calendar"></i> <i class="fa fa-calendar"></i>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment