user/project: show run/task tabelement only when loaded

This commit is contained in:
Simone Gotti 2019-07-10 17:11:03 +02:00
parent 3ff8a1350b
commit 9187efc9c9
2 changed files with 34 additions and 24 deletions

View File

@ -51,29 +51,35 @@
<span>Pull Requests</span> <span>Pull Requests</span>
</router-link> </router-link>
</li> </li>
<li v-if="$route.name.endsWith('project run') || $route.name.endsWith('project run task')"> <li
v-if="run && ($route.name.endsWith('project run') || $route.name.endsWith('project run task'))"
>
<tabarrow /> <tabarrow />
</li> </li>
<li <li
class="tab-element" class="tab-element"
v-if="$route.name.endsWith('project run') || $route.name.endsWith('project run task')" v-if="run && ($route.name.endsWith('project run') || $route.name.endsWith('project run task'))"
:class="[{ 'tab-element-selected': $route.name.endsWith('project run') }]" :class="[{ 'tab-element-selected': $route.name.endsWith('project run') }]"
> >
<router-link :to="projectRunLink(ownertype, ownername, projectref, $route.params.runid)"> <router-link :to="projectRunLink(ownertype, ownername, projectref, $route.params.runid)">
<p v-if="run"> <p>
Run Run
<strong>#{{run.counter}}</strong> <strong>#{{run.counter}}</strong>
</p> </p>
</router-link> </router-link>
</li> </li>
<li v-if="$route.name.endsWith('project run task')"> <li v-if="run && $route.name.endsWith('project run task')">
<tabarrow /> <tabarrow />
</li> </li>
<li class="tab-element" v-if="$route.name.endsWith('project run task')"> <li
class="tab-element"
v-if="run && $route.name.endsWith('project run task')"
:class="[{ 'tab-element-selected': $route.name.endsWith('project run task') }]"
>
<router-link <router-link
:to="projectRunTaskLink(ownertype, ownername, projectref, $route.params.runid, $route.params.taskid)" :to="projectRunTaskLink(ownertype, ownername, projectref, $route.params.runid, $route.params.taskid)"
> >
<p v-if="run"> <p>
Task Task
<strong>{{run.tasks[$route.params.taskid].name}}</strong> <strong>{{run.tasks[$route.params.taskid].name}}</strong>
</p> </p>
@ -168,6 +174,7 @@ export default {
}, },
watch: { watch: {
$route: async function(route) { $route: async function(route) {
this.run = null;
if (route.params.runid) { if (route.params.runid) {
let { data, error } = await fetchRun(route.params.runid); let { data, error } = await fetchRun(route.params.runid);
if (error) { if (error) {

View File

@ -39,33 +39,35 @@
<span>Direct Runs</span> <span>Direct Runs</span>
</router-link> </router-link>
</li> </li>
<li v-if="$route.name === 'user direct run' || $route.name == 'user direct run task'"> <li
v-if="run && ($route.name === 'user direct run' || $route.name == 'user direct run task')"
>
<tabarrow /> <tabarrow />
</li> </li>
<li <li
class="tab-element" class="tab-element"
v-if="$route.name === 'user direct run' || $route.name == 'user direct run task'" v-if="run && ($route.name === 'user direct run' || $route.name == 'user direct run task')"
:class="[{ 'tab-element-selected': $route.name === 'user direct run' }]" :class="[{ 'tab-element-selected': $route.name === 'user direct run' }]"
> >
<router-link :to="userDirectRunLink(username, $route.params.runid)"> <router-link :to="userDirectRunLink(username, $route.params.runid)">
<span v-if="run"> <span>
Run Run
<strong>#{{run.counter}}</strong> <strong>#{{run.counter}}</strong>
</span> </span>
</router-link> </router-link>
</li> </li>
<li v-if="$route.name === 'user direct run task'"> <li v-if="run && $route.name === 'user direct run task'">
<tabarrow /> <tabarrow />
</li> </li>
<li <li
class="tab-element" class="tab-element"
v-if="$route.name == 'user direct run task'" v-if="run && $route.name == 'user direct run task'"
:class="[{ 'tab-element-selected': $route.name === 'user direct run task' }]" :class="[{ 'tab-element-selected': $route.name === 'user direct run task' }]"
> >
<router-link <router-link
:to="userDirectRunTaskLink(username, $route.params.runid, $route.params.taskid)" :to="userDirectRunTaskLink(username, $route.params.runid, $route.params.taskid)"
> >
<span v-if="run"> <span>
Task Task
<strong>{{run.tasks[$route.params.taskid].name}}</strong> <strong>{{run.tasks[$route.params.taskid].name}}</strong>
</span> </span>
@ -168,6 +170,7 @@ export default {
}, },
watch: { watch: {
$route: async function(route) { $route: async function(route) {
this.run = null;
if (route.params.runid) { if (route.params.runid) {
let { data, error } = await fetchRun(route.params.runid); let { data, error } = await fetchRun(route.params.runid);
if (error) { if (error) {