Resolve remaining lint violations and stabilize ESLint config
Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
<template>
|
||||
<ModalContainer/>
|
||||
<header id='header_inside_maincontainer' class="sticky inset-x-0 top-0 w-full bg-neutral-10 z-10">
|
||||
<Header/>
|
||||
<Navbar/>
|
||||
<ModalContainer />
|
||||
<header
|
||||
id="header_inside_maincontainer"
|
||||
class="sticky inset-x-0 top-0 w-full bg-neutral-10 z-10"
|
||||
>
|
||||
<Header />
|
||||
<Navbar />
|
||||
</header>
|
||||
<main id='loading_and_router_view_container_in_maincontainer' class="w-full">
|
||||
<main id="loading_and_router_view_container_in_maincontainer" class="w-full">
|
||||
<Loading v-if="loadingStore.isLoading" />
|
||||
<router-view></router-view>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script lang='ts'>
|
||||
<script lang="ts">
|
||||
// The Lucia project.
|
||||
// Copyright 2023-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
@@ -24,54 +27,57 @@
|
||||
* via beforeRouteUpdate.
|
||||
*/
|
||||
|
||||
import { useLoginStore } from "@/stores/login";
|
||||
import { usePageAdminStore } from "@/stores/pageAdmin";
|
||||
import { useAllMapDataStore } from "@/stores/allMapData";
|
||||
import { useConformanceStore } from "@/stores/conformance";
|
||||
import { useLoginStore as useLoginStoreInGuard } from "@/stores/login";
|
||||
import { usePageAdminStore as usePageAdminStoreInGuard } from "@/stores/pageAdmin";
|
||||
import { useAllMapDataStore as useAllMapDataStoreInGuard } from "@/stores/allMapData";
|
||||
import { useConformanceStore as useConformanceStoreInGuard } from "@/stores/conformance";
|
||||
import { getCookie, setCookie } from "@/utils/cookieUtil.js";
|
||||
import { leaveFilter, leaveConformance } from "@/module/alertModal.js";
|
||||
import emitter from "@/utils/emitter";
|
||||
import {
|
||||
leaveFilter as leaveFilterInGuard,
|
||||
leaveConformance as leaveConformanceInGuard,
|
||||
} from "@/module/alertModal.js";
|
||||
import emitterInGuard from "@/utils/emitter";
|
||||
|
||||
export default {
|
||||
// When the page is refreshed or entered for the first time, beforeRouteEnter is executed, but beforeRouteUpdate is not
|
||||
// PSEUDOCODE
|
||||
// if (not logged in) {
|
||||
// if (has refresh token) {
|
||||
// refresh_token();
|
||||
// if (refresh failed) {
|
||||
// go to log in();
|
||||
// } else {
|
||||
// cookie add("refresh_token=" + refresh_token "; expire=****")
|
||||
// }
|
||||
// } else {
|
||||
// go to log in();
|
||||
// }
|
||||
// }
|
||||
// PSEUDOCODE
|
||||
// if (not logged in) {
|
||||
// if (has refresh token) {
|
||||
// refresh_token();
|
||||
// if (refresh failed) {
|
||||
// go to log in();
|
||||
// } else {
|
||||
// cookie add("refresh_token=" + refresh_token "; expire=****")
|
||||
// }
|
||||
// } else {
|
||||
// go to log in();
|
||||
// }
|
||||
// }
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
const loginStore = useLoginStore();
|
||||
const loginStore = useLoginStoreInGuard();
|
||||
const relativeReturnTo = `${window.location.pathname}${window.location.search}${window.location.hash}`;
|
||||
|
||||
if (!getCookie("isLuciaLoggedIn")) {
|
||||
if (getCookie('luciaRefreshToken')) {
|
||||
if (getCookie("luciaRefreshToken")) {
|
||||
try {
|
||||
await loginStore.refreshToken();
|
||||
loginStore.setIsLoggedIn(true);
|
||||
setCookie("isLuciaLoggedIn", "true");
|
||||
next();
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
next({
|
||||
path: '/login',
|
||||
path: "/login",
|
||||
query: {
|
||||
'return-to': btoa(relativeReturnTo),
|
||||
}
|
||||
"return-to": btoa(relativeReturnTo),
|
||||
},
|
||||
});
|
||||
}
|
||||
} else {
|
||||
next({
|
||||
path: '/login',
|
||||
path: "/login",
|
||||
query: {
|
||||
'return-to': btoa(relativeReturnTo),
|
||||
}
|
||||
"return-to": btoa(relativeReturnTo),
|
||||
},
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@@ -80,21 +86,31 @@ export default {
|
||||
},
|
||||
// Remember, Swal modal handling is called before beforeRouteUpdate
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
const pageAdminStore = usePageAdminStore();
|
||||
const allMapDataStore = useAllMapDataStore();
|
||||
const conformanceStore = useConformanceStore();
|
||||
const pageAdminStore = usePageAdminStoreInGuard();
|
||||
const allMapDataStore = useAllMapDataStoreInGuard();
|
||||
const conformanceStore = useConformanceStoreInGuard();
|
||||
|
||||
pageAdminStore.setPreviousPage(from.name);
|
||||
|
||||
// When leaving the Map page, check if there is unsaved data
|
||||
if ((from.name === 'Map' || from.name === 'CheckMap') && allMapDataStore.tempFilterId) {
|
||||
if (
|
||||
(from.name === "Map" || from.name === "CheckMap") &&
|
||||
allMapDataStore.tempFilterId
|
||||
) {
|
||||
// Notify the Map's Sidebar to close
|
||||
emitter.emit('leaveFilter', false);
|
||||
leaveFilter(next, allMapDataStore.addFilterId, to.path)
|
||||
} else if((from.name === 'Conformance' || from.name === 'CheckConformance')
|
||||
&& (conformanceStore.conformanceLogTempCheckId || conformanceStore.conformanceFilterTempCheckId)) {
|
||||
leaveConformance(next, conformanceStore.addConformanceCreateCheckId, to.path);
|
||||
} else if(pageAdminStore.shouldKeepPreviousPage) {
|
||||
emitterInGuard.emit("leaveFilter", false);
|
||||
leaveFilterInGuard(next, allMapDataStore.addFilterId, to.path);
|
||||
} else if (
|
||||
(from.name === "Conformance" || from.name === "CheckConformance") &&
|
||||
(conformanceStore.conformanceLogTempCheckId ||
|
||||
conformanceStore.conformanceFilterTempCheckId)
|
||||
) {
|
||||
leaveConformanceInGuard(
|
||||
next,
|
||||
conformanceStore.addConformanceCreateCheckId,
|
||||
to.path,
|
||||
);
|
||||
} else if (pageAdminStore.shouldKeepPreviousPage) {
|
||||
pageAdminStore.clearShouldKeepPreviousPageBoolean();
|
||||
} else {
|
||||
pageAdminStore.copyPendingPageToActivePage();
|
||||
@@ -104,21 +120,21 @@ export default {
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup lang='ts'>
|
||||
import { onBeforeMount } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useLoadingStore } from '@/stores/loading';
|
||||
import { useAllMapDataStore } from '@/stores/allMapData';
|
||||
import { useConformanceStore } from '@/stores/conformance';
|
||||
<script setup lang="ts">
|
||||
import { onBeforeMount } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { useLoadingStore } from "@/stores/loading";
|
||||
import { useAllMapDataStore } from "@/stores/allMapData";
|
||||
import { useConformanceStore } from "@/stores/conformance";
|
||||
import Header from "@/components/Header.vue";
|
||||
import Navbar from "@/components/Navbar.vue";
|
||||
import Loading from '@/components/Loading.vue';
|
||||
import { leaveFilter, leaveConformance } from '@/module/alertModal.js';
|
||||
import { usePageAdminStore } from '@/stores/pageAdmin';
|
||||
import Loading from "@/components/Loading.vue";
|
||||
import { leaveFilter, leaveConformance } from "@/module/alertModal.js";
|
||||
import { usePageAdminStore } from "@/stores/pageAdmin";
|
||||
import { useLoginStore } from "@/stores/login";
|
||||
import emitter from '@/utils/emitter';
|
||||
import ModalContainer from './AccountManagement/ModalContainer.vue';
|
||||
import emitter from "@/utils/emitter";
|
||||
import ModalContainer from "./AccountManagement/ModalContainer.vue";
|
||||
|
||||
const loadingStore = useLoadingStore();
|
||||
const allMapDataStore = useAllMapDataStore();
|
||||
@@ -127,18 +143,22 @@ const pageAdminStore = usePageAdminStore();
|
||||
const loginStore = useLoginStore();
|
||||
const router = useRouter();
|
||||
|
||||
const { tempFilterId, createFilterId, temporaryData, postRuleData, ruleData } = storeToRefs(allMapDataStore);
|
||||
const { conformanceLogTempCheckId, conformanceFilterTempCheckId } = storeToRefs(conformanceStore);
|
||||
const { tempFilterId, createFilterId, temporaryData, postRuleData, ruleData } =
|
||||
storeToRefs(allMapDataStore);
|
||||
const { conformanceLogTempCheckId, conformanceFilterTempCheckId } =
|
||||
storeToRefs(conformanceStore);
|
||||
|
||||
/** Sets the highlighted navbar item based on the current URL path on page load. */
|
||||
const setHighlightedNavItemOnLanding = () => {
|
||||
const currentPath = router.currentRoute.value.path;
|
||||
const pathSegments: string[] = currentPath.split('/').filter(segment => segment !== '');
|
||||
if(pathSegments.length === 1) {
|
||||
if(pathSegments[0] === 'files') {
|
||||
pageAdminStore.setActivePage('ALL');
|
||||
const pathSegments = currentPath
|
||||
.split("/")
|
||||
.filter((segment) => segment !== "");
|
||||
if (pathSegments.length === 1) {
|
||||
if (pathSegments[0] === "files") {
|
||||
pageAdminStore.setActivePage("ALL");
|
||||
}
|
||||
} else if (pathSegments.length > 1){
|
||||
} else if (pathSegments.length > 1) {
|
||||
pageAdminStore.setActivePage(pathSegments[1].toUpperCase());
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user