Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XRDDEV-1939 Mock UI updates #1194

Merged
merged 4 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<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'" />
Expand All @@ -41,6 +41,7 @@
</template>
<span>{{ getStatusText() }}</span>
</v-tooltip>
<span class="status-text">{{ getStatusText() }}</span>
</div>
</template>

Expand Down Expand Up @@ -86,4 +87,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 @@ -270,14 +270,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 @@ -288,7 +286,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 @@ -334,6 +337,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);
Original file line number Diff line number Diff line change
Expand Up @@ -115,44 +115,39 @@ export default Vue.extend({
created: '2021-02-01',
type: 'change_owner',
serverOwnerName: 'Tartu Kesklinna Perearstikeskus OÜ',
serverOnwerId: 'DEV-333',
serverCode: 'sidecar',
serverId: 'DEV-333:sidecar',
status: 'APPROVED',
},
{
id: '736287',
created: '2021-05-05',
type: 'delete_certificate',
serverOwnerName: 'Eesti Põllumajandusloomade Jõudluskontrolli ASi',
serverOnwerId: 'COM-777',
serverCode: 'SS1',
serverId: 'COM-777:SS1',
Copy link
Contributor

@jhyoty jhyoty Mar 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mock data is not up to date the with opendapi definition (or current implementation). More accurate would be something like:

{
  "id": 13,
  "type": "AUTH_CERT_REGISTRATION_REQUEST",
  "origin": "CENTER",
  "server_owner_name": "...",
  "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"
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mock data has been updated to look more like the real one

status: 'REJECTED',
},
{
id: '234234',
created: '2021-03-12',
type: 'delete_client',
serverOwnerName: 'Helsingin kristillisen koulun kannatusyhdistys',
serverOnwerId: 'COM-666',
serverCode: 'SS2',
serverId: 'COM-666:SS2',
status: 'PENDING',
},
{
id: '987283',
created: '2021-04-22',
type: 'register_certificate',
serverOwnerName: 'Siseministeerium',
serverOnwerId: 'DEV-444',
serverCode: 'SS2',
serverId: 'DEV-444:SS2',
status: 'APPROVED',
},
{
id: '123235',
created: '2021-01-21',
type: 'register_client',
serverOwnerName: 'Turvallisuus- ja kemikaalivirasto',
serverOnwerId: 'COM-555',
serverCode: 'dev-toolkit-confidential.i.x-road',
serverId: 'COM-555:dev-toolkit-confidential.i.x-road',
status: 'PENDING',
},
],
Expand Down Expand Up @@ -187,17 +182,11 @@ export default Vue.extend({
class: 'xrd-table-header mr-table-header-owner-name',
},
{
text: this.$t('managementRequests.serverOnwerId') as string,
text: this.$t('managementRequests.serverIdentifier') as string,
align: 'start',
value: 'serverOnwerId',
value: 'serverId',
class: 'xrd-table-header mr-table-header-owner-id',
},
{
text: this.$t('managementRequests.serverCode') as string,
align: 'start',
value: 'serverCode',
class: 'xrd-table-header mr-table-header-server-code',
},

{
text: this.$t('global.status') as string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
$t('global.memberCode')
}}</v-card-title>
<v-divider></v-divider>
<v-card-text data-test="member-code-value">12121212</v-card-text>
<v-card-text data-test="member-code-value">{{
memberCode
}}</v-card-text>
<v-divider class="pb-4"></v-divider>
</v-card>
</div>
Expand Down Expand Up @@ -130,9 +132,12 @@
>
<template #[`item.button`]>
<div class="cs-table-actions-wrap">
<xrd-button text :outlined="false">{{
$t('action.delete')
}}</xrd-button>
<xrd-button
text
:outlined="false"
@click="showDeleteFromGroupDialog = true"
>{{ $t('action.delete') }}</xrd-button
>
</div>
</template>

Expand All @@ -141,26 +146,131 @@
</template>
</v-data-table>
</v-card>

<div class="delete-action" @click="showDialog = true">
<div>
<v-icon class="xrd-large-button-icon" :color="colors.Purple100"
>mdi-close-circle</v-icon
>
</div>
<div class="action-text">
{{ $t('members.member.details.deleteMember') }} "{{ memberName }}"
</div>
</div>
</div>

<!-- Delete member - Check member code dialog -->

<v-dialog v-if="showDialog" v-model="showDialog" width="500" persistent>
<ValidationObserver ref="initializationForm" v-slot="{ invalid }">
<v-card class="xrd-card">
<v-card-title>
<span class="headline">{{
$t('members.member.details.deleteMember')
}}</span>
</v-card-title>
<v-card-text class="pt-4">
{{
$t('members.member.details.areYouSure1', {
member: 'NIIS',
})
}}
<div class="dlg-input-width pt-4">
<ValidationProvider
v-slot="{ errors }"
ref="initializationParamsVP"
name="init.identifier"
:rules="{ required: true, is: memberCode }"
data-test="instance-identifier--validation"
>
<v-text-field
v-model="offeredCode"
outlined
:label="$t('members.member.details.enterCode')"
autofocus
data-test="add-local-group-code-input"
:error-messages="errors"
></v-text-field>
</ValidationProvider>
</div>
</v-card-text>
<v-card-actions class="xrd-card-actions">
<v-spacer></v-spacer>
<xrd-button outlined @click="cancelDelete()">{{
$t('action.cancel')
}}</xrd-button>
<xrd-button :disabled="invalid" @click="deleteMember()">{{
$t('action.delete')
}}</xrd-button>
</v-card-actions>
</v-card>
</ValidationObserver>
</v-dialog>

<!-- Delete member from a group -->
<v-dialog
v-if="showDeleteFromGroupDialog"
v-model="showDeleteFromGroupDialog"
width="500"
persistent
>
<v-card class="xrd-card">
<v-card-title>
<span class="headline">{{
$t('members.member.details.deleteMember')
}}</span>
</v-card-title>
<v-card-text class="pt-4">
{{
$t('members.member.details.areYouSure2', {
member: memberName,
group: 'opendata-providers',
})
}}
</v-card-text>
<v-card-actions class="xrd-card-actions">
<v-spacer></v-spacer>
<xrd-button outlined @click="cancelDelete()">{{
$t('action.cancel')
}}</xrd-button>
<xrd-button @click="deleteMemberFromGroup()">{{
$t('action.delete')
}}</xrd-button>
</v-card-actions>
</v-card>
</v-dialog>
</main>
</template>

<script lang="ts">
import Vue from 'vue';
import { DataTableHeader } from 'vuetify';
import { Colors } from '@/global';
import { ValidationObserver, ValidationProvider } from 'vee-validate';

/**
* Component for a Members details view
*/
export default Vue.extend({
name: 'MemberDetails',
components: {
ValidationObserver,
ValidationProvider,
},
data() {
return {
searchServers: '',
searchGroups: '',
memberName: 'Netum',
loading: false,
loadingGroups: false,
showOnlyPending: false,
colors: Colors,
showDialog: false,
offeredCode: '',
memberCode: '12345', // Mock. This will come from a backend with member data
wrongCode: false,
showDeleteFromGroupDialog: false,
servers: [
{
name: 'SS1',
Expand Down Expand Up @@ -223,6 +333,22 @@ export default Vue.extend({
];
},
},
methods: {
deleteMember() {
// Delete action
this.showDialog = false;
this.offeredCode = '';
},

deleteMemberFromGroup() {
this.showDeleteFromGroupDialog = false;
},
cancelDelete() {
this.showDialog = false;
this.showDeleteFromGroupDialog = false;
this.offeredCode = '';
},
},
});
</script>

Expand All @@ -244,6 +370,17 @@ export default Vue.extend({
justify-content: flex-end;
}

.delete-action {
margin-top: 34px;
color: $XRoad-Link;
cursor: pointer;
display: flex;
flex-direction: row;
.action-text {
margin-top: 2px;
}
}

#member-details {
margin-top: 24px;
display: flex;
Expand Down
24 changes: 0 additions & 24 deletions src/centralserver/admin-ui/src/views/Members/Member/Member.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,10 @@
-->
<template>
<div id="memberview">
<div class="navigation-back" data-test="navigation-back">
<router-link to="/members">
<v-icon :color="colors.Purple100">mdi-chevron-left</v-icon>
{{ $t('global.navigation.back') }}
</router-link>
</div>
<div class="header-row">
<div class="title-search">
<div class="xrd-view-title">NETUM</div>
</div>
<xrd-button data-test="remove-member-button"
><v-icon class="xrd-large-button-icon">mdi-close-circle</v-icon>
{{ $t('members.deleteMember') }}</xrd-button
>
</div>
<PageNavigation :items="memberNavigationItems"></PageNavigation>
<router-view />
Expand Down Expand Up @@ -93,17 +83,3 @@ export default Vue.extend({
},
});
</script>

<style lang="scss" scoped>
@import '~styles/colors';

.navigation-back {
color: $XRoad-Link;
cursor: pointer;
margin-bottom: 20px;

a {
text-decoration: none;
}
}
</style>
Loading