refactor: refs #8220 requested changes
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
5de2805fa9
commit
548db113eb
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, onBeforeMount } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
import VnImg from 'src/components/ui/VnImg.vue';
|
||||||
|
@ -17,7 +17,7 @@ import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import ItemListFilter from './ItemListFilter.vue';
|
import ItemListFilter from './ItemListFilter.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import axios from 'axios';
|
||||||
|
|
||||||
const entityId = computed(() => route.params.id);
|
const entityId = computed(() => route.params.id);
|
||||||
const { openCloneDialog } = cloneItem();
|
const { openCloneDialog } = cloneItem();
|
||||||
|
@ -26,6 +26,8 @@ const { t } = useI18n();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const validPriorities = ref([]);
|
const validPriorities = ref([]);
|
||||||
|
const defaultTag = ref();
|
||||||
|
const defaultPriority = ref();
|
||||||
const itemFilter = {
|
const itemFilter = {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
@ -134,7 +136,6 @@ const columns = computed(() => [
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
create: true,
|
|
||||||
visible: false,
|
visible: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -302,13 +303,17 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
const { data } = await axios.get('ItemConfigs');
|
||||||
|
defaultTag.value = data[0].defaultTag;
|
||||||
|
defaultPriority.value = data[0].defaultPriority;
|
||||||
|
data.forEach((priority) => {
|
||||||
|
validPriorities.value = priority.validPriorities;
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
url="ItemConfigs"
|
|
||||||
@on-fetch="([{ validPriorities: data }]) => (validPriorities = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="ItemList"
|
data-key="ItemList"
|
||||||
:label="t('item.searchbar.label')"
|
:label="t('item.searchbar.label')"
|
||||||
|
@ -320,6 +325,7 @@ const columns = computed(() => [
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<VnTable
|
<VnTable
|
||||||
|
v-if="defaultTag"
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="ItemList"
|
data-key="ItemList"
|
||||||
url="Items/filter"
|
url="Items/filter"
|
||||||
|
@ -329,8 +335,8 @@ const columns = computed(() => [
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(`${id}/basic-data`),
|
onDataSaved: ({ id }) => tableRef.redirect(`${id}/basic-data`),
|
||||||
formInitialData: {
|
formInitialData: {
|
||||||
editorFk: entityId,
|
editorFk: entityId,
|
||||||
tag: 56,
|
tag: defaultTag,
|
||||||
priority: 2,
|
priority: defaultPriority,
|
||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
:order="['isActive DESC', 'name', 'id']"
|
:order="['isActive DESC', 'name', 'id']"
|
||||||
|
|
|
@ -3,12 +3,10 @@ describe('Item botanical', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/item/list`);
|
cy.visit(`/#/item/1/botanical`);
|
||||||
cy.typeSearchbar('1{enter}');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should modify the botanical', () => {
|
it('should modify the botanical', () => {
|
||||||
cy.get('[href="#/item/1/botanical"]').click();
|
|
||||||
cy.dataCy('AddGenusSelectDialog').type('Abies');
|
cy.dataCy('AddGenusSelectDialog').type('Abies');
|
||||||
cy.get('.q-menu .q-item').contains('Abies').click();
|
cy.get('.q-menu .q-item').contains('Abies').click();
|
||||||
cy.dataCy('AddSpeciesSelectDialog').type('dealbata');
|
cy.dataCy('AddSpeciesSelectDialog').type('dealbata');
|
||||||
|
@ -18,7 +16,6 @@ describe('Item botanical', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create a new Genus', () => {
|
it('should create a new Genus', () => {
|
||||||
cy.get('[href="#/item/1/botanical"]').click();
|
|
||||||
cy.dataCy('Genus_icon').click();
|
cy.dataCy('Genus_icon').click();
|
||||||
cy.dataCy('Latin genus name_input').type('Test');
|
cy.dataCy('Latin genus name_input').type('Test');
|
||||||
cy.dataCy('FormModelPopup_save').click();
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
|
@ -26,7 +23,6 @@ describe('Item botanical', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create a new specie', () => {
|
it('should create a new specie', () => {
|
||||||
cy.get('[href="#/item/1/botanical"]').click();
|
|
||||||
cy.dataCy('Species_icon').click();
|
cy.dataCy('Species_icon').click();
|
||||||
cy.dataCy('Latin species name_input').type('Test specie');
|
cy.dataCy('Latin species name_input').type('Test specie');
|
||||||
cy.dataCy('FormModelPopup_save').click();
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
|
|
|
@ -3,8 +3,7 @@ describe('Item summary', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/item/list`);
|
cy.visit(`/#/item/1/summary`);
|
||||||
cy.typeSearchbar('1{enter}');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should clone the item', () => {
|
it('should clone the item', () => {
|
||||||
|
|
|
@ -3,12 +3,10 @@ describe('Item tax', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/item/list`);
|
cy.visit(`/#/item/1/tax`);
|
||||||
cy.typeSearchbar('1{enter}');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should modify the tax for Spain', () => {
|
it('should modify the tax for Spain', () => {
|
||||||
cy.get('[href="#/item/1/tax"]').click();
|
|
||||||
cy.dataCy('Class_select').eq(1).type('General VAT{enter}');
|
cy.dataCy('Class_select').eq(1).type('General VAT{enter}');
|
||||||
cy.dataCy('crudModelDefaultSaveBtn').click();
|
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||||
cy.checkNotification('Data saved');
|
cy.checkNotification('Data saved');
|
||||||
|
|
Loading…
Reference in New Issue