diff --git a/package.json b/package.json
index fcdb9ac..2cef8ba 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,6 @@
{
"name": "dash-platform-console",
+ "description": "Dash Platform Console",
"version": "0.1.0",
"private": true,
"scripts": {
diff --git a/public/index.html b/public/index.html
index ac78773..0070966 100644
--- a/public/index.html
+++ b/public/index.html
@@ -5,7 +5,7 @@
-
Dash platform console
+ Dash Platform Console
diff --git a/src/App.vue b/src/App.vue
index 7d773a9..c733f75 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,7 +1,7 @@
- dashevo exprlorer
+ Dash Platform Console
diff --git a/src/router/index.js b/src/router/index.js
index 37f47cb..42ba61c 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,5 +1,6 @@
import Vue from 'vue';
import VueRouter from 'vue-router';
+import Identities from '@/views/Identities.vue';
Vue.use(VueRouter);
@@ -7,7 +8,7 @@ const routes = [
{
path: '/identities',
name: 'identities',
- component: () => import(/* webpackChunkName: "identities" */ '../views/Identities.vue'),
+ component: Identities,
},
{
path: '/contracts',
diff --git a/src/store/index.js b/src/store/index.js
index d058a70..957d6c7 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -4,24 +4,67 @@ import createPersistedState from 'vuex-persistedstate';
Vue.use(Vuex);
+export const identityTypes = {
+ application: {
+ name: 'application',
+ value: 1,
+ },
+ user: {
+ name: 'user',
+ value: 2,
+ },
+};
+
export default new Vuex.Store({
state: {
- identities: [],
- names: [],
+ identities: {
+ user: [],
+ application: [],
+ },
+ names: {},
contracts: [],
documents: [],
},
mutations: {
- addIdentity(state, identity) {
- state.identities.push(identity);
+ addIdentity(state, { identity, type }) {
+ state.identities[type.name].push(identity);
+ },
+ addName(state, { identity, name }) {
+ const { id } = identity;
+ if (!state.names[id]) {
+ state.names[id] = [];
+ }
+ state.names[id].push(name);
},
},
actions: {
async createIdentity({ commit }, type) {
const identity = await new Promise((resolve) => {
- setTimeout(() => resolve({ id: `t_id_${Date.now()}`, type }), 2000);
+ setTimeout(() => resolve({ id: `t_${type.name}_id_${Date.now()}`, type }), 2000);
});
- commit('addIdentity', identity);
+ commit('addIdentity', { identity, type });
+ },
+ async registerName({ commit }, { identity, name }) {
+ await new Promise((resolve) => {
+ setTimeout(() => resolve(name), 2000);
+ });
+ commit('addName', { identity, name });
+ },
+ },
+ getters: {
+ identityLists(state) {
+ const { identities } = state;
+ return Object.keys(identityTypes).map(typeName => ({
+ type: identityTypes[typeName],
+ items: identities[typeName],
+ }));
+ },
+ userIdentitiesWithNames(state) {
+ const { user } = state.identities;
+ return user.map(identity => ({
+ ...identity,
+ names: state.names[identity.id] || [],
+ }));
},
},
plugins: [createPersistedState()],
diff --git a/src/views/Contracts.vue b/src/views/Contracts.vue
index 8cc9f29..7bb149c 100644
--- a/src/views/Contracts.vue
+++ b/src/views/Contracts.vue
@@ -1,5 +1,7 @@
-
+
+
+
diff --git a/src/views/Identities.vue b/src/views/Identities.vue
index 9948ffc..36391cb 100644
--- a/src/views/Identities.vue
+++ b/src/views/Identities.vue
@@ -1,89 +1,62 @@
-
-
-
- Create identity
-
-
-
-
-
- createIdentity(1)"
- >
- application
-
-
-
- createIdentity(2)"
- >
- user
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Id |
- Type |
-
-
-
-
- {{ identity.id }} |
- {{ identity.type === 1 ? 'application' : 'user' }} |
-
-
-
+
+
+
+ {{ list.type.name }}
+
+
+ createIdentity(list.type)"
+ >
+ mdi-plus
+
+
+
+
+
+
+
+ {{ identity.id }}
+
+
+
+
+
+ List is empty.
+ Try to create an Identity
+
+
+