agola-web/src/views/Project.vue

134 lines
4.0 KiB
Vue
Raw Normal View History

2018-12-09 13:21:20 +00:00
<template>
<div>
<projbreadcrumbs :ownertype="ownertype" :ownername="ownername" :projectref="projectref"/>
2018-12-09 13:21:20 +00:00
<div class="tabs">
<ul>
<li
:class="[{ 'is-active': $route.name.match('project runs') || $route.name.endsWith('project') }]"
2018-12-09 13:21:20 +00:00
>
<router-link :to="projectRunsLink(ownertype, ownername, projectref)">Runs History</router-link>
</li>
<li :class="[{ 'is-active': $route.name.match('project branches runs') }]">
<router-link :to="projectBranchesRunsLink(ownertype, ownername, projectref)">Branches</router-link>
</li>
<li :class="[{ 'is-active': $route.name.match('project tags runs') }]">
<router-link :to="projectTagsRunsLink(ownertype, ownername, projectref)">Tags</router-link>
</li>
<li :class="[{ 'is-active': $route.name.match('project pull requests runs') }]">
<router-link :to="projectPRsRunsLink(ownertype, ownername, projectref)">Pull Requests</router-link>
2018-12-09 13:21:20 +00:00
</li>
<li
v-if="$route.name.endsWith('project run') || $route.name.endsWith('project run task')"
:class="[{ 'is-active': $route.name.endsWith('project run') }]"
>
<tabarrow/>
</li>
<li
v-if="$route.name.endsWith('project run') || $route.name.endsWith('project run task')"
:class="[{ 'is-active': $route.name.endsWith('project run') }]"
>
<router-link :to="projectRunLink(ownertype, ownername, projectref, $route.params.runid)">
<p v-if="run">
Run
<strong>#{{run.counter}}</strong>
</p>
</router-link>
2018-12-09 13:21:20 +00:00
</li>
<li
v-if="$route.name.endsWith('project run task')"
:class="[{ 'is-active': $route.name.endsWith('project run') }]"
>
<tabarrow/>
</li>
<li v-if="$route.name.endsWith('project run task')" class="is-active">
<router-link
:to="projectRunTaskLink(ownertype, ownername, projectref, $route.params.runid, $route.params.taskid)"
>
<p v-if="run">
Task
<strong>{{run.tasks[$route.params.taskid].name}}</strong>
</p>
</router-link>
2018-12-09 13:21:20 +00:00
</li>
</ul>
<ul class="is-right">
<li :class="[{ 'is-active': $route.name.endsWith('project settings') }]">
<router-link :to="projectSettingsLink(ownertype, ownername, projectref)">Project Settings</router-link>
</li>
</ul>
2018-12-09 13:21:20 +00:00
</div>
<router-view></router-view>
</div>
</template>
<script>
import {
projectLink,
projectRunsLink,
projectBranchesRunsLink,
projectTagsRunsLink,
projectPRsRunsLink,
2018-12-09 13:21:20 +00:00
projectRunLink,
projectRunTaskLink,
projectSettingsLink
2018-12-09 13:21:20 +00:00
} from "@/util/link.js";
import { fetchRun } from "@/util/data.js";
2018-12-09 13:21:20 +00:00
import projbreadcrumbs from "@/components/projbreadcrumbs.vue";
import tabarrow from "@/components/tabarrow.vue";
export default {
name: "Project",
components: { projbreadcrumbs, tabarrow },
2018-12-09 13:21:20 +00:00
props: {
ownertype: String,
ownername: String,
projectref: Array
2018-12-09 13:21:20 +00:00
},
data() {
return {
run: null
};
},
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: {
projectLink: projectLink,
projectRunsLink: projectRunsLink,
projectBranchesRunsLink: projectBranchesRunsLink,
projectTagsRunsLink: projectTagsRunsLink,
projectPRsRunsLink: projectPRsRunsLink,
2018-12-09 13:21:20 +00:00
projectRunLink: projectRunLink,
projectRunTaskLink: projectRunTaskLink,
projectSettingsLink: projectSettingsLink
},
created: async function() {
if (this.$route.params.runid) {
this.run = await fetchRun(this.$route.params.runid);
}
2018-12-09 13:21:20 +00:00
}
};
</script>
<style scoped lang="scss">
@import "@/css/_variables.scss";
.user-title {
display: flex;
align-items: center;
padding-left: 5px;
margin-bottom: 25px;
.user-name {
padding-left: 5px;
font-size: 1.5rem;
padding-right: 1rem;
}
}
</style>