Renewing and updating is clean
This commit is contained in:
parent
d83126755b
commit
2ef74854e6
18
.eslintrc.js
18
.eslintrc.js
|
@ -1,20 +1,22 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: "babel-eslint"
|
parser: "babel-eslint",
|
||||||
|
ecmaVersion: 10,
|
||||||
|
sourceType: "module"
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
node: true,
|
node: true,
|
||||||
browser: true
|
browser: true,
|
||||||
|
es6: true
|
||||||
},
|
},
|
||||||
extends: [
|
extends: [
|
||||||
// "plugin:prettier/recommended",
|
|
||||||
"plugin:vue/recommended",
|
"plugin:vue/recommended",
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
"prettier/vue"
|
"prettier/vue",
|
||||||
|
"plugin:prettier/recommended"
|
||||||
],
|
],
|
||||||
// required to lint *.vue files
|
plugins: ["prettier"],
|
||||||
plugins: ["vue", "prettier"],
|
|
||||||
globals: {
|
globals: {
|
||||||
__statics: true,
|
__statics: true,
|
||||||
__ryo_bin: true
|
__ryo_bin: true
|
||||||
|
@ -23,7 +25,7 @@ module.exports = {
|
||||||
rules: {
|
rules: {
|
||||||
// allow debugger during development
|
// allow debugger during development
|
||||||
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
|
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
|
||||||
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
|
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
|
||||||
"vue/component-name-in-template-casing": ["error", "PascalCase"]
|
// "vue/component-name-in-template-casing": ["error", "PascalCase"]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1 +1,7 @@
|
||||||
// intentionally blank
|
module.exports = {
|
||||||
|
semi: true,
|
||||||
|
singleQuote: false,
|
||||||
|
useTabs: false,
|
||||||
|
trailingComma: "none",
|
||||||
|
printWidth: 80
|
||||||
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "loki-electron-wallet",
|
"name": "loki-electron-wallet",
|
||||||
"version": "1.4.6",
|
"version": "1.5.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -6138,9 +6138,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint-config-prettier": {
|
"eslint-config-prettier": {
|
||||||
"version": "6.11.0",
|
"version": "6.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.12.0.tgz",
|
||||||
"integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==",
|
"integrity": "sha512-9jWPlFlgNwRUYVoujvWTQ1aMO8o6648r+K7qU7K5Jmkbyqav1fuEZC0COYpGBxyiAJb65Ra9hrmFx19xRGwXWw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"get-stdin": "^6.0.0"
|
"get-stdin": "^6.0.0"
|
||||||
|
|
|
@ -53,12 +53,12 @@
|
||||||
"electron-devtools-installer": "^2.2.4",
|
"electron-devtools-installer": "^2.2.4",
|
||||||
"electron-notarize": "^0.1.1",
|
"electron-notarize": "^0.1.1",
|
||||||
"eslint": "^5.16.0",
|
"eslint": "^5.16.0",
|
||||||
"eslint-config-prettier": "^6.10.0",
|
"eslint-config-prettier": "^6.12.0",
|
||||||
"eslint-friendly-formatter": "^4.0.1",
|
"eslint-friendly-formatter": "^4.0.1",
|
||||||
"eslint-loader": "^2.2.1",
|
"eslint-loader": "^2.2.1",
|
||||||
"eslint-plugin-import": "^2.16.0",
|
"eslint-plugin-import": "^2.16.0",
|
||||||
"eslint-plugin-node": "^8.0.1",
|
"eslint-plugin-node": "^8.0.1",
|
||||||
"eslint-plugin-prettier": "^3.1.2",
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
"eslint-plugin-promise": "^4.0.1",
|
"eslint-plugin-promise": "^4.0.1",
|
||||||
"eslint-plugin-vue": "^5.2.3",
|
"eslint-plugin-vue": "^5.2.3",
|
||||||
"husky": "^4.2.3",
|
"husky": "^4.2.3",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import child_process from "child_process";
|
import child_process from "child_process";
|
||||||
|
|
||||||
const request = require("request-promise");
|
const request = require("request-promise");
|
||||||
const queue = require("promise-queue");
|
const queue = require("promise-queue");
|
||||||
const http = require("http");
|
const http = require("http");
|
||||||
|
@ -488,20 +489,18 @@ export class Daemon {
|
||||||
if (!Array.isArray(owners) || owners.length === 0) {
|
if (!Array.isArray(owners) || owners.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
// NEED TO FIX THIS
|
|
||||||
// console.log("Getting records for owners with owners:");
|
|
||||||
// console.log(owners[0]);
|
|
||||||
|
|
||||||
// try just the main address as owner
|
// only 256 addresses allowed in this call
|
||||||
|
let ownersMax = owners.slice(0, 256);
|
||||||
const data = await this.sendRPC("lns_owners_to_names", {
|
const data = await this.sendRPC("lns_owners_to_names", {
|
||||||
entries: [owners[0]]
|
entries: ownersMax
|
||||||
});
|
});
|
||||||
if (!data.hasOwnProperty("result")) return [];
|
if (!data.hasOwnProperty("result")) return [];
|
||||||
|
|
||||||
// We need to map request_index to owner
|
// We need to map request_index to owner
|
||||||
const { entries } = data.result;
|
const { entries } = data.result;
|
||||||
const recordsWithOwners = (entries || []).map(record => {
|
const recordsWithOwners = (entries || []).map(record => {
|
||||||
const owner = owners[record.request_index];
|
const owner = ownersMax[record.request_index];
|
||||||
return {
|
return {
|
||||||
...record,
|
...record,
|
||||||
owner
|
owner
|
||||||
|
@ -520,10 +519,8 @@ export class Daemon {
|
||||||
entries: [
|
entries: [
|
||||||
{
|
{
|
||||||
name_hash: nameHash,
|
name_hash: nameHash,
|
||||||
// Update this when we have other types.
|
|
||||||
// 0 = session
|
// 0 = session
|
||||||
// 2+ = lokinet for different # years
|
// 2 = lokinet
|
||||||
// TODO: Ensure these are actually the correct types
|
|
||||||
types: [0, 2]
|
types: [0, 2]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -535,8 +532,6 @@ export class Daemon {
|
||||||
const entries = this._sanitizeLNSRecords(data.result.entries);
|
const entries = this._sanitizeLNSRecords(data.result.entries);
|
||||||
if (entries.length === 0) return null;
|
if (entries.length === 0) return null;
|
||||||
|
|
||||||
// console.log("Returning entries 0 of entries:");
|
|
||||||
// console.log(entries);
|
|
||||||
return entries[0];
|
return entries[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import child_process from "child_process";
|
import child_process from "child_process";
|
||||||
|
|
||||||
const request = require("request-promise");
|
const request = require("request-promise");
|
||||||
const queue = require("promise-queue");
|
const queue = require("promise-queue");
|
||||||
const http = require("http");
|
const http = require("http");
|
||||||
|
@ -363,7 +364,6 @@ export class WalletRPC {
|
||||||
this.lnsRenewMapping(params.password, params.type, params.name);
|
this.lnsRenewMapping(params.password, params.type, params.name);
|
||||||
break;
|
break;
|
||||||
case "lns_known_names":
|
case "lns_known_names":
|
||||||
console.log("LNS known records case");
|
|
||||||
this.lnsKnownNames();
|
this.lnsKnownNames();
|
||||||
break;
|
break;
|
||||||
case "update_lns_mapping":
|
case "update_lns_mapping":
|
||||||
|
@ -987,9 +987,6 @@ export class WalletRPC {
|
||||||
addresses
|
addresses
|
||||||
);
|
);
|
||||||
|
|
||||||
// console.log("records from owners");
|
|
||||||
// console.log(records);
|
|
||||||
|
|
||||||
// We need to ensure that we decrypt any incoming records that we already have
|
// We need to ensure that we decrypt any incoming records that we already have
|
||||||
const currentRecords = this.wallet_state.lnsRecords;
|
const currentRecords = this.wallet_state.lnsRecords;
|
||||||
const recordsToUpdate = { ...this.purchasedNames };
|
const recordsToUpdate = { ...this.purchasedNames };
|
||||||
|
@ -1021,12 +1018,13 @@ export class WalletRPC {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// what does this even do?? isn't state set through the gateway
|
|
||||||
this.wallet_state.lnsRecords = newRecords;
|
this.wallet_state.lnsRecords = newRecords;
|
||||||
|
|
||||||
// console.log("New LNS records found in update:");
|
// console.log("New LNS records found in update:");
|
||||||
// console.log(newRecords);
|
// console.log(newRecords);
|
||||||
|
|
||||||
|
// ========= FETCH THE CACHED RECORDS HERE AND JOIN WITH THE OTHER RECORDS =====
|
||||||
|
// ===== UI DISPLAYS UNLOCKED RECORDS IF THE ENTRY HAS A 'name' and 'value' field
|
||||||
// const isSession = record => record.type === "session";
|
// const isSession = record => record.type === "session";
|
||||||
// let nonSessionRecords = newRecords.filter(record => !isSession(record));
|
// let nonSessionRecords = newRecords.filter(record => !isSession(record));
|
||||||
// console.log("non session records");
|
// console.log("non session records");
|
||||||
|
@ -1101,8 +1099,6 @@ export class WalletRPC {
|
||||||
lokinet_1y, lokinet_2y, lokinet_5y, lokinet_10y
|
lokinet_1y, lokinet_2y, lokinet_5y, lokinet_10y
|
||||||
*/
|
*/
|
||||||
lnsRenewMapping(password, type, name) {
|
lnsRenewMapping(password, type, name) {
|
||||||
console.log("Lns renew mapping called with type and name:");
|
|
||||||
console.log(type, name);
|
|
||||||
let _name = name.trim().toLowerCase();
|
let _name = name.trim().toLowerCase();
|
||||||
|
|
||||||
// the RPC accepts names with the .loki already appeneded only
|
// the RPC accepts names with the .loki already appeneded only
|
||||||
|
@ -1140,11 +1136,8 @@ export class WalletRPC {
|
||||||
name: _name
|
name: _name
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("lns renew mapping about to be called");
|
|
||||||
this.sendRPC("lns_renew_mapping", params).then(data => {
|
this.sendRPC("lns_renew_mapping", params).then(data => {
|
||||||
if (data.hasOwnProperty("error")) {
|
if (data.hasOwnProperty("error")) {
|
||||||
console.log("error");
|
|
||||||
console.log(data);
|
|
||||||
let error =
|
let error =
|
||||||
data.error.message.charAt(0).toUpperCase() +
|
data.error.message.charAt(0).toUpperCase() +
|
||||||
data.error.message.slice(1);
|
data.error.message.slice(1);
|
||||||
|
@ -1518,7 +1511,6 @@ export class WalletRPC {
|
||||||
|
|
||||||
// submits the transaction to the blockchain, irreversible from here
|
// submits the transaction to the blockchain, irreversible from here
|
||||||
async relayTransaction(metadataList, isBlink, addressSave, note, isSweepAll) {
|
async relayTransaction(metadataList, isBlink, addressSave, note, isSweepAll) {
|
||||||
console.log("Relay transaction called");
|
|
||||||
// for a sweep these don't exist
|
// for a sweep these don't exist
|
||||||
let address = "";
|
let address = "";
|
||||||
let payment_id = "";
|
let payment_id = "";
|
||||||
|
|
|
@ -66,8 +66,9 @@ export default {
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
message
|
message
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$refs.form.reset();
|
this.$refs.form.reset();
|
||||||
|
this.renewing = false;
|
||||||
|
this.updating = false;
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
|
@ -110,12 +111,17 @@ export default {
|
||||||
this.renewing = false;
|
this.renewing = false;
|
||||||
},
|
},
|
||||||
async update(record, oldRecord) {
|
async update(record, oldRecord) {
|
||||||
|
console.log("update called");
|
||||||
|
console.log(record);
|
||||||
|
console.log(oldRecord);
|
||||||
// Make sure we have a diff between the 2 records
|
// Make sure we have a diff between the 2 records
|
||||||
const isOwnerDifferent =
|
const isOwnerDifferent =
|
||||||
record.owner !== "" && record.owner !== oldRecord.owner;
|
record.owner !== "" && record.owner !== oldRecord.owner;
|
||||||
const isBackupOwnerDifferent =
|
const isBackupOwnerDifferent =
|
||||||
record.backup_owner !== "" &&
|
record.backup_owner !== "" &&
|
||||||
record.backup_owner !== oldRecord.backup_owner;
|
record.backup_owner !== oldRecord.backup_owner;
|
||||||
|
console.log("old value: " + oldRecord.value);
|
||||||
|
console.log("new value: " + record.value);
|
||||||
const isValueDifferent = record.value !== oldRecord.value;
|
const isValueDifferent = record.value !== oldRecord.value;
|
||||||
const different =
|
const different =
|
||||||
isOwnerDifferent || isBackupOwnerDifferent || isValueDifferent;
|
isOwnerDifferent || isBackupOwnerDifferent || isValueDifferent;
|
||||||
|
@ -132,10 +138,12 @@ export default {
|
||||||
|
|
||||||
const updatedRecord = {
|
const updatedRecord = {
|
||||||
...record,
|
...record,
|
||||||
value: isValueDifferent ? record.value : "",
|
value: isValueDifferent ? record.value : oldRecord.value,
|
||||||
owner: isOwnerDifferent ? record.owner : "",
|
owner: isOwnerDifferent ? record.owner : "",
|
||||||
backup_owner: isBackupOwnerDifferent ? record.backup_owner : ""
|
backup_owner: isBackupOwnerDifferent ? record.backup_owner : ""
|
||||||
};
|
};
|
||||||
|
console.log("updated record");
|
||||||
|
console.log(updatedRecord);
|
||||||
|
|
||||||
let passwordDialog = await this.showPasswordConfirmation({
|
let passwordDialog = await this.showPasswordConfirmation({
|
||||||
title: this.$t("dialog.lnsUpdate.title"),
|
title: this.$t("dialog.lnsUpdate.title"),
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
:placeholder="owner_placeholder"
|
:placeholder="owner_placeholder"
|
||||||
borderless
|
borderless
|
||||||
dense
|
dense
|
||||||
|
:disable="renewing"
|
||||||
@blur="$v.record.owner.$touch"
|
@blur="$v.record.owner.$touch"
|
||||||
/>
|
/>
|
||||||
</LokiField>
|
</LokiField>
|
||||||
|
|
|
@ -9,17 +9,15 @@
|
||||||
<q-icon :name="isLocked(record) ? 'lock' : 'lock_open'" size="24px" />
|
<q-icon :name="isLocked(record) ? 'lock' : 'lock_open'" size="24px" />
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label :class="bindClass(record)">
|
<q-item-label :class="bindClass(record)">{{
|
||||||
{{ isLocked(record) ? record.name_hash : record.name }}
|
isLocked(record) ? record.name_hash : record.name
|
||||||
</q-item-label>
|
}}</q-item-label>
|
||||||
<q-item-label v-if="!isLocked(record)">
|
<q-item-label v-if="!isLocked(record)">{{ record.value }}</q-item-label>
|
||||||
{{ record.value }}
|
|
||||||
</q-item-label>
|
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section side class="height">
|
<q-item-section side class="height">
|
||||||
<template v-if="isLocked(record)">
|
<template v-if="isLocked(record)">{{
|
||||||
{{ record.update_height | blockHeight }}
|
record.update_height | blockHeight
|
||||||
</template>
|
}}</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<div class="row update-renew-buttons">
|
<div class="row update-renew-buttons">
|
||||||
|
@ -39,14 +37,12 @@
|
||||||
</template>
|
</template>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section v-if="!isLocked(record)" side>
|
<q-item-section v-if="!isLocked(record)" side>
|
||||||
<span v-if="record.type === 'session'">
|
<span v-if="record.type === 'session'">{{
|
||||||
{{ record.update_height | blockHeight }}
|
record.update_height | blockHeight
|
||||||
</span>
|
}}</span>
|
||||||
<span v-else>
|
<span v-else>{{ record.expiration_height | expirationHeight }}</span>
|
||||||
{{ record.expiration_height | expirationHeight }}
|
|
||||||
</span>
|
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<!-- <ContextMenu
|
<ContextMenu
|
||||||
:menu-items="validMenuItems(record)"
|
:menu-items="validMenuItems(record)"
|
||||||
@ownerCopy="copy(record.owner, $t('notification.positive.ownerCopied'))"
|
@ownerCopy="copy(record.owner, $t('notification.positive.ownerCopied'))"
|
||||||
@nameCopy="copy(record.name, $t('notification.positive.nameCopied'))"
|
@nameCopy="copy(record.name, $t('notification.positive.nameCopied'))"
|
||||||
|
@ -57,7 +53,7 @@
|
||||||
$t('notification.positive.backupOwnerCopied')
|
$t('notification.positive.backupOwnerCopied')
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
/> -->
|
/>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
</template>
|
</template>
|
||||||
|
@ -65,10 +61,14 @@
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from "vuex";
|
import { mapState } from "vuex";
|
||||||
import { i18n } from "boot/i18n";
|
import { i18n } from "boot/i18n";
|
||||||
// import ContextMenu from "components/menus/contextmenu";
|
import ContextMenu from "components/menus/contextmenu";
|
||||||
|
const { clipboard } = require("electron");
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "LNSRecordList",
|
name: "LNSRecordList",
|
||||||
|
components: {
|
||||||
|
ContextMenu
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
recordList: {
|
recordList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
@ -79,9 +79,6 @@ export default {
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// components: {
|
|
||||||
// ContextMenu
|
|
||||||
// },
|
|
||||||
computed: mapState({
|
computed: mapState({
|
||||||
theme: state => state.gateway.app.config.appearance.theme
|
theme: state => state.gateway.app.config.appearance.theme
|
||||||
}),
|
}),
|
||||||
|
@ -107,6 +104,56 @@ export default {
|
||||||
},
|
},
|
||||||
onRenew(record) {
|
onRenew(record) {
|
||||||
this.$emit("onRenew", record);
|
this.$emit("onRenew", record);
|
||||||
|
},
|
||||||
|
copyNameI18nLabel(record) {
|
||||||
|
if (record.type === "session") {
|
||||||
|
return "menuItems.copyName";
|
||||||
|
} else {
|
||||||
|
return "menuItems.copyLokinetName";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
copyValueI18nLabel(record) {
|
||||||
|
if (record.type === "session") {
|
||||||
|
return "menuItems.copySessionId";
|
||||||
|
} else if (record.type === "lokinet") {
|
||||||
|
return "menuItems.copyLokinetAddress";
|
||||||
|
}
|
||||||
|
return "menuItems.copyAddress";
|
||||||
|
},
|
||||||
|
validMenuItems(record) {
|
||||||
|
// change name depending on if lokinet or session
|
||||||
|
const lockedItems = [
|
||||||
|
{ action: "nameCopy", i18n: this.copyNameI18nLabel(record) },
|
||||||
|
{ action: "copyValue", i18n: this.copyValueI18nLabel(record) }
|
||||||
|
];
|
||||||
|
let menuItems = [{ action: "ownerCopy", i18n: "menuItems.copyOwner" }];
|
||||||
|
const backupOwnerItem = [
|
||||||
|
{ action: "backupOwnerCopy", i18n: "menuItems.copyBackupOwner" }
|
||||||
|
];
|
||||||
|
if (!this.isLocked(record)) {
|
||||||
|
menuItems = [...lockedItems, ...menuItems];
|
||||||
|
}
|
||||||
|
if (record.backup_owner !== "") {
|
||||||
|
menuItems = [...menuItems, ...backupOwnerItem];
|
||||||
|
}
|
||||||
|
return menuItems;
|
||||||
|
},
|
||||||
|
// can copy a value on unlock
|
||||||
|
copyValue(record) {
|
||||||
|
let message = this.$t("notification.positive.lokinetAddressCopied");
|
||||||
|
if (record.type === "session") {
|
||||||
|
message = this.$t("notification.positive.sessionIdCopied");
|
||||||
|
}
|
||||||
|
this.copy(record.value, message);
|
||||||
|
},
|
||||||
|
copy(value, message) {
|
||||||
|
if (!value) return;
|
||||||
|
clipboard.writeText(value.trim());
|
||||||
|
this.$q.notify({
|
||||||
|
type: "positive",
|
||||||
|
timeout: 2000,
|
||||||
|
message
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,11 +50,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const { clipboard } = require("electron");
|
|
||||||
import { mapState } from "vuex";
|
import { mapState } from "vuex";
|
||||||
import LokiField from "components/loki_field";
|
import LokiField from "components/loki_field";
|
||||||
import { session_id_or_lokinet_name } from "src/validators/common";
|
import { session_id_or_lokinet_name } from "src/validators/common";
|
||||||
// import ContextMenu from "components/menus/contextmenu";
|
|
||||||
import LNSRecordList from "./lns_record_list";
|
import LNSRecordList from "./lns_record_list";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -62,7 +60,6 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
LokiField,
|
LokiField,
|
||||||
LNSRecordList
|
LNSRecordList
|
||||||
// ContextMenu
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -93,23 +90,6 @@ export default {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
validMenuItems(record) {
|
|
||||||
const lockedItems = [
|
|
||||||
{ action: "nameCopy", i18n: "menuItems.copyName" },
|
|
||||||
{ action: "copyValue", i18n: this.copyValueI18nLabel(record) }
|
|
||||||
];
|
|
||||||
let menuItems = [{ action: "ownerCopy", i18n: "menuItems.copyOwner" }];
|
|
||||||
const backupOwnerItem = [
|
|
||||||
{ action: "backupOwnerCopy", i18n: "menuItems.copyBackupOwner" }
|
|
||||||
];
|
|
||||||
if (!this.isLocked(record)) {
|
|
||||||
menuItems = [...lockedItems, ...menuItems];
|
|
||||||
}
|
|
||||||
if (record.backup_owner !== "") {
|
|
||||||
menuItems = [...menuItems, ...backupOwnerItem];
|
|
||||||
}
|
|
||||||
return menuItems;
|
|
||||||
},
|
|
||||||
records_of_type(state, type) {
|
records_of_type(state, type) {
|
||||||
// receives the type and returns the records of that type
|
// receives the type and returns the records of that type
|
||||||
const ourAddresses = this.ourAddresses;
|
const ourAddresses = this.ourAddresses;
|
||||||
|
@ -137,14 +117,6 @@ export default {
|
||||||
isLocked(record) {
|
isLocked(record) {
|
||||||
return !record.name || !record.value;
|
return !record.name || !record.value;
|
||||||
},
|
},
|
||||||
copyValueI18nLabel(record) {
|
|
||||||
if (record.type === "session") {
|
|
||||||
return "menuItems.copySessionId";
|
|
||||||
} else if (record.type === "lokinet") {
|
|
||||||
return "menuItems.copyLokinetName";
|
|
||||||
}
|
|
||||||
return "menuItems.copyAddress";
|
|
||||||
},
|
|
||||||
onUpdate(record) {
|
onUpdate(record) {
|
||||||
this.$emit("onUpdate", record);
|
this.$emit("onUpdate", record);
|
||||||
},
|
},
|
||||||
|
@ -205,23 +177,6 @@ export default {
|
||||||
type
|
type
|
||||||
});
|
});
|
||||||
this.decrypting = true;
|
this.decrypting = true;
|
||||||
},
|
|
||||||
// TODO: Update this
|
|
||||||
copyValue(record) {
|
|
||||||
let message = this.$t("notification.positive.addressCopied");
|
|
||||||
if (record.type === "session") {
|
|
||||||
message = this.$t("notification.positive.sessionIdCopied");
|
|
||||||
}
|
|
||||||
this.copy(record.value, message);
|
|
||||||
},
|
|
||||||
copy(value, message) {
|
|
||||||
if (!value) return;
|
|
||||||
clipboard.writeText(value.trim());
|
|
||||||
this.$q.notify({
|
|
||||||
type: "positive",
|
|
||||||
timeout: 2000,
|
|
||||||
message
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -270,6 +270,8 @@ export default {
|
||||||
changePassword: "Change Password",
|
changePassword: "Change Password",
|
||||||
copyAddress: "Copy address",
|
copyAddress: "Copy address",
|
||||||
copyBackupOwner: "Copy backup owner",
|
copyBackupOwner: "Copy backup owner",
|
||||||
|
copyLokinetAddress: "Copy lokinet address",
|
||||||
|
copyLokinetName: "Copy lokinet name",
|
||||||
copyName: "Copy name",
|
copyName: "Copy name",
|
||||||
copyOwner: "Copy owner",
|
copyOwner: "Copy owner",
|
||||||
copyQR: "Copy QR code",
|
copyQR: "Copy QR code",
|
||||||
|
@ -310,6 +312,8 @@ export default {
|
||||||
imported: "Key images imported"
|
imported: "Key images imported"
|
||||||
},
|
},
|
||||||
lnsRecordUpdated: "LNS Record was successfully updated",
|
lnsRecordUpdated: "LNS Record was successfully updated",
|
||||||
|
lokinetAddressCopied: "Full lokinet address copied",
|
||||||
|
lokinetNameCopied: "Lokinet name copied",
|
||||||
passwordUpdated: "Password updated",
|
passwordUpdated: "Password updated",
|
||||||
namePurchased: "Name successfully purchased",
|
namePurchased: "Name successfully purchased",
|
||||||
nameRenewed: "Name successfully renewed",
|
nameRenewed: "Name successfully renewed",
|
||||||
|
|
Loading…
Reference in New Issue