Skip to content

Commit 2dfbedb

Browse files
Merge pull request #1804 from MetRonnie/userprofile
Mock server: update introspection query & userprofile responses
2 parents 8f25266 + ae7d429 commit 2dfbedb

25 files changed

+2412
-783
lines changed

src/components/cylc/Drawer.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2828
<v-list
2929
class="pa-0 d-flex flex-column"
3030
>
31-
<c-header :user="user.username" />
31+
<c-header />
3232

3333
<v-list-item
3434
to="/"
@@ -69,7 +69,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
6969

7070
<script>
7171
import Header from '@/components/cylc/Header.vue'
72-
import { mapMutations, mapState } from 'vuex'
72+
import { mapMutations } from 'vuex'
7373
import Workflows from '@/views/Workflows.vue'
7474
import { mdiHome, mdiGraphql } from '@mdi/js'
7575
import pkg from '@/../package.json'
@@ -94,7 +94,6 @@ export default {
9494
},
9595
9696
computed: {
97-
...mapState('user', ['user']),
9897
drawer: {
9998
get () {
10099
return this.$store.state.app.drawer

src/components/cylc/Header.vue

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,3 @@ const showGoButton = computed(() => (
149149
))
150150
151151
</script>
152-
153-
<style>
154-
/* work around bug with v-combobox overflow https://github.com/vuetifyjs/vuetify/issues/17596 */
155-
.v-combobox__selection {
156-
overflow-x: hidden;
157-
}
158-
</style>

src/components/cylc/workspace/Toolbar.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
180180
</v-avatar>
181181
<v-menu activator="parent">
182182
<v-card :title="user.username">
183-
<v-card-subtitle v-if="user.admin">
184-
Admin
185-
</v-card-subtitle>
186183
<v-card-text>
187184
<v-btn
188185
to="/user-profile"

src/lang/en-GB/UserProfile.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
2-
"tableHeader": "Your Profile",
3-
"tableSubHeader": "This is a read-only view of your user",
2+
"title": "Settings",
3+
"yourProfile": "Your Profile",
44
"username": "Username",
5-
"administrator": "Administrator",
6-
"groups": "Groups",
7-
"created": "Created",
85
"permissions": "Authorized Operations"
96
}

src/lang/pt-BR/UserProfile.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
2-
"tableHeader": "Seu perfil de Usuário",
3-
"tableSubHeader": "Esta é a lista (modo leitura) do perfil do seu usuário",
2+
"title": "Configurações",
3+
"yourProfile": "Seu perfil de Usuário",
44
"username": "Nome de Usuário",
5-
"administrator": "Administrador",
6-
"groups": "Grupos",
7-
"created": "Criado",
85
"permissions": "Operações Autorizadas"
96
}

src/model/User.model.js

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* Copyright (C) NIWA & British Crown (Met Office) & Contributors.
33
*
44
* This program is free software: you can redistribute it and/or modify
@@ -15,33 +15,37 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
/**
19-
* @typedef {object} User
20-
* @property {string} username - user name
21-
* @property {string[]} groups - user groups
22-
* @property {string} created - date when the user was created
23-
* @property {boolean} admin - whether the user is an administrator or not
24-
* @property {string} server - server URL
25-
* @property {string} owner - UIS owner
26-
* @property {string[]} permissions - list of permissions
27-
* @property {string} mode - single or multi user mode
28-
* @property {string} initials - user initials
29-
*/
3018
export default class User {
31-
constructor (username, groups, created, admin, server, owner, permissions, mode, initials) {
32-
// the authenticated user
33-
// (full info only available when authenticated via the hub)
19+
constructor ({ username, owner, permissions, mode, initials, color }) {
20+
/**
21+
* @type {string}
22+
*/
3423
this.username = username
35-
this.groups = groups
36-
this.created = created
37-
this.admin = admin
38-
this.server = server || '?' // server can be unset
39-
// the UIS owner
40-
// (i.e. the user who's workflows we are looking at)
41-
// (this might not be the authenticated user for multi-user setups)
24+
/**
25+
* the UIS owner (i.e. the user who's workflows we are looking at)
26+
* (this might not be the authenticated user for multi-user setups)
27+
* @type {string}
28+
*/
4229
this.owner = owner
30+
/**
31+
* list of permissions
32+
* @type {string[]}
33+
*/
4334
this.permissions = permissions
35+
/**
36+
* single or multi user mode
37+
* @type {string}
38+
*/
4439
this.mode = mode
40+
/**
41+
* user initials
42+
* @type {string}
43+
*/
4544
this.initials = initials
45+
/**
46+
* user avatar color if set
47+
* @type {string | null}
48+
*/
49+
this.color = color
4650
}
4751
}

src/services/mock/json-server.cjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ server.ws('/subscriptions', (ws) => {
5151
* Render a response. This can be used to customize outputs,
5252
* map response parameters to other values.
5353
* @see https://www.rahulpnath.com/blog/setting-up-a-fake-rest-api-using-json-server/
54-
* @param req - express HTTP request
55-
* @param res - express HTTP response
54+
* @param {import('express').Request} req - express HTTP request
55+
* @param {import('express').Response} res - express HTTP response
5656
*/
5757
router.render = async (req, res) => {
5858
// This is the original response.
@@ -65,11 +65,12 @@ router.render = async (req, res) => {
6565
} else {
6666
responseData = await graphql.handleGraphQLRequest(req)
6767
}
68+
// NB: json-server returns 404 for requests that are not in the router
69+
// but we have dynamic requests for the /graphql endpoint (i.e. no single
70+
// data response) hence the status(200) below.
71+
res.status(200)
6872
}
69-
// NB: json-server returns 404 for requests that are not in db.json, but
70-
// we have dynamic requests for the /graphql endpoint (i.e. no single
71-
// data response) hence the status(200) below.
72-
res.status(200).jsonp(responseData)
73+
res.jsonp(responseData)
7374
}
7475

7576
server.use(router)

0 commit comments

Comments
 (0)