*: show root project group settings

This commit is contained in:
Simone Gotti 2019-05-14 15:47:35 +02:00
parent 7e4346001d
commit b45e0014cc
6 changed files with 55 additions and 18 deletions

View File

@ -6,7 +6,7 @@
<projectvars :variables="variables" :allvariables="allvariables"/>
</div>
</nav>
<nav class="panel is-danger">
<nav v-if="!isRootProjectGroup" class="panel is-danger">
<p class="panel-heading is-danger">Danger Zone</p>
<div class="panel-block is-block">
<div>
@ -84,6 +84,9 @@ export default {
},
deleteButtonEnabled: function() {
return this.projectGroupNameToDelete == this.projectGroupName;
},
isRootProjectGroup() {
return this.projectgroupref.length == 0;
}
},
methods: {

View File

@ -231,6 +231,12 @@ const router = new VueRouter({
component: orgmembers,
props: (route) => ({ orgname: route.params.orgname })
},
/* {
path: "settings",
name: "org settings",
component: orgsettings,
props: (route) => ({ username: route.params.username }),
}, */
{
path: "createprojectgroup",
name: "org create project group",

View File

@ -1,5 +1,9 @@
export function parseRef(ref) {
ref = ref.replace(/\.proj/, "")
// return empty array or split return an array with the empty element
if (!ref) {
return []
}
return ref.split("/")
}
@ -44,19 +48,16 @@ export function orgMembersLink(orgname) {
// escape it
export function projectGroupPath(ownertype, ownername, projectgroupref) {
let path = `/${ownertype}/${ownername}`
if (Array.isArray(projectgroupref) && projectgroupref.length) {
// root project group will have a .proj without a name
let projectgrouppath = (projectgroupref.join("/") + ".proj")
path = `${path}/projectgroups/${projectgrouppath}`
}
return path
}
export function projectPath(ownertype, ownername, projectref) {
let path = `/${ownertype}/${ownername}`
if (Array.isArray(projectref) && projectref.length) {
let projectpath = (projectref.join("/") + ".proj")
path = `${path}/projects/${projectpath}`
}
return path
}
@ -105,8 +106,8 @@ export function projectRunTaskLink(ownertype, ownername, projectref, runid, task
}
export function projectGroupSettingsLink(ownertype, ownername, projectgroupref) {
let projectgrouppath = (projectgroupref.join("/") + ".proj")
return { path: `/${ownertype}/${ownername}/projectgroups/${projectgrouppath}/settings` }
let path = projectGroupPath(ownertype, ownername, projectgroupref)
return { path: `${path}/settings` }
}
export function projectSettingsLink(ownertype, ownername, projectref) {

View File

@ -38,7 +38,15 @@
</li>
</ul>
<ul class="is-right">
<li :class="[{ 'is-active': $route.name.endsWith('project group settings') }]">
<li :class="[{ 'is-active': $route.name.endsWith('org project group settings') }]">
<router-link :to="projectGroupSettingsLink('org', orgname, [])">
<span class="icon is-small">
<i class="mdi mdi-settings"/>
</span>
<span>Root Project Group Settings</span>
</router-link>
</li>
<li :class="[{ 'is-active': $route.name.endsWith('org settings') }]">
<router-link :to="ownerSettingsLink('org', orgname)">
<span class="icon is-small">
<i class="mdi mdi-settings"/>
@ -60,7 +68,8 @@ import {
ownerSettingsLink,
orgMembersLink,
projectGroupCreateProjectGroupLink,
projectGroupCreateProjectLink
projectGroupCreateProjectLink,
projectGroupSettingsLink
} from "@/util/link.js";
import createprojectbutton from "@/components/createprojectbutton.vue";
@ -78,13 +87,16 @@ export default {
orgMembersLink: orgMembersLink,
projectGroupCreateProjectGroupLink: projectGroupCreateProjectGroupLink,
projectGroupCreateProjectLink: projectGroupCreateProjectLink,
projectGroupSettingsLink: projectGroupSettingsLink,
goToCreate(type) {
if (type == "project") {
this.$router.push(projectGroupCreateProjectLink("org", this.orgname));
this.$router.push(
projectGroupCreateProjectLink("org", this.orgname, [])
);
return;
}
this.$router.push(
projectGroupCreateProjectGroupLink("org", this.orgname)
projectGroupCreateProjectGroupLink("org", this.orgname, [])
);
}
}

View File

@ -68,6 +68,9 @@ export default {
projectGroupCreateProjectGroupLink: projectGroupCreateProjectGroupLink,
projectGroupCreateProjectLink: projectGroupCreateProjectLink,
projectGroupName() {
if (!this.projectgroupref.length) {
return "Root Project Group";
}
return this.projectgroupref[this.projectgroupref.length - 1];
},
goToCreate(type) {

View File

@ -71,6 +71,14 @@
</li>
</ul>
<ul class="is-right">
<li :class="[{ 'is-active': $route.name.endsWith('user project group settings') }]">
<router-link :to="projectGroupSettingsLink('user', username, [])">
<span class="icon is-small">
<i class="mdi mdi-settings"/>
</span>
<span>Root Project Group Settings</span>
</router-link>
</li>
<li :class="[{ 'is-active': $route.name.endsWith('user settings') }]">
<router-link :to="ownerSettingsLink('user', username)">
<span class="icon is-small">
@ -95,7 +103,8 @@ import {
userLocalRunTaskLink,
ownerSettingsLink,
projectGroupCreateProjectGroupLink,
projectGroupCreateProjectLink
projectGroupCreateProjectLink,
projectGroupSettingsLink
} from "@/util/link.js";
import { fetchRun } from "@/util/data.js";
@ -135,13 +144,16 @@ export default {
ownerSettingsLink: ownerSettingsLink,
projectGroupCreateProjectGroupLink: projectGroupCreateProjectGroupLink,
projectGroupCreateProjectLink: projectGroupCreateProjectLink,
projectGroupSettingsLink: projectGroupSettingsLink,
goToCreate(type) {
if (type == "project") {
this.$router.push(projectGroupCreateProjectLink("user", this.username));
this.$router.push(
projectGroupCreateProjectLink("user", this.username, [])
);
return;
}
this.$router.push(
projectGroupCreateProjectGroupLink("user", this.username)
projectGroupCreateProjectGroupLink("user", this.username, [])
);
}
}