diff --git a/src/frontend/src/backend.js b/src/frontend/src/backend.js
index 6d972b1..a0a9172 100644
--- a/src/frontend/src/backend.js
+++ b/src/frontend/src/backend.js
@@ -1,6 +1,7 @@
import logger from "@/logger.js";
import {useNotificationStore} from "@/store/notification.js";
import {config} from "@/config";
+import {useActiveUserStore} from "@/store/activeuser.js";
const getCsrfToken = () => {
const value = `; ${document.cookie}`;
@@ -11,43 +12,6 @@ const getCsrfToken = () => {
return null;
}
-let sessionRefreshInterval = null;
-let lastActivity = Date.now();
-
-const refreshSession = async () => {
- try {
- await performRequest(null, 'GET', `${config.backendUrl}/error/`, null);
- logger.log('Session refreshed');
- } catch (e) {
- logger.error('Session refresh failed', e);
- }
-}
-
-const trackActivity = () => {
- lastActivity = Date.now();
-}
-
-const startSessionRefresh = () => {
-
- if (sessionRefreshInterval) {
- clearInterval(sessionRefreshInterval);
- }
-
- sessionRefreshInterval = setInterval(async () => {
- const timeSinceActivity = Date.now() - lastActivity;
-
- if (timeSinceActivity < (10 * 60 * 1000)) {
- await refreshSession();
- }
- }, 2 * 60 * 1000);
-}
-
-const stopSessionRefresh = () => {
- if (sessionRefreshInterval) {
- clearInterval(sessionRefreshInterval);
- }
-}
-
const performRequest = async (requestingStore, method, url, body, expectResponse = true, expectedException = null) => {
const params = {
@@ -159,7 +123,9 @@ function handleErrorResponse(data, requestingStore, request) {
}
const executeRequest = async (requestingStore, request) => {
- trackActivity();
+
+ useActiveUserStore().trackActivity();
+
const response = await fetch(request.url, request.params
).catch(e => {
@@ -231,4 +197,4 @@ const executeRequest = async (requestingStore, request) => {
}
export default performRequest;
-export {performUpload, performDownload, getCsrfToken, startSessionRefresh, stopSessionRefresh};
+export {performUpload, performDownload, getCsrfToken};
diff --git a/src/frontend/src/components/layout/TraceView.vue b/src/frontend/src/components/layout/TraceView.vue
index 261f05a..b0cc3e8 100644
--- a/src/frontend/src/components/layout/TraceView.vue
+++ b/src/frontend/src/components/layout/TraceView.vue
@@ -66,10 +66,6 @@ export default {
},
},
- created() {
- console.log(this.error);
- console.log(this.error.trace);
- },
methods: {
highlightClasses(traceItem) {
return traceItem.className?.includes('de.avatic.lcc') ? 'highlight-trace-item' : 'trace-item';
diff --git a/src/frontend/src/components/layout/config/AddApp.vue b/src/frontend/src/components/layout/config/AddApp.vue
index fd001b9..bb224a3 100644
--- a/src/frontend/src/components/layout/config/AddApp.vue
+++ b/src/frontend/src/components/layout/config/AddApp.vue
@@ -99,7 +99,6 @@ export default {
if (!this.disableButton) {
const app = await this.appsStore.addApp(this.appName, this.selectedGroups);
this.stage1 = false;
- console.log("app in add app", app);
this.clientSecret = app.client_secret;
this.clientId = app.client_id;
}
diff --git a/src/frontend/src/components/layout/config/EditUser.vue b/src/frontend/src/components/layout/config/EditUser.vue
index d4fd725..04ef116 100644
--- a/src/frontend/src/components/layout/config/EditUser.vue
+++ b/src/frontend/src/components/layout/config/EditUser.vue
@@ -75,7 +75,6 @@ export default {
const idx = this.user.groups?.indexOf(groupName);
- console.log("update selected", idx, checked, groupName, this.user.groups);
if (checked) {
if ((idx ?? null) !== null && idx === -1)
@@ -83,7 +82,7 @@ export default {
} else {
if ((idx ?? null) !== null && idx !== -1)
- this.user.groups.splice(idx);
+ this.user.groups.splice(idx,1);
}
},
diff --git a/src/frontend/src/components/layout/edit/destination/DestinationEditHandlingCost.vue b/src/frontend/src/components/layout/edit/destination/DestinationEditHandlingCost.vue
index 4d3fedc..84635bd 100644
--- a/src/frontend/src/components/layout/edit/destination/DestinationEditHandlingCost.vue
+++ b/src/frontend/src/components/layout/edit/destination/DestinationEditHandlingCost.vue
@@ -41,16 +41,15 @@
import Checkbox from "@/components/UI/Checkbox.vue";
import {mapStores} from "pinia";
-import {usePremiseEditStore} from "@/store/premiseEdit.js";
-import {set} from "@vueuse/core";
import {parseNumberFromString} from "@/common.js";
import {useDestinationSingleEditStore} from "@/store/destinationSingleEdit.js";
+import logger from "@/logger.js";
export default {
name: "DestinationEditHandlingCost",
components: {Checkbox},
created() {
- console.log("Destination:", this.destination)
+ logger.log("Destination:", this.destination)
},
computed: {
...mapStores(useDestinationSingleEditStore),
diff --git a/src/frontend/src/components/layout/edit/destination/DestinationEditRoutes.vue b/src/frontend/src/components/layout/edit/destination/DestinationEditRoutes.vue
index b46f482..b64e7f5 100644
--- a/src/frontend/src/components/layout/edit/destination/DestinationEditRoutes.vue
+++ b/src/frontend/src/components/layout/edit/destination/DestinationEditRoutes.vue
@@ -81,6 +81,7 @@ import {mapStores} from "pinia";
import {parseNumberFromString} from "@/common.js";
import Tooltip from "@/components/UI/Tooltip.vue";
import {useDestinationSingleEditStore} from "@/store/destinationSingleEdit.js";
+import logger from "@/logger.js";
export default {
name: "DestinationEditRoutes",
@@ -117,7 +118,7 @@ export default {
}
},
created() {
- console.log("Destination:", this.destination)
+ logger.log("Destination:", this.destination)
},
data() {
return {
diff --git a/src/frontend/src/components/layout/error/ErrorModal.vue b/src/frontend/src/components/layout/error/ErrorModal.vue
index 88e6643..bb6f75a 100644
--- a/src/frontend/src/components/layout/error/ErrorModal.vue
+++ b/src/frontend/src/components/layout/error/ErrorModal.vue
@@ -2,7 +2,7 @@
@@ -36,6 +36,12 @@ export default {
required: true
}
},
+ methods: {
+ handleTabChange(eventData) {
+ const {_, tab} = eventData;
+ this.tabsError.forEach(t => t.props.isSelected = t.title === tab.title);
+ }
+ },
computed: {
tabsError() {
const tabs = [];
diff --git a/src/frontend/src/components/layout/error/ErrorModalTraceView.vue b/src/frontend/src/components/layout/error/ErrorModalTraceView.vue
index 918870c..275c6ad 100644
--- a/src/frontend/src/components/layout/error/ErrorModalTraceView.vue
+++ b/src/frontend/src/components/layout/error/ErrorModalTraceView.vue
@@ -49,10 +49,6 @@ export default {
},
},
- created() {
- console.log(this.error);
- console.log(this.error.trace);
- },
methods: {
highlightClasses(traceItem) {
return traceItem.fullPath?.includes('de.avatic.lcc') ? 'highlight-trace-item' : 'trace-item';
diff --git a/src/frontend/src/main.js b/src/frontend/src/main.js
index 3d3a07e..17a8b34 100644
--- a/src/frontend/src/main.js
+++ b/src/frontend/src/main.js
@@ -1,38 +1,42 @@
import router from './router.js';
//import store from './store/index.js';
-import { setupErrorBuffer } from './store/notification.js'
+import {setupErrorBuffer} from './store/notification.js'
import {createApp} from 'vue'
import {createPinia} from 'pinia';
-import {startSessionRefresh} from "@/backend.js";
import App from './App.vue'
import {
- PhStar,
- PhCalculator,
- PhSealCheck,
- PhCloudArrowUp,
- PhX,
- PhTrain,
- PhTruckTrailer,
- PhTruck,
+ PhArchive,
+ PhArrowCounterClockwise,
PhBoat,
- PhPencilSimple,
+ PhBug,
+ PhCalculator,
+ PhCheck,
+ PhClipboard,
+ PhCloudArrowUp,
+ PhDesktop,
+ PhDownload,
+ PhFile,
+ PhFloppyDisk,
+ PhHardDrives,
PhLock,
PhLockOpen,
- PhWarning,
PhMagnifyingGlass,
+ PhPencilSimple,
PhPlus,
- PhUpload,
- PhDownload,
+ PhSealCheck,
+ PhShuffle,
+ PhStack,
+ PhStar,
+ PhTrain,
PhTrash,
- PhArchive,
- PhFloppyDisk,
- PhArrowCounterClockwise,
- PhCheck, PhBug, PhShuffle, PhStack, PhFile, PhFilePlus, PhDownloadSimple, PhMonitor, PhCpu, PhFileJs, PhFileCloud,
- PhCloudX, PhDesktop, PhHardDrives, PhClipboard
+ PhTruck,
+ PhTruckTrailer,
+ PhUpload,
+ PhWarning,
+ PhX
} from "@phosphor-icons/vue";
-
-
+import {setupSessionRefresh} from "@/store/activeuser.js";
const app = createApp(App);
@@ -75,6 +79,6 @@ app.use(router);
setupErrorBuffer()
-startSessionRefresh();
+setupSessionRefresh();
app.mount('#app');
diff --git a/src/frontend/src/pages/Calculations.vue b/src/frontend/src/pages/Calculations.vue
index 9b4d523..f54cccc 100644
--- a/src/frontend/src/pages/Calculations.vue
+++ b/src/frontend/src/pages/Calculations.vue
@@ -169,8 +169,6 @@ export default {
async handleMultiselectAction(action) {
this.selectedStatus = await this.premiseStore.resolveStatus();
- console.log("status: ", this.selectedStatus)
-
if (action === "delete") {
if (0 === this.selectedStatus.draft.length) {
diff --git a/src/frontend/src/pages/Config.vue b/src/frontend/src/pages/Config.vue
index 7685205..381b331 100644
--- a/src/frontend/src/pages/Config.vue
+++ b/src/frontend/src/pages/Config.vue
@@ -121,7 +121,7 @@ export default {
},
methods: {
handleTabChange(eventData) {
- const {index, tab} = eventData;
+ const {_, tab} = eventData;
this.tabsConfig.forEach(t => t.props.isSelected = t.title === tab.title);
}
}
diff --git a/src/frontend/src/pages/DevPage.vue b/src/frontend/src/pages/DevPage.vue
index 6e9ec16..d425b09 100644
--- a/src/frontend/src/pages/DevPage.vue
+++ b/src/frontend/src/pages/DevPage.vue
@@ -18,6 +18,7 @@ import TabContainer from "@/components/UI/TabContainer.vue";
import {markRaw} from "vue";
import CalculationDumpList from "@/components/layout/dev/CalculationDumpList.vue";
import DevUserControl from "@/components/layout/dev/DevUserControl.vue";
+import logger from "@/logger.js";
export default {
name: "DevPage",
@@ -47,10 +48,9 @@ export default {
methods: {
handleTabChange(eventData) {
- console.log("handleTabChange")
const { index, tab } = eventData;
- console.log(`Tab ${index} activated:`, tab.title);
+ logger.log(`Tab ${index} activated:`, tab.title);
this.tabsConfig.forEach(t => t.props.isSelected = t.title === tab.title);
diff --git a/src/frontend/src/pages/ErrorLog.vue b/src/frontend/src/pages/ErrorLog.vue
index 8af885b..2000156 100644
--- a/src/frontend/src/pages/ErrorLog.vue
+++ b/src/frontend/src/pages/ErrorLog.vue
@@ -74,7 +74,6 @@ export default {
methods: {
async fetchData(query) {
- console.log("fetchData")
await this.errorLogStore.setQuery(query);
this.pagination = this.errorLogStore.getPagination;
return this.errorLogStore.getErrors;
@@ -83,7 +82,6 @@ export default {
return buildDate(date, true);
},
showDetails(error) {
- console.log("click")
this.error = error;
this.showModal = true;
}
diff --git a/src/frontend/src/store/activeuser.js b/src/frontend/src/store/activeuser.js
index c738235..149f52d 100644
--- a/src/frontend/src/store/activeuser.js
+++ b/src/frontend/src/store/activeuser.js
@@ -1,12 +1,15 @@
import {defineStore} from 'pinia'
import {config} from '@/config'
-import performRequest from "@/backend.js";
+import performRequest, {getCsrfToken} from "@/backend.js";
+import logger from "@/logger.js";
export const useActiveUserStore = defineStore('activeUser', {
state: () => {
return {
user: null,
+ lastActivity: Date.now(),
+ sessionRefreshInterval: null
}
},
getters: {
@@ -63,6 +66,29 @@ export const useActiveUserStore = defineStore('activeUser', {
},
actions: {
+ trackActivity() {
+ this.lastActivity = Date.now();
+ },
+ setupSessionRefresh() {
+ if (this.sessionRefreshInterval) {
+ clearInterval(this.sessionRefreshInterval);
+ }
+ this.sessionRefreshInterval = setInterval(async () => {
+ const timeSinceActivity = Date.now() - this.lastActivity;
+
+ if (timeSinceActivity < (10 * 60 * 1000)) {
+ await this.refreshSession();
+ }
+ }, 2 * 60 * 1000);
+ },
+ async refreshSession() {
+ try {
+ await this.load();
+ logger.log('Session refreshed');
+ } catch (e) {
+ logger.error('Session refresh failed', e);
+ }
+ },
async loadIfRequired() {
if (this.user === null)
await this.load();
@@ -72,4 +98,16 @@ export const useActiveUserStore = defineStore('activeUser', {
this.user = resp.data;
}
}
-});
\ No newline at end of file
+});
+
+
+export function setupSessionRefresh() {
+ useActiveUserStore().setupSessionRefresh();
+}
+
+// const stopSessionRefresh = () => {
+// useActiveUserStore().stopSessionRefresh
+// if (sessionRefreshInterval) {
+// clearInterval(sessionRefreshInterval);
+// }
+// }
diff --git a/src/frontend/src/store/assistant.js b/src/frontend/src/store/assistant.js
index 60777cb..8cc3861 100644
--- a/src/frontend/src/store/assistant.js
+++ b/src/frontend/src/store/assistant.js
@@ -2,6 +2,7 @@ import {defineStore} from 'pinia'
import {config} from '@/config'
import {useNotificationStore} from "@/store/notification.js";
import performRequest from "@/backend.js";
+import logger from "@/logger.js";
export const useAssistantStore = defineStore('assistant', {
@@ -89,7 +90,7 @@ export const useAssistantStore = defineStore('assistant', {
const url = `${config.backendUrl}/calculation/search/`;
- console.log(`${url} with query ${query}`);
+ logger.log(`${url} with query ${query}`);
try {
const resp = await performRequest(this, 'GET', `${config.backendUrl}/calculation/search/?search=${encodeURIComponent(query)}`, null, true);
diff --git a/src/frontend/src/store/containerRate.js b/src/frontend/src/store/containerRate.js
index b3b53e0..165771c 100644
--- a/src/frontend/src/store/containerRate.js
+++ b/src/frontend/src/store/containerRate.js
@@ -53,8 +53,6 @@ export const useContainerRateStore = defineStore('containerRate', {
this.rates = data;
this.pagination = { page: parseInt(headers.get('X-Current-Page')), pageCount: parseInt(headers.get('X-Page-Count')), totalCount: parseInt(headers.get('X-Total-Count'))};
- console.log(this.pagination)
-
this.loading = false;
}
diff --git a/src/frontend/src/store/errorLog.js b/src/frontend/src/store/errorLog.js
index 86358bf..200110d 100644
--- a/src/frontend/src/store/errorLog.js
+++ b/src/frontend/src/store/errorLog.js
@@ -50,7 +50,6 @@ export const useErrorLogStore = defineStore('errorLog', {
this.errors = data;
this.pagination = { page: parseInt(headers.get('X-Current-Page')), pageCount: parseInt(headers.get('X-Page-Count')), totalCount: parseInt(headers.get('X-Total-Count'))};
- console.log(this.pagination)
this.loading = false;
diff --git a/src/frontend/src/store/properties.js b/src/frontend/src/store/properties.js
index e26d320..7fd279e 100644
--- a/src/frontend/src/store/properties.js
+++ b/src/frontend/src/store/properties.js
@@ -36,8 +36,6 @@ export const usePropertiesStore = defineStore('properties', {
async setProperty(property) {
if(this.properties === null) return;
- console.log(property)
-
const prop = this.properties.find(p => p.external_mapping_id === property.id);
if((prop ?? null) === null) return;