From 589a3776a53a0c0d975304e3575cd9c2136b6fd5 Mon Sep 17 00:00:00 2001 From: Andrea Leardini Date: Wed, 30 Jul 2025 13:15:29 +0200 Subject: [PATCH 01/28] fix: third party apps --- frontend/src/i18n/en/translation.json | 15 ++-- frontend/src/lib/thirdPartyApps.ts | 19 ++++- frontend/src/views/DashboardView.vue | 114 +------------------------- 3 files changed, 21 insertions(+), 127 deletions(-) diff --git a/frontend/src/i18n/en/translation.json b/frontend/src/i18n/en/translation.json index db3eaa0ed..d352fdf06 100644 --- a/frontend/src/i18n/en/translation.json +++ b/frontend/src/i18n/en/translation.json @@ -73,15 +73,7 @@ }, "dashboard": { "title": "Dashboard", - "welcome_user": "Welcome {user}", - "warehouse": "Warehouse", - "warehouse_description": "Check product inventory", - "nethshop": "NethShop", - "nethshop_description": "Browse and order Nethesis products", - "helpdesk": "Helpdesk", - "helpdesk_description": "Get support, open and manage tickets", - "training_portal": "Training portal", - "training_portal_description": "Access training materials and courses" + "welcome_user": "Welcome {user}" }, "distributors": { "title": "Distributors", @@ -208,7 +200,10 @@ "username_already_exists": "Username already exists" }, "third_party_apps": { - "description_example_company_com": "Description of Example app" + "description_nethshop_nethesis_it": "Browse and order Nethesis products and services.", + "description_my_nethspot_com": "Manage your hotspot devices.", + "description_stock_nethesis_it": "Check product inventory and manage stock.", + "description_helpdesk_nethesis_it": "Get support, open and manage tickets." }, "ne_text_input": { "show_password": "Show password", diff --git a/frontend/src/lib/thirdPartyApps.ts b/frontend/src/lib/thirdPartyApps.ts index 865eeeb20..8838fdb83 100644 --- a/frontend/src/lib/thirdPartyApps.ts +++ b/frontend/src/lib/thirdPartyApps.ts @@ -4,7 +4,13 @@ import axios from 'axios' import { API_URL } from './config' import { useLoginStore } from '@/stores/login' -import { faArrowUpRightFromSquare, faRocket } from '@fortawesome/free-solid-svg-icons' +import { + faArrowUpRightFromSquare, + faHeadset, + faShop, + faWarehouse, + faWifi, +} from '@fortawesome/free-solid-svg-icons' export type ThirdPartyApp = { id: string @@ -30,9 +36,14 @@ export const getThirdPartyApps = () => { export const getThirdPartyAppIcon = (thirdPartyApp: ThirdPartyApp) => { switch (thirdPartyApp.name) { - //// - case 'example.company.com': - return faRocket + case 'helpdesk.nethesis.it': + return faHeadset + case 'nethshop.nethesis.it': + return faShop + case 'my.nethspot.com': + return faWifi + case 'stock.nethesis.it': + return faWarehouse default: // fallback icon return faArrowUpRightFromSquare diff --git a/frontend/src/views/DashboardView.vue b/frontend/src/views/DashboardView.vue index 25afd898d..261e94dba 100644 --- a/frontend/src/views/DashboardView.vue +++ b/frontend/src/views/DashboardView.vue @@ -12,14 +12,7 @@ import { openThirdPartyApp, } from '@/lib/thirdPartyApps' import { useLoginStore } from '@/stores/login' -import { - faArrowUpRightFromSquare, - faCrown, - faGraduationCap, - faHeadset, - faShop, - faWarehouse, -} from '@fortawesome/free-solid-svg-icons' +import { faArrowUpRightFromSquare, faCrown } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' import { NeAvatar, @@ -76,111 +69,6 @@ const { state: thirdPartyApps } = useQuery({ - - - -
-
-
- - - {{ $t('dashboard.warehouse') }} - -
-

- {{ $t('dashboard.warehouse_description') }} -

-
- - - {{ $t('common.coming_soon') }} - -
-
- - -
-
-
- - - {{ $t('dashboard.nethshop') }} - -
-

- {{ $t('dashboard.nethshop_description') }} -

-
- - - {{ $t('common.coming_soon') }} - -
-
- - -
-
-
- - - {{ $t('dashboard.helpdesk') }} - -
-

- {{ $t('dashboard.helpdesk_description') }} -

-
- - - {{ $t('common.coming_soon') }} - -
-
- - -
-
-
- - - {{ $t('dashboard.training_portal') }} - -
-

- {{ $t('dashboard.training_portal_description') }} -

-
- - - {{ $t('common.coming_soon') }} - -
-
diff --git a/frontend/src/components/account/ProfilePanel.vue b/frontend/src/components/account/ProfilePanel.vue index 96030f781..21e9ae363 100644 --- a/frontend/src/components/account/ProfilePanel.vue +++ b/frontend/src/components/account/ProfilePanel.vue @@ -20,6 +20,7 @@ import type { AxiosError } from 'axios' import { ref, useTemplateRef, watch, type ShallowRef } from 'vue' import { useI18n } from 'vue-i18n' import * as v from 'valibot' +import { USERS_KEY } from '@/lib/users' const { t } = useI18n() const loginStore = useLoginStore() @@ -47,8 +48,7 @@ const { validationIssues.value = getValidationIssues(error as AxiosError, 'users') }, onSettled: () => { - queryCache.invalidateQueries({ key: ['authMe'] }) - queryCache.invalidateQueries({ key: ['users'] }) + queryCache.invalidateQueries({ key: [USERS_KEY] }) }, }) diff --git a/frontend/src/components/customers/CreateOrEditCustomerDrawer.vue b/frontend/src/components/customers/CreateOrEditCustomerDrawer.vue index 6a29fbed4..2e7652f3e 100644 --- a/frontend/src/components/customers/CreateOrEditCustomerDrawer.vue +++ b/frontend/src/components/customers/CreateOrEditCustomerDrawer.vue @@ -14,6 +14,8 @@ import { import { computed, ref, useTemplateRef, watch, type ShallowRef } from 'vue' import { CreateCustomerSchema, + CUSTOMERS_KEY, + CUSTOMERS_TOTAL_KEY, CustomerSchema, postCustomer, putCustomer, @@ -65,8 +67,10 @@ const { console.error('Error creating customer:', error) validationIssues.value = getValidationIssues(error as AxiosError, 'organizations') }, - - onSettled: () => queryCache.invalidateQueries({ key: ['customers'] }), + onSettled: () => { + queryCache.invalidateQueries({ key: [CUSTOMERS_KEY] }) + queryCache.invalidateQueries({ key: [CUSTOMERS_TOTAL_KEY] }) + }, }) const { @@ -95,8 +99,7 @@ const { onError: (error) => { console.error('Error editing customer:', error) }, - - onSettled: () => queryCache.invalidateQueries({ key: ['customers'] }), + onSettled: () => queryCache.invalidateQueries({ key: [CUSTOMERS_KEY] }), }) const name = ref('') diff --git a/frontend/src/components/customers/DeleteCustomerModal.vue b/frontend/src/components/customers/DeleteCustomerModal.vue index bc2309097..5e57368c9 100644 --- a/frontend/src/components/customers/DeleteCustomerModal.vue +++ b/frontend/src/components/customers/DeleteCustomerModal.vue @@ -8,7 +8,7 @@ import { NeInlineNotification } from '@nethesis/vue-components' import { NeModal } from '@nethesis/vue-components' import { useI18n } from 'vue-i18n' import { useMutation, useQueryCache } from '@pinia/colada' -import { deleteCustomer, type Customer } from '@/lib/customers' +import { CUSTOMERS_KEY, CUSTOMERS_TOTAL_KEY, deleteCustomer, type Customer } from '@/lib/customers' import { useNotificationsStore } from '@/stores/notifications' const { visible = false, customer = undefined } = defineProps<{ @@ -48,8 +48,10 @@ const { onError: (error) => { console.error('Error deleting customer:', error) }, - - onSettled: () => queryCache.invalidateQueries({ key: ['customers'] }), + onSettled: () => { + queryCache.invalidateQueries({ key: [CUSTOMERS_KEY] }) + queryCache.invalidateQueries({ key: [CUSTOMERS_TOTAL_KEY] }) + }, }) function onShow() { diff --git a/frontend/src/components/dashboard/CustomersCounterCard.vue b/frontend/src/components/dashboard/CustomersCounterCard.vue new file mode 100644 index 000000000..927b3f609 --- /dev/null +++ b/frontend/src/components/dashboard/CustomersCounterCard.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/frontend/src/components/dashboard/DistributorsCounterCard.vue b/frontend/src/components/dashboard/DistributorsCounterCard.vue new file mode 100644 index 000000000..3bd90024d --- /dev/null +++ b/frontend/src/components/dashboard/DistributorsCounterCard.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/frontend/src/components/dashboard/ResellersCounterCard.vue b/frontend/src/components/dashboard/ResellersCounterCard.vue new file mode 100644 index 000000000..1e213285b --- /dev/null +++ b/frontend/src/components/dashboard/ResellersCounterCard.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/frontend/src/components/dashboard/UsersCounterCard.vue b/frontend/src/components/dashboard/UsersCounterCard.vue new file mode 100644 index 000000000..5b50dad2a --- /dev/null +++ b/frontend/src/components/dashboard/UsersCounterCard.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/frontend/src/components/distributors/CreateOrEditDistributorDrawer.vue b/frontend/src/components/distributors/CreateOrEditDistributorDrawer.vue index 3e31042af..f47c56ac0 100644 --- a/frontend/src/components/distributors/CreateOrEditDistributorDrawer.vue +++ b/frontend/src/components/distributors/CreateOrEditDistributorDrawer.vue @@ -14,6 +14,8 @@ import { import { computed, ref, useTemplateRef, watch, type ShallowRef } from 'vue' import { CreateDistributorSchema, + DISTRIBUTORS_KEY, + DISTRIBUTORS_TOTAL_KEY, DistributorSchema, postDistributor, putDistributor, @@ -65,8 +67,10 @@ const { console.error('Error creating distributor:', error) validationIssues.value = getValidationIssues(error as AxiosError, 'organizations') }, - - onSettled: () => queryCache.invalidateQueries({ key: ['distributors'] }), + onSettled: () => { + queryCache.invalidateQueries({ key: [DISTRIBUTORS_KEY] }) + queryCache.invalidateQueries({ key: [DISTRIBUTORS_TOTAL_KEY] }) + }, }) const { @@ -95,8 +99,9 @@ const { onError: (error) => { console.error('Error editing distributor:', error) }, - - onSettled: () => queryCache.invalidateQueries({ key: ['distributors'] }), + onSettled: () => { + queryCache.invalidateQueries({ key: [DISTRIBUTORS_KEY] }) + }, }) const name = ref('') diff --git a/frontend/src/components/distributors/DeleteDistributorModal.vue b/frontend/src/components/distributors/DeleteDistributorModal.vue index d99403af1..5c828c9d7 100644 --- a/frontend/src/components/distributors/DeleteDistributorModal.vue +++ b/frontend/src/components/distributors/DeleteDistributorModal.vue @@ -8,7 +8,7 @@ import { NeInlineNotification } from '@nethesis/vue-components' import { NeModal } from '@nethesis/vue-components' import { useI18n } from 'vue-i18n' import { useMutation, useQueryCache } from '@pinia/colada' -import { deleteDistributor, type Distributor } from '@/lib/distributors' +import { deleteDistributor, DISTRIBUTORS_KEY, type Distributor } from '@/lib/distributors' import { useNotificationsStore } from '@/stores/notifications' const { visible = false, distributor = undefined } = defineProps<{ @@ -48,8 +48,7 @@ const { onError: (error) => { console.error('Error deleting distributor:', error) }, - - onSettled: () => queryCache.invalidateQueries({ key: ['distributors'] }), + onSettled: () => queryCache.invalidateQueries({ key: [DISTRIBUTORS_KEY] }), }) function onShow() { diff --git a/frontend/src/components/resellers/CreateOrEditResellerDrawer.vue b/frontend/src/components/resellers/CreateOrEditResellerDrawer.vue index be5148a33..d730dc977 100644 --- a/frontend/src/components/resellers/CreateOrEditResellerDrawer.vue +++ b/frontend/src/components/resellers/CreateOrEditResellerDrawer.vue @@ -14,6 +14,8 @@ import { import { computed, ref, useTemplateRef, watch, type ShallowRef } from 'vue' import { CreateResellerSchema, + RESELLERS_KEY, + RESELLERS_TOTAL_KEY, ResellerSchema, postReseller, putReseller, @@ -65,8 +67,10 @@ const { console.error('Error creating reseller:', error) validationIssues.value = getValidationIssues(error as AxiosError, 'organizations') }, - - onSettled: () => queryCache.invalidateQueries({ key: ['resellers'] }), + onSettled: () => { + queryCache.invalidateQueries({ key: [RESELLERS_KEY] }) + queryCache.invalidateQueries({ key: [RESELLERS_TOTAL_KEY] }) + }, }) const { @@ -95,8 +99,7 @@ const { onError: (error) => { console.error('Error editing reseller:', error) }, - - onSettled: () => queryCache.invalidateQueries({ key: ['resellers'] }), + onSettled: () => queryCache.invalidateQueries({ key: [RESELLERS_KEY] }), }) const name = ref('') diff --git a/frontend/src/components/resellers/DeleteResellerModal.vue b/frontend/src/components/resellers/DeleteResellerModal.vue index 0f5cfcbaa..ea8a89900 100644 --- a/frontend/src/components/resellers/DeleteResellerModal.vue +++ b/frontend/src/components/resellers/DeleteResellerModal.vue @@ -8,7 +8,7 @@ import { NeInlineNotification } from '@nethesis/vue-components' import { NeModal } from '@nethesis/vue-components' import { useI18n } from 'vue-i18n' import { useMutation, useQueryCache } from '@pinia/colada' -import { deleteReseller, type Reseller } from '@/lib/resellers' +import { deleteReseller, RESELLERS_KEY, RESELLERS_TOTAL_KEY, type Reseller } from '@/lib/resellers' import { useNotificationsStore } from '@/stores/notifications' const { visible = false, reseller = undefined } = defineProps<{ @@ -48,8 +48,10 @@ const { onError: (error) => { console.error('Error deleting reseller:', error) }, - - onSettled: () => queryCache.invalidateQueries({ key: ['resellers'] }), + onSettled: () => { + queryCache.invalidateQueries({ key: [RESELLERS_KEY] }) + queryCache.invalidateQueries({ key: [RESELLERS_TOTAL_KEY] }) + }, }) function onShow() { diff --git a/frontend/src/components/users/CreateOrEditUserDrawer.vue b/frontend/src/components/users/CreateOrEditUserDrawer.vue index dd174c3ea..b050cd9df 100644 --- a/frontend/src/components/users/CreateOrEditUserDrawer.vue +++ b/frontend/src/components/users/CreateOrEditUserDrawer.vue @@ -19,6 +19,8 @@ import { EditUserSchema, postUser, putUser, + USERS_KEY, + USERS_TOTAL_KEY, type CreateUser, type EditUser, type User, @@ -31,8 +33,8 @@ import { getValidationIssues, isValidationError } from '../../lib/validation' import type { AxiosError } from 'axios' import { useQuery } from '@pinia/colada' import { useLoginStore } from '@/stores/login' -import { getOrganizations } from '@/lib/organizations' -import { getUserRoles } from '@/lib/userRoles' +import { getOrganizations, ORGANIZATIONS_KEY } from '@/lib/organizations' +import { getUserRoles, USER_ROLES_KEY } from '@/lib/userRoles' import { PRODUCT_NAME } from '@/lib/config' const { isShown = false, currentUser = undefined } = defineProps<{ @@ -47,12 +49,12 @@ const queryCache = useQueryCache() const notificationsStore = useNotificationsStore() const loginStore = useLoginStore() const { state: organizations } = useQuery({ - key: ['organizations'], + key: [ORGANIZATIONS_KEY], enabled: () => !!loginStore.jwtToken && isShown, query: getOrganizations, }) const { state: allUserRoles } = useQuery({ - key: ['userRoles'], + key: [USER_ROLES_KEY], enabled: () => !!loginStore.jwtToken && isShown, query: getUserRoles, }) @@ -84,7 +86,10 @@ const { console.error('Error creating user:', error) validationIssues.value = getValidationIssues(error as AxiosError, 'users') }, - onSettled: () => queryCache.invalidateQueries({ key: ['users'] }), + onSettled: () => { + queryCache.invalidateQueries({ key: [USERS_KEY] }) + queryCache.invalidateQueries({ key: [USERS_TOTAL_KEY] }) + }, }) const { @@ -114,7 +119,7 @@ const { console.error('Error editing user:', error) validationIssues.value = getValidationIssues(error as AxiosError, 'users') }, - onSettled: () => queryCache.invalidateQueries({ key: ['users'] }), + onSettled: () => queryCache.invalidateQueries({ key: [USERS_KEY] }), }) const email = ref('') diff --git a/frontend/src/components/users/DeleteUserModal.vue b/frontend/src/components/users/DeleteUserModal.vue index d2fbd4d89..d824c21ea 100644 --- a/frontend/src/components/users/DeleteUserModal.vue +++ b/frontend/src/components/users/DeleteUserModal.vue @@ -8,7 +8,7 @@ import { NeInlineNotification } from '@nethesis/vue-components' import { NeModal } from '@nethesis/vue-components' import { useI18n } from 'vue-i18n' import { useMutation, useQueryCache } from '@pinia/colada' -import { deleteUser, type User } from '@/lib/users' +import { deleteUser, USERS_KEY, USERS_TOTAL_KEY, type User } from '@/lib/users' import { useNotificationsStore } from '@/stores/notifications' const { visible = false, user = undefined } = defineProps<{ @@ -48,8 +48,10 @@ const { onError: (error) => { console.error('Error deleting user:', error) }, - - onSettled: () => queryCache.invalidateQueries({ key: ['users'] }), + onSettled: () => { + queryCache.invalidateQueries({ key: [USERS_KEY] }) + queryCache.invalidateQueries({ key: [USERS_TOTAL_KEY] }) + }, }) function onShow() { diff --git a/frontend/src/lib/customers.ts b/frontend/src/lib/customers.ts index 425c24617..f1c571549 100644 --- a/frontend/src/lib/customers.ts +++ b/frontend/src/lib/customers.ts @@ -7,6 +7,9 @@ import { useLoginStore } from '@/stores/login' import * as v from 'valibot' import { paginationQueryString } from './users' +export const CUSTOMERS_KEY = 'customers' +export const CUSTOMERS_TOTAL_KEY = 'customersTotal' + export const CreateCustomerSchema = v.object({ name: v.pipe(v.string(), v.nonEmpty('organizations.name_cannot_be_empty')), description: v.optional(v.string()), @@ -61,6 +64,16 @@ export const deleteCustomer = (customer: Customer) => { }) } +export const getCustomersTotal = () => { + const loginStore = useLoginStore() + + return axios + .get(`${API_URL}/customers/totals`, { + headers: { Authorization: `Bearer ${loginStore.jwtToken}` }, + }) + .then((res) => res.data.data.total as number) +} + export const searchStringInCustomer = ( searchString: string, diff --git a/frontend/src/lib/distributors.ts b/frontend/src/lib/distributors.ts index 1c02e84d1..e712b148d 100644 --- a/frontend/src/lib/distributors.ts +++ b/frontend/src/lib/distributors.ts @@ -7,6 +7,9 @@ import { useLoginStore } from '@/stores/login' import * as v from 'valibot' import { paginationQueryString } from './users' +export const DISTRIBUTORS_KEY = 'distributors' +export const DISTRIBUTORS_TOTAL_KEY = 'distributorsTotal' + export const CreateDistributorSchema = v.object({ name: v.pipe(v.string(), v.nonEmpty('organizations.name_cannot_be_empty')), description: v.optional(v.string()), @@ -61,6 +64,16 @@ export const deleteDistributor = (distributor: Distributor) => { }) } +export const getDistributorsTotal = () => { + const loginStore = useLoginStore() + + return axios + .get(`${API_URL}/distributors/totals`, { + headers: { Authorization: `Bearer ${loginStore.jwtToken}` }, + }) + .then((res) => res.data.data.total as number) +} + export const searchStringInDistributor = ( searchString: string, diff --git a/frontend/src/lib/organizations.ts b/frontend/src/lib/organizations.ts index 9ffc102b2..603820552 100644 --- a/frontend/src/lib/organizations.ts +++ b/frontend/src/lib/organizations.ts @@ -12,6 +12,8 @@ export type Organization = { type: string } +export const ORGANIZATIONS_KEY = 'organizations' + export const getOrganizations = () => { const loginStore = useLoginStore() diff --git a/frontend/src/lib/resellers.ts b/frontend/src/lib/resellers.ts index 442e4cab1..351801c55 100644 --- a/frontend/src/lib/resellers.ts +++ b/frontend/src/lib/resellers.ts @@ -7,6 +7,9 @@ import { useLoginStore } from '@/stores/login' import * as v from 'valibot' import { paginationQueryString } from './users' +export const RESELLERS_KEY = 'resellers' +export const RESELLERS_TOTAL_KEY = 'resellersTotal' + export const CreateResellerSchema = v.object({ name: v.pipe(v.string(), v.nonEmpty('organizations.name_cannot_be_empty')), description: v.optional(v.string()), @@ -61,6 +64,16 @@ export const deleteReseller = (reseller: Reseller) => { }) } +export const getResellersTotal = () => { + const loginStore = useLoginStore() + + return axios + .get(`${API_URL}/resellers/totals`, { + headers: { Authorization: `Bearer ${loginStore.jwtToken}` }, + }) + .then((res) => res.data.data.total as number) +} + export const searchStringInReseller = ( searchString: string, diff --git a/frontend/src/lib/thirdPartyApps.ts b/frontend/src/lib/thirdPartyApps.ts index 85be8c668..5dcecd2ce 100644 --- a/frontend/src/lib/thirdPartyApps.ts +++ b/frontend/src/lib/thirdPartyApps.ts @@ -12,6 +12,8 @@ import { faWifi, } from '@fortawesome/free-solid-svg-icons' +export const THIRD_PARTY_APPS_KEY = 'thirdPartyApps' + export type ThirdPartyApp = { id: string name: string diff --git a/frontend/src/lib/userRoles.ts b/frontend/src/lib/userRoles.ts index 8250cb883..db7129517 100644 --- a/frontend/src/lib/userRoles.ts +++ b/frontend/src/lib/userRoles.ts @@ -11,6 +11,8 @@ export type UserRole = { description: string } +export const USER_ROLES_KEY = 'userRoles' + export const getUserRoles = () => { const loginStore = useLoginStore() diff --git a/frontend/src/lib/users.ts b/frontend/src/lib/users.ts index dd2859b1c..e2a2a95ac 100644 --- a/frontend/src/lib/users.ts +++ b/frontend/src/lib/users.ts @@ -10,7 +10,9 @@ import { faBuilding, faCity, faCrown, faGlobe, faQuestion } from '@fortawesome/f //// remove after implementing pagination export const paginationQueryString = '?page_size=100' -//// check attributes +export const USERS_KEY = 'users' +export const USERS_TOTAL_KEY = 'usersTotal' + export const CreateUserSchema = v.object({ email: v.pipe(v.string(), v.nonEmpty('users.email_required'), v.email('users.email_invalid')), name: v.pipe(v.string(), v.nonEmpty('users.name_cannot_be_empty')), @@ -91,6 +93,16 @@ export const deleteUser = (user: User) => { }) } +export const getUsersTotal = () => { + const loginStore = useLoginStore() + + return axios + .get(`${API_URL}/users/totals`, { + headers: { Authorization: `Bearer ${loginStore.jwtToken}` }, + }) + .then((res) => res.data.data.total as number) +} + export const resetPassword = (user: User, newPassword: string) => { const loginStore = useLoginStore() diff --git a/frontend/src/queries/customers.ts b/frontend/src/queries/customers.ts index cc4882643..a0899d791 100644 --- a/frontend/src/queries/customers.ts +++ b/frontend/src/queries/customers.ts @@ -1,7 +1,7 @@ // Copyright (C) 2025 Nethesis S.r.l. // SPDX-License-Identifier: GPL-3.0-or-later -import { getCustomers } from '@/lib/customers' +import { CUSTOMERS_KEY, getCustomers } from '@/lib/customers' import { useLoginStore } from '@/stores/login' import { defineQuery, useQuery } from '@pinia/colada' @@ -9,7 +9,7 @@ export const useCustomers = defineQuery(() => { const loginStore = useLoginStore() const { state, asyncStatus, ...rest } = useQuery({ - key: () => ['customers'], + key: () => [CUSTOMERS_KEY], enabled: () => !!loginStore.jwtToken, query: getCustomers, }) diff --git a/frontend/src/queries/distributors.ts b/frontend/src/queries/distributors.ts index da3a75966..69f9fc8a4 100644 --- a/frontend/src/queries/distributors.ts +++ b/frontend/src/queries/distributors.ts @@ -1,7 +1,7 @@ // Copyright (C) 2025 Nethesis S.r.l. // SPDX-License-Identifier: GPL-3.0-or-later -import { getDistributors } from '@/lib/distributors' +import { DISTRIBUTORS_KEY, getDistributors } from '@/lib/distributors' import { useLoginStore } from '@/stores/login' import { defineQuery, useQuery } from '@pinia/colada' @@ -9,7 +9,7 @@ export const useDistributors = defineQuery(() => { const loginStore = useLoginStore() const { state, asyncStatus, ...rest } = useQuery({ - key: () => ['distributors'], + key: () => [DISTRIBUTORS_KEY], enabled: () => !!loginStore.jwtToken, query: getDistributors, }) diff --git a/frontend/src/queries/resellers.ts b/frontend/src/queries/resellers.ts index 51a344107..aac52fec3 100644 --- a/frontend/src/queries/resellers.ts +++ b/frontend/src/queries/resellers.ts @@ -1,7 +1,7 @@ // Copyright (C) 2025 Nethesis S.r.l. // SPDX-License-Identifier: GPL-3.0-or-later -import { getResellers } from '@/lib/resellers' +import { getResellers, RESELLERS_KEY } from '@/lib/resellers' import { useLoginStore } from '@/stores/login' import { defineQuery, useQuery } from '@pinia/colada' @@ -9,7 +9,7 @@ export const useResellers = defineQuery(() => { const loginStore = useLoginStore() const { state, asyncStatus, ...rest } = useQuery({ - key: () => ['resellers'], + key: () => [RESELLERS_KEY], enabled: () => !!loginStore.jwtToken, query: getResellers, }) diff --git a/frontend/src/queries/users.ts b/frontend/src/queries/users.ts index c4573ff01..a5c147f6e 100644 --- a/frontend/src/queries/users.ts +++ b/frontend/src/queries/users.ts @@ -1,7 +1,7 @@ // Copyright (C) 2025 Nethesis S.r.l. // SPDX-License-Identifier: GPL-3.0-or-later -import { getUsers } from '@/lib/users' +import { getUsers, USERS_KEY } from '@/lib/users' import { useLoginStore } from '@/stores/login' import { defineQuery, useQuery } from '@pinia/colada' @@ -9,7 +9,7 @@ export const useUsers = defineQuery(() => { const loginStore = useLoginStore() const { state, asyncStatus, ...rest } = useQuery({ - key: () => ['users'], + key: () => [USERS_KEY], enabled: () => !!loginStore.jwtToken, query: getUsers, }) diff --git a/frontend/src/views/DashboardView.vue b/frontend/src/views/DashboardView.vue index 261e94dba..6aa46c3e1 100644 --- a/frontend/src/views/DashboardView.vue +++ b/frontend/src/views/DashboardView.vue @@ -4,12 +4,17 @@ --> @@ -18,7 +19,7 @@ const isShownCreateUserDrawer = ref(false) {{ $t('users.title') }}
- {{ $t('users.page_description') }} + {{ $t('users.page_description', { productName: PRODUCT_NAME }) }}
From 1baf09ef67322c005ab4b935cf5e76041b5996d2 Mon Sep 17 00:00:00 2001 From: Andrea Leardini Date: Fri, 1 Aug 2025 12:28:37 +0200 Subject: [PATCH 28/28] fix: i18n strings --- frontend/src/i18n/en/translation.json | 6 +++--- frontend/src/i18n/it/translation.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/i18n/en/translation.json b/frontend/src/i18n/en/translation.json index 432682dd2..b2207c62f 100644 --- a/frontend/src/i18n/en/translation.json +++ b/frontend/src/i18n/en/translation.json @@ -86,7 +86,7 @@ "cannot_save_distributor": "Cannot save distributor", "cannot_delete_distributor": "Cannot delete distributor", "delete_distributor": "Delete distributor", - "delete_distributor_confirmation": "Are you sure you want to delete distributor {name}? This action cannot be undone.", + "delete_distributor_confirmation": "Are you sure you want to delete distributor {name}? All users associated with this organization will also be deleted. This action cannot be undone.", "no_distributor": "No distributors" }, "resellers": { @@ -105,7 +105,7 @@ "cannot_save_reseller": "Cannot save reseller", "cannot_delete_reseller": "Cannot delete reseller", "delete_reseller": "Delete reseller", - "delete_reseller_confirmation": "Are you sure you want to delete reseller {name}? This action cannot be undone.", + "delete_reseller_confirmation": "Are you sure you want to delete reseller {name}? All users associated with this organization will also be deleted. This action cannot be undone.", "no_reseller": "No resellers" }, "customers": { @@ -124,7 +124,7 @@ "cannot_save_customer": "Cannot save customer", "cannot_delete_customer": "Cannot delete customer", "delete_customer": "Delete customer", - "delete_customer_confirmation": "Are you sure you want to delete customer {name}? This action cannot be undone.", + "delete_customer_confirmation": "Are you sure you want to delete customer {name}? All users associated with this organization will also be deleted. This action cannot be undone.", "no_customer": "No customers" }, "organizations": { diff --git a/frontend/src/i18n/it/translation.json b/frontend/src/i18n/it/translation.json index 4f1bf093f..274773fa3 100644 --- a/frontend/src/i18n/it/translation.json +++ b/frontend/src/i18n/it/translation.json @@ -86,7 +86,7 @@ "cannot_save_distributor": "Impossibile salvare il distributore", "cannot_delete_distributor": "Impossibile eliminare il distributore", "delete_distributor": "Elimina distributore", - "delete_distributor_confirmation": "Sei sicuro di voler eliminare il distributore {name}? Questa azione non può essere annullata.", + "delete_distributor_confirmation": "Sei sicuro di voler eliminare il distributore {name}? Tutti gli utenti associati a questa organizzazione verranno eliminati. Questa azione non può essere annullata.", "no_distributor": "Nessun distributore" }, "resellers": { @@ -105,7 +105,7 @@ "cannot_save_reseller": "Impossibile salvare il rivenditore", "cannot_delete_reseller": "Impossibile eliminare il rivenditore", "delete_reseller": "Elimina rivenditore", - "delete_reseller_confirmation": "Sei sicuro di voler eliminare il rivenditore {name}? Questa azione non può essere annullata.", + "delete_reseller_confirmation": "Sei sicuro di voler eliminare il rivenditore {name}? Tutti gli utenti associati a questa organizzazione verranno eliminati. Questa azione non può essere annullata.", "no_reseller": "Nessun rivenditore" }, "customers": { @@ -124,7 +124,7 @@ "cannot_save_customer": "Impossibile salvare il cliente", "cannot_delete_customer": "Impossibile eliminare il cliente", "delete_customer": "Elimina cliente", - "delete_customer_confirmation": "Sei sicuro di voler eliminare il cliente {name}? Questa azione non può essere annullata.", + "delete_customer_confirmation": "Sei sicuro di voler eliminare il cliente {name}? Tutti gli utenti associati a questa organizzazione verranno eliminati. Questa azione non può essere annullata.", "no_customer": "Nessun cliente" }, "organizations": {