Discover: fetch discover api && set element(nodes, edges) done

This commit is contained in:
chiayin
2023-02-22 16:10:40 +08:00
parent 8228f9791c
commit 78e18663aa
11 changed files with 361 additions and 74 deletions

29
src/stores/allMapData.js Normal file
View File

@@ -0,0 +1,29 @@
import { defineStore } from "pinia";
export default defineStore('allMapDataStore', {
state: () => ({
logId: null,
processMap: {},
bpmn: {},
}),
getters: {
},
actions: {
/**
* fetch discover api, include '/process-map, /bpmn, /stats, /insights'.
*/
async getAllMapData() {
let logId = this.logId
const api = `/api/logs/${logId}/discover`;
try {
const response = await this.$axios.get(api);
// console.log(response);
this.processMap = response.data.process_map;
this.bpmn = response.data.bpmn;
} catch(error) {
// console.dir(error);
};
},
}
})

View File

@@ -30,7 +30,7 @@ export default defineStore('filesStore', {
switchFilesTagData: {
ALL: ['Log', 'Filter', 'Rule', 'Design'],
DISCOVER: ['Log', 'Filter', 'Rule'],
COMPARE: ['Filter'],
COMPARE: ['Log','Filter'],
DESIGN: ['Log', 'Design'],
},
filesTag: 'ALL',
@@ -60,7 +60,7 @@ export default defineStore('filesStore', {
* Fetch event logs api
*/
async fetchEventLog() {
const api = 'api/logs';
const api = '/api/logs';
try {
const response = await axios.get(api);
@@ -92,7 +92,7 @@ export default defineStore('filesStore', {
* Fetch filters api
*/
async fetchFilter() {
const api = 'api/filters';
const api = '/api/filters';
try {
const response = await axios.get(api);

View File

@@ -22,7 +22,7 @@ export default defineStore('loginStore', {
* fetch Login For Access Token api
*/
async signIn() {
const api = 'api/oauth/token';
const api = '/api/oauth/token';
const config = {
headers: {
// http post 預設的 url 編碼,非 json 格式
@@ -38,7 +38,7 @@ export default defineStore('loginStore', {
const token = response.data.access_token;
document.cookie = `luciaToken=${token}`;
this.$router.push('/files')
this.$router.push('/files');
}
} catch(error) {
this.isInvalid = true;
@@ -61,7 +61,7 @@ export default defineStore('loginStore', {
* get user detail for 'my-account' api
*/
async getUserData() {
const api = 'api/my-account';
const api = '/api/my-account';
try {
const response = await axios.get(api);
@@ -74,7 +74,7 @@ export default defineStore('loginStore', {
* check login for 'my-account' api
*/
async checkLogin() {
const api = 'api/my-account';
const api = '/api/my-account';
try {
const response = await axios.get(api);