diff --git a/package.json b/package.json index 88d0167f..024a1ae9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yattie", - "version": "0.9.0", + "version": "0.9.1", "engines": { "npm": ">=8.0.0 <9.0.0", "node": ">=16.0.0 <17.0.0" diff --git a/src/background.js b/src/background.js index f2f3b6f1..5ae9bf96 100644 --- a/src/background.js +++ b/src/background.js @@ -25,7 +25,7 @@ databaseUtility.initializeSession(); const startupConfig = databaseUtility.getConfig(); if (startupConfig.devMode) { isDevelopment = true; - windowUtility.setDevMode({enabled: true}); + windowUtility.setDevMode({ enabled: true }); } // Scheme must be registered before the app is ready diff --git a/src/components/TestWrapper.vue b/src/components/TestWrapper.vue index 2fa6dfc9..6578fd05 100644 --- a/src/components/TestWrapper.vue +++ b/src/components/TestWrapper.vue @@ -271,7 +271,7 @@ export default { }, computed: { aiAssistEnabled() { - return this?.config?.aiAssist || false; + return this?.config?.ai?.enabled || false; }, currentTheme() { if (this.$vuetify.theme.dark) { diff --git a/src/components/dialogs/NoteDialog.vue b/src/components/dialogs/NoteDialog.vue index d4d2d41e..adbf8857 100644 --- a/src/components/dialogs/NoteDialog.vue +++ b/src/components/dialogs/NoteDialog.vue @@ -67,7 +67,6 @@ ? "mdi-robot-off-outline" : "mdi-robot-outline" }} - mdi-robot-outline @@ -281,7 +280,7 @@ export default { }, computed: { aiAssistEnabled() { - return this?.config?.aiAssist || false; + return this?.config?.ai?.enabled || false; }, currentTheme() { if (this.$vuetify.theme.dark) { diff --git a/src/components/dialogs/SummaryDialog.vue b/src/components/dialogs/SummaryDialog.vue index 1566b0f1..96e59373 100644 --- a/src/components/dialogs/SummaryDialog.vue +++ b/src/components/dialogs/SummaryDialog.vue @@ -189,7 +189,7 @@ export default { }, computed: { aiAssistEnabled() { - return this?.config?.aiAssist || false; + return this?.config?.ai?.enabled || false; }, currentTheme() { if (this.$vuetify.theme.dark) { diff --git a/src/components/jira/JiraAddIssue.vue b/src/components/jira/JiraAddIssue.vue index 9077471a..6b8741e3 100644 --- a/src/components/jira/JiraAddIssue.vue +++ b/src/components/jira/JiraAddIssue.vue @@ -377,19 +377,6 @@ - - {{ snackBar.message }} - - @@ -442,14 +429,13 @@ export default { newIssue: { fields: {}, }, + blankIssue: { + fields: {}, + }, valid: true, rules: [(v) => !!v || "This field is required"], dateMenu: false, issueConfirmDialog: false, - snackBar: { - enabled: false, - message: "", - }, fieldMappings: { description: { type: "text", @@ -485,6 +471,9 @@ export default { this.newIssue = { fields: {}, }; + this.blankIssue = { + fields: {}, + }; }, async handleSave() { const isValid = this.$refs.form.validate(); @@ -495,6 +484,36 @@ export default { const issueType = { id: this.issueTypeId, }; + + for (const [key, value] of Object.entries(this.newIssue.fields)) { + let thisField = this.issueFields.filter((field) => field.key === key); + if (thisField.length > 0) { + if ( + thisField[0]?.schema?.type === "number" && + value.constructor === String && + value.length > 0 + ) { + this.$set(this.newIssue.fields, key, parseFloat(value)); + } + if (value === this.blankIssue.fields[key]) { + if ( + !thisField[0]?.required && + (["number", "string"].includes(thisField[0]?.schema?.type) || + (thisField[0]?.schema?.type === "array" && + thisField[0]?.schema?.items === "json")) + // This second set of parameters are to filter JIRA fields + // like "Sprints" which need the data pulled from the api. + // I have removed Sprints from incoming fields though, so + // this may not be necessary. But it may prevent issues + // with similar fields in the future. + ) { + // Remove unrequired simple fields that haven't changed. + this.$delete(this.newIssue.fields, key); + } + } + } + } + this.$set(this.newIssue.fields, "project", project); this.$set(this.newIssue.fields, "issuetype", issueType); this.loading = true; @@ -506,10 +525,10 @@ export default { ); if (response?.error) { this.loading = false; - this.snackBar.enabled = true; - this.snackBar.message = response.error.message + let message = response.error.message ? response.error.message : this.$tc("message.api_error", 1); + this.$root.$emit("set-snackbar", message); if (response.error?.checkAuth) { this.$root.$emit("update-auth", []); } @@ -559,8 +578,8 @@ export default { } } } else { - this.snackBar.enabled = true; - this.snackBar.message = this.$tc("message.please_fill_required", 1); + let message = this.$tc("message.please_fill_required", 1); + this.$root.$emit("set-snackbar", message); } }, async showDialog() { @@ -600,10 +619,10 @@ export default { this.loading = false; if (response?.error) { - this.snackBar.enabled = true; - this.snackBar.message = response.error.message + let message = response.error.message ? response.error.message : this.$tc("message.api_error", 1); + this.$root.$emit("set-snackbar", message); if (response.error?.checkAuth) { this.$root.$emit("update-auth", []); } @@ -616,15 +635,16 @@ export default { this.projectId, this.issueTypeId ); - this.newIssue = response.blankIssue; + this.blankIssue.fields = Object.assign({}, response.blankIssue.fields); + this.newIssue = Object.assign({}, response.blankIssue); this.issueFields = response.fieldData; this.loading = false; if (response?.error) { - this.snackBar.enabled = true; - this.snackBar.message = response.error.message + let message = response.error.message ? response.error.message : this.$tc("message.api_error", 1); + this.$root.$emit("set-snackbar", message); if (response.error?.checkAuth) { this.$root.$emit("update-auth", []); } @@ -640,10 +660,10 @@ export default { this.userLoading = false; if (response?.error) { - this.snackBar.enabled = true; - this.snackBar.message = response.error.message + let message = response.error.message ? response.error.message : this.$tc("message.api_error", 1); + this.$root.$emit("set-snackbar", message); if (response.error?.checkAuth) { this.$root.$emit("update-auth", []); } @@ -659,10 +679,10 @@ export default { this.issueLoading = false; if (response?.error) { - this.snackBar.enabled = true; - this.snackBar.message = response.error.message + let message = response.error.message ? response.error.message : this.$tc("message.api_error", 1); + this.$root.$emit("set-snackbar", message); if (response.error?.checkAuth) { this.$root.$emit("update-auth", []); } diff --git a/src/components/settings/AddonsTab.vue b/src/components/settings/AddonsTab.vue index 7a7aa197..b9de21f9 100755 --- a/src/components/settings/AddonsTab.vue +++ b/src/components/settings/AddonsTab.vue @@ -33,7 +33,7 @@ solo :rules="[rules.rightLength, rules.noAsterisk]" :errorMessages="customErrors" - :disabled="!config.aiAssist" + :disabled="!config.ai.enabled" @focus="emptyKeyOnFocus" > @@ -45,7 +45,7 @@ color="white" class="text-capitalize" :style="{ color: currentTheme.black }" - :disabled="!config.aiAssist" + :disabled="!config?.ai?.enabled" @click="handleCancelOpenAIKey" > {{ $tc("caption.cancel", 1) }} @@ -57,7 +57,7 @@ block color="primary" class="text-capitalize" - :disabled="!config.aiAssist" + :disabled="!config?.ai?.enabled" @click="handleOpenAIKey" > {{ $tc("caption.save", 1) }} diff --git a/src/integrations/JiraIntegrationHelpers.js b/src/integrations/JiraIntegrationHelpers.js index 95a4c069..c63f2502 100644 --- a/src/integrations/JiraIntegrationHelpers.js +++ b/src/integrations/JiraIntegrationHelpers.js @@ -129,7 +129,7 @@ export default { }) .catch((error) => { returnResponse.error = { - message: error.message, + message: JSON.stringify(error.response.data.errors), }; if ( @@ -168,7 +168,7 @@ export default { }) .catch((error) => { returnResponse.error = { - message: error.message, + message: JSON.stringify(error.response.data.errors), }; if ( @@ -226,7 +226,7 @@ export default { }) .catch((error) => { returnResponse.error = { - message: error.message, + message: JSON.stringify(error.response.data.errors), }; if ( @@ -261,7 +261,7 @@ export default { }) .catch((error) => { returnResponse.error = { - message: error.message, + message: JSON.stringify(error.response.data.errors), }; if ( @@ -303,9 +303,14 @@ export default { item && item.key !== "issuetype" && item.key !== "project" && + item.name !== "Sprint" && item.schema.type !== "any" && !["attachment", "issuelinks"].includes(item.schema.system) ) { + // We exclude fields we will add back in later (projects) and + // those that need to have options pulled from the API separately + // (Sprints). We may want to renable the latter at some point + // and handle it in a generic way. returnResponse.fieldData.push(item); if (item.key === "reporter") { const reporter = { @@ -328,7 +333,7 @@ export default { }) .catch((error) => { returnResponse.error = { - message: error.message, + message: JSON.stringify(error.response.data.errors), }; if ( @@ -359,7 +364,7 @@ export default { let returnResponse = {}; await axios.post(url, formData, options).catch((error) => { returnResponse.error = { - message: error.message, + message: JSON.stringify(error.response.data.errors), }; if ( @@ -403,7 +408,7 @@ export default { }) .catch((error) => { returnResponse.error = { - message: error.message, + message: JSON.stringify(error.response.data.errors), }; if ( diff --git a/src/menu.js b/src/menu.js index 10858d6d..920259ef 100644 --- a/src/menu.js +++ b/src/menu.js @@ -71,18 +71,18 @@ const createMenu = (win) => { }, ], }, - //{ - // label: i18n.t("menu.edit"), - // submenu: [ - // { label: i18n.t("menu.undo"), accelerator: "Ctrl+Z" }, - // { label: i18n.t("menu.redo"), accelerator: "Ctrl+Shift+Z" }, - // { type: "separator" }, - // { label: i18n.t("menu.cut"), accelerator: "Ctrl+X" }, - // { label: i18n.t("menu.copy"), accelerator: "Ctrl+C" }, - // { label: i18n.t("menu.paste"), accelerator: "Ctrl+V" }, - // { label: i18n.t("menu.select_all"), accelerator: "Ctrl+A" }, - // ], - //}, + { + label: i18n.t("menu.edit"), + submenu: [ + { label: i18n.t("menu.undo"), accelerator: "CmdOrCtrl+Z", role: "undo" }, + { label: i18n.t("menu.redo"), accelerator: "CmdOrCtrl+Y", role: "redo" }, + { type: "separator" }, + { label: i18n.t("menu.cut"), accelerator: "CmdOrCtrl+X", role: "cut" }, + { label: i18n.t("menu.copy"), accelerator: "CmdOrCtrl+C", role: "copy" }, + { label: i18n.t("menu.paste"), accelerator: "CmdOrCtrl+V", role: "paste" }, + { label: i18n.t("menu.select_all"), accelerator: "CmdOrCtrl+A", role: "selectAll" }, + ], + }, { label: "Help", submenu: [ diff --git a/src/views/AddEvidence.vue b/src/views/AddEvidence.vue index 66558290..907c5c8e 100644 --- a/src/views/AddEvidence.vue +++ b/src/views/AddEvidence.vue @@ -266,7 +266,7 @@ export default { }, computed: { aiAssistEnabled() { - return this?.config?.aiAssist || false; + return this?.config?.ai?.enabled || false; }, fileSuffix() { let splitName = []; diff --git a/src/views/EditEvidence.vue b/src/views/EditEvidence.vue index f4ce81a3..67267af3 100644 --- a/src/views/EditEvidence.vue +++ b/src/views/EditEvidence.vue @@ -322,7 +322,7 @@ export default { }, computed: { aiAssistEnabled() { - return this?.config?.aiAssist || false; + return this?.config?.ai?.enabled || false; }, fileSuffix() { let splitName = [];