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

View File

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