From 0738ad1c1507e8422bc41a8501392e7c4cc6f26f Mon Sep 17 00:00:00 2001 From: liyasthomas Date: Wed, 11 Aug 2021 16:57:40 +0530 Subject: [PATCH] refactor: better toast messages + minor ui improvements --- components/app/Header.vue | 6 +- components/app/Search.vue | 1 - components/collections/Add.vue | 4 +- components/collections/AddFolder.vue | 4 +- components/collections/Edit.vue | 4 +- components/collections/EditFolder.vue | 4 +- components/collections/EditRequest.vue | 4 +- components/collections/ImportExport.vue | 24 +-- components/collections/graphql/Add.vue | 4 +- components/collections/graphql/Edit.vue | 4 +- components/collections/graphql/EditFolder.vue | 4 +- .../collections/graphql/EditRequest.vue | 4 +- .../collections/graphql/ImportExport.vue | 10 +- components/collections/graphql/Request.vue | 5 - components/collections/index.vue | 72 ++++----- components/collections/teams/Folder.vue | 14 +- components/environments/Add.vue | 4 +- components/environments/Edit.vue | 17 +-- components/environments/ImportExport.vue | 10 +- components/firebase/Login.vue | 23 +-- components/firebase/Logout.vue | 5 +- components/graphql/QueryEditor.vue | 2 +- components/graphql/RequestOptions.vue | 26 ++-- components/http/BodyParameters.vue | 2 + components/http/Headers.vue | 2 + components/http/ImportCurl.vue | 4 +- components/http/Parameters.vue | 2 + components/http/RawBody.vue | 1 + components/realtime/Mqtt.vue | 8 +- components/realtime/Socketio.vue | 10 +- components/realtime/Sse.vue | 8 +- components/realtime/Websocket.vue | 9 +- components/teams/Add.vue | 10 +- components/teams/Edit.vue | 142 ++++++++++-------- components/teams/Team.vue | 18 +-- helpers/GQLConnection.ts | 7 +- .../codegen/generators/javascript-fetch.js | 4 +- .../codegen/generators/javascript-jquery.js | 4 +- helpers/codegen/generators/nodejs-axios.js | 4 +- helpers/fb/auth.ts | 1 - helpers/fb/environments.ts | 1 - helpers/network.ts | 20 +-- helpers/oauth.js | 14 +- helpers/strategies/AxiosStrategy.js | 2 + helpers/ternlint.js | 8 +- helpers/utils/uri.js | 2 +- lang/en-US.json | 13 +- layouts/error.vue | 2 +- netlify/api.js | 4 +- newstore/GQLSession.ts | 3 +- pages/documentation.vue | 11 +- pages/enter.vue | 4 +- 52 files changed, 300 insertions(+), 275 deletions(-) diff --git a/components/app/Header.vue b/components/app/Header.vue index 8834b73ef..b0ab208c3 100644 --- a/components/app/Header.vue +++ b/components/app/Header.vue @@ -25,11 +25,7 @@ v-tippy="{ theme: 'tooltip' }" :url="currentUser.photoURL" :alt="currentUser.displayName" - :title=" - `${currentUser.displayName || 'Name not found'}` + - '
' + - `${currentUser.email || 'Email not found'}` - " + :title="currentUser.displayName" indicator :indicator-styles="isOnLine ? 'bg-green-500' : 'bg-red-500'" /> diff --git a/components/app/Search.vue b/components/app/Search.vue index d38eaa84f..9adaf600a 100644 --- a/components/app/Search.vue +++ b/components/app/Search.vue @@ -17,7 +17,6 @@ pt-2 pb-6 truncate - appearance-none focus:outline-none " /> diff --git a/components/collections/Add.vue b/components/collections/Add.vue index a93c72a54..d6f0a775c 100644 --- a/components/collections/Add.vue +++ b/components/collections/Add.vue @@ -38,7 +38,9 @@ export default { methods: { addNewCollection() { if (!this.name) { - this.$toast.info(this.$t("collection.invalid_name")) + this.$toast.info(this.$t("collection.invalid_name"), { + icon: "info", + }) return } this.$emit("submit", this.name) diff --git a/components/collections/AddFolder.vue b/components/collections/AddFolder.vue index 005ca5725..284fbf64d 100644 --- a/components/collections/AddFolder.vue +++ b/components/collections/AddFolder.vue @@ -45,7 +45,9 @@ export default { methods: { addFolder() { if (!this.name) { - this.$toast.info(this.$t("collection.invalid_name")) + this.$toast.info(this.$t("collection.invalid_name"), { + icon: "info", + }) return } this.$emit("add-folder", { diff --git a/components/collections/Edit.vue b/components/collections/Edit.vue index 9f7edce35..3950ea159 100644 --- a/components/collections/Edit.vue +++ b/components/collections/Edit.vue @@ -39,7 +39,9 @@ export default { methods: { saveCollection() { if (!this.name) { - this.$toast.info(this.$t("collection.invalid_name")) + this.$toast.info(this.$t("collection.invalid_name"), { + icon: "info", + }) return } this.$emit("submit", this.name) diff --git a/components/collections/EditFolder.vue b/components/collections/EditFolder.vue index d68c7cc80..42ad127d3 100644 --- a/components/collections/EditFolder.vue +++ b/components/collections/EditFolder.vue @@ -42,7 +42,9 @@ export default { methods: { editFolder() { if (!this.name) { - this.$toast.info(this.$t("collection.invalid_name")) + this.$toast.info(this.$t("collection.invalid_name"), { + icon: "info", + }) return } this.$emit("submit", this.name) diff --git a/components/collections/EditRequest.vue b/components/collections/EditRequest.vue index fddbd0b45..8e3b376be 100644 --- a/components/collections/EditRequest.vue +++ b/components/collections/EditRequest.vue @@ -41,7 +41,9 @@ export default { methods: { saveRequest() { if (!this.requestUpdateData.name) { - this.$toast.info(this.$t("collection.invalid_name")) + this.$toast.info(this.$t("collection.invalid_name"), { + icon: "info", + }) return } this.$emit("submit", this.requestUpdateData) diff --git a/components/collections/ImportExport.vue b/components/collections/ImportExport.vue index d95c1d639..74c710a50 100644 --- a/components/collections/ImportExport.vue +++ b/components/collections/ImportExport.vue @@ -219,11 +219,11 @@ export default { }) window.open(res.html_url) }) - .catch((error) => { - this.$toast.error(this.$t("something_went_wrong"), { + .catch((e) => { + this.$toast.error(this.$t("error.something_went_wrong"), { icon: "error", }) - console.log(error) + console.error(e) }) }, async readCollectionGist() { @@ -240,9 +240,9 @@ export default { setRESTCollections(collections) this.fileImported() }) - .catch((error) => { + .catch((e) => { this.failedImport() - console.log(error) + console.error(e) }) }, hideModal() { @@ -292,8 +292,8 @@ export default { this.failedImport() } }) - .catch((error) => { - console.log(error) + .catch((e) => { + console.error(e) this.failedImport() }) } else { @@ -346,8 +346,8 @@ export default { this.failedImport() } }) - .catch((error) => { - console.log(error) + .catch((e) => { + console.error(e) this.failedImport() }) } else { @@ -373,8 +373,8 @@ export default { this.failedImport() } }) - .catch((error) => { - console.log(error) + .catch((e) => { + console.error(e) this.failedImport() }) }, @@ -409,7 +409,7 @@ export default { }, 1000) }, fileImported() { - this.$toast.info(this.$t("file_imported"), { + this.$toast.success(this.$t("file_imported"), { icon: "folder_shared", }) }, diff --git a/components/collections/graphql/Add.vue b/components/collections/graphql/Add.vue index 7be91b996..569a442e9 100644 --- a/components/collections/graphql/Add.vue +++ b/components/collections/graphql/Add.vue @@ -41,7 +41,9 @@ export default Vue.extend({ methods: { addNewCollection() { if (!this.name) { - this.$toast.info(this.$t("collection.invalid_name").toString()) + this.$toast.info(this.$t("collection.invalid_name").toString(), { + icon: "info", + }) return } diff --git a/components/collections/graphql/Edit.vue b/components/collections/graphql/Edit.vue index 9bfd9cc37..08631e611 100644 --- a/components/collections/graphql/Edit.vue +++ b/components/collections/graphql/Edit.vue @@ -43,7 +43,9 @@ export default Vue.extend({ methods: { saveCollection() { if (!this.name) { - this.$toast.info(this.$t("collection.invalid_name").toString()) + this.$toast.info(this.$t("collection.invalid_name").toString(), { + icon: "info", + }) return } const collectionUpdated = { diff --git a/components/collections/graphql/EditFolder.vue b/components/collections/graphql/EditFolder.vue index 36ca02975..f6494882b 100644 --- a/components/collections/graphql/EditFolder.vue +++ b/components/collections/graphql/EditFolder.vue @@ -47,7 +47,9 @@ export default Vue.extend({ methods: { editFolder() { if (!this.name) { - this.$toast.info(this.$t("collection.invalid_name").toString()) + this.$toast.info(this.$t("collection.invalid_name").toString(), { + icon: "info", + }) return } editGraphqlFolder(this.folderPath, { ...this.folder, name: this.name }) diff --git a/components/collections/graphql/EditRequest.vue b/components/collections/graphql/EditRequest.vue index 9e5c584da..f90c59bcd 100644 --- a/components/collections/graphql/EditRequest.vue +++ b/components/collections/graphql/EditRequest.vue @@ -46,7 +46,9 @@ export default Vue.extend({ methods: { saveRequest() { if (!this.requestUpdateData.name) { - this.$toast.info(this.$t("collection.invalid_name").toString()) + this.$toast.info(this.$t("collection.invalid_name").toString(), { + icon: "info", + }) return } const requestUpdated = { diff --git a/components/collections/graphql/ImportExport.vue b/components/collections/graphql/ImportExport.vue index 2370444f4..8ca0e513d 100644 --- a/components/collections/graphql/ImportExport.vue +++ b/components/collections/graphql/ImportExport.vue @@ -138,11 +138,11 @@ export default { }) window.open(res.html_url) }) - .catch((error) => { - this.$toast.error(this.$t("something_went_wrong"), { + .catch((e) => { + this.$toast.error(this.$t("error.something_went_wrong"), { icon: "error", }) - console.log(error) + console.error(e) }) }, async readCollectionGist() { @@ -159,9 +159,9 @@ export default { setGraphqlCollections(collections) this.fileImported() }) - .catch((error) => { + .catch((e) => { this.failedImport() - console.log(error) + console.error(e) }) }, hideModal() { diff --git a/components/collections/graphql/Request.vue b/components/collections/graphql/Request.vue index 3c93e6241..ed8200e59 100644 --- a/components/collections/graphql/Request.vue +++ b/components/collections/graphql/Request.vue @@ -133,12 +133,7 @@ export default Vue.extend({ selectRequest() { if (this.savingMode) { this.pick() - return } - - this.$store.commit("postwoman/selectGraphqlRequest", { - request: this.request, - }) }, dragStart({ dataTransfer }: any) { this.dragging = !this.dragging diff --git a/components/collections/index.vue b/components/collections/index.vue index 90adb7dd3..4b8b524fe 100644 --- a/components/collections/index.vue +++ b/components/collections/index.vue @@ -333,11 +333,11 @@ export default { icon: "done", }) }) - .catch((error) => { - this.$toast.error(this.$t("error_occurred"), { - icon: "done", + .catch((e) => { + this.$toast.error(this.$t("error.something_went_wrong"), { + icon: "error", }) - console.error(error) + console.error(e) }) } this.displayModalAdd(false) @@ -345,7 +345,9 @@ export default { // Intented to be called by CollectionEdit modal submit event updateEditingCollection(newName) { if (!newName) { - this.$toast.info(this.$t("collection.invalid_name")) + this.$toast.info(this.$t("collection.invalid_name"), { + icon: "info", + }) return } if (this.collectionsType.type === "my-collections") { @@ -367,11 +369,11 @@ export default { icon: "done", }) }) - .catch((error) => { - this.$toast.error(this.$t("error_occurred"), { - icon: "done", + .catch((e) => { + this.$toast.error(this.$t("error.something_went_wrong"), { + icon: "error", }) - console.error(error) + console.error(e) }) } this.displayModalEdit(false) @@ -387,17 +389,15 @@ export default { teamUtils .renameCollection(this.$apollo, name, this.editingFolder.id) .then(() => { - // Result this.$toast.success(this.$t("folder.renamed"), { icon: "done", }) }) - .catch((error) => { - // Error - this.$toast.error(this.$t("error_occurred"), { - icon: "done", + .catch((e) => { + this.$toast.error(this.$t("error.something_went_wrong"), { + icon: "error", }) - console.error(error) + console.error(e) }) } @@ -434,11 +434,11 @@ export default { }) this.$emit("update-team-collections") }) - .catch((error) => { - this.$toast.error(this.$t("error_occurred"), { - icon: "done", + .catch((e) => { + this.$toast.error(this.$t("error.something_went_wrong"), { + icon: "error", }) - console.error(error) + console.error(e) }) } @@ -502,18 +502,16 @@ export default { }, }) .then(() => { - // Result this.$toast.success(this.$t("folder.created"), { icon: "done", }) this.$emit("update-team-collections") }) - .catch((error) => { - // Error - this.$toast.error(this.$t("error_occurred"), { - icon: "done", + .catch((e) => { + this.$toast.error(this.$t("error.something_went_wrong"), { + icon: "error", }) - console.error(error) + console.error(e) }) } } @@ -605,17 +603,15 @@ export default { }, }) .then(() => { - // Result - this.$toast.success(this.$t("deleted"), { + this.$toast.error(this.$t("deleted"), { icon: "delete", }) }) - .catch((error) => { - // Error - this.$toast.error(this.$t("error_occurred"), { - icon: "done", + .catch((e) => { + this.$toast.error(this.$t("error.something_went_wrong"), { + icon: "error", }) - console.error(error) + console.error(e) }) } } @@ -649,17 +645,15 @@ export default { teamUtils .deleteRequest(this.$apollo, requestIndex) .then(() => { - // Result - this.$toast.success(this.$t("deleted"), { + this.$toast.error(this.$t("deleted"), { icon: "delete", }) }) - .catch((error) => { - // Error - this.$toast.error(this.$t("error_occurred"), { - icon: "done", + .catch((e) => { + this.$toast.error(this.$t("error.something_went_wrong"), { + icon: "error", }) - console.error(error) + console.error(e) }) } }, diff --git a/components/collections/teams/Folder.vue b/components/collections/teams/Folder.vue index 01ead93be..eec9a1465 100644 --- a/components/collections/teams/Folder.vue +++ b/components/collections/teams/Folder.vue @@ -32,7 +32,7 @@ v-tippy="{ theme: 'tooltip' }" icon="create_new_folder" :title="$t('folder.new')" - class="group-hover:inline-flex hidden" + class="hidden group-hover:inline-flex" @click.native="$emit('add-folder', { folder, path: folderPath })" /> { - // Result - this.$toast.success(this.$t("deleted"), { + this.$toast.error(this.$t("deleted"), { icon: "delete", }) this.$emit("update-team-collections") }) - .catch((error) => { - // Error - this.$toast.error(this.$t("error_occurred"), { - icon: "done", + .catch((e) => { + this.$toast.error(this.$t("error.something_went_wrong"), { + icon: "error", }) - console.error(error) + console.error(e) }) this.$emit("update-team-collections") } diff --git a/components/environments/Add.vue b/components/environments/Add.vue index 2769949fc..4db1e13a5 100644 --- a/components/environments/Add.vue +++ b/components/environments/Add.vue @@ -41,7 +41,9 @@ export default Vue.extend({ methods: { addNewEnvironment() { if (!this.name) { - this.$toast.info(this.$t("invalid_environment_name").toString()) + this.$toast.info(this.$t("invalid_environment_name").toString(), { + icon: "info", + }) return } createEnvironment(this.name) diff --git a/components/environments/Edit.vue b/components/environments/Edit.vue index 50cf7eb70..0c7e463b7 100644 --- a/components/environments/Edit.vue +++ b/components/environments/Edit.vue @@ -17,7 +17,7 @@
-
-
+
{ - this.$toast.error(this.$t("something_went_wrong"), { + .catch((e) => { + this.$toast.error(this.$t("error.something_went_wrong"), { icon: "error", }) - console.log(error) + console.error(e) }) }, async readEnvironmentGist() { @@ -159,9 +159,9 @@ export default { replaceEnvironments(environments) this.fileImported() }) - .catch((error) => { + .catch((e) => { this.failedImport() - console.log(error) + console.error(e) }) }, hideModal() { diff --git a/components/firebase/Login.vue b/components/firebase/Login.vue index c71c581f2..55afe7120 100644 --- a/components/firebase/Login.vue +++ b/components/firebase/Login.vue @@ -183,16 +183,16 @@ export default { } this.showLoginSuccess() - } catch (err) { - console.log(err) + } catch (e) { + console.error(e) // An error happened. - if (err.code === "auth/account-exists-with-different-credential") { + if (e.code === "auth/account-exists-with-different-credential") { // Step 2. // User's email already exists. // The pending Google credential. - const pendingCred = err.credential + const pendingCred = e.credential // The provider account's email address. - const email = err.email + const email = e.email // Get sign-in methods for this email. const methods = await getSignInMethodsForEmail(email) @@ -259,16 +259,16 @@ export default { } this.showLoginSuccess() - } catch (err) { - console.log(err) + } catch (e) { + console.error(e) // An error happened. - if (err.code === "auth/account-exists-with-different-credential") { + if (e.code === "auth/account-exists-with-different-credential") { // Step 2. // User's email already exists. // The pending Google credential. - const pendingCred = err.credential + const pendingCred = e.credential // The provider account's email address. - const email = err.email + const email = e.email // Get sign-in methods for this email. const methods = await getSignInMethodsForEmail(email) @@ -322,7 +322,8 @@ export default { this.mode = "email-sent" setLocalConfig("emailForSignIn", this.form.email) }) - .catch((error) => { + .catch((e) => { + console.error(e) this.$toast.error(error.message, { icon: "error", }) diff --git a/components/firebase/Logout.vue b/components/firebase/Logout.vue index 41515f8f1..b72c45db4 100644 --- a/components/firebase/Logout.vue +++ b/components/firebase/Logout.vue @@ -35,8 +35,9 @@ export default Vue.extend({ this.$toast.info(this.$t("logged_out").toString(), { icon: "vpn_key", }) - } catch (err) { - this.$toast.show(err.message || err, { + } catch (e) { + console.error(e) + this.$toast.error(this.$t("error.something_went_wrong").toString(), { icon: "error", }) } diff --git a/components/graphql/QueryEditor.vue b/components/graphql/QueryEditor.vue index a81eaef7f..84838a9b2 100644 --- a/components/graphql/QueryEditor.vue +++ b/components/graphql/QueryEditor.vue @@ -171,7 +171,7 @@ export default { try { this.$emit("update-query", gql.print(gql.parse(this.editor.getValue()))) } catch (e) { - this.$toast.error(`${this.$t("gql_prettify_invalid_query")}`, { + this.$toast.error(this.$t("gql_prettify_invalid_query"), { icon: "error", }) } diff --git a/components/graphql/RequestOptions.vue b/components/graphql/RequestOptions.vue index c5bf351de..4e53d4725 100644 --- a/components/graphql/RequestOptions.vue +++ b/components/graphql/RequestOptions.vue @@ -161,14 +161,15 @@ :value="header.key" autofocus styles=" - bg-primaryLight - flex - font-semibold font-mono - flex-1 - py-2 - px-4 - focus:outline-none - " + bg-primaryLight + flex + font-semibold font-mono + flex-1 + py-2 + px-4 + truncate + focus:outline-none + " @input=" updateGQLHeader(index, { key: $event, @@ -185,6 +186,7 @@ w-full py-2 px-4 + truncate focus:outline-none " :placeholder="$t('count.value', { count: index + 1 })" @@ -389,14 +391,14 @@ export default defineComponent({ $toast.success(t("finished_in", { duration }).toString(), { icon: "done", }) - } catch (error: any) { - response.value = `${error}. ${t("check_console_details")}` + } catch (e: any) { + response.value = `${e}. ${t("error.check_console_details")}` nuxt.value.$loading.finish() - $toast.error(`${error} ${t("f12_details").toString()}`, { + $toast.error(`${e} ${t("f12_details").toString()}`, { icon: "error", }) - console.log("Error", error) + console.error(e) } logHoppRequestRunToAnalytics({ diff --git a/components/http/BodyParameters.vue b/components/http/BodyParameters.vue index a1c38b7b9..131972fcd 100644 --- a/components/http/BodyParameters.vue +++ b/components/http/BodyParameters.vue @@ -67,6 +67,7 @@ flex-1 py-2 px-4 + truncate focus:outline-none " :placeholder="$t('count.parameter', { count: index + 1 })" @@ -111,6 +112,7 @@ flex-1 py-2 px-4 + truncate focus:outline-none " :placeholder="$t('count.value', { count: index + 1 })" diff --git a/components/http/Headers.vue b/components/http/Headers.vue index 31bc01bb1..8c68793f7 100644 --- a/components/http/Headers.vue +++ b/components/http/Headers.vue @@ -50,6 +50,7 @@ flex-1 py-1 px-4 + truncate focus:outline-none " @input=" @@ -90,6 +91,7 @@ flex-1 py-2 px-4 + truncate focus:outline-none " :placeholder="$t('count.value', { count: index + 1 })" diff --git a/components/http/ImportCurl.vue b/components/http/ImportCurl.vue index e0cfb46e6..5ff988d6d 100644 --- a/components/http/ImportCurl.vue +++ b/components/http/ImportCurl.vue @@ -118,8 +118,8 @@ export default defineComponent({ }, }) ) - } catch (error) { - this.showCurlImportModal = false + } catch (e) { + console.error(e) this.$toast.error(this.$t("curl_invalid_format").toString(), { icon: "error", }) diff --git a/components/http/Parameters.vue b/components/http/Parameters.vue index 6de1b46c4..c5420b769 100644 --- a/components/http/Parameters.vue +++ b/components/http/Parameters.vue @@ -67,6 +67,7 @@ flex-1 py-2 px-4 + truncate focus:outline-none " :placeholder="$t('count.parameter', { count: index + 1 })" @@ -111,6 +112,7 @@ flex-1 py-2 px-4 + truncate focus:outline-none " :placeholder="$t('count.value', { count: index + 1 })" diff --git a/components/http/RawBody.vue b/components/http/RawBody.vue index 113673c40..f0fa2669c 100644 --- a/components/http/RawBody.vue +++ b/components/http/RawBody.vue @@ -118,6 +118,7 @@ export default defineComponent({ this.prettifyIcon = "done" setTimeout(() => (this.prettifyIcon = "photo_filter"), 1000) } catch (e) { + console.error(e) this.$toast.error(`${this.$t("json_prettify_invalid_body")}`, { icon: "error", }) diff --git a/components/realtime/Mqtt.vue b/components/realtime/Mqtt.vue index 84799d8aa..95b1f44e6 100644 --- a/components/realtime/Mqtt.vue +++ b/components/realtime/Mqtt.vue @@ -227,7 +227,7 @@ export default defineComponent({ this.connectingState = false this.connectionState = false this.log.push({ - payload: this.$t("error_occurred"), + payload: this.$t("error.something_went_wrong"), source: "info", color: "#ff5555", ts: new Date().toLocaleTimeString(), @@ -279,7 +279,7 @@ export default defineComponent({ icon: "sync_disabled", }) } else { - this.$toast.error(this.$t("something_went_wrong"), { + this.$toast.error(this.$t("error.something_went_wrong"), { icon: "error", }) } @@ -298,7 +298,7 @@ export default defineComponent({ } catch (e) { this.log.push({ payload: - this.$t("error_occurred") + + this.$t("error.something_went_wrong") + `while publishing msg: ${this.msg} to topic: ${this.pub_topic}`, source: "info", color: "#ff5555", @@ -322,7 +322,7 @@ export default defineComponent({ } catch (e) { this.log.push({ payload: - this.$t("error_occurred") + + this.$t("error.something_went_wrong") + `while subscribing to topic: ${this.sub_topic}`, source: "info", color: "#ff5555", diff --git a/components/realtime/Socketio.vue b/components/realtime/Socketio.vue index 29c1b0e9e..4263245a3 100644 --- a/components/realtime/Socketio.vue +++ b/components/realtime/Socketio.vue @@ -283,9 +283,9 @@ export default defineComponent({ icon: "sync_disabled", }) }) - } catch (ex) { - this.handleError(ex) - this.$toast.error(this.$t("something_went_wrong"), { + } catch (e) { + this.handleError(e) + this.$toast.error(this.$t("error.something_went_wrong"), { icon: "error", }) } @@ -302,7 +302,7 @@ export default defineComponent({ this.connectingState = false this.connectionState = false this.communication.log.push({ - payload: this.$t("error_occurred"), + payload: this.$t("error.something_went_wrong"), source: "info", color: "#ff5555", ts: new Date().toLocaleTimeString(), @@ -321,7 +321,7 @@ export default defineComponent({ .map((input) => { try { return JSON.parse(input) - } catch (err) { + } catch (e) { return input } }) diff --git a/components/realtime/Sse.vue b/components/realtime/Sse.vue index 59670f2c7..11544f3d6 100644 --- a/components/realtime/Sse.vue +++ b/components/realtime/Sse.vue @@ -182,9 +182,9 @@ export default { ts: new Date().toLocaleTimeString(), }) }) - } catch (ex) { - this.handleSSEError(ex) - this.$toast.error(this.$t("something_went_wrong"), { + } catch (e) { + this.handleSSEError(e) + this.$toast.error(this.$t("error.something_went_wrong"), { icon: "error", }) } @@ -207,7 +207,7 @@ export default { this.stop() this.connectionSSEState = false this.events.log.push({ - payload: this.$t("error_occurred"), + payload: this.$t("error.something_went_wrong"), source: "info", color: "#ff5555", ts: new Date().toLocaleTimeString(), diff --git a/components/realtime/Websocket.vue b/components/realtime/Websocket.vue index eb7a77747..5f9cbc0f6 100644 --- a/components/realtime/Websocket.vue +++ b/components/realtime/Websocket.vue @@ -91,6 +91,7 @@ flex-1 py-2 px-4 + truncate focus:outline-none " :placeholder="$t('count.protocol', { count: index + 1 })" @@ -322,9 +323,9 @@ export default defineComponent({ ts: new Date().toLocaleTimeString(), }) } - } catch (ex) { - this.handleError(ex) - this.$toast.error(this.$t("something_went_wrong"), { + } catch (e) { + this.handleError(e) + this.$toast.error(this.$t("error.something_went_wrong"), { icon: "error", }) } @@ -344,7 +345,7 @@ export default defineComponent({ this.disconnect() this.connectionState = false this.communication.log.push({ - payload: this.$t("error_occurred"), + payload: this.$t("error.something_went_wrong"), source: "info", color: "#ff5555", ts: new Date().toLocaleTimeString(), diff --git a/components/teams/Add.vue b/components/teams/Add.vue index c8e408f2d..f911ea864 100644 --- a/components/teams/Add.vue +++ b/components/teams/Add.vue @@ -44,7 +44,9 @@ export default { // We clear it early to give the UI a snappy feel this.name = "" if (!name) { - this.$toast.info(this.$t("empty.team_name")) + this.$toast.info(this.$t("empty.team_name"), { + icon: "info", + }) return } if (name !== null && name.replace(/\s/g, "").length < 6) { @@ -57,12 +59,10 @@ export default { teamUtils .createTeam(this.$apollo, name) .then(() => { - // Result this.hideModal() }) - .catch((error) => { - // Error - console.error(error) + .catch((e) => { + console.error(e) // We restore the initial user input this.name = name }) diff --git a/components/teams/Edit.vue b/components/teams/Edit.vue index 16dc2805d..8767fd782 100644 --- a/components/teams/Edit.vue +++ b/components/teams/Edit.vue @@ -2,37 +2,37 @@