org: add organization settings

This commit is contained in:
Simone Gotti 2019-05-07 00:31:44 +02:00
parent 8787b14e53
commit e1ccccac71
3 changed files with 27 additions and 8 deletions

View File

@ -15,6 +15,13 @@ export function ownerProjectsLink(ownertype, ownername) {
return { name: ownertype + " projects", params: { ownername: ownername } } return { name: ownertype + " projects", params: { ownername: ownername } }
} }
export function ownerSettingsLink(ownertype, ownername) {
if (ownertype == "user") {
return { name: ownertype + " settings", params: { username: ownername } }
} else if (ownertype == "org") {
return { name: ownertype + " settings", params: { orgname: ownername } }
}
}
export function userLocalRunsLink(username) { export function userLocalRunsLink(username) {
return { name: "user local runs", params: { username: username } } return { name: "user local runs", params: { username: username } }
@ -28,9 +35,6 @@ export function userLocalRunTaskLink(username, runid, taskid) {
return { name: "user local run task", params: { username: username, runid: runid, taskid: taskid } } return { name: "user local run task", params: { username: username, runid: runid, taskid: taskid } }
} }
export function userSettingsLink(username) {
return { name: "user settings", params: { username: username } }
}
// Note, when creating a router link containing a project/projectgroup ref (a // Note, when creating a router link containing a project/projectgroup ref (a
// path), unfortunately, we cannot use route name and params since it will path // path), unfortunately, we cannot use route name and params since it will path

View File

@ -26,6 +26,16 @@
</router-link> </router-link>
</li> </li>
</ul> </ul>
<ul class="is-right">
<li :class="[{ 'is-active': $route.name.endsWith('project group settings') }]">
<router-link :to="ownerSettingsLink('org', orgname)">
<span class="icon is-small">
<i class="mdi mdi-settings"/>
</span>
<span>Organization Settings</span>
</router-link>
</li>
</ul>
</div> </div>
<router-view></router-view> <router-view></router-view>
</div> </div>
@ -33,7 +43,11 @@
<script> <script>
import { ownerLink, ownerProjectsLink } from "@/util/link.js"; import {
ownerLink,
ownerProjectsLink,
ownerSettingsLink
} from "@/util/link.js";
export default { export default {
name: "Org", name: "Org",
@ -43,7 +57,8 @@ export default {
}, },
methods: { methods: {
ownerLink: ownerLink, ownerLink: ownerLink,
ownerProjectsLink: ownerProjectsLink ownerProjectsLink: ownerProjectsLink,
ownerSettingsLink: ownerSettingsLink
} }
}; };
</script> </script>

View File

@ -69,7 +69,7 @@
</ul> </ul>
<ul class="is-right"> <ul class="is-right">
<li :class="[{ 'is-active': $route.name.endsWith('user settings') }]"> <li :class="[{ 'is-active': $route.name.endsWith('user settings') }]">
<router-link :to="userSettingsLink(username)"> <router-link :to="ownerSettingsLink('user', username)">
<span class="icon is-small"> <span class="icon is-small">
<i class="mdi mdi-settings"/> <i class="mdi mdi-settings"/>
</span> </span>
@ -90,7 +90,7 @@ import {
userLocalRunsLink, userLocalRunsLink,
userLocalRunLink, userLocalRunLink,
userLocalRunTaskLink, userLocalRunTaskLink,
userSettingsLink ownerSettingsLink
} from "@/util/link.js"; } from "@/util/link.js";
import { fetchRun } from "@/util/data.js"; import { fetchRun } from "@/util/data.js";
@ -121,7 +121,7 @@ export default {
userLocalRunsLink: userLocalRunsLink, userLocalRunsLink: userLocalRunsLink,
userLocalRunLink: userLocalRunLink, userLocalRunLink: userLocalRunLink,
userLocalRunTaskLink: userLocalRunTaskLink, userLocalRunTaskLink: userLocalRunTaskLink,
userSettingsLink: userSettingsLink ownerSettingsLink: ownerSettingsLink
} }
}; };
</script> </script>