mirror of
https://github.com/seigler/dash-platform-console
synced 2025-07-27 09:36:10 +00:00
contracts
This commit is contained in:
parent
bffa2b6027
commit
3f8ecf0b08
8 changed files with 221 additions and 41 deletions
13
package-lock.json
generated
13
package-lock.json
generated
|
@ -2655,6 +2655,11 @@
|
||||||
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=",
|
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"brace": {
|
||||||
|
"version": "0.11.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/brace/-/brace-0.11.1.tgz",
|
||||||
|
"integrity": "sha1-SJb8ydVE7vRfS7dmDbMg07N5/lg="
|
||||||
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
|
@ -13042,6 +13047,14 @@
|
||||||
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
|
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"vue2-ace-editor": {
|
||||||
|
"version": "0.0.15",
|
||||||
|
"resolved": "https://registry.npmjs.org/vue2-ace-editor/-/vue2-ace-editor-0.0.15.tgz",
|
||||||
|
"integrity": "sha512-e3TR9OGXc71cGpvYcW068lNpRcFt3+OONCC81oxHL/0vwl/V3OgqnNMw2/RRolgQkO/CA5AjqVHWmANWKOtNnQ==",
|
||||||
|
"requires": {
|
||||||
|
"brace": "^0.11.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"vuelidate": {
|
"vuelidate": {
|
||||||
"version": "0.7.4",
|
"version": "0.7.4",
|
||||||
"resolved": "https://registry.npmjs.org/vuelidate/-/vuelidate-0.7.4.tgz",
|
"resolved": "https://registry.npmjs.org/vuelidate/-/vuelidate-0.7.4.tgz",
|
||||||
|
|
|
@ -11,9 +11,11 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dashevo/dapi-client": "github:dashevo/dapi-client#v0.8-dev",
|
"@dashevo/dapi-client": "github:dashevo/dapi-client#v0.8-dev",
|
||||||
"@dashevo/dpp": "github:dashevo/js-dpp#v0.10-dev",
|
"@dashevo/dpp": "github:dashevo/js-dpp#v0.10-dev",
|
||||||
|
"brace": "^0.11.1",
|
||||||
"core-js": "^3.4.3",
|
"core-js": "^3.4.3",
|
||||||
"vue": "^2.6.10",
|
"vue": "^2.6.10",
|
||||||
"vue-router": "^3.1.3",
|
"vue-router": "^3.1.3",
|
||||||
|
"vue2-ace-editor": "0.0.15",
|
||||||
"vuelidate": "^0.7.4",
|
"vuelidate": "^0.7.4",
|
||||||
"vuetify": "^2.1.0",
|
"vuetify": "^2.1.0",
|
||||||
"vuex": "^3.1.2",
|
"vuex": "^3.1.2",
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import VueRouter from 'vue-router';
|
import VueRouter from 'vue-router';
|
||||||
import Identities from '@/views/Identities.vue';
|
import Identities from '@/views/Identities.vue';
|
||||||
|
import Names from '@/views/Names.vue';
|
||||||
|
import Contracts from '@/views/Contracts.vue';
|
||||||
|
import Documents from '@/views/Documents.vue';
|
||||||
|
|
||||||
Vue.use(VueRouter);
|
Vue.use(VueRouter);
|
||||||
|
|
||||||
|
@ -13,17 +16,17 @@ const routes = [
|
||||||
{
|
{
|
||||||
path: '/contracts',
|
path: '/contracts',
|
||||||
name: 'contracts',
|
name: 'contracts',
|
||||||
component: () => import(/* webpackChunkName: "contracts" */ '../views/Contracts.vue'),
|
component: Contracts,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/documents',
|
path: '/documents',
|
||||||
name: 'documents',
|
name: 'documents',
|
||||||
component: () => import(/* webpackChunkName: "documents" */ '../views/Documents.vue'),
|
component: Documents,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/names',
|
path: '/names',
|
||||||
name: 'names',
|
name: 'names',
|
||||||
component: () => import(/* webpackChunkName: "names" */ '../views/Names.vue'),
|
component: Names,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '*',
|
path: '*',
|
||||||
|
|
|
@ -22,8 +22,8 @@ export default new Vuex.Store({
|
||||||
application: [],
|
application: [],
|
||||||
},
|
},
|
||||||
names: {},
|
names: {},
|
||||||
contracts: [],
|
contracts: {},
|
||||||
documents: [],
|
documents: {},
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
addIdentity(state, { identity, type }) {
|
addIdentity(state, { identity, type }) {
|
||||||
|
@ -31,10 +31,21 @@ export default new Vuex.Store({
|
||||||
},
|
},
|
||||||
addName(state, { identity, name }) {
|
addName(state, { identity, name }) {
|
||||||
const { id } = identity;
|
const { id } = identity;
|
||||||
if (!state.names[id]) {
|
const names = state.names[id] || [];
|
||||||
state.names[id] = [];
|
state.names = {
|
||||||
}
|
...state.names,
|
||||||
state.names[id].push(name);
|
[id]: [
|
||||||
|
...names,
|
||||||
|
name,
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
addContract(state, { identity, contract }) {
|
||||||
|
const { id } = identity;
|
||||||
|
state.contracts = {
|
||||||
|
...state.contracts,
|
||||||
|
[id]: contract,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -50,6 +61,12 @@ export default new Vuex.Store({
|
||||||
});
|
});
|
||||||
commit('addName', { identity, name });
|
commit('addName', { identity, name });
|
||||||
},
|
},
|
||||||
|
async registerContract({ commit }, { identity, json }) {
|
||||||
|
const contract = await new Promise((resolve) => {
|
||||||
|
setTimeout(() => resolve(json), 2000);
|
||||||
|
});
|
||||||
|
commit('addContract', { identity, contract });
|
||||||
|
},
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
identityLists(state) {
|
identityLists(state) {
|
||||||
|
@ -66,6 +83,13 @@ export default new Vuex.Store({
|
||||||
names: state.names[identity.id] || [],
|
names: state.names[identity.id] || [],
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
applicationIdentitiesWithContracts(state) {
|
||||||
|
const { application } = state.identities;
|
||||||
|
return application.map(identity => ({
|
||||||
|
...identity,
|
||||||
|
contract: state.contracts[identity.id],
|
||||||
|
}));
|
||||||
|
},
|
||||||
},
|
},
|
||||||
plugins: [createPersistedState()],
|
plugins: [createPersistedState()],
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +1,135 @@
|
||||||
<template>
|
<template>
|
||||||
<v-container>
|
<v-container>
|
||||||
|
<v-row v-if="applicationIdentitiesWithContracts.length">
|
||||||
|
<v-col>
|
||||||
|
<v-simple-table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Id</th>
|
||||||
|
<th>Contract</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr
|
||||||
|
v-for="identity in applicationIdentitiesWithContracts"
|
||||||
|
:key="identity.id"
|
||||||
|
>
|
||||||
|
<td>{{ identity.id }}</td>
|
||||||
|
<td>
|
||||||
|
<v-btn text @click="() => openDialog(identity)">
|
||||||
|
{{ identity.contract ? 'view' : 'register' }}
|
||||||
|
</v-btn>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</v-simple-table>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
<v-row v-else>
|
||||||
|
<v-col>
|
||||||
|
<v-alert type="error">
|
||||||
|
You must have Application Identity
|
||||||
|
in order to register a Contract for it
|
||||||
|
</v-alert>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
<v-dialog
|
||||||
|
v-model="showJsonDialog"
|
||||||
|
fullscreen hide-overlay transition="dialog-bottom-transition"
|
||||||
|
>
|
||||||
|
<v-card>
|
||||||
|
<v-form @submit="submit">
|
||||||
|
<v-toolbar color="primary">
|
||||||
|
<v-btn icon @click="showJsonDialog = false">
|
||||||
|
<v-icon>mdi-close</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
<v-toolbar-title>Contract for {{selectedIdentity.id}}</v-toolbar-title>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<v-toolbar-items v-if="!selectedIdentity.contract">
|
||||||
|
<v-btn
|
||||||
|
text
|
||||||
|
:loading="submitting"
|
||||||
|
@click="submit"
|
||||||
|
>
|
||||||
|
submit
|
||||||
|
</v-btn>
|
||||||
|
</v-toolbar-items>
|
||||||
|
</v-toolbar>
|
||||||
|
<AceEditor
|
||||||
|
ref="aceEditor"
|
||||||
|
v-model="json"
|
||||||
|
@init="aceEditorInit"
|
||||||
|
lang="json"
|
||||||
|
theme="clouds_midnight"
|
||||||
|
width="100%"
|
||||||
|
height="94vh"
|
||||||
|
/>
|
||||||
|
</v-form>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
</v-container>
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapGetters, mapActions } from 'vuex';
|
||||||
|
import AceEditor from 'vue2-ace-editor';
|
||||||
|
import 'brace/mode/json';
|
||||||
|
import 'brace/theme/clouds_midnight';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: { AceEditor },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showJsonDialog: false,
|
||||||
|
submitting: false,
|
||||||
|
selectedIdentity: {},
|
||||||
|
json: '',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters([
|
||||||
|
'applicationIdentitiesWithContracts',
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(['registerContract']),
|
||||||
|
setAceEditorReadonly() {
|
||||||
|
const readonly = this.selectedIdentity.contract;
|
||||||
|
if (this.$refs.aceEditor) {
|
||||||
|
this.$refs.aceEditor.editor.setReadOnly(readonly);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
aceEditorInit() {
|
||||||
|
this.setAceEditorReadonly();
|
||||||
|
},
|
||||||
|
openDialog(identity) {
|
||||||
|
this.selectedIdentity = identity;
|
||||||
|
this.json = identity.contract ? identity.contract : '';
|
||||||
|
this.showJsonDialog = true;
|
||||||
|
this.setAceEditorReadonly();
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
const { json, selectedIdentity } = this;
|
||||||
|
this.submitting = true;
|
||||||
|
this.registerContract({
|
||||||
|
identity: selectedIdentity,
|
||||||
|
json,
|
||||||
|
}).then(() => {
|
||||||
|
this.showJsonDialog = false;
|
||||||
|
}).finally(() => {
|
||||||
|
this.submitting = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
tr>td:last-child {
|
||||||
|
width: 1%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ace_editor {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<v-container>
|
<v-container>
|
||||||
|
<v-row>
|
||||||
|
<v-col>
|
||||||
<v-alert type="warning">
|
<v-alert type="warning">
|
||||||
Not Implemented
|
Not Implemented
|
||||||
</v-alert>
|
</v-alert>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
</v-container>
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
<v-col>
|
<v-col>
|
||||||
<h1>{{ list.type.name }}</h1>
|
<h1>{{ list.type.name }}</h1>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col md="auto">
|
<v-col cols="auto">
|
||||||
<v-btn
|
<v-btn
|
||||||
fab dark color="indigo"
|
fab dark color="primary"
|
||||||
:loading="createIdentityLoading[list.type.name]"
|
:loading="createIdentityLoading[list.type.name]"
|
||||||
@click="() => createIdentity(list.type)"
|
@click="() => createIdentity(list.type)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Id</th>
|
<th>Id</th>
|
||||||
<th>Registered names</th>
|
<th>Names</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -27,33 +27,38 @@
|
||||||
</v-simple-table>
|
</v-simple-table>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-alert v-else type="error">
|
<v-row v-else>
|
||||||
You must have an identity
|
<v-col>
|
||||||
in order to create a domain name for it
|
<v-alert type="error">
|
||||||
|
You must have User Identity
|
||||||
|
in order to register a Domain Name for it
|
||||||
</v-alert>
|
</v-alert>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
<v-dialog
|
<v-dialog
|
||||||
v-model="showNameDialog"
|
v-model="showNameDialog"
|
||||||
max-width="400px"
|
max-width="400px"
|
||||||
>
|
>
|
||||||
<v-card>
|
<v-card>
|
||||||
|
<v-form @submit="submit">
|
||||||
<v-card-title>
|
<v-card-title>
|
||||||
Register a new domain name
|
{{ selectedIdentity.id }}
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-text-field counter v-model="name" />
|
<v-text-field counter v-model="name" label="Name" />
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn text @click="showNameDialog">close</v-btn>
|
<v-btn text @click="showNameDialog = false">close</v-btn>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
color="primary"
|
color="primary"
|
||||||
|
type="submit"
|
||||||
:loading="submitting"
|
:loading="submitting"
|
||||||
@click="submit"
|
|
||||||
>
|
>
|
||||||
submit
|
Register
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
|
</v-form>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-dialog>
|
</v-dialog>
|
||||||
</v-container>
|
</v-container>
|
||||||
|
@ -67,7 +72,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
showNameDialog: false,
|
showNameDialog: false,
|
||||||
submitting: false,
|
submitting: false,
|
||||||
selectedIdentity: undefined,
|
selectedIdentity: {},
|
||||||
name: '',
|
name: '',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -81,7 +86,8 @@ export default {
|
||||||
this.name = '';
|
this.name = '';
|
||||||
this.showNameDialog = true;
|
this.showNameDialog = true;
|
||||||
},
|
},
|
||||||
submit() {
|
submit(event) {
|
||||||
|
event.preventDefault();
|
||||||
const { name, selectedIdentity } = this;
|
const { name, selectedIdentity } = this;
|
||||||
this.submitting = true;
|
this.submitting = true;
|
||||||
this.registerName({
|
this.registerName({
|
||||||
|
@ -98,7 +104,10 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
tr>td:last-child{
|
tr>td:first-child {
|
||||||
|
width: 1%;
|
||||||
|
}
|
||||||
|
tr>td:last-child {
|
||||||
width: 1%;
|
width: 1%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue