Standardize store exports to named useXxxStore convention
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import Swal from 'sweetalert2';
|
||||
import AllMapDataStore from '@/stores/allMapData.js';
|
||||
import ConformanceStore from '@/stores/conformance.js';
|
||||
import FilesStore from '@/stores/files.js';
|
||||
import PageAdminStore from '@/stores/pageAdmin.js';
|
||||
import { useAllMapDataStore } from '@/stores/allMapData.js';
|
||||
import { useConformanceStore } from '@/stores/conformance.js';
|
||||
import { useFilesStore } from '@/stores/files.js';
|
||||
import { usePageAdminStore } from '@/stores/pageAdmin.js';
|
||||
import { useModalStore } from '@/stores/modal.js';
|
||||
import { escapeHtml } from '@/utils/escapeHtml.js';
|
||||
|
||||
@@ -23,7 +23,7 @@ const customClass = {
|
||||
*/
|
||||
export async function saveFilter(addFilterId, next = null) {
|
||||
let fileName = '';
|
||||
const pageAdminStore = PageAdminStore();
|
||||
const pageAdminStore = usePageAdminStore();
|
||||
|
||||
const { value, isConfirmed } = await Swal.fire({
|
||||
title: 'SAVE NEW FILTER',
|
||||
@@ -90,8 +90,8 @@ export async function savedSuccessfully(value) {
|
||||
* @param { function } logOut 登出函式
|
||||
*/
|
||||
export async function leaveFilter(next, addFilterId, toPath, logOut) {
|
||||
const allMapDataStore = AllMapDataStore();
|
||||
const pageAdminStore = PageAdminStore();
|
||||
const allMapDataStore = useAllMapDataStore();
|
||||
const pageAdminStore = usePageAdminStore();
|
||||
|
||||
const result = await Swal.fire({
|
||||
title: 'SAVE YOUR FILTER?',
|
||||
@@ -122,7 +122,7 @@ export async function leaveFilter(next, addFilterId, toPath, logOut) {
|
||||
} else if(result.dismiss === 'cancel') {
|
||||
// console.log('popup cancel case', );
|
||||
// Handle page admin issue
|
||||
// console.log("PageAdminStore.activePage", PageAdminStore.activePage);
|
||||
// console.log("usePageAdminStore.activePage", usePageAdminStore.activePage);
|
||||
pageAdminStore.keepPreviousPage();
|
||||
|
||||
allMapDataStore.tempFilterId = null;
|
||||
@@ -130,7 +130,7 @@ export async function leaveFilter(next, addFilterId, toPath, logOut) {
|
||||
} else if(result.dismiss === 'backdrop') {
|
||||
// console.log('popup backdrop case', );
|
||||
// Handle page admin issue
|
||||
// console.log("PageAdminStore.activePage", PageAdminStore.activePage);
|
||||
// console.log("usePageAdminStore.activePage", usePageAdminStore.activePage);
|
||||
pageAdminStore.keepPreviousPage();
|
||||
|
||||
if(!logOut){
|
||||
@@ -186,7 +186,7 @@ export async function saveConformance(addConformanceCreateCheckId) {
|
||||
* @param { function } logOut 登出函式
|
||||
*/
|
||||
export async function leaveConformance(next, addConformanceCreateCheckId, toPath, logOut) {
|
||||
const conformanceStore = ConformanceStore();
|
||||
const conformanceStore = useConformanceStore();
|
||||
const result = await showConfirmationDialog();
|
||||
|
||||
if (result.isConfirmed) {
|
||||
@@ -359,7 +359,7 @@ export async function uploadSuccess() {
|
||||
* @param { object } fetchData 後端 API POST data
|
||||
*/
|
||||
export async function uploadConfirm(fetchData) {
|
||||
const filesStore = FilesStore();
|
||||
const filesStore = useFilesStore();
|
||||
const result = await Swal.fire({
|
||||
title: 'ARE YOU SURE?',
|
||||
html: 'After importing, you won’t be able to modify labels.',
|
||||
@@ -441,7 +441,7 @@ export async function renameModal(rename, type, id, baseName) {
|
||||
* @param { string } name 原本的檔案
|
||||
*/
|
||||
export async function deleteFileModal(files, type, id, name) {
|
||||
const filesStore = FilesStore();
|
||||
const filesStore = useFilesStore();
|
||||
|
||||
const safeName = escapeHtml(name);
|
||||
const htmlText = files.length === 0 ? `Do you really want to delete <span class="text-primary">${safeName}</span>?` : `<div class="text-left mx-4 space-y-1"><p class="mb-2">Do you really want to delete <span class="text-primary">${safeName}</span>?</p><p>The following dependent file(s) will also be deleted:</p><ul class="list-disc ml-6">${files}</ul></div>`;
|
||||
@@ -489,7 +489,7 @@ export async function deleteSuccess() {
|
||||
* @param {array} reallyDeleteData 被刪除的檔案 data,未取得 recordId 而傳入
|
||||
*/
|
||||
export async function reallyDeleteInformation(files, reallyDeleteData) {
|
||||
const filesStore = FilesStore();
|
||||
const filesStore = useFilesStore();
|
||||
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>`;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import loadingStore from '@/stores/loading.js';
|
||||
import { useLoadingStore } from '@/stores/loading.js';
|
||||
import {useToast} from 'vue-toast-notification';
|
||||
import 'vue-toast-notification/dist/theme-sugar.css';
|
||||
|
||||
@@ -12,7 +12,7 @@ const delay = (s = 0) => new Promise((resolve, reject) => setTimeout(resolve, s
|
||||
* @param {string} toastMessage Toast 的提示文字
|
||||
*/
|
||||
export default async function apiError(error, toastMessage) {
|
||||
const loading = loadingStore();
|
||||
const loading = useLoadingStore();
|
||||
const $toast = useToast();
|
||||
await delay();
|
||||
loading.isLoading = true;
|
||||
|
||||
@@ -5,9 +5,9 @@ import fcose from 'cytoscape-fcose';
|
||||
import cola from 'cytoscape-cola';
|
||||
import tippy from 'tippy.js';
|
||||
import 'tippy.js/dist/tippy.css';
|
||||
import MapPathStore from '@/stores/mapPathStore';
|
||||
import { useMapPathStore } from '@/stores/mapPathStore';
|
||||
import { getTimeLabel } from '@/module/timeLabel.js'; // 時間格式轉換器
|
||||
import CytoscapeStore from '@/stores/cytoscapeStore';
|
||||
import { useCytoscapeStore } from '@/stores/cytoscapeStore';
|
||||
import { SAVE_KEY_NAME } from '@/constants/constants.js';
|
||||
|
||||
const composeFreqTypeText = (baseText, dataLayerOption, optionValue) => { //sonar-qube
|
||||
@@ -232,12 +232,12 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu
|
||||
|
||||
// 按下節點光暈效果與鄰邊光暈效果
|
||||
cy.on('tap, mousedown', 'node', function (event) {
|
||||
MapPathStore().onNodeClickHighlightEdges(event.target);
|
||||
useMapPathStore().onNodeClickHighlightEdges(event.target);
|
||||
});
|
||||
|
||||
// 按下線段光暈效果與兩端點光暈效果
|
||||
cy.on('tap, mousedown', 'edge', function (event) {
|
||||
MapPathStore().onEdgeClickHighlightNodes(event.target);
|
||||
useMapPathStore().onEdgeClickHighlightNodes(event.target);
|
||||
});
|
||||
|
||||
// creat tippy.js
|
||||
@@ -260,7 +260,7 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu
|
||||
});
|
||||
|
||||
// here we remember and recall positions
|
||||
const cytoscapeStore = CytoscapeStore();
|
||||
const cytoscapeStore = useCytoscapeStore();
|
||||
cy.ready(() => {
|
||||
cytoscapeStore.loadPositionsFromStorage(rank);
|
||||
// 判斷localStorage是否儲存過拜訪資訊
|
||||
|
||||
Reference in New Issue
Block a user