user: load run on component creation

This commit is contained in:
Simone Gotti 2019-07-09 11:21:37 +02:00
parent c3950fbdd6
commit aad3358498
1 changed files with 19 additions and 9 deletions

View File

@ -16,7 +16,7 @@
<div class="mb-8 flex justify-between"> <div class="mb-8 flex justify-between">
<span class="text-3xl">{{username}}</span> <span class="text-3xl">{{username}}</span>
<createprojectbutton v-on:click="goToCreate($event)"/> <createprojectbutton v-on:click="goToCreate($event)" />
</div> </div>
<div class="flex justify-between"> <div class="flex justify-between">
@ -26,7 +26,7 @@
:class="[{ 'tab-element-selected': $route.name === 'user projects' || $route.name === 'user' }]" :class="[{ 'tab-element-selected': $route.name === 'user projects' || $route.name === 'user' }]"
> >
<router-link :to="ownerProjectsLink('user', username)"> <router-link :to="ownerProjectsLink('user', username)">
<i class="mr-1 mdi mdi-home"/> <i class="mr-1 mdi mdi-home" />
<span>Projects</span> <span>Projects</span>
</router-link> </router-link>
</li> </li>
@ -35,12 +35,12 @@
:class="[{ 'tab-element-selected': $route.name === 'user direct runs' }]" :class="[{ 'tab-element-selected': $route.name === 'user direct runs' }]"
> >
<router-link :to="userDirectRunsLink(username)"> <router-link :to="userDirectRunsLink(username)">
<i class="mr-1 mdi mdi-run-fast"/> <i class="mr-1 mdi mdi-run-fast" />
<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="$route.name === 'user direct run' || $route.name == 'user direct run task'">
<tabarrow/> <tabarrow />
</li> </li>
<li <li
class="tab-element" class="tab-element"
@ -55,7 +55,7 @@
</router-link> </router-link>
</li> </li>
<li v-if="$route.name === 'user direct run task'"> <li v-if="$route.name === 'user direct run task'">
<tabarrow/> <tabarrow />
</li> </li>
<li <li
class="tab-element" class="tab-element"
@ -77,7 +77,7 @@
:class="[{ 'tab-element-selected': $route.name.endsWith('user project group settings') }]" :class="[{ 'tab-element-selected': $route.name.endsWith('user project group settings') }]"
> >
<router-link :to="projectGroupSettingsLink('user', username, [])"> <router-link :to="projectGroupSettingsLink('user', username, [])">
<i class="mr-1 mdi mdi-settings"/> <i class="mr-1 mdi mdi-settings" />
<span>Root Project Group Settings</span> <span>Root Project Group Settings</span>
</router-link> </router-link>
</li> </li>
@ -87,7 +87,7 @@
:class="[{ 'tab-element-selected': $route.name.endsWith('user settings') }]" :class="[{ 'tab-element-selected': $route.name.endsWith('user settings') }]"
> >
<router-link :to="ownerSettingsLink('user', username)"> <router-link :to="ownerSettingsLink('user', username)">
<i class="mr-1 mdi mdi-settings"/> <i class="mr-1 mdi mdi-settings" />
<span>User Settings</span> <span>User Settings</span>
</router-link> </router-link>
</li> </li>
@ -103,7 +103,7 @@
<button <button
class="relative flex items-center focus:outline-none bg-transparent hover:bg-gray-300 text-dark font-semibold hover:text-dark py-1 px-4 border border-gray-500 rounded" class="relative flex items-center focus:outline-none bg-transparent hover:bg-gray-300 text-dark font-semibold hover:text-dark py-1 px-4 border border-gray-500 rounded"
> >
<i class="mr-4 mdi mdi-settings"/> <i class="mr-4 mdi mdi-settings" />
<i class="mdi mdi-chevron-down"></i> <i class="mdi mdi-chevron-down"></i>
</button> </button>
</div> </div>
@ -117,7 +117,7 @@
class="block px-4 py-2 hover:bg-blue-500 hover:text-white" class="block px-4 py-2 hover:bg-blue-500 hover:text-white"
:to="projectGroupSettingsLink('user', username, [])" :to="projectGroupSettingsLink('user', username, [])"
> >
<i class="mr-1 mdi mdi-settings"/> <i class="mr-1 mdi mdi-settings" />
<span>Root Project Group Settings</span> <span>Root Project Group Settings</span>
</router-link> </router-link>
</li> </li>
@ -199,6 +199,16 @@ export default {
projectGroupCreateProjectGroupLink("user", this.username, []) projectGroupCreateProjectGroupLink("user", this.username, [])
); );
} }
},
created: async function() {
if (this.$route.params.runid) {
let { data, error } = await fetchRun(this.$route.params.runid);
if (error) {
this.$store.dispatch("setError", error);
return;
}
this.run = data;
}
} }
}; };
</script> </script>