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

View File

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

View File

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

View File

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

View File

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

View File

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