diff --git a/cypress.config.js b/cypress.config.js index dfe963a12..368b92d8d 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -31,7 +31,6 @@ export default defineConfig({ requestTimeout: 10000, responseTimeout: 30000, pageLoadTimeout: 60000, - defaultBrowser: 'chromium', fixturesFolder: 'test/cypress/fixtures', screenshotsFolder: 'test/cypress/screenshots', supportFile: 'test/cypress/support/index.js', @@ -39,10 +38,17 @@ export default defineConfig({ downloadsFolder: 'test/cypress/downloads', video: false, specPattern: 'test/cypress/integration/**/*.spec.js', - experimentalRunAllSpecs: true, - watchForFileChanges: true, - reporter, - reporterOptions, + experimentalRunAllSpecs: false, + watchForFileChanges: false, + reporter: 'cypress-mochawesome-reporter', + reporterOptions: { + charts: true, + reportPageTitle: 'Cypress Inline Reporter', + reportFilename: '[status]_[datetime]-report', + embeddedScreenshots: true, + reportDir: 'test/cypress/reports', + inlineAssets: true, + }, component: { componentFolder: 'src', testFiles: '**/*.spec.js', diff --git a/src/components/VnTable/VnFilter.vue b/src/components/VnTable/VnFilter.vue index 0de3834ea..e9660e4c2 100644 --- a/src/components/VnTable/VnFilter.vue +++ b/src/components/VnTable/VnFilter.vue @@ -91,7 +91,6 @@ const components = { event: updateEvent, attrs: { ...defaultAttrs, - style: 'min-width: 150px', }, forceAttrs, }, diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 9a7d78e43..c1e541abb 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -31,6 +31,7 @@ import VnLv from 'components/ui/VnLv.vue'; import VnTableOrder from 'src/components/VnTable/VnOrder.vue'; import VnTableFilter from './VnTableFilter.vue'; import { getColAlign } from 'src/composables/getColAlign'; +import RightMenu from '../common/RightMenu.vue'; const arrayData = useArrayData(useAttrs()['data-key']); const $props = defineProps({ @@ -50,10 +51,6 @@ const $props = defineProps({ type: Boolean, default: true, }, - rightSearchIcon: { - type: Boolean, - default: true, - }, rowClick: { type: [Function, Boolean], default: null, @@ -413,20 +410,13 @@ async function renderInput(rowId, field, clickedElement) { eventHandlers: { 'update:modelValue': async (value) => { if (isSelect && value) { - row[column.name] = value[column.attrs?.optionValue ?? 'id']; - row[column?.name + 'TextValue'] = - value[column.attrs?.optionLabel ?? 'name']; - await column?.cellEvent?.['update:modelValue']?.( - value, - oldValue, - row, - ); + await updateSelectValue(value, column, row, oldValue); } else row[column.name] = value; await column?.cellEvent?.['update:modelValue']?.(value, oldValue, row); }, keyup: async (event) => { if (event.key === 'Enter') - await destroyInput(rowIndex, field, clickedElement); + await destroyInput(rowId, field, clickedElement); }, keydown: async (event) => { switch (event.key) { @@ -457,6 +447,17 @@ async function renderInput(rowId, field, clickedElement) { node.el?.querySelector('span > div > div').focus(); } +async function updateSelectValue(value, column, row, oldValue) { + row[column.name] = value[column.attrs?.optionValue ?? 'id']; + + row[column?.name + 'VnTableTextValue'] = value[column.attrs?.optionLabel ?? 'name']; + + if (column?.attrs?.find?.label) + row[column?.attrs?.find?.label] = value[column.attrs?.optionLabel ?? 'name']; + + await column?.cellEvent?.['update:modelValue']?.(value, oldValue, row); +} + async function destroyInput(rowIndex, field, clickedElement) { if (!clickedElement) clickedElement = document.querySelector( @@ -519,9 +520,9 @@ function getToggleIcon(value) { } function formatColumnValue(col, row, dashIfEmpty) { - if (col?.format || row[col?.name + 'TextValue']) { - if (selectRegex.test(col?.component) && row[col?.name + 'TextValue']) { - return dashIfEmpty(row[col?.name + 'TextValue']); + if (col?.format || row[col?.name + 'VnTableTextValue']) { + if (selectRegex.test(col?.component) && row[col?.name + 'VnTableTextValue']) { + return dashIfEmpty(row[col?.name + 'VnTableTextValue']); } else { return col.format(row, dashIfEmpty); } @@ -554,19 +555,33 @@ function formatColumnValue(col, row, dashIfEmpty) { } return dashIfEmpty(row[col?.name]); } + function cardClick(_, row) { if ($props.redirect) router.push({ path: `/${$props.redirect}/${row.id}` }); } + +function removeTextValue(data, getChanges) { + let changes = data.updates; + if (!changes) return data; + + for (const change of changes) { + for (const key in change.data) { + if (key.endsWith('VnTableTextValue')) { + delete change.data[key]; + } + } + } + + data.updates = changes.filter((change) => Object.keys(change.data).length > 0); + + if ($attrs?.beforeSaveFn) data = $attrs.beforeSaveFn(data, getChanges); + + return data; +} + { ); }); +const routeName = computed(() => { + const DESCRIPTOR_PROXY = 'DescriptorProxy'; + + let name = $props.dataKey; + if ($props.dataKey.includes(DESCRIPTOR_PROXY)) { + name = name.split(DESCRIPTOR_PROXY)[0]; + } + return `${name}Summary`; +}); async function getData() { store.url = $props.url; store.filter = $props.filter ?? {}; @@ -154,9 +163,7 @@ const toModule = computed(() => {{ t('components.smartCard.openSummary') }} - + #{{ getValueFromPath(subtitle) ?? entity.id }} - {{ t('globals.copyId') }} -
diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 9a60e9da1..9e46c54e3 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -153,6 +153,7 @@ globals: maxTemperature: Max minTemperature: Min changePass: Change password + setPass: Set password deleteConfirmTitle: Delete selected elements changeState: Change state raid: 'Raid {daysInForward} days' diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 846c442ea..6e43e0882 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -157,6 +157,7 @@ globals: maxTemperature: Máx minTemperature: Mín changePass: Cambiar contraseña + setPass: Establecer contraseña deleteConfirmTitle: Eliminar los elementos seleccionados changeState: Cambiar estado raid: 'Redada {daysInForward} días' diff --git a/src/pages/Account/Card/AccountDescriptorMenu.vue b/src/pages/Account/Card/AccountDescriptorMenu.vue index 30584c61f..eafd62df6 100644 --- a/src/pages/Account/Card/AccountDescriptorMenu.vue +++ b/src/pages/Account/Card/AccountDescriptorMenu.vue @@ -25,12 +25,13 @@ const $props = defineProps({ const { t } = useI18n(); const { hasAccount } = toRefs($props); const { openConfirmationModal } = useVnConfirm(); +const arrayData = useArrayData('Account'); const route = useRoute(); const router = useRouter(); const state = useState(); const user = state.getUser(); const { notify } = useQuasar(); -const account = computed(() => useArrayData('Account').store.data[0]); +const account = computed(() => arrayData.store.data); account.value.hasAccount = hasAccount.value; const entityId = computed(() => +route.params.id); const hasitManagementAccess = ref(); @@ -39,7 +40,7 @@ const isHimself = computed(() => user.value.id === account.value.id); const url = computed(() => isHimself.value ? 'Accounts/change-password' - : `Accounts/${entityId.value}/setPassword` + : `Accounts/${entityId.value}/setPassword`, ); async function updateStatusAccount(active) { @@ -153,6 +154,7 @@ onMounted(() => { t('account.card.actions.disableAccount.title'), t('account.card.actions.disableAccount.subtitle'), () => deleteAccount(), + () => deleteAccount(), ) " > @@ -172,6 +174,7 @@ onMounted(() => { t('account.card.actions.enableAccount.title'), t('account.card.actions.enableAccount.subtitle'), () => updateStatusAccount(true), + () => updateStatusAccount(true), ) " > @@ -186,6 +189,7 @@ onMounted(() => { t('account.card.actions.disableAccount.title'), t('account.card.actions.disableAccount.subtitle'), () => updateStatusAccount(false), + () => updateStatusAccount(false), ) " > @@ -201,6 +205,7 @@ onMounted(() => { t('account.card.actions.activateUser.title'), t('account.card.actions.activateUser.title'), () => updateStatusUser(true), + () => updateStatusUser(true), ) " > @@ -215,6 +220,7 @@ onMounted(() => { t('account.card.actions.deactivateUser.title'), t('account.card.actions.deactivateUser.title'), () => updateStatusUser(false), + () => updateStatusUser(false), ) " > diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue index 67034da1a..43941d1dc 100644 --- a/src/pages/Claim/Card/ClaimBasicData.vue +++ b/src/pages/Claim/Card/ClaimBasicData.vue @@ -40,7 +40,7 @@ const workersOptions = ref([]);