agola-web/src/views/User.vue

153 lines
4.2 KiB
Vue
Raw Normal View History

2018-12-09 13:21:20 +00:00
<template>
<div>
<nav class="breadcrumb" aria-label="breadcrumbs">
<ul>
<li>
<a>user</a>
</li>
<li>
<router-link :to="ownerLink('user', username)">{{username}}</router-link>
</li>
</ul>
</nav>
<div class="name">
<span class="is-size-3">{{username}}</span>
<div class="is-pulled-right">
<createprojectbutton v-on:click="goToCreate($event)"/>
</div>
</div>
2018-12-09 13:21:20 +00:00
<div class="tabs">
<ul>
<li :class="[{ 'is-active': $route.name === 'user projects' || $route.name === 'user' }]">
2019-05-06 11:43:15 +00:00
<router-link :to="ownerProjectsLink('user', username)">
<span class="icon is-small">
<i class="mdi mdi-home"/>
</span>
<span>Projects</span>
</router-link>
2018-12-09 13:21:20 +00:00
</li>
<li :class="[{ 'is-active': $route.name === 'user local runs' }]">
2019-05-06 11:43:15 +00:00
<router-link :to="userLocalRunsLink(username)">
<span class="icon is-small">
<i class="mdi mdi-run-fast"/>
</span>
<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'"
:class="[{ 'is-active': $route.name === 'user local run' }]"
>
<tabarrow/>
</li>
<li
v-if="$route.name === 'user local run' || $route.name == 'user local run task'"
:class="[{ 'is-active': $route.name === 'user local run' }]"
>
<router-link :to="userLocalRunLink(username, $route.params.runid)">
<p v-if="run">
Run
<strong>#{{run.counter}}</strong>
</p>
</router-link>
</li>
<li
v-if="$route.name === 'user local run task'"
:class="[{ 'is-active': $route.name === 'user local run' }]"
>
<tabarrow/>
</li>
<li v-if="$route.name == 'user local run task'" class="is-active">
<router-link
:to="userLocalRunTaskLink(username, $route.params.runid, $route.params.taskid)"
>
<p v-if="run">
Task
<strong>{{run.tasks[$route.params.taskid].name}}</strong>
</p>
</router-link>
</li>
</ul>
<ul class="is-right">
<li :class="[{ 'is-active': $route.name.endsWith('user settings') }]">
2019-05-06 22:31:44 +00:00
<router-link :to="ownerSettingsLink('user', username)">
2019-05-06 11:43:15 +00:00
<span class="icon is-small">
<i class="mdi mdi-settings"/>
</span>
<span>User Settings</span>
</router-link>
</li>
</ul>
2018-12-09 13:21:20 +00:00
</div>
<router-view></router-view>
</div>
</template>
<script>
import {
ownerLink,
ownerProjectsLink,
userLocalRunsLink,
userLocalRunLink,
userLocalRunTaskLink,
ownerSettingsLink,
projectGroupCreateProjectGroupLink,
projectGroupCreateProjectLink
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) {
this.run = await fetchRun(route.params.runid);
}
}
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,
goToCreate(type) {
if (type == "project") {
this.$router.push(projectGroupCreateProjectLink("user", this.username));
return;
}
this.$router.push(
projectGroupCreateProjectGroupLink("user", this.username)
);
}
2018-12-09 13:21:20 +00:00
}
};
</script>
<style scoped lang="scss">
@import "@/css/_variables.scss";
.name {
2018-12-09 13:21:20 +00:00
padding-left: 5px;
margin-bottom: 25px;
}
</style>