feature: cytoscape node positions are remembered

This commit is contained in:
Cindy Chang
2024-06-28 16:20:41 +08:00
parent b890df9de6
commit 2110388a2d
8 changed files with 134 additions and 19 deletions

View File

@@ -53,12 +53,14 @@
</template>
<script>
import { onBeforeMount, } from 'vue';
import { storeToRefs } from 'pinia';
import axios from 'axios';
import LoadingStore from '@/stores/loading.js';
import AllMapDataStore from '@/stores/allMapData.js';
import ConformanceStore from '@/stores/conformance.js';
import cytoscapeMap from '@/module/cytoscapeMap.js';
import CytoscapeStore from '@/stores/cytoscapeStore.js';
import SidebarView from '@/components/Discover/Map/SidebarView.vue';
import SidebarState from '@/components/Discover/Map/SidebarState.vue';
import SidebarTraces from '@/components/Discover/Map/SidebarTraces.vue';
@@ -69,9 +71,26 @@ export default {
const loadingStore = LoadingStore();
const allMapDataStore = AllMapDataStore();
const { isLoading } = storeToRefs(loadingStore);
const { processMap, bpmn, stats, insights, traceId, traces, baseTraces, baseTraceId, filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe, filterTrace, temporaryData, isRuleData, ruleData, logId, baseLogId, createFilterId, cases, postRuleData } = storeToRefs(allMapDataStore);
const { processMap, bpmn, stats, insights, traceId, traces, baseTraces, baseTraceId,
filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe, filterTrace,
temporaryData, isRuleData, ruleData, logId, baseLogId, createFilterId, cases,
postRuleData
} = storeToRefs(allMapDataStore);
return { isLoading, processMap, bpmn, stats, insights, traceId, traces, baseTraces, baseTraceId, filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe, filterTrace, logId, baseLogId, createFilterId, temporaryData, isRuleData, ruleData, allMapDataStore, cases, postRuleData }
const cytoscapeStore = CytoscapeStore();
const { setCurrentGraphId } = cytoscapeStore;
onBeforeMount(() => {
setCurrentGraphId(logId);
});
return { isLoading, processMap, bpmn, stats, insights, traceId, traces, baseTraces,
baseTraceId, filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe,
filterTrace, logId, baseLogId, createFilterId, temporaryData, isRuleData,
ruleData, allMapDataStore, cases, postRuleData,
setCurrentGraphId,
};
},
props:['type', 'checkType', 'checkId', 'checkFileId'], // router props
components: {
@@ -94,6 +113,7 @@ export default {
nodes: [],
edges: [],
},
cytoscapeGraph: null,
curveStyle:'unbundled-bezier', // unbundled-bezier | taxi
mapType: 'processMap', // processMap | bpmn
dataLayerType: 'freq', // freq | duration
@@ -355,7 +375,7 @@ export default {
if(this[type].vertices.length !== 0){
this.setNodesData(mapData);
this.setEdgesData(mapData);
cytoscapeMap(mapData, this.dataLayerType, this.dataLayerOption, this.curveStyle, this.rank, graphId);
this.cytoscapeGraph = cytoscapeMap(mapData, this.dataLayerType, this.dataLayerOption, this.curveStyle, this.rank, graphId);
};
},
},

View File

@@ -11,7 +11,8 @@
</span>
<input type="text" id="account" class="w-full border border-neutral-300 rounded py-1 pl-10 pr-2 focus:outline-none focus:border-primary focus:ring-1 "
:class="{'border-danger':isInvalid}" required autofocus v-model.trim="auth.username"
@change="changeHandler($event)"/>
@change="changeHandler($event)"
@focus="onInputAccountFocus"/>
</label>
<label for="passwordt" class="relative block">
<p class="text-sm font-normal mb-2">Password</p>
@@ -20,7 +21,8 @@
</span>
<input :type="showPassword ? 'text' : 'password'" id="password" aria-describedby="password-addon"
class="w-full border border-neutral-300 rounded py-1 pl-10 pr-2 focus:outline-none focus:border-primary focus:ring-1 "
:class="{'border-danger':isInvalid}" required v-model.trim="auth.password" @change="changeHandler($event)"/>
:class="{'border-danger':isInvalid}" required v-model.trim="auth.password" @change="changeHandler($event)"
@focus="onInputPwdFocus"/>
<span class="absolute bottom-2 right-4 inline-flex items-center cursor-pointer" v-show="auth.password"
@click="showPassword = !showPassword">
<IconEyeOpen class="h-5 w-5" v-if="showPassword"/>
@@ -34,7 +36,7 @@
</span>
</p>
<button id="login_btn_main_btn" type="submit" class="w-full btn btn-lg"
:class="this.isDisabled ? 'btn-disable' : 'btn-c-primary'"
:class="isDisabledButton ? 'btn-disable' : 'btn-c-primary'"
:disabled="isDisabledButton">
Log in
</button>
@@ -45,6 +47,7 @@
</template>
<script>
import { ref, } from 'vue';
import { storeToRefs, mapActions } from 'pinia';
import loginStore from '@/stores/login.js';
import IconMember from '@/components/icons/IconMember.vue';
@@ -67,11 +70,13 @@ export default {
const { auth, isInvalid } = storeToRefs(store);
// 調用 store 裡的 action
const { signIn } = store;
const isJustFocus = ref(true);
return {
auth,
isInvalid,
signIn,
isJustFocus,
}
},
components: {
@@ -85,9 +90,8 @@ export default {
/**
* if input no value , disabled.
*/
isDisabledButton() {
let inputAreSpaces = this.auth.username === '' || this.auth.password === '' || this.isInvalid === true;
return this.isDisabled = inputAreSpaces ? true : false;
isDisabledButton() {
return this.auth.username === '' || this.auth.password === '' || this.isInvalid;
},
},
methods: {
@@ -101,6 +105,10 @@ export default {
this.isInvalid = false;
}
},
onInputAccountFocus(){
},
onInputPwdFocus(){
},
...mapActions(loginStore, ['setRememberedReturnToUrl']),
},
created() {

View File

@@ -107,12 +107,13 @@ export default {
// go to log in();
// }
// }
beforeRouteEnter(to, from, next) {
async beforeRouteEnter(to, from, next) {
const loginStore = LoginStore();
if (!loginStore.isLoggedIn) {
if (getCookie('luciaRefreshToken')) {
loginStore.refreshToken();
await loginStore.refreshToken();
loginStore.setIsLoggedIn(true);
} else {
next({
path: '/login',