diff --git a/src/components/usersettings.vue b/src/components/usersettings.vue
new file mode 100644
index 0000000..842892b
--- /dev/null
+++ b/src/components/usersettings.vue
@@ -0,0 +1,72 @@
+
+
+
User Tokens
+
+
No user tokens
+
+
+
+ User token created: {{token}}
+
+
Create new User Token
+
+
+
+
+
+
+
+
diff --git a/src/router.js b/src/router.js
index 4c4889d..e5c4aa0 100644
--- a/src/router.js
+++ b/src/router.js
@@ -5,7 +5,7 @@ import User from "./views/User.vue";
import Org from "./views/Org.vue";
import Project from "./views/Project.vue";
import ProjectGroup from "./views/ProjectGroup.vue";
-//import Run from "./views/Run.vue";
+import usersettings from "./components/usersettings.vue";
import projects from "./components/projects.vue";
import projectsettings from "./components/projectsettings.vue";
import projectgroupsettings from "./components/projectgroupsettings.vue";
@@ -84,6 +84,12 @@ export default new VueRouter({
component: task,
props: (route) => ({ ownertype: "user", ownername: route.params.username, runid: route.params.runid, taskid: route.params.taskid })
},
+ {
+ path: "settings",
+ name: "user settings",
+ component: usersettings,
+ props: (route) => ({ username: route.params.username }),
+ },
]
},
{
diff --git a/src/util/data.js b/src/util/data.js
index 3162109..bb1ec94 100644
--- a/src/util/data.js
+++ b/src/util/data.js
@@ -1,5 +1,11 @@
import { apiurl, fetch } from "@/util/auth";
+export async function fetchCurrentUser() {
+ let path = "/user"
+ let res = await fetch(apiurl(path));
+ return res.json();
+}
+
export async function fetchRuns(group, lastrun) {
let u = apiurl("/runs");
if (group) {
@@ -43,4 +49,25 @@ export async function fetchVariables(ownertype, ref, all) {
}
let res = await fetch(apiurl(path));
return res.json();
+}
+
+export async function createUserToken(username, tokenname) {
+ let path = "/users/" + username + "/tokens"
+ let init = {
+ method: "POST",
+ body: JSON.stringify({
+ token_name: tokenname,
+ })
+ }
+ let res = await fetch(apiurl(path), init)
+ return res.json();
+}
+
+export async function deleteUserToken(username, tokenname) {
+ let path = "/users/" + username + "/tokens/" + tokenname
+ let init = {
+ method: "DELETE",
+ }
+ let res = await fetch(apiurl(path), init)
+ return res.text();
}
\ No newline at end of file
diff --git a/src/util/link.js b/src/util/link.js
index a6ae07d..713880a 100644
--- a/src/util/link.js
+++ b/src/util/link.js
@@ -15,9 +15,6 @@ export function ownerProjectsLink(ownertype, ownername) {
return { name: ownertype + " projects", params: { ownername: ownername } }
}
-export function projectGroupProjectsLink(ownertype, ownername) {
- return { name: ownertype + " project group projects", params: { ownername: ownername } }
-}
export function userLocalRunsLink(username) {
return { name: "user local runs", params: { username: username } }
@@ -31,6 +28,10 @@ export function userLocalRunTaskLink(username, runid, 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
// path), unfortunately, we cannot use route name and params since it will path
// escape it
@@ -39,6 +40,11 @@ export function projectGroupLink(ownertype, ownername, projectgroupref) {
return { path: `/${ownertype}/${ownername}/projectgroups/${projectgrouppath}`, }
}
+export function projectGroupProjectsLink(ownertype, ownername, projectgroupref) {
+ let projectgrouppath = (projectgroupref.join("/") + ".proj")
+ return { path: `/${ownertype}/${ownername}/projectgroups/${projectgrouppath}/projects`, }
+}
+
export function projectLink(ownertype, ownername, projectref) {
let projectpath = (projectref.join("/") + ".proj")
return { path: `/${ownertype}/${ownername}/projects/${projectpath}` }
diff --git a/src/views/ProjectGroup.vue b/src/views/ProjectGroup.vue
index 21ab565..63f56e4 100644
--- a/src/views/ProjectGroup.vue
+++ b/src/views/ProjectGroup.vue
@@ -11,7 +11,9 @@
- Projects
+ Projects
diff --git a/src/views/User.vue b/src/views/User.vue
index 8edb3da..49664f4 100644
--- a/src/views/User.vue
+++ b/src/views/User.vue
@@ -52,6 +52,11 @@
+
@@ -64,7 +69,8 @@ import {
ownerProjectsLink,
userLocalRunsLink,
userLocalRunLink,
- userLocalRunTaskLink
+ userLocalRunTaskLink,
+ userSettingsLink
} from "@/util/link.js";
import { fetchRun } from "@/util/data.js";
@@ -94,7 +100,8 @@ export default {
ownerProjectsLink: ownerProjectsLink,
userLocalRunsLink: userLocalRunsLink,
userLocalRunLink: userLocalRunLink,
- userLocalRunTaskLink: userLocalRunTaskLink
+ userLocalRunTaskLink: userLocalRunTaskLink,
+ userSettingsLink: userSettingsLink
}
};