2019-04-02 16:08:03 +00:00
|
|
|
export function parseRef(ref) {
|
|
|
|
ref = ref.replace(/\.proj/, "")
|
|
|
|
return ref.split("/")
|
|
|
|
}
|
2018-12-09 13:21:20 +00:00
|
|
|
|
|
|
|
export function ownerLink(ownertype, ownername) {
|
|
|
|
if (ownertype == "user") {
|
|
|
|
return { name: ownertype, params: { username: ownername } }
|
|
|
|
} else if (ownertype == "org") {
|
|
|
|
return { name: ownertype, params: { orgname: ownername } }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function ownerProjectsLink(ownertype, ownername) {
|
|
|
|
return { name: ownertype + " projects", params: { ownername: ownername } }
|
|
|
|
}
|
|
|
|
|
2019-04-02 16:08:03 +00:00
|
|
|
export function projectGroupProjectsLink(ownertype, ownername) {
|
|
|
|
return { name: ownertype + " project group projects", params: { ownername: ownername } }
|
|
|
|
}
|
|
|
|
|
2018-12-09 13:21:20 +00:00
|
|
|
export function userLocalRunsLink(username) {
|
|
|
|
return { name: "user local runs", params: { username: username } }
|
|
|
|
}
|
|
|
|
|
|
|
|
export function userLocalRunLink(username, runid) {
|
|
|
|
return { name: "user local run", params: { username: username, runid: runid } }
|
|
|
|
}
|
|
|
|
|
|
|
|
export function userLocalRunTaskLink(username, runid, taskid) {
|
|
|
|
return { name: "user local run task", params: { username: username, runid: runid, taskid: taskid } }
|
|
|
|
}
|
|
|
|
|
2019-04-02 16:08:03 +00:00
|
|
|
// 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
|
|
|
|
// escape it
|
|
|
|
export function projectGroupLink(ownertype, ownername, projectgroupref) {
|
|
|
|
let projectgrouppath = (projectgroupref.join("/") + ".proj")
|
|
|
|
return { path: `/${ownertype}/${ownername}/projectgroups/${projectgrouppath}`, }
|
|
|
|
}
|
|
|
|
|
|
|
|
export function projectLink(ownertype, ownername, projectref) {
|
|
|
|
let projectpath = (projectref.join("/") + ".proj")
|
|
|
|
return { path: `/${ownertype}/${ownername}/projects/${projectpath}` }
|
|
|
|
}
|
|
|
|
|
|
|
|
export function projectRunsLink(ownertype, ownername, projectref) {
|
|
|
|
let projectpath = (projectref.join("/") + ".proj")
|
|
|
|
return { path: `/${ownertype}/${ownername}/projects/${projectpath}/runs` }
|
2018-12-09 13:21:20 +00:00
|
|
|
}
|
|
|
|
|
2019-04-02 16:08:03 +00:00
|
|
|
export function projectBranchesRunsLink(ownertype, ownername, projectref) {
|
|
|
|
let projectpath = (projectref.join("/") + ".proj")
|
|
|
|
return { path: `/${ownertype}/${ownername}/projects/${projectpath}/branches`, }
|
2018-12-09 13:21:20 +00:00
|
|
|
}
|
|
|
|
|
2019-04-02 16:08:03 +00:00
|
|
|
export function projectTagsRunsLink(ownertype, ownername, projectref) {
|
|
|
|
let projectpath = (projectref.join("/") + ".proj")
|
|
|
|
return { path: `/${ownertype}/${ownername}/projects/${projectpath}/tags`, }
|
2019-03-27 14:41:29 +00:00
|
|
|
}
|
|
|
|
|
2019-04-02 16:08:03 +00:00
|
|
|
export function projectPRsRunsLink(ownertype, ownername, projectref) {
|
|
|
|
let projectpath = (projectref.join("/") + ".proj")
|
|
|
|
return { path: `/${ownertype}/${ownername}/projects/${projectpath}/pullrequests`, }
|
2019-03-27 14:41:29 +00:00
|
|
|
}
|
|
|
|
|
2019-04-02 16:08:03 +00:00
|
|
|
export function projectRunLink(ownertype, ownername, projectref, runid) {
|
|
|
|
let projectpath = (projectref.join("/") + ".proj")
|
|
|
|
return { path: `/${ownertype}/${ownername}/projects/${projectpath}/runs/${runid}`, }
|
2019-03-27 14:41:29 +00:00
|
|
|
}
|
|
|
|
|
2019-04-02 16:08:03 +00:00
|
|
|
export function projectRunTaskLink(ownertype, ownername, projectref, runid, taskid) {
|
|
|
|
let projectpath = (projectref.join("/") + ".proj")
|
|
|
|
return { path: `/${ownertype}/${ownername}/projects/${projectpath}/runs/${runid}/tasks/${taskid}`, }
|
2018-12-09 13:21:20 +00:00
|
|
|
}
|
|
|
|
|
2019-04-02 16:08:03 +00:00
|
|
|
export function projectGroupSettingsLink(ownertype, ownername, projectgroupref) {
|
|
|
|
let projectgrouppath = (projectgroupref.join("/") + ".proj")
|
|
|
|
return { path: `/${ownertype}/${ownername}/projectgroups/${projectgrouppath}/settings`, }
|
2019-03-22 07:39:03 +00:00
|
|
|
}
|
|
|
|
|
2019-04-02 16:08:03 +00:00
|
|
|
export function projectSettingsLink(ownertype, ownername, projectref) {
|
|
|
|
let projectpath = (projectref.join("/") + ".proj")
|
|
|
|
return { path: `/${ownertype}/${ownername}/projects/${projectpath}/settings`, }
|
2018-12-09 13:21:20 +00:00
|
|
|
}
|