Skip to content

Commit

Permalink
Merge pull request #1194 from nordic-institute/XRDDEV-1939-cs-mock-up…
Browse files Browse the repository at this point in the history
…dates

XRDDEV-1939 Mock UI updates
  • Loading branch information
jhyoty authored May 3, 2022
2 parents 1c17dc4 + 726a227 commit 3a04c08
Show file tree
Hide file tree
Showing 12 changed files with 601 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<div class="request-id">{{ item.id }}</div>
</template>

<template #[`item.created_at`]="{ item }">
<div>{{ item.created_at | formatDateTime }}</div>
</template>

<template #[`item.type`]="{ item }">
<type-cell :status="item.type" />
</template>
Expand Down Expand Up @@ -124,7 +128,7 @@ export default Vue.extend({
{
text: this.$t('global.created') as string,
align: 'start',
value: 'created',
value: 'created_at',
class: 'xrd-table-header mr-table-header-created',
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,23 @@
<v-tooltip top>
<template #activator="{ on, attrs }">
<div v-bind="attrs" v-on="on">
<xrd-icon-base v-bind="attrs" v-on="on">
<xrd-icon-base v-bind="attrs" class="mr-3" v-on="on">
<!-- Decide what icon to show -->
<XrdIconChangeOwner v-if="status === 'change_owner'" />
<XrdIconAddUser v-if="status === 'register_client'" />
<XrdIconRemoveUser v-if="status === 'delete_client'" />
<XrdIconRemoveCertificate v-if="status === 'delete_certificate'" />
<XrdIconAddCertificate v-if="status === 'register_certificate'" />
<XrdIconChangeOwner v-if="status === 'OWNER_CHANGE_REQUEST'" />
<XrdIconAddUser v-if="status === 'CLIENT_REGISTRATION_REQUEST'" />
<XrdIconRemoveUser v-if="status === 'CLIENT_DELETION_REQUEST'" />
<XrdIconRemoveCertificate
v-if="status === 'AUTH_CERT_DELETION_REQUEST'"
/>
<XrdIconAddCertificate
v-if="status === 'AUTH_CERT_REGISTRATION_REQUEST'"
/>
</xrd-icon-base>
</div>
</template>
<span>{{ getStatusText() }}</span>
</v-tooltip>
<span class="status-text">{{ getStatusText() }}</span>
</div>
</template>

Expand All @@ -54,21 +59,22 @@ export default Vue.extend({
default: undefined,
},
},

methods: {
getStatusText() {
if (!this.status) {
return '';
}
switch (this.status) {
case 'change_owner':
case 'OWNER_CHANGE_REQUEST':
return this.$t('managementRequests.changeOwner') as string;
case 'delete_certificate':
case 'AUTH_CERT_DELETION_REQUEST':
return this.$t('managementRequests.removeCertificate') as string;
case 'delete_client':
case 'CLIENT_DELETION_REQUEST':
return this.$t('managementRequests.removeClient') as string;
case 'register_certificate':
case 'AUTH_CERT_REGISTRATION_REQUEST':
return this.$t('managementRequests.addCertificate') as string;
case 'register_client':
case 'CLIENT_REGISTRATION_REQUEST':
return this.$t('managementRequests.addClient') as string;
default:
return '';
Expand All @@ -86,4 +92,10 @@ export default Vue.extend({
flex-direction: row;
align-items: center;
}

@media (max-width: 1200px) {
.status-text {
display: none;
}
}
</style>
14 changes: 10 additions & 4 deletions src/centralserver/admin-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,12 @@
"rejected": "Rejected",
"removeCertificate": "Remove Certificate",
"removeClient": "Remove Client",
"serverCode": "Server Code",
"serverOnwerId": "Server Owner ID",
"serverIdentifier": "Server Identifier",
"serverOwnerName": "Server Owner Name",
"showOnlyPending": "Show only pending requests"
},
"members": {
"addMember": "Add member",
"deleteMember": "Delete member",
"header": "Members",
"member": {
"details": {
Expand All @@ -292,7 +290,12 @@
"globalGroups": "Global Groups",
"group": "Group",
"ownedServers": "Owned Servers",
"server": "Server"
"server": "Server",
"enterCode": "Enter Member Code",
"deleteMember": "Delete member",
"deleteMemberFromGroup": "Delete memmer from Global group",
"areYouSure1": "Are you sure you want to delete the Member {member} from the system configuration? Enter the member code to confirm.",
"areYouSure2": "Are you sure you want to delete the member {member} from the {group}?"
},
"managementRequests": {
"created": "Created",
Expand Down Expand Up @@ -339,6 +342,9 @@
"expires": "Expires",
"serialNumber": "Serial Number",
"subject": "Subject",
"deleteSecurityServer": "Delete Security Server",
"enterCode": "Enter Security Server Code",
"areYouSure": "Are you sure you want to delete the Security Server {securityServer} from the system configuration? Enter the server code to confirm.",
"tabs": {
"authCertificates": "Authentication Certificates",
"clients": "Clients",
Expand Down
5 changes: 4 additions & 1 deletion src/centralserver/admin-ui/src/plugins/vee-validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* THE SOFTWARE.
*/
import { extend, configure } from 'vee-validate';
import { required, min, between } from 'vee-validate/dist/rules';
import { required, min, between, is } from 'vee-validate/dist/rules';
import i18n from '../i18n';

configure({
Expand All @@ -47,3 +47,6 @@ extend('min', min);

// Install between rule and message.
extend('between', between);

// Install is rule and message.
extend('is', is);
131 changes: 131 additions & 0 deletions src/centralserver/admin-ui/src/store/modules/managementRequests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*
* The MIT License
*
* Copyright (c) 2019- Nordic Institute for Interoperability Solutions (NIIS)
* Copyright (c) 2018 Estonian Information System Authority (RIA),
* Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK)
* Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

import { defineStore } from 'pinia';

export const useManagementRequests = defineStore('managementRequests', {
state: () => {
return {
// Mock data. This will be replaced with data from server.
managementRequestsMockData: [
{
id: 13,
type: 'AUTH_CERT_REGISTRATION_REQUEST',
origin: 'CENTER',
server_owner_name: 'Tartu Kesklinna Perearstikeskus OÜ',
security_server_id: {
instance_id: 'DEV7X',
type: 'SERVER',
member_class: 'TST',
member_code: 'MEMBER1',
server_code: 'RH1',
},
status: 'APPROVED',
created_at: '2021-07-07T10:09:42.10186Z',
},
{
id: 736287,
type: 'CLIENT_REGISTRATION_REQUEST',
origin: 'CENTER',
server_owner_name: 'Eesti Põllumajandusloomade Jõudluskontrolli ASi',
security_server_id: {
instance_id: 'DEV9X',
type: 'SERVER',
member_class: 'TST',
member_code: 'MEMBER22',
server_code: 'RH3',
},
status: 'REJECTED',
created_at: '2021-02-08T10:09:40.10186Z',
},
{
id: 64,
type: 'OWNER_CHANGE_REQUEST',
origin: 'CENTER',
server_owner_name: 'Helsingin kristillisen koulun kannatusyhdistys',
security_server_id: {
instance_id: 'OPP',
type: 'SERVER',
member_class: 'RAA',
member_code: 'MEMBER7',
server_code: 'X1',
},
status: 'PENDING',
created_at: '2021-03-11T10:09:40.10186Z',
},
{
id: 112283,
type: 'CLIENT_DELETION_REQUEST',
origin: 'CENTER',
server_owner_name: 'Siseministeerium',
security_server_id: {
instance_id: 'WAP',
type: 'SERVER',
member_class: 'MOP',
member_code: 'MEM227',
server_code: 'K8',
},
status: 'APPROVED',
created_at: '2020-12-13T10:09:40.10186Z',
},
{
id: 947283,
type: 'AUTH_CERT_DELETION_REQUEST',
origin: 'CENTER',
server_owner_name: 'Turvallisuus- ja kemikaalivirasto',
security_server_id: {
instance_id: 'NEO',
type: 'SERVER',
member_class: 'AUS',
member_code: 'MEMBER9',
server_code: 'SR2',
},
status: 'PENDING',
created_at: '2020-12-13T10:09:40.10186Z',
},
],
};
},
getters: {
getManagementRequests(state) {
// Server id shown in data table is combined from instance id + member class + member code
// Any should be replaced with proper interface
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return state.managementRequestsMockData.map((item: any) => {
item.displayedServerId =
item.security_server_id.instance_id +
':' +
item.security_server_id.member_class +
':' +
item.security_server_id.member_code;
return item;
});
},
},

actions: {},
});
Loading

0 comments on commit 3a04c08

Please sign in to comment.