ADD: Save feedback and dirtyState
This commit is contained in:
@@ -144,7 +144,7 @@
|
|||||||
: 'border-2'
|
: 'border-2'
|
||||||
"
|
"
|
||||||
class="app-titlebar-button"
|
class="app-titlebar-button"
|
||||||
@click="console.log('Save not implemented!')"
|
@click="deviceStore.saveChangesOnDevice"
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</MenubarButton>
|
</MenubarButton>
|
||||||
|
|||||||
@@ -117,9 +117,7 @@ export const useDeviceStore = defineStore('device', {
|
|||||||
name = `name (${index})`
|
name = `name (${index})`
|
||||||
}
|
}
|
||||||
nanoIpc.send(this.currentDeviceId!, JSON.stringify({ profile: name }))
|
nanoIpc.send(this.currentDeviceId!, JSON.stringify({ profile: name }))
|
||||||
setTimeout(() => {
|
this.selectProfile(name)
|
||||||
this.selectProfile(name)
|
|
||||||
}, 1000)
|
|
||||||
},
|
},
|
||||||
addProfile(profile: Profile, updateDevice: boolean = true) {
|
addProfile(profile: Profile, updateDevice: boolean = true) {
|
||||||
if (!this.profileNames.includes(profile.name)) {
|
if (!this.profileNames.includes(profile.name)) {
|
||||||
@@ -207,6 +205,13 @@ export const useDeviceStore = defineStore('device', {
|
|||||||
nanoIpc.disconnect(deviceId)
|
nanoIpc.disconnect(deviceId)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setDirtyState(dirty: boolean) {
|
||||||
|
this.dirtyState = dirty
|
||||||
|
},
|
||||||
|
saveChangesOnDevice() {
|
||||||
|
this.setDirtyState(true)
|
||||||
|
nanoIpc.send(this.currentDeviceId!, JSON.stringify({ save: true }))
|
||||||
|
},
|
||||||
setProfileNames(profileNames: string[], updateDevice: boolean = true) {
|
setProfileNames(profileNames: string[], updateDevice: boolean = true) {
|
||||||
this.profileNames = profileNames
|
this.profileNames = profileNames
|
||||||
if (updateDevice) {
|
if (updateDevice) {
|
||||||
@@ -287,6 +292,7 @@ export const initializeDevices = () => {
|
|||||||
messageCallbacks.forEach((callback) => callback('Error', dataString))
|
messageCallbacks.forEach((callback) => callback('Error', dataString))
|
||||||
}
|
}
|
||||||
if (eventid === 'saved') {
|
if (eventid === 'saved') {
|
||||||
|
deviceStore.setDirtyState(false)
|
||||||
messageCallbacks.forEach((callback) => callback('Saved', 'Changes saved to device'))
|
messageCallbacks.forEach((callback) => callback('Saved', 'Changes saved to device'))
|
||||||
}
|
}
|
||||||
if (eventid === 'device-attached') {
|
if (eventid === 'device-attached') {
|
||||||
|
|||||||
Reference in New Issue
Block a user