update runs.vue to be consistent with other components for user runs

Don't use the "username" property but just the ownername when projectref is
undefined like all the other components already do.
This commit is contained in:
Simone Gotti 2019-05-17 17:28:11 +02:00
parent a3918d9672
commit 4862c6103e
2 changed files with 7 additions and 15 deletions

View File

@ -5,21 +5,16 @@
<div v-for="run in runs" v-bind:key="run.id" :class="runResultClass(run)">
<div class="item-content">
<router-link
v-if="username"
tag="div"
class="name"
:to="userLocalRunLink(username, run.id)"
>
<span>{{run.name}}</span>
</router-link>
<router-link
v-else
v-if="projectref"
tag="div"
class="name"
:to="projectRunLink(ownertype, ownername, projectref, run.id)"
>
<span>{{run.name}}</span>
</router-link>
<router-link v-else tag="div" class="name" :to="userLocalRunLink(ownername, run.id)">
<span>{{run.name}}</span>
</router-link>
<div class="commitmessage">{{run.annotations.message}}</div>
<span v-if="waitingApproval(run)" class="waitingapproval tag">Waiting Approval</span>
<span v-if="!waitingApproval(run)" class="waitingapproval"></span>
@ -83,7 +78,6 @@ export default {
props: {
ownertype: String,
ownername: String,
username: String,
projectref: Array,
query: String
},
@ -127,10 +121,8 @@ export default {
clearInterval(this.polling);
if (this.projectref !== undefined) {
this.fetchProject();
} else if (this.username !== undefined) {
this.fetchUser();
} else {
this.fetchRuns();
this.fetchUser();
}
this.pollData();
},
@ -151,7 +143,7 @@ export default {
this.fetchRuns();
},
async fetchUser() {
let { data, error } = await fetchUser(this.username);
let { data, error } = await fetchUser(this.ownername);
if (error) {
this.$store.dispatch("setError", error);
return;

View File

@ -81,7 +81,7 @@ const router = new VueRouter({
path: "runs",
name: "user local runs",
component: runs,
props: (route) => ({ ownertype: "user", username: route.params.username })
props: (route) => ({ ownertype: "user", ownername: route.params.username })
},
{
path: "runs/:runid",