diff --git a/fe/src/components/base/ButtonComp.vue b/fe/src/components/base/ButtonComp.vue index bcb1608..8d6b264 100644 --- a/fe/src/components/base/ButtonComp.vue +++ b/fe/src/components/base/ButtonComp.vue @@ -12,7 +12,7 @@ diff --git a/fe/src/components/macros/parts/RecorderFooter.vue b/fe/src/components/macros/parts/RecorderFooter.vue index d628217..6ddafa8 100644 --- a/fe/src/components/macros/parts/RecorderFooter.vue +++ b/fe/src/components/macros/parts/RecorderFooter.vue @@ -3,7 +3,6 @@ Reset @@ -20,10 +19,10 @@

Are you sure you want to overwrite:

{{ macroRecorder.macroName }}

- No - Yes + Yes
@@ -33,7 +32,6 @@ v-if="macroRecorder.steps.length > 0" :disabled="macroRecorder.state.record || macroRecorder.state.edit" variant="success" - size="sm" @click="startCheck()" > @@ -65,7 +63,7 @@ onMounted(() => { }) const startCheck = async () => { - const checkResp = await macroRecorder.check() + const checkResp = await macroRecorder.checkMacro() if (checkResp) overwriteDialog.value.toggleDialog(true) else saveMacro() @@ -74,7 +72,7 @@ const startCheck = async () => { const saveMacro = async () => { overwriteDialog.value.toggleDialog(false) - const saveResp = await macroRecorder.save() + const saveResp = await macroRecorder.saveMacro() if (!saveResp) errorDialog.value.toggleDialog(true) else window.location.reload() diff --git a/fe/src/components/macros/parts/RecorderHeader.vue b/fe/src/components/macros/parts/RecorderHeader.vue index 045500a..e6fc90f 100644 --- a/fe/src/components/macros/parts/RecorderHeader.vue +++ b/fe/src/components/macros/parts/RecorderHeader.vue @@ -76,8 +76,6 @@ onUpdated(() => { }) function changeName(name) { - console.log(name) - macroRecorder.changeName(name) nameSet.value = name.length > 0 } diff --git a/fe/src/stores/macrorecorder.js b/fe/src/stores/macrorecorder.js index ae05783..f5b4d10 100644 --- a/fe/src/stores/macrorecorder.js +++ b/fe/src/stores/macrorecorder.js @@ -74,8 +74,6 @@ export const useMacroRecorderStore = defineStore('macrorecorder', () => { if (key !== false) steps.value[key] = stepVal else steps.value.push(stepVal) - - console.log(steps.value) } const recordDelay = () => { @@ -167,15 +165,16 @@ export const useMacroRecorderStore = defineStore('macrorecorder', () => { state.value.editDelay = false } - const reset = () => { + const resetMacro = () => { state.value.record = false delay.value.start = 0 + macroName.value = '' steps.value = [] if (state.value.edit) resetEdit() } - const check = async () => { + const checkMacro = async () => { const resp = await axios.post(appUrl() + '/macro/check', { macro: macroName.value, }) @@ -183,7 +182,7 @@ export const useMacroRecorderStore = defineStore('macrorecorder', () => { return resp.data } - const save = async () => { + const saveMacro = async () => { state.value.validationErrors = invalidMacro(steps.value) if (state.value.validationErrors) return false @@ -196,15 +195,22 @@ export const useMacroRecorderStore = defineStore('macrorecorder', () => { return resp.status == 200 } - const open = async (macroFileName, name) => { + const deleteMacro = async (macroFilename) => { + const resp = await axios.post(appUrl() + '/macro/delete', { + macro: macroFilename, + }) + + if (resp.status == 200) return resp.data + else return false + } + + const openMacro = async (macroFileName, name) => { const openResp = await axios.post(appUrl() + '/macro/open', { macro: macroFileName, }) if (openResp.data) steps.value = translateJSON(openResp.data) - // console.log(macroName) - macroName.value = name } @@ -224,9 +230,10 @@ export const useMacroRecorderStore = defineStore('macrorecorder', () => { changeDelay, toggleEdit, resetEdit, - reset, - check, - save, - open, + resetMacro, + checkMacro, + saveMacro, + deleteMacro, + openMacro, } })