Skip to content

Commit

Permalink
apachegh-31: Append the actual user details to the top header
Browse files Browse the repository at this point in the history
  • Loading branch information
dinukadesilva committed Oct 8, 2020
1 parent 6587a80 commit c8eb992
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 116 deletions.
5 changes: 0 additions & 5 deletions custos-demo-gateway/src/components/workspace/Agents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@

</div>
</div>
</div>
</template>

<script>
Expand Down Expand Up @@ -303,8 +302,4 @@
margin-left: 30%;
margin-top: 3%;
}
.gotoWork {
margin-left: 70%;
}
</style>
5 changes: 0 additions & 5 deletions custos-demo-gateway/src/components/workspace/Groups.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div>

<Header/>
<div class="p-3">
<div class="grouptable">
Expand Down Expand Up @@ -722,8 +721,4 @@
margin-right: 0;
position: relative;
}
.gotoWork {
margin-left: 70%;
}
</style>
28 changes: 25 additions & 3 deletions custos-demo-gateway/src/components/workspace/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<div class="custos-logo-text pl-2">Custos</div>
</div>
<div class="user-details">
<div class="username">John Doe</div>
<div class="email">[email protected]</div>
<div class="username">{{this.user.first_name + " "+ this.user.last_name}}</div>
<div class="email">{{this.user.email}}</div>
</div>


Expand Down Expand Up @@ -56,7 +56,9 @@
return {
custosId: null,
custosSec: null,
isAdmin: false
isAdmin: false,
user: null,
currentUserName: null
}
},
methods: {
Expand All @@ -79,6 +81,26 @@
this.custosId = config.value('clientId')
this.custosSec = config.value('clientSec')
this.isAdmin = await this.$store.dispatch('identity/isLoggedUserHasAdminAccess')
this.currentUserName = await this.$store.dispatch('identity/getCurrentUserName')
let data = {
offset: 0, limit: 1, client_id: this.custosId, client_sec: this.custosSec,
username: this.currentUserName
}
let resp = await this.$store.dispatch('user/users', data)
if (Array.isArray(resp) && resp.length > 0) {
resp.forEach(obj => {
this.user = {
username: obj.username,
first_name: obj.first_name,
last_name: obj.last_name,
email: obj.email,
status: obj.state,
attributes: [],
roles: []
}
})
}
}
}
</script>
Expand Down
208 changes: 105 additions & 103 deletions custos-demo-gateway/src/components/workspace/Workspace.vue
Original file line number Diff line number Diff line change
@@ -1,112 +1,116 @@
<template>
<dev>
<div class="loggeduser">
Welcome {{this.user.first_name + " "+ this.user.last_name}}
</div>

<div class="logout">
<b-button href="#" v-on:click="logout">Logout</b-button>
</div>
<div class="grouping">
<b-card-group deck>
<b-card :img-src="require('../../assets/users.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<div v-if="this.isAdmin">
<b-button href="#" variant="outline-primary" v-on:click="loadRoute($event, '/workspace/users')">
Manage Users
</b-button>
</div>
<div v-if="!this.isAdmin">
<b-button href="#" variant="outline-primary" v-on:click="loadRoute($event, '/workspace/profile')">
Manage Profile
<div>
<Header/>
<div class="p-3">
<div class="grouping">
<b-card-group deck>
<b-card :img-src="require('../../assets/users.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<div v-if="this.isAdmin">
<b-button href="#" variant="outline-primary"
v-on:click="loadRoute($event, '/workspace/users')">
Manage Users
</b-button>
</div>
<div v-if="!this.isAdmin">
<b-button href="#" variant="outline-primary"
v-on:click="loadRoute($event, '/workspace/profile')">
Manage Profile
</b-button>
</div>
</b-card>
<b-card :img-src="require('../../assets/groups_web.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<b-button href="#" variant="outline-primary"
v-on:click="loadRoute($event, '/workspace/groups')">
Manage Groups
</b-button>
</div>
</b-card>
<b-card :img-src="require('../../assets/groups_web.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<b-button href="#" variant="outline-primary" v-on:click="loadRoute($event, '/workspace/groups')">
Manage Groups
</b-button>
</b-card>
<b-card :img-src="require('../../assets/credentials.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<b-button href="#" variant="outline-primary" v-on:click="loadRoute($event, '/workspace/secrets')">
Manage Secrets
</b-button>
</b-card>
</b-card-group>
</div>
<div v-if="isAdmin" class="groupingbt">
<b-card-group deck>
<b-card :img-src="require('../../assets/sharings.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<b-button href="#" variant="outline-primary" v-on:click="loadRoute($event, '/workspace/sharings')">
Sharing
</b-button>
</b-card>
</b-card>
<b-card :img-src="require('../../assets/credentials.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<b-button href="#" variant="outline-primary"
v-on:click="loadRoute($event, '/workspace/secrets')">
Manage Secrets
</b-button>
</b-card>
</b-card-group>
</div>
<div v-if="isAdmin" class="groupingbt">
<b-card-group deck>
<b-card :img-src="require('../../assets/sharings.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<b-button href="#" variant="outline-primary"
v-on:click="loadRoute($event, '/workspace/sharings')">
Sharing
</b-button>
</b-card>

<b-card :img-src="require('../../assets/bots.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<b-button href="#" variant="outline-primary" :disabled="!isAdmin"
v-on:click="loadRoute($event, '/workspace/agents')">
Community Accounts
</b-button>
</b-card>
<b-card :img-src="require('../../assets/dblogs.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<b-button href="#" variant="outline-primary" :disabled="!isAdmin"
v-on:click="loadRoute($event, '/workspace/logs')">
Logs
</b-button>
</b-card>
</b-card-group>
</div>
<div v-if="!isAdmin" class="groupingbtntA">
<b-card-group deck>
<b-card :img-src="require('../../assets/sharings.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<b-button href="#" variant="outline-primary" v-on:click="loadRoute($event, '/workspace/sharings')">
Sharing
</b-button>
</b-card>
</b-card-group>
<b-card :img-src="require('../../assets/bots.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<b-button href="#" variant="outline-primary" :disabled="!isAdmin"
v-on:click="loadRoute($event, '/workspace/agents')">
Community Accounts
</b-button>
</b-card>
<b-card :img-src="require('../../assets/dblogs.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<b-button href="#" variant="outline-primary" :disabled="!isAdmin"
v-on:click="loadRoute($event, '/workspace/logs')">
Logs
</b-button>
</b-card>
</b-card-group>
</div>
<div v-if="!isAdmin" class="groupingbtntA">
<b-card-group deck>
<b-card :img-src="require('../../assets/sharings.png')"
img-height="50%"
style="max-width: 20rem;"
class="mb-2"
body-class="bcbody"
>
<b-button href="#" variant="outline-primary"
v-on:click="loadRoute($event, '/workspace/sharings')">
Sharing
</b-button>
</b-card>
</b-card-group>
</div>
</div>
</dev>
</div>
</template>

<script>
import config from "@/config";
import Header from "./Header";
export default {
name: "Workspace",
components: {Header},
data: function () {
return {
custosId: null,
Expand Down Expand Up @@ -186,17 +190,15 @@
margin-left: 70%;
}
.loggeduser{
.loggeduser {
font-size: x-large;
color: blue;
}
.groupingbtntA{
.groupingbtntA {
position: relative;
margin-left: 40%;
width: 40%;
margin-top: 5%;
}
</style>

0 comments on commit c8eb992

Please sign in to comment.