diff --git a/package-lock.json b/package-lock.json index e2f7f18a9..a609304b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "vue-router": "^4.2.5", "vue2-dropzone": "^3.6.0", "vuex": "^4.1.0", - "webitel-sdk": "^23.12.18" + "webitel-sdk": "^23.12.24" }, "devDependencies": { "@vitejs/plugin-vue": "^4.4.0", @@ -8236,9 +8236,9 @@ } }, "node_modules/webitel-sdk": { - "version": "23.12.20", - "resolved": "https://registry.npmjs.org/webitel-sdk/-/webitel-sdk-23.12.20.tgz", - "integrity": "sha512-CrmHrj94xiGHkOXnn9SFsxhiMVR4vgI6TjTDtBdHTSbHtbfrqS5J8aypd2qzNR7Gi+WRHOVVP6tJFjYtPUBMYg==", + "version": "23.12.24", + "resolved": "https://registry.npmjs.org/webitel-sdk/-/webitel-sdk-23.12.24.tgz", + "integrity": "sha512-u1h6yXmdvGLv2QSFjle634vWPpFthlh6DOunjjuULeKvXmRueJUnEqXQrPM/44bPpxSm8ElEilaZAI7S6mGyIg==", "dependencies": { "@types/webrtc": "~0.0.41", "deep-copy": "1.4.2", @@ -13953,9 +13953,9 @@ "dev": true }, "webitel-sdk": { - "version": "23.12.20", - "resolved": "https://registry.npmjs.org/webitel-sdk/-/webitel-sdk-23.12.20.tgz", - "integrity": "sha512-CrmHrj94xiGHkOXnn9SFsxhiMVR4vgI6TjTDtBdHTSbHtbfrqS5J8aypd2qzNR7Gi+WRHOVVP6tJFjYtPUBMYg==", + "version": "23.12.24", + "resolved": "https://registry.npmjs.org/webitel-sdk/-/webitel-sdk-23.12.24.tgz", + "integrity": "sha512-u1h6yXmdvGLv2QSFjle634vWPpFthlh6DOunjjuULeKvXmRueJUnEqXQrPM/44bPpxSm8ElEilaZAI7S6mGyIg==", "requires": { "@types/webrtc": "~0.0.41", "deep-copy": "1.4.2", diff --git a/package.json b/package.json index 4d8a5e30c..e4bc1d7db 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "vue-router": "^4.2.5", "vue2-dropzone": "^3.6.0", "vuex": "^4.1.0", - "webitel-sdk": "^23.12.18" + "webitel-sdk": "^23.12.24" }, "devDependencies": { "@vitejs/plugin-vue": "^4.4.0", diff --git a/src/app/mixins/baseMixins/baseObjectMixin/baseObjectMixin.js b/src/app/mixins/baseMixins/baseObjectMixin/baseObjectMixin.js index 72422fc56..173f22553 100644 --- a/src/app/mixins/baseMixins/baseObjectMixin/baseObjectMixin.js +++ b/src/app/mixins/baseMixins/baseObjectMixin/baseObjectMixin.js @@ -23,7 +23,10 @@ export default { }, disabledSave() { - console.log('this.checkValidations():', this.checkValidations()); + console.log('this.checkValidations():', this.checkValidations(), + 'this.itemInstance._dirty:', this.itemInstance._dirty, + '!this.itemInstance._dirty && !!this.id:', !this.itemInstance._dirty && !!this.id, + 'itemInstance:', this.itemInstance); // if there's a validation problem // OR it's edit and any fields haven't changed return this.checkValidations() || diff --git a/src/modules/system/modules/global-variables/api/global-variables.js b/src/modules/system/modules/global-variables/api/global-variables.js index 882b9ca88..e565b63ae 100644 --- a/src/modules/system/modules/global-variables/api/global-variables.js +++ b/src/modules/system/modules/global-variables/api/global-variables.js @@ -5,7 +5,6 @@ import { import applyTransform, { camelToSnake, merge, - mergeEach, notify, sanitize, snakeToCamel, @@ -68,7 +67,6 @@ const get = async ({ itemId: id }) => { const fieldsToSend = ['id', 'name', 'value', 'encrypt']; const add = async ({itemInstance}) => { - console.log('add API:', itemInstance) const item = applyTransform(itemInstance, [ sanitize(fieldsToSend), camelToSnake(), @@ -86,12 +84,10 @@ const add = async ({itemInstance}) => { }; const update = async ({ itemInstance, itemId: id }) => { - console.log('update API id:', id, 'itemInstance:', itemInstance); const item = applyTransform(itemInstance, [ sanitize(fieldsToSend), camelToSnake(), ]); - console.log('update API item:', item); try { const response = await service.updateSchemaVariable(id, item); return applyTransform(response.data, [ @@ -104,8 +100,24 @@ const update = async ({ itemInstance, itemId: id }) => { } }; +const patch = async ({ id, changes }) => { + const body = applyTransform(changes, [ + sanitize(fieldsToSend), + camelToSnake(), + ]); + try { + const response = await service.patchSchemaVariable(id, body); + return applyTransform(response.data, [ + snakeToCamel(), + ]); + } catch (err) { + throw applyTransform(err, [ + notify, + ]); + } +}; + const deleteItem = async ({ id }) => { - console.log('deleteItem id:', id); try { const response = await service.deleteSchemaVariable(id); return applyTransform(response.data, []); @@ -127,6 +139,7 @@ const GlobalVariablesAPI = { get, add, update, + patch, delete: deleteItem, getLookup, }; diff --git a/src/modules/system/modules/global-variables/components/global-variables-popup.vue b/src/modules/system/modules/global-variables/components/global-variables-popup.vue index 8f458cfb7..471aa0cf0 100644 --- a/src/modules/system/modules/global-variables/components/global-variables-popup.vue +++ b/src/modules/system/modules/global-variables/components/global-variables-popup.vue @@ -17,7 +17,6 @@ :label="$t('objects.key')" required /> - isSwitcherOn: {{ isSwitcherOn }} inputType: {{ inputType }} !item.id), + $autoDirty: true }, + encrypt: { $autoDirty: true } }, }, - computed: { - // isSwitcherOn() { - // return (this.id && this.itemInstance.encrypt); - // } - }, + computed: {}, methods: { async save() { + if (!this.disabledSave) { if (this.id) { await this.updateItem(); } else { @@ -101,6 +99,7 @@ export default { } } this.close(); + } }, async loadPageData() { try { diff --git a/src/modules/system/modules/global-variables/components/the-global-variables.vue b/src/modules/system/modules/global-variables/components/the-global-variables.vue index 5735a0d7f..6c7b9c23d 100644 --- a/src/modules/system/modules/global-variables/components/the-global-variables.vue +++ b/src/modules/system/modules/global-variables/components/the-global-variables.vue @@ -84,13 +84,13 @@ {{ item.name }}