diff --git a/src/components/createproject.vue b/src/components/createproject.vue
new file mode 100644
index 0000000..6305e6c
--- /dev/null
+++ b/src/components/createproject.vue
@@ -0,0 +1,109 @@
+
+
+
Create Project
+
+
Available remote repositories
+
+
Remote source: {{remoteSource.name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/createprojectbutton.vue b/src/components/createprojectbutton.vue
new file mode 100644
index 0000000..296a16f
--- /dev/null
+++ b/src/components/createprojectbutton.vue
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/createprojectgroup.vue b/src/components/createprojectgroup.vue
new file mode 100644
index 0000000..289b3ea
--- /dev/null
+++ b/src/components/createprojectgroup.vue
@@ -0,0 +1,84 @@
+
+
+
Create Project Group
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/remoterepos.vue b/src/components/remoterepos.vue
new file mode 100644
index 0000000..3b5f6c8
--- /dev/null
+++ b/src/components/remoterepos.vue
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+ {{repo.path}}
+
+
+
No remote repositories
+
+
+
+
+
+
diff --git a/src/router.js b/src/router.js
index e5c4aa0..e292339 100644
--- a/src/router.js
+++ b/src/router.js
@@ -9,6 +9,8 @@ import usersettings from "./components/usersettings.vue";
import projects from "./components/projects.vue";
import projectsettings from "./components/projectsettings.vue";
import projectgroupsettings from "./components/projectgroupsettings.vue";
+import createproject from "./components/createproject.vue";
+import createprojectgroup from "./components/createprojectgroup.vue";
import runs from "./components/runs.vue";
import run from "./components/run.vue";
import task from "./components/task.vue";
@@ -90,6 +92,18 @@ export default new VueRouter({
component: usersettings,
props: (route) => ({ username: route.params.username }),
},
+ {
+ path: "createprojectgroup",
+ name: "user create project group",
+ component: createprojectgroup,
+ props: (route) => ({ ownertype: "user", ownername: route.params.username })
+ },
+ {
+ path: "createproject",
+ name: "user create project",
+ component: createproject,
+ props: (route) => ({ ownertype: "user", ownername: route.params.username })
+ },
]
},
{
@@ -171,6 +185,18 @@ export default new VueRouter({
component: projectgroupsettings,
props: (route) => ({ ownertype: "user", ownername: route.params.username, projectgroupref: parseRef(route.params.projectgroupref) })
},
+ {
+ path: "createprojectgroup",
+ name: "user project group create project group",
+ component: createprojectgroup,
+ props: (route) => ({ ownertype: "user", ownername: route.params.username, projectgroupref: parseRef(route.params.projectgroupref) })
+ },
+ {
+ path: "createproject",
+ name: "user project group create project",
+ component: createproject,
+ props: (route) => ({ ownertype: "user", ownername: route.params.username, projectgroupref: parseRef(route.params.projectgroupref) })
+ },
]
},
@@ -191,6 +217,18 @@ export default new VueRouter({
component: projects,
props: (route) => ({ ownertype: "org", ownername: route.params.orgname })
},
+ {
+ path: "createprojectgroup",
+ name: "org create project group",
+ component: createprojectgroup,
+ props: (route) => ({ ownertype: "org", ownername: route.params.orgname })
+ },
+ {
+ path: "createproject",
+ name: "org create project",
+ component: createproject,
+ props: (route) => ({ ownertype: "org", ownername: route.params.orgname })
+ },
]
},
@@ -273,6 +311,18 @@ export default new VueRouter({
component: projectgroupsettings,
props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectgroupref: parseRef(route.params.projectgroupref) })
},
+ {
+ path: "createprojectgroup",
+ name: "org project group create project group",
+ component: createprojectgroup,
+ props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectgroupref: parseRef(route.params.projectgroupref) })
+ },
+ {
+ path: "createproject",
+ name: "org project group create project",
+ component: createproject,
+ props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectgroupref: parseRef(route.params.projectgroupref) })
+ },
]
},
]
diff --git a/src/util/data.js b/src/util/data.js
index b70449d..0bdfa44 100644
--- a/src/util/data.js
+++ b/src/util/data.js
@@ -113,4 +113,40 @@ export async function fetchRemoteSources() {
let path = "/remotesources"
let res = await fetch(apiurl(path));
return res.json();
+}
+
+export async function userRemoteRepos(remotesourceid) {
+ let path = "/user/remoterepos/" + remotesourceid
+ let res = await fetch(apiurl(path));
+ return res.json();
+}
+
+export async function createProjectGroup(parentref, name) {
+ let path = "/projectgroups"
+ let init = {
+ method: "POST",
+ body: JSON.stringify({
+ name: name,
+ parent_ref: parentref,
+ visibility: "public",
+ })
+ }
+ let res = await fetch(apiurl(path), init)
+ return res.json();
+}
+
+export async function createProject(parentref, name, remotesourcename, remoterepopath) {
+ let path = "/projects"
+ let init = {
+ method: "POST",
+ body: JSON.stringify({
+ name: name,
+ parent_ref: parentref,
+ visibility: "public",
+ remote_source_name: remotesourcename,
+ repo_path: remoterepopath,
+ })
+ }
+ let res = await fetch(apiurl(path), init)
+ return res.json();
}
\ No newline at end of file
diff --git a/src/util/link.js b/src/util/link.js
index 4250ce0..8d332de 100644
--- a/src/util/link.js
+++ b/src/util/link.js
@@ -39,14 +39,31 @@ export function userLocalRunTaskLink(username, runid, taskid) {
// 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 projectGroupPath(ownertype, ownername, projectgroupref) {
+ let path = `/${ownertype}/${ownername}`
+ if (Array.isArray(projectgroupref) && projectgroupref.length) {
+ 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
+}
+
export function projectGroupLink(ownertype, ownername, projectgroupref) {
- let projectgrouppath = (projectgroupref.join("/") + ".proj")
- return { path: `/${ownertype}/${ownername}/projectgroups/${projectgrouppath}`, }
+ return { path: projectGroupPath(ownertype, ownername, projectgroupref) }
}
export function projectGroupProjectsLink(ownertype, ownername, projectgroupref) {
let projectgrouppath = (projectgroupref.join("/") + ".proj")
- return { path: `/${ownertype}/${ownername}/projectgroups/${projectgrouppath}/projects`, }
+ return { path: `/${ownertype}/${ownername}/projectgroups/${projectgrouppath}/projects` }
}
export function projectLink(ownertype, ownername, projectref) {
@@ -61,35 +78,45 @@ export function projectRunsLink(ownertype, ownername, projectref) {
export function projectBranchesRunsLink(ownertype, ownername, projectref) {
let projectpath = (projectref.join("/") + ".proj")
- return { path: `/${ownertype}/${ownername}/projects/${projectpath}/branches`, }
+ return { path: `/${ownertype}/${ownername}/projects/${projectpath}/branches` }
}
export function projectTagsRunsLink(ownertype, ownername, projectref) {
let projectpath = (projectref.join("/") + ".proj")
- return { path: `/${ownertype}/${ownername}/projects/${projectpath}/tags`, }
+ return { path: `/${ownertype}/${ownername}/projects/${projectpath}/tags` }
}
export function projectPRsRunsLink(ownertype, ownername, projectref) {
let projectpath = (projectref.join("/") + ".proj")
- return { path: `/${ownertype}/${ownername}/projects/${projectpath}/pullrequests`, }
+ return { path: `/${ownertype}/${ownername}/projects/${projectpath}/pullrequests` }
}
export function projectRunLink(ownertype, ownername, projectref, runid) {
let projectpath = (projectref.join("/") + ".proj")
- return { path: `/${ownertype}/${ownername}/projects/${projectpath}/runs/${runid}`, }
+ return { path: `/${ownertype}/${ownername}/projects/${projectpath}/runs/${runid}` }
}
export function projectRunTaskLink(ownertype, ownername, projectref, runid, taskid) {
let projectpath = (projectref.join("/") + ".proj")
- return { path: `/${ownertype}/${ownername}/projects/${projectpath}/runs/${runid}/tasks/${taskid}`, }
+ return { path: `/${ownertype}/${ownername}/projects/${projectpath}/runs/${runid}/tasks/${taskid}` }
}
export function projectGroupSettingsLink(ownertype, ownername, projectgroupref) {
let projectgrouppath = (projectgroupref.join("/") + ".proj")
- return { path: `/${ownertype}/${ownername}/projectgroups/${projectgrouppath}/settings`, }
+ return { path: `/${ownertype}/${ownername}/projectgroups/${projectgrouppath}/settings` }
}
export function projectSettingsLink(ownertype, ownername, projectref) {
let projectpath = (projectref.join("/") + ".proj")
- return { path: `/${ownertype}/${ownername}/projects/${projectpath}/settings`, }
+ return { path: `/${ownertype}/${ownername}/projects/${projectpath}/settings` }
+}
+
+export function projectGroupCreateProjectGroupLink(ownertype, ownername, projectgroupref) {
+ let path = projectGroupPath(ownertype, ownername, projectgroupref)
+ return { path: `${path}/createprojectgroup` }
+}
+
+export function projectGroupCreateProjectLink(ownertype, ownername, projectgroupref) {
+ let path = projectGroupPath(ownertype, ownername, projectgroupref)
+ return { path: `${path}/createproject` }
}
\ No newline at end of file
diff --git a/src/views/Org.vue b/src/views/Org.vue
index be62ac7..9bb7a99 100644
--- a/src/views/Org.vue
+++ b/src/views/Org.vue
@@ -13,6 +13,9 @@
@@ -46,19 +49,34 @@
import {
ownerLink,
ownerProjectsLink,
- ownerSettingsLink
+ ownerSettingsLink,
+ projectGroupCreateProjectGroupLink,
+ projectGroupCreateProjectLink
} from "@/util/link.js";
+import createprojectbutton from "@/components/createprojectbutton.vue";
+
export default {
name: "Org",
- components: {},
+ components: { createprojectbutton },
props: {
orgname: String
},
methods: {
ownerLink: ownerLink,
ownerProjectsLink: ownerProjectsLink,
- ownerSettingsLink: ownerSettingsLink
+ ownerSettingsLink: ownerSettingsLink,
+ projectGroupCreateProjectGroupLink: projectGroupCreateProjectGroupLink,
+ projectGroupCreateProjectLink: projectGroupCreateProjectLink,
+ goToCreate(type) {
+ if (type == "project") {
+ this.$router.push(projectGroupCreateProjectLink("org", this.orgname));
+ return;
+ }
+ this.$router.push(
+ projectGroupCreateProjectGroupLink("org", this.orgname)
+ );
+ }
}
};
diff --git a/src/views/ProjectGroup.vue b/src/views/ProjectGroup.vue
index b84aa4e..9e93801 100644
--- a/src/views/ProjectGroup.vue
+++ b/src/views/ProjectGroup.vue
@@ -8,7 +8,10 @@
/>
-
{{projectgroupref[projectgroupref.length-1]}}
+
{{projectGroupName()}}
+
+
+
@@ -43,16 +46,19 @@