Fix typos: updataFilter, updataConformance, setPrevioiusPage, reallyDeldet, tooken, pageAdimin
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -62,19 +62,19 @@ export default {
|
|||||||
const store = filesStore();
|
const store = filesStore();
|
||||||
const allMapDataStore = AllMapDataStore();
|
const allMapDataStore = AllMapDataStore();
|
||||||
const conformanceStore = ConformanceStore();
|
const conformanceStore = ConformanceStore();
|
||||||
const { logId, tempFilterId, createFilterId, filterName, postRuleData, isUpdataFilter } = storeToRefs(allMapDataStore);
|
const { logId, tempFilterId, createFilterId, filterName, postRuleData, isUpdateFilter } = storeToRefs(allMapDataStore);
|
||||||
const { conformanceRuleData, conformanceLogId, conformanceFilterId,
|
const { conformanceRuleData, conformanceLogId, conformanceFilterId,
|
||||||
conformanceLogTempCheckId, conformanceFilterTempCheckId,
|
conformanceLogTempCheckId, conformanceFilterTempCheckId,
|
||||||
conformanceLogCreateCheckId, conformanceFilterCreateCheckId,
|
conformanceLogCreateCheckId, conformanceFilterCreateCheckId,
|
||||||
isUpdataConformance, conformanceFileName
|
isUpdateConformance, conformanceFileName
|
||||||
} = storeToRefs(conformanceStore);
|
} = storeToRefs(conformanceStore);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
store, allMapDataStore, logId, tempFilterId, createFilterId,
|
store, allMapDataStore, logId, tempFilterId, createFilterId,
|
||||||
filterName, postRuleData, isUpdataFilter, conformanceStore, conformanceRuleData,
|
filterName, postRuleData, isUpdateFilter, conformanceStore, conformanceRuleData,
|
||||||
conformanceLogId, conformanceFilterId, conformanceLogTempCheckId,
|
conformanceLogId, conformanceFilterId, conformanceLogTempCheckId,
|
||||||
conformanceFilterTempCheckId, conformanceLogCreateCheckId,
|
conformanceFilterTempCheckId, conformanceLogCreateCheckId,
|
||||||
conformanceFilterCreateCheckId, isUpdataConformance, conformanceFileName,
|
conformanceFilterCreateCheckId, isUpdateConformance, conformanceFileName,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -300,8 +300,8 @@ export default {
|
|||||||
},
|
},
|
||||||
async handleMapSave() {
|
async handleMapSave() {
|
||||||
if (this.createFilterId) {
|
if (this.createFilterId) {
|
||||||
await this.allMapDataStore.updataFilter();
|
await this.allMapDataStore.updateFilter();
|
||||||
if (this.isUpdataFilter) {
|
if (this.isUpdateFilter) {
|
||||||
await savedSuccessfully(this.filterName);
|
await savedSuccessfully(this.filterName);
|
||||||
}
|
}
|
||||||
} else if (this.logId) {
|
} else if (this.logId) {
|
||||||
@@ -321,8 +321,8 @@ export default {
|
|||||||
},
|
},
|
||||||
async handleConformanceSave() {
|
async handleConformanceSave() {
|
||||||
if (this.conformanceFilterCreateCheckId || this.conformanceLogCreateCheckId) {
|
if (this.conformanceFilterCreateCheckId || this.conformanceLogCreateCheckId) {
|
||||||
await this.conformanceStore.updataConformance();
|
await this.conformanceStore.updateConformance();
|
||||||
if (this.isUpdataConformance) {
|
if (this.isUpdateConformance) {
|
||||||
await savedSuccessfully(this.conformanceFileName);
|
await savedSuccessfully(this.conformanceFileName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -340,7 +340,7 @@ export default {
|
|||||||
},
|
},
|
||||||
...mapActions(PageAdminStore, [
|
...mapActions(PageAdminStore, [
|
||||||
'setPendingActivePage',
|
'setPendingActivePage',
|
||||||
'setPrevioiusPage',
|
'setPreviousPage',
|
||||||
'setActivePage',
|
'setActivePage',
|
||||||
'setActivePageComputedByRoute',
|
'setActivePageComputedByRoute',
|
||||||
'setIsPagePendingBoolean',
|
'setIsPagePendingBoolean',
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ export async function leaveFilter(next, addFilterId, toPath, logOut) {
|
|||||||
|
|
||||||
if(result.isConfirmed) {
|
if(result.isConfirmed) {
|
||||||
if(allMapDataStore.createFilterId) {
|
if(allMapDataStore.createFilterId) {
|
||||||
await allMapDataStore.updataFilter();
|
await allMapDataStore.updateFilter();
|
||||||
if(allMapDataStore.isUpdataFilter) {
|
if(allMapDataStore.isUpdateFilter) {
|
||||||
await savedSuccessfully(allMapDataStore.filterName);
|
await savedSuccessfully(allMapDataStore.filterName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -212,8 +212,8 @@ async function showConfirmationDialog() {
|
|||||||
|
|
||||||
async function handleConfirmed(conformanceStore, addConformanceCreateCheckId) {
|
async function handleConfirmed(conformanceStore, addConformanceCreateCheckId) {
|
||||||
if (conformanceStore.conformanceFilterCreateCheckId || conformanceStore.conformanceLogCreateCheckId) {
|
if (conformanceStore.conformanceFilterCreateCheckId || conformanceStore.conformanceLogCreateCheckId) {
|
||||||
await conformanceStore.updataConformance();
|
await conformanceStore.updateConformance();
|
||||||
if (conformanceStore.isUpdataConformance) {
|
if (conformanceStore.isUpdateConformance) {
|
||||||
await savedSuccessfully(conformanceStore.conformanceFileName);
|
await savedSuccessfully(conformanceStore.conformanceFileName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -486,9 +486,9 @@ export async function deleteSuccess() {
|
|||||||
/**
|
/**
|
||||||
* Really deleted information
|
* Really deleted information
|
||||||
* @param {string} files 被刪除的檔案 html
|
* @param {string} files 被刪除的檔案 html
|
||||||
* @param {array} reallyDeldetData 被刪除的檔案 data,未取得 recordId 而傳入
|
* @param {array} reallyDeleteData 被刪除的檔案 data,未取得 recordId 而傳入
|
||||||
*/
|
*/
|
||||||
export async function reallyDeldetInformation(files, reallyDeldetData) {
|
export async function reallyDeleteInformation(files, reallyDeleteData) {
|
||||||
const filesStore = FilesStore();
|
const filesStore = FilesStore();
|
||||||
const deleteCustomClass = { ...customClass };
|
const deleteCustomClass = { ...customClass };
|
||||||
const htmlText = `<div class="text-left mx-4 space-y-1"><p>The following file(s) have been deleted by other user(s):</p><ul class="list-disc ml-6">${files}</ul></div>`;
|
const htmlText = `<div class="text-left mx-4 space-y-1"><p>The following file(s) have been deleted by other user(s):</p><ul class="list-disc ml-6">${files}</ul></div>`;
|
||||||
@@ -508,7 +508,7 @@ export async function reallyDeldetInformation(files, reallyDeldetData) {
|
|||||||
confirmButton.style.border = '1px solid #0099FF';
|
confirmButton.style.border = '1px solid #0099FF';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
await Promise.all(reallyDeldetData.map(file => filesStore.deletionRecord(file.id)));
|
await Promise.all(reallyDeleteData.map(file => filesStore.deletionRecord(file.id)));
|
||||||
await filesStore.fetchAllFiles();
|
await filesStore.fetchAllFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export default defineStore('allMapDataStore', {
|
|||||||
ruleData: [], // Funnle view's data
|
ruleData: [], // Funnle view's data
|
||||||
isRuleData: [], // toggle button data
|
isRuleData: [], // toggle button data
|
||||||
allFunnelData: [],
|
allFunnelData: [],
|
||||||
isUpdataFilter: false, // 是否成功儲存 Filter 檔
|
isUpdateFilter: false, // 是否成功儲存 Filter 檔
|
||||||
selectTimeFrame: [], // user select time start and end
|
selectTimeFrame: [], // user select time start and end
|
||||||
infinite404: null, // 無限滾動式是否到底要換頁
|
infinite404: null, // 無限滾動式是否到底要換頁
|
||||||
infiniteStart: 0, // 無限滾動 case 開始的數字
|
infiniteStart: 0, // 無限滾動 case 開始的數字
|
||||||
@@ -354,19 +354,19 @@ export default defineStore('allMapDataStore', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Updata an Existing Filter
|
* Update an Existing Filter
|
||||||
*/
|
*/
|
||||||
async updataFilter() {
|
async updateFilter() {
|
||||||
let createFilterId = this.createFilterId
|
let createFilterId = this.createFilterId
|
||||||
const api = `/api/filters/${createFilterId}`;
|
const api = `/api/filters/${createFilterId}`;
|
||||||
const data = this.postRuleData;
|
const data = this.postRuleData;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await this.$axios.put(api, data);
|
const response = await this.$axios.put(api, data);
|
||||||
this.isUpdataFilter = response.status === 200;
|
this.isUpdateFilter = response.status === 200;
|
||||||
this.tempFilterId = null;
|
this.tempFilterId = null;
|
||||||
}catch(error) {
|
}catch(error) {
|
||||||
apiError(error, 'Failed to updata an Existing Filter.');
|
apiError(error, 'Failed to update an Existing Filter.');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export default defineStore('conformanceStore', {
|
|||||||
isStartSelected: null, // start & end 連動先選擇 start
|
isStartSelected: null, // start & end 連動先選擇 start
|
||||||
isEndSelected: null, // start & end 連動先選擇 end
|
isEndSelected: null, // start & end 連動先選擇 end
|
||||||
conformanceRuleData: null, // create checkId's data to save
|
conformanceRuleData: null, // create checkId's data to save
|
||||||
isUpdataConformance: false, // 成功儲存後要跳 Modal
|
isUpdateConformance: false, // 成功儲存後要跳 Modal
|
||||||
conformanceFileName: null, // 儲存成功的 Modal 用
|
conformanceFileName: null, // 儲存成功的 Modal 用
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
@@ -436,9 +436,9 @@ export default defineStore('conformanceStore', {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Updata an Existing Conformance Check, log and filter
|
* Update an Existing Conformance Check, log and filter
|
||||||
*/
|
*/
|
||||||
async updataConformance() {
|
async updateConformance() {
|
||||||
let logCreateCheckId = this.conformanceLogCreateCheckId;
|
let logCreateCheckId = this.conformanceLogCreateCheckId;
|
||||||
let filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
let filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
||||||
let api = '';
|
let api = '';
|
||||||
@@ -450,11 +450,11 @@ export default defineStore('conformanceStore', {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await this.$axios.put(api, data);
|
const response = await this.$axios.put(api, data);
|
||||||
this.isUpdataConformance = response.status === 200;
|
this.isUpdateConformance = response.status === 200;
|
||||||
this.conformanceLogTempCheckId = null;
|
this.conformanceLogTempCheckId = null;
|
||||||
this.conformanceFilterTempCheckId = null;
|
this.conformanceFilterTempCheckId = null;
|
||||||
}catch(error) {
|
}catch(error) {
|
||||||
apiError(error, 'Failed to updata an Existing Conformance.');
|
apiError(error, 'Failed to update an Existing Conformance.');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export default defineStore('loginStore', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Logout, tooken expired
|
* Logout, token expired
|
||||||
*/
|
*/
|
||||||
logOut() {
|
logOut() {
|
||||||
delete axios.defaults.headers.common["Authorization"];
|
delete axios.defaults.headers.common["Authorization"];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { mapPageNameToCapitalUnifiedName } from "../utils/pageUtils";
|
import { mapPageNameToCapitalUnifiedName } from "../utils/pageUtils";
|
||||||
const printPageAdiminLog = false;
|
const printPageAdminLog = false;
|
||||||
|
|
||||||
// There are at least two ways to trigger a page navigation:
|
// There are at least two ways to trigger a page navigation:
|
||||||
// clicking the navigation button and refreshing the page.
|
// clicking the navigation button and refreshing the page.
|
||||||
@@ -23,7 +23,7 @@ export default defineStore('pageAdminStore', {
|
|||||||
setActivePageComputedByRoute(routeMatched){
|
setActivePageComputedByRoute(routeMatched){
|
||||||
if (routeMatched.length && routeMatched[routeMatched.length - 1]
|
if (routeMatched.length && routeMatched[routeMatched.length - 1]
|
||||||
&& routeMatched[routeMatched.length - 1].name) {
|
&& routeMatched[routeMatched.length - 1].name) {
|
||||||
printPageAdiminLog && console.log('setActivePageComputedByRoute()', mapPageNameToCapitalUnifiedName(routeMatched[routeMatched.length - 1].name));
|
printPageAdminLog && console.log('setActivePageComputedByRoute()', mapPageNameToCapitalUnifiedName(routeMatched[routeMatched.length - 1].name));
|
||||||
this.activePageComputedByRoute = mapPageNameToCapitalUnifiedName(
|
this.activePageComputedByRoute = mapPageNameToCapitalUnifiedName(
|
||||||
routeMatched[routeMatched.length - 1].name);
|
routeMatched[routeMatched.length - 1].name);
|
||||||
}
|
}
|
||||||
@@ -33,20 +33,20 @@ export default defineStore('pageAdminStore', {
|
|||||||
* @param {string} activePage
|
* @param {string} activePage
|
||||||
*/
|
*/
|
||||||
setActivePage(activePage) {
|
setActivePage(activePage) {
|
||||||
printPageAdiminLog && console.log("setActivePage", activePage)
|
printPageAdminLog && console.log("setActivePage", activePage)
|
||||||
this.activePage = mapPageNameToCapitalUnifiedName(activePage);
|
this.activePage = mapPageNameToCapitalUnifiedName(activePage);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Specify previous page state value.
|
* Specify previous page state value.
|
||||||
* @param {string} prevPage
|
* @param {string} prevPage
|
||||||
*/
|
*/
|
||||||
setPrevioiusPage(prevPage) {
|
setPreviousPage(prevPage) {
|
||||||
this.previousPage = mapPageNameToCapitalUnifiedName(prevPage);
|
this.previousPage = mapPageNameToCapitalUnifiedName(prevPage);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Set the previous(usually current) pages to the ones we just decide.
|
* Set the previous(usually current) pages to the ones we just decide.
|
||||||
*/
|
*/
|
||||||
setPrevioiusPageUsingActivePage() {
|
setPreviousPageUsingActivePage() {
|
||||||
this.previousPage = this.activePage;
|
this.previousPage = this.activePage;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -61,7 +61,7 @@ export default defineStore('pageAdminStore', {
|
|||||||
* Copy(transit) the value of pendingActivePage to activePage
|
* Copy(transit) the value of pendingActivePage to activePage
|
||||||
*/
|
*/
|
||||||
copyPendingPageToActivePage() {
|
copyPendingPageToActivePage() {
|
||||||
printPageAdiminLog && console.log('pinia copying this.pendingActivePage', this.pendingActivePage);
|
printPageAdminLog && console.log('pinia copying this.pendingActivePage', this.pendingActivePage);
|
||||||
this.activePage = this.pendingActivePage;
|
this.activePage = this.pendingActivePage;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +72,7 @@ export default defineStore('pageAdminStore', {
|
|||||||
* @param {string} pendingActivePage
|
* @param {string} pendingActivePage
|
||||||
*/
|
*/
|
||||||
setPendingActivePage(argPendingActivePage) {
|
setPendingActivePage(argPendingActivePage) {
|
||||||
printPageAdiminLog && console.log('pinia setting this.pendingActivePage', this.pendingActivePage);
|
printPageAdminLog && console.log('pinia setting this.pendingActivePage', this.pendingActivePage);
|
||||||
this.pendingActivePage = mapPageNameToCapitalUnifiedName(argPendingActivePage);
|
this.pendingActivePage = mapPageNameToCapitalUnifiedName(argPendingActivePage);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -87,7 +87,7 @@ export default defineStore('pageAdminStore', {
|
|||||||
* instead, we apply the previous page.
|
* instead, we apply the previous page.
|
||||||
*/
|
*/
|
||||||
keepPreviousPage() {
|
keepPreviousPage() {
|
||||||
printPageAdiminLog && console.log('pinia keeping this.previousPage', this.previousPage);
|
printPageAdminLog && console.log('pinia keeping this.previousPage', this.previousPage);
|
||||||
this.activePage = this.previousPage;
|
this.activePage = this.previousPage;
|
||||||
this.shouldKeepPreviousPage = true;
|
this.shouldKeepPreviousPage = true;
|
||||||
},
|
},
|
||||||
@@ -95,7 +95,7 @@ export default defineStore('pageAdminStore', {
|
|||||||
* Clean up the state of the boolean related to modal showing phase
|
* Clean up the state of the boolean related to modal showing phase
|
||||||
*/
|
*/
|
||||||
clearShouldKeepPreviousPageBoolean(){
|
clearShouldKeepPreviousPageBoolean(){
|
||||||
printPageAdiminLog && console.log('clearShouldKeepPreviousPageBoolean()');
|
printPageAdminLog && console.log('clearShouldKeepPreviousPageBoolean()');
|
||||||
this.shouldKeepPreviousPage = false;
|
this.shouldKeepPreviousPage = false;
|
||||||
},
|
},
|
||||||
setCurrentMapFile(fileName){
|
setCurrentMapFile(fileName){
|
||||||
|
|||||||
@@ -235,7 +235,7 @@
|
|||||||
import IconVector from '@/components/icons/IconVector.vue';
|
import IconVector from '@/components/icons/IconVector.vue';
|
||||||
import IconList from '@/components/icons/IconList.vue';
|
import IconList from '@/components/icons/IconList.vue';
|
||||||
import IconGrid from '@/components/icons/IconGrid.vue';
|
import IconGrid from '@/components/icons/IconGrid.vue';
|
||||||
import { renameModal, deleteFileModal, reallyDeldetInformation } from '@/module/alertModal.js';
|
import { renameModal, deleteFileModal, reallyDeleteInformation } from '@/module/alertModal.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -335,7 +335,7 @@
|
|||||||
/**
|
/**
|
||||||
* Really deleted information
|
* Really deleted information
|
||||||
*/
|
*/
|
||||||
reallyDeldetData: function() {
|
reallyDeleteData: function() {
|
||||||
let result = [];
|
let result = [];
|
||||||
|
|
||||||
if(this.store.allFiles.length !== 0){
|
if(this.store.allFiles.length !== 0){
|
||||||
@@ -360,7 +360,7 @@
|
|||||||
if(newValue != null) this.compareData = JSON.parse(JSON.stringify(newValue));
|
if(newValue != null) this.compareData = JSON.parse(JSON.stringify(newValue));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reallyDeldetData: {
|
reallyDeleteData: {
|
||||||
handler(newValue, oldValue) {
|
handler(newValue, oldValue) {
|
||||||
if(newValue.length !== 0 && oldValue.length === 0){
|
if(newValue.length !== 0 && oldValue.length === 0){
|
||||||
this.showReallyDeldet();
|
this.showReallyDeldet();
|
||||||
@@ -512,8 +512,8 @@
|
|||||||
showReallyDeldet(){
|
showReallyDeldet(){
|
||||||
let srt = '';
|
let srt = '';
|
||||||
|
|
||||||
if(this.reallyDeldetData.length !== 0) {
|
if(this.reallyDeleteData.length !== 0) {
|
||||||
this.reallyDeldetData.forEach(file => {
|
this.reallyDeleteData.forEach(file => {
|
||||||
switch (file.type) {
|
switch (file.type) {
|
||||||
case 'log-check':
|
case 'log-check':
|
||||||
case 'filter-check':
|
case 'filter-check':
|
||||||
@@ -526,7 +526,7 @@
|
|||||||
srt += content;
|
srt += content;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
reallyDeldetInformation(srt, this.reallyDeldetData);
|
reallyDeleteInformation(srt, this.reallyDeleteData);
|
||||||
srt = '';
|
srt = '';
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
...mapActions(PageAdminStore, [
|
...mapActions(PageAdminStore, [
|
||||||
'copyPendingPageToActivePage',
|
'copyPendingPageToActivePage',
|
||||||
'setPrevioiusPage',
|
'setPreviousPage',
|
||||||
'clearShouldKeepPreviousPageBoolean',
|
'clearShouldKeepPreviousPageBoolean',
|
||||||
'setActivePageComputedByRoute',
|
'setActivePageComputedByRoute',
|
||||||
],),
|
],),
|
||||||
@@ -137,7 +137,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// Remember, Swal modal handling is called before beforeRouteUpdate
|
// Remember, Swal modal handling is called before beforeRouteUpdate
|
||||||
beforeRouteUpdate(to, from, next) {
|
beforeRouteUpdate(to, from, next) {
|
||||||
this.setPrevioiusPage(from.name);
|
this.setPreviousPage(from.name);
|
||||||
|
|
||||||
// 離開 Map 頁時判斷是否有無資料和需要存檔
|
// 離開 Map 頁時判斷是否有無資料和需要存檔
|
||||||
if ((from.name === 'Map' || from.name === 'CheckMap') && this.tempFilterId) {
|
if ((from.name === 'Map' || from.name === 'CheckMap') && this.tempFilterId) {
|
||||||
|
|||||||
@@ -173,20 +173,20 @@ describe('allMapDataStore', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('updataFilter', () => {
|
describe('updateFilter', () => {
|
||||||
it('updates filter and clears temp id', async () => {
|
it('updates filter and clears temp id', async () => {
|
||||||
store.createFilterId = 88;
|
store.createFilterId = 88;
|
||||||
store.tempFilterId = 77;
|
store.tempFilterId = 77;
|
||||||
store.postRuleData = [{ type: 'updated' }];
|
store.postRuleData = [{ type: 'updated' }];
|
||||||
mockAxios.put.mockResolvedValue({ status: 200 });
|
mockAxios.put.mockResolvedValue({ status: 200 });
|
||||||
|
|
||||||
await store.updataFilter();
|
await store.updateFilter();
|
||||||
|
|
||||||
expect(mockAxios.put).toHaveBeenCalledWith(
|
expect(mockAxios.put).toHaveBeenCalledWith(
|
||||||
'/api/filters/88',
|
'/api/filters/88',
|
||||||
[{ type: 'updated' }],
|
[{ type: 'updated' }],
|
||||||
);
|
);
|
||||||
expect(store.isUpdataFilter).toBe(true);
|
expect(store.isUpdateFilter).toBe(true);
|
||||||
expect(store.tempFilterId).toBeNull();
|
expect(store.tempFilterId).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -147,19 +147,19 @@ describe('conformanceStore', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('updataConformance', () => {
|
describe('updateConformance', () => {
|
||||||
it('updates existing log check', async () => {
|
it('updates existing log check', async () => {
|
||||||
store.conformanceLogCreateCheckId = 50;
|
store.conformanceLogCreateCheckId = 50;
|
||||||
store.conformanceRuleData = { type: 'updated' };
|
store.conformanceRuleData = { type: 'updated' };
|
||||||
mockAxios.put.mockResolvedValue({ status: 200 });
|
mockAxios.put.mockResolvedValue({ status: 200 });
|
||||||
|
|
||||||
await store.updataConformance();
|
await store.updateConformance();
|
||||||
|
|
||||||
expect(mockAxios.put).toHaveBeenCalledWith(
|
expect(mockAxios.put).toHaveBeenCalledWith(
|
||||||
'/api/log-checks/50',
|
'/api/log-checks/50',
|
||||||
{ type: 'updated' },
|
{ type: 'updated' },
|
||||||
);
|
);
|
||||||
expect(store.isUpdataConformance).toBe(true);
|
expect(store.isUpdateConformance).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ describe('pageAdminStore', () => {
|
|||||||
expect(store.activePage).toBe('CONFORMANCE');
|
expect(store.activePage).toBe('CONFORMANCE');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('setPrevioiusPage converts page name', () => {
|
it('setPreviousPage converts page name', () => {
|
||||||
store.setPrevioiusPage('CheckPerformance');
|
store.setPreviousPage('CheckPerformance');
|
||||||
expect(store.previousPage).toBe('PERFORMANCE');
|
expect(store.previousPage).toBe('PERFORMANCE');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('setPrevioiusPageUsingActivePage copies activePage to previousPage', () => {
|
it('setPreviousPageUsingActivePage copies activePage to previousPage', () => {
|
||||||
store.setActivePage('CONFORMANCE');
|
store.setActivePage('CONFORMANCE');
|
||||||
store.setPrevioiusPageUsingActivePage();
|
store.setPreviousPageUsingActivePage();
|
||||||
expect(store.previousPage).toBe('CONFORMANCE');
|
expect(store.previousPage).toBe('CONFORMANCE');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ describe('pageAdminStore', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('keepPreviousPage restores previous page', () => {
|
it('keepPreviousPage restores previous page', () => {
|
||||||
store.setPrevioiusPage('CONFORMANCE');
|
store.setPreviousPage('CONFORMANCE');
|
||||||
store.setActivePage('PERFORMANCE');
|
store.setActivePage('PERFORMANCE');
|
||||||
store.keepPreviousPage();
|
store.keepPreviousPage();
|
||||||
expect(store.activePage).toBe('CONFORMANCE');
|
expect(store.activePage).toBe('CONFORMANCE');
|
||||||
|
|||||||
Reference in New Issue
Block a user