Disable the Save button, enabled after a change to indicate that save needs to be done.
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button @click="visibleKey = !visibleKey" x-text="visibleKey ? 'Hide' : 'Show'"></button>
|
<button @click="visibleKey = !visibleKey" x-text="visibleKey ? 'Hide' : 'Show'"></button>
|
||||||
<button @click="await saveProfile()">Save</button>
|
<button @click="await saveProfile()" :disabled="!needsSaving">Save</button>
|
||||||
<button @click="confirmClear = true" x-show="!confirmClear">Clear Data</button>
|
<button @click="confirmClear = true" x-show="!confirmClear">Clear Data</button>
|
||||||
<button @click="await clearData()" x-show="confirmClear">Confirm Clear</button>
|
<button @click="await clearData()" x-show="confirmClear">Confirm Clear</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ window.Alpine = Alpine;
|
|||||||
Alpine.data('popup', () => ({
|
Alpine.data('popup', () => ({
|
||||||
privKey: '',
|
privKey: '',
|
||||||
pubKey: '',
|
pubKey: '',
|
||||||
|
pristinePrivKey: '',
|
||||||
hosts: [],
|
hosts: [],
|
||||||
name: '',
|
name: '',
|
||||||
|
pristineName: '',
|
||||||
profileNames: ['Default'],
|
profileNames: ['Default'],
|
||||||
profileIndex: 0,
|
profileIndex: 0,
|
||||||
visibleKey: false,
|
visibleKey: false,
|
||||||
@@ -50,12 +52,11 @@ Alpine.data('popup', () => ({
|
|||||||
|
|
||||||
async getNsecKey() {
|
async getNsecKey() {
|
||||||
this.privKey = await browser.runtime.sendMessage({kind: 'getNsecKey'});
|
this.privKey = await browser.runtime.sendMessage({kind: 'getNsecKey'});
|
||||||
console.log('privKey: ', this.privKey);
|
this.pristinePrivKey = this.privKey;
|
||||||
},
|
},
|
||||||
|
|
||||||
async getNpubKey() {
|
async getNpubKey() {
|
||||||
this.pubKey = await browser.runtime.sendMessage({kind: 'getNpubKey'});
|
this.pubKey = await browser.runtime.sendMessage({kind: 'getNpubKey'});
|
||||||
console.log('pubKey: ', this.pubKey);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async getHosts() {
|
async getHosts() {
|
||||||
@@ -64,17 +65,15 @@ Alpine.data('popup', () => ({
|
|||||||
|
|
||||||
async getProfileNames() {
|
async getProfileNames() {
|
||||||
this.profileNames = await browser.runtime.sendMessage({kind: 'getProfileNames'});
|
this.profileNames = await browser.runtime.sendMessage({kind: 'getProfileNames'});
|
||||||
console.log('Profile Names: ', this.profileNames);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async getName() {
|
async getName() {
|
||||||
this.name = await browser.runtime.sendMessage({kind: 'getName'});
|
this.name = await browser.runtime.sendMessage({kind: 'getName'});
|
||||||
console.log('Name: ', this.name);
|
this.pristineName = this.name;
|
||||||
},
|
},
|
||||||
|
|
||||||
async getProfileIndex() {
|
async getProfileIndex() {
|
||||||
this.profileIndex = await browser.runtime.sendMessage({kind: 'getProfileIndex'});
|
this.profileIndex = await browser.runtime.sendMessage({kind: 'getProfileIndex'});
|
||||||
console.log('Profile Index: ', this.profileIndex);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async newProfile() {
|
async newProfile() {
|
||||||
@@ -107,6 +106,10 @@ Alpine.data('popup', () => ({
|
|||||||
get hasValidPubKey() {
|
get hasValidPubKey() {
|
||||||
return typeof(this.pubKey) === 'string' && this.pubKey.length > 0;
|
return typeof(this.pubKey) === 'string' && this.pubKey.length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get needsSaving() {
|
||||||
|
return (this.privKey !== this.pristinePrivKey || this.name !== this.pristineName);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user