Skip to content

Commit

Permalink
Merge pull request #192 from webitel/update/add-reset-table
Browse files Browse the repository at this point in the history
update: add reserTable[WTEL-5711](https://webitel.atlassian.net/brows…
  • Loading branch information
Lera24 authored Dec 13, 2024
2 parents 2abca0e + 27ded6b commit f0f64f1
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 17 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"@vueuse/core": "^11.0.3",
"@webitel/ui-sdk": "^24.12.20",
"@webitel/ui-sdk": "^24.12.22",
"axios": "^1.7.7",
"deep-equal": "^2.2.1",
"dompurify": "^3.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ import FilterPagination from '@webitel/ui-sdk/src/modules/Filters/components/fil
import DeleteConfirmationPopup
from '@webitel/ui-sdk/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue';
import { useTableFilters } from '@webitel/ui-sdk/src/modules/Filters/composables/useTableFilters.js';
import { useTableStore } from '@webitel/ui-sdk/src/modules/TableStoreModule/composables/useTableStore.js';
import { useTableStore } from '@webitel/ui-sdk/src/store/new/modules/tableStoreModule/useTableStore.js';
import { useTableEmpty } from '@webitel/ui-sdk/src/modules/TableComponentModule/composables/useTableEmpty.js';
import filters from '../modules/filters/store/filters.js';
Expand Down Expand Up @@ -159,6 +159,7 @@ const {
sort,
setSelected,
onFilterEvent,
resetState,
} = useTableStore(baseNamespace);
const {
Expand All @@ -178,6 +179,7 @@ restoreFilters();
onUnmounted(() => {
flushSubscribers();
resetState();
});
const path = computed(() => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ import {
} from '@webitel/ui-sdk/src/modules/DeleteConfirmationPopup/composables/useDeleteConfirmationPopup';
import FilterPagination from '@webitel/ui-sdk/src/modules/Filters/components/filter-pagination.vue';
import { useTableFilters } from '@webitel/ui-sdk/src/modules/Filters/composables/useTableFilters.js';
import { useCardStore, useTableStore } from '@webitel/ui-sdk/store';
import { useCardStore } from '@webitel/ui-sdk/store';
import { useTableStore } from '@webitel/ui-sdk/src/store/new/modules/tableStoreModule/useTableStore.js';
import { onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
Expand Down Expand Up @@ -166,6 +167,7 @@ const {
sort,
setSelected,
onFilterEvent,
resetState,
} = useTableStore(namespace);
const {
Expand All @@ -185,6 +187,7 @@ restoreFilters();
onUnmounted(() => {
flushSubscribers();
resetState();
});
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ import ConditionsAPI from '../api/conditions.js';
import filters from '../modules/filters/store/filters.js';
import headers from './_internals/headers.js';

const resettableItemState = {
const resetTableState = {
dataList: [],
selected: [],
error: {},
isLoading: false,
isNextPage: false,
};

const resetCardState = {
itemId: '',
itemInstance: {
},
};
Expand All @@ -26,6 +35,7 @@ const api = createApiStoreModule({
const table = createTableStoreModule({
state: {
headers,
_resettable: resetTableState,
},
getters,
modules: {
Expand All @@ -35,7 +45,7 @@ const table = createTableStoreModule({
});

const card = createCardStoreModule({
state: { _resettable: resettableItemState },
state: { _resettable: resetCardState },
getters,
modules: {
api,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ import headers from './_internals/headers';
import filters from '../modules/filters/store/filters';
import conditions from '../modules/conditions/store/conditions';

const resettableState = {
const resetTableState = {
dataList: [],
selected: [],
error: {},
isLoading: false,
isNextPage: false,
};

const resetCardState = {
itemId: '',
itemInstance: {
name: '',
description: '',
Expand All @@ -28,17 +37,15 @@ const api = createApiStoreModule({
});

const table = createTableStoreModule({
state: {
headers,
},
state: { _resettable: resetTableState, headers },
modules: {
filters,
api,
},
});

const card = createCardStoreModule({
state: { _resettable: resettableState },
state: { _resettable: resetCardState },
modules: {
api,
conditions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ import FilterPagination from '@webitel/ui-sdk/src/modules/Filters/components/fil
import DeleteConfirmationPopup
from '@webitel/ui-sdk/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue';
import { useTableFilters } from '@webitel/ui-sdk/src/modules/Filters/composables/useTableFilters.js';
import { useTableStore } from '@webitel/ui-sdk/src/modules/TableStoreModule/composables/useTableStore.js';
import { computed, onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import { useTableEmpty } from '@webitel/ui-sdk/src/modules/TableComponentModule/composables/useTableEmpty.js';
import { useTableStore } from '@webitel/ui-sdk/src/store/new/modules/tableStoreModule/useTableStore.js';
import filters from '../modules/filters/store/filters.js';
const baseNamespace = 'configuration/lookups/sources';
Expand Down Expand Up @@ -158,6 +158,7 @@ const {
sort,
setSelected,
onFilterEvent,
resetState,
} = useTableStore(baseNamespace);
const {
Expand All @@ -177,6 +178,7 @@ restoreFilters();
onUnmounted(() => {
flushSubscribers();
resetState();
});
const path = computed(() => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ import SourcesAPI from '../api/sources.js';
import headers from './_internals/headers';
import filters from '../modules/filters/store/filters';

const resettableState = {
const resetTableState = {
dataList: [],
selected: [],
error: {},
isLoading: false,
isNextPage: false,
};

const resetCardState = {
itemInstance: {
name: '',
description: '',
Expand All @@ -25,6 +33,7 @@ const api = createApiStoreModule({
const table = createTableStoreModule({
state: {
headers,
_resettable: resetTableState,
},
modules: {
filters,
Expand All @@ -33,7 +42,7 @@ const table = createTableStoreModule({
});

const card = createCardStoreModule({
state: { _resettable: resettableState },
state: { _resettable: resetCardState },
modules: {
api,
},
Expand Down

0 comments on commit f0f64f1

Please sign in to comment.