agola-web/src/views/User.vue

168 lines
4.9 KiB
Vue
Raw Normal View History

2018-12-09 13:21:20 +00:00
<template>
<div>
<nav class="mb-4 bg-grey-light rounded font-sans w-full">
<ol class="list-reset flex text-grey-dark">
<li>
<a>user</a>
</li>
<li>
<span class="mx-2">/</span>
</li>
<li>
<router-link :to="ownerLink('user', username)">{{username}}</router-link>
</li>
</ol>
</nav>
<div class="mb-8 flex justify-between">
<span class="text-3xl">{{username}}</span>
<createprojectbutton v-on:click="goToCreate($event)"/>
</div>
<div class="flex justify-between">
<ul class="flex-grow tab">
<li
class="tab-element"
:class="[{ 'tab-element-selected': $route.name === 'user projects' || $route.name === 'user' }]"
>
2019-05-06 11:43:15 +00:00
<router-link :to="ownerProjectsLink('user', username)">
<i class="mr-1 mdi mdi-home"/>
2019-05-06 11:43:15 +00:00
<span>Projects</span>
</router-link>
2018-12-09 13:21:20 +00:00
</li>
<li
class="tab-element"
:class="[{ 'tab-element-selected': $route.name === 'user local runs' }]"
>
2019-05-06 11:43:15 +00:00
<router-link :to="userLocalRunsLink(username)">
<i class="mr-1 mdi mdi-run-fast"/>
2019-05-06 11:43:15 +00:00
<span>Local Runs</span>
</router-link>
2018-12-09 13:21:20 +00:00
</li>
<li v-if="$route.name === 'user local run' || $route.name == 'user local run task'">
2018-12-09 13:21:20 +00:00
<tabarrow/>
</li>
<li
class="tab-element"
2018-12-09 13:21:20 +00:00
v-if="$route.name === 'user local run' || $route.name == 'user local run task'"
:class="[{ 'tab-element-selected': $route.name === 'user local run' }]"
2018-12-09 13:21:20 +00:00
>
<router-link :to="userLocalRunLink(username, $route.params.runid)">
<span v-if="run">
2018-12-09 13:21:20 +00:00
Run
<strong>#{{run.counter}}</strong>
</span>
2018-12-09 13:21:20 +00:00
</router-link>
</li>
<li v-if="$route.name === 'user local run task'">
2018-12-09 13:21:20 +00:00
<tabarrow/>
</li>
<li
class="tab-element"
v-if="$route.name == 'user local run task'"
:class="[{ 'tab-element-selected': $route.name === 'user local run task' }]"
>
2018-12-09 13:21:20 +00:00
<router-link
:to="userLocalRunTaskLink(username, $route.params.runid, $route.params.taskid)"
>
<span v-if="run">
2018-12-09 13:21:20 +00:00
Task
<strong>{{run.tasks[$route.params.taskid].name}}</strong>
</span>
2018-12-09 13:21:20 +00:00
</router-link>
</li>
</ul>
<ul class="flex tab">
<li
class="tab-element"
:class="[{ 'tab-element-selected': $route.name.endsWith('user project group settings') }]"
>
2019-05-14 13:47:35 +00:00
<router-link :to="projectGroupSettingsLink('user', username, [])">
<i class="mr-1 mdi mdi-settings"/>
2019-05-14 13:47:35 +00:00
<span>Root Project Group Settings</span>
</router-link>
</li>
<li
class="tab-element"
:class="[{ 'tab-element-selected': $route.name.endsWith('user settings') }]"
>
2019-05-06 22:31:44 +00:00
<router-link :to="ownerSettingsLink('user', username)">
<i class="mr-1 mdi mdi-settings"/>
2019-05-06 11:43:15 +00:00
<span>User Settings</span>
</router-link>
</li>
</ul>
2018-12-09 13:21:20 +00:00
</div>
<router-view class="mt-8"></router-view>
2018-12-09 13:21:20 +00:00
</div>
</template>
<script>
import {
ownerLink,
ownerProjectsLink,
userLocalRunsLink,
userLocalRunLink,
userLocalRunTaskLink,
ownerSettingsLink,
projectGroupCreateProjectGroupLink,
2019-05-14 13:47:35 +00:00
projectGroupCreateProjectLink,
projectGroupSettingsLink
2018-12-09 13:21:20 +00:00
} from "@/util/link.js";
import { fetchRun } from "@/util/data.js";
import createprojectbutton from "@/components/createprojectbutton.vue";
2018-12-09 13:21:20 +00:00
import tabarrow from "@/components/tabarrow.vue";
export default {
name: "User",
components: { createprojectbutton, tabarrow },
2018-12-09 13:21:20 +00:00
props: {
username: String
2018-12-09 13:21:20 +00:00
},
data() {
return {
run: null
};
},
2019-03-29 17:21:57 +00:00
watch: {
$route: async function(route) {
if (route.params.runid) {
let { data, error } = await fetchRun(route.params.runid);
if (error) {
this.$store.dispatch("setError", error);
return;
}
this.run = data;
2019-03-29 17:21:57 +00:00
}
}
2018-12-09 13:21:20 +00:00
},
methods: {
ownerLink: ownerLink,
ownerProjectsLink: ownerProjectsLink,
userLocalRunsLink: userLocalRunsLink,
userLocalRunLink: userLocalRunLink,
userLocalRunTaskLink: userLocalRunTaskLink,
ownerSettingsLink: ownerSettingsLink,
projectGroupCreateProjectGroupLink: projectGroupCreateProjectGroupLink,
projectGroupCreateProjectLink: projectGroupCreateProjectLink,
2019-05-14 13:47:35 +00:00
projectGroupSettingsLink: projectGroupSettingsLink,
goToCreate(type) {
if (type == "project") {
2019-05-14 13:47:35 +00:00
this.$router.push(
projectGroupCreateProjectLink("user", this.username, [])
);
return;
}
this.$router.push(
2019-05-14 13:47:35 +00:00
projectGroupCreateProjectGroupLink("user", this.username, [])
);
}
2018-12-09 13:21:20 +00:00
}
};
</script>
<style scoped lang="scss">
</style>