Apply repository-wide ESLint auto-fix formatting pass
Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
import { defineStore } from "pinia";
|
||||
import moment from "moment";
|
||||
import apiClient from "@/api/client.js";
|
||||
import apiError from '@/module/apiError.js';
|
||||
import { Decimal } from 'decimal.js';
|
||||
import apiError from "@/module/apiError.js";
|
||||
import { Decimal } from "decimal.js";
|
||||
|
||||
/**
|
||||
* Returns the API base path for the current map data source,
|
||||
@@ -30,7 +30,7 @@ function getMapApiBase(state) {
|
||||
}
|
||||
|
||||
/** Pinia store for Discover Map page data and filter management. */
|
||||
export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
export const useAllMapDataStore = defineStore("allMapDataStore", {
|
||||
state: () => ({
|
||||
baseLogId: null,
|
||||
logId: null,
|
||||
@@ -68,73 +68,85 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
baseInfiniteStart: 0, // Starting index for base infinite scroll cases
|
||||
}),
|
||||
getters: {
|
||||
processMap: state => {
|
||||
processMap: (state) => {
|
||||
return state.allProcessMap;
|
||||
},
|
||||
bpmn: state => {
|
||||
bpmn: (state) => {
|
||||
return state.allBpmn;
|
||||
},
|
||||
stats: state => {
|
||||
stats: (state) => {
|
||||
return state.allStats;
|
||||
},
|
||||
insights: state => {
|
||||
insights: (state) => {
|
||||
return state.allInsights;
|
||||
},
|
||||
traces: state => {
|
||||
traces: (state) => {
|
||||
return state.allTrace.sort((x, y) => x.id - y.id);
|
||||
},
|
||||
baseTraces: state => {
|
||||
baseTraces: (state) => {
|
||||
return state.allBaseTrace.sort((x, y) => x.id - y.id);
|
||||
},
|
||||
cases: state => {
|
||||
cases: (state) => {
|
||||
return state.allCase;
|
||||
},
|
||||
baseCases: state => {
|
||||
baseCases: (state) => {
|
||||
return state.allBaseCase;
|
||||
},
|
||||
infiniteFirstCases: state => {
|
||||
if(state.infiniteStart === 0) return state.allCase;
|
||||
infiniteFirstCases: (state) => {
|
||||
if (state.infiniteStart === 0) return state.allCase;
|
||||
},
|
||||
BaseInfiniteFirstCases: state => {
|
||||
if(state.baseInfiniteStart === 0) return state.allBaseCase;
|
||||
BaseInfiniteFirstCases: (state) => {
|
||||
if (state.baseInfiniteStart === 0) return state.allBaseCase;
|
||||
},
|
||||
traceTaskSeq: state => {
|
||||
traceTaskSeq: (state) => {
|
||||
return state.allTraceTaskSeq;
|
||||
},
|
||||
baseTraceTaskSeq: state => {
|
||||
baseTraceTaskSeq: (state) => {
|
||||
return state.allBaseTraceTaskSeq;
|
||||
},
|
||||
// All tasks
|
||||
filterTasks: state => {
|
||||
filterTasks: (state) => {
|
||||
return state.allFilterTask;
|
||||
},
|
||||
// form start to end tasks
|
||||
filterStartToEnd: state => {
|
||||
filterStartToEnd: (state) => {
|
||||
return state.allFilterStartToEnd;
|
||||
},
|
||||
// form end to start tasks
|
||||
filterEndToStart: state => {
|
||||
filterEndToStart: (state) => {
|
||||
return state.allFilterEndToStart;
|
||||
},
|
||||
filterTimeframe: state => {
|
||||
filterTimeframe: (state) => {
|
||||
return state.allFilterTimeframe;
|
||||
},
|
||||
filterTrace: state => {
|
||||
filterTrace: (state) => {
|
||||
return state.allFilterTrace;
|
||||
},
|
||||
filterAttrs: state => {
|
||||
if(state.allFilterAttrs !== null){
|
||||
return state.allFilterAttrs.map(att => {
|
||||
filterAttrs: (state) => {
|
||||
if (state.allFilterAttrs !== null) {
|
||||
return state.allFilterAttrs.map((att) => {
|
||||
const copy = { ...att };
|
||||
switch (copy.type) {
|
||||
case 'date':
|
||||
copy.min = copy.min !== null ? moment(copy.min).format('YYYY/MM/DD HH:mm') : null;
|
||||
copy.max = copy.max !== null ? moment(copy.max).format('YYYY/MM/DD HH:mm') : null;
|
||||
case "date":
|
||||
copy.min =
|
||||
copy.min !== null
|
||||
? moment(copy.min).format("YYYY/MM/DD HH:mm")
|
||||
: null;
|
||||
copy.max =
|
||||
copy.max !== null
|
||||
? moment(copy.max).format("YYYY/MM/DD HH:mm")
|
||||
: null;
|
||||
break;
|
||||
case "float":
|
||||
copy.min =
|
||||
copy.min !== null
|
||||
? Number(new Decimal(copy.min).toFixed(2, 1))
|
||||
: null;
|
||||
copy.max =
|
||||
copy.max !== null
|
||||
? Number(new Decimal(copy.max).toFixed(2, 0))
|
||||
: null;
|
||||
break;
|
||||
case 'float':
|
||||
copy.min = copy.min !== null ? Number(new Decimal(copy.min).toFixed(2, 1)) : null;
|
||||
copy.max = copy.max !== null ? Number(new Decimal(copy.max).toFixed(2, 0)) : null;
|
||||
break
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -142,7 +154,7 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
});
|
||||
}
|
||||
},
|
||||
allFunnels: state => {
|
||||
allFunnels: (state) => {
|
||||
return state.allFunnelData;
|
||||
},
|
||||
},
|
||||
@@ -158,9 +170,9 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
this.allBpmn = response.data.bpmn;
|
||||
this.allStats = response.data.stats;
|
||||
this.allInsights = response.data.insights;
|
||||
} catch(error) {
|
||||
apiError(error, 'Failed to load the Map.');
|
||||
};
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to load the Map.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* fetch trace api.
|
||||
@@ -173,12 +185,12 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
let baseResponse;
|
||||
const response = await apiClient.get(api);
|
||||
this.allTrace = response.data;
|
||||
if(baseLogId) {
|
||||
if (baseLogId) {
|
||||
baseResponse = await apiClient.get(baseApi);
|
||||
this.allBaseTrace = baseResponse.data;
|
||||
}
|
||||
} catch(error) {
|
||||
apiError(error, 'Failed to load the Trace.');
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to load the Trace.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
@@ -192,30 +204,36 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
const response = await apiClient.get(api);
|
||||
this.allTraceTaskSeq = response.data.task_seq;
|
||||
this.allCase = response.data.cases;
|
||||
this.allCase.forEach(c => {
|
||||
c.started_at = moment(c.started_at).format('YYYY/MM/DD HH:mm');
|
||||
c.completed_at = moment(c.completed_at).format('YYYY/MM/DD HH:mm');
|
||||
c.attributes.forEach(att => {
|
||||
this.allCase.forEach((c) => {
|
||||
c.started_at = moment(c.started_at).format("YYYY/MM/DD HH:mm");
|
||||
c.completed_at = moment(c.completed_at).format("YYYY/MM/DD HH:mm");
|
||||
c.attributes.forEach((att) => {
|
||||
switch (att.type) {
|
||||
case 'date':
|
||||
att.value = att.value !== null ? moment(att.value).format('YYYY/MM/DD HH:mm') : null;
|
||||
case "date":
|
||||
att.value =
|
||||
att.value !== null
|
||||
? moment(att.value).format("YYYY/MM/DD HH:mm")
|
||||
: null;
|
||||
break;
|
||||
case 'float':
|
||||
att.value = att.value !== null ? Number(new Decimal(att.value).toFixed(2)) : null;
|
||||
case "float":
|
||||
att.value =
|
||||
att.value !== null
|
||||
? Number(new Decimal(att.value).toFixed(2))
|
||||
: null;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
return this.allCase;
|
||||
} catch(error) {
|
||||
if(error.response?.status === 404) {
|
||||
} catch (error) {
|
||||
if (error.response?.status === 404) {
|
||||
this.infinite404 = 404;
|
||||
return;
|
||||
}
|
||||
apiError(error, 'Failed to load the Trace Detail.');
|
||||
};
|
||||
apiError(error, "Failed to load the Trace Detail.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* fetch base log trace detail api.
|
||||
@@ -230,30 +248,36 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
const response = await apiClient.get(api);
|
||||
this.allBaseTraceTaskSeq = response.data.task_seq;
|
||||
this.allBaseCase = response.data.cases;
|
||||
this.allBaseCase.forEach(c => {
|
||||
c.started_at = moment(c.started_at).format('YYYY/MM/DD HH:mm');
|
||||
c.completed_at = moment(c.completed_at).format('YYYY/MM/DD HH:mm');
|
||||
c.attributes.forEach(att => {
|
||||
this.allBaseCase.forEach((c) => {
|
||||
c.started_at = moment(c.started_at).format("YYYY/MM/DD HH:mm");
|
||||
c.completed_at = moment(c.completed_at).format("YYYY/MM/DD HH:mm");
|
||||
c.attributes.forEach((att) => {
|
||||
switch (att.type) {
|
||||
case 'date':
|
||||
att.value = att.value !== null ? moment(att.value).format('YYYY/MM/DD HH:mm') : null;
|
||||
case "date":
|
||||
att.value =
|
||||
att.value !== null
|
||||
? moment(att.value).format("YYYY/MM/DD HH:mm")
|
||||
: null;
|
||||
break;
|
||||
case 'float':
|
||||
att.value = att.value !== null ? Number(new Decimal(att.value).toFixed(2)) : null;
|
||||
case "float":
|
||||
att.value =
|
||||
att.value !== null
|
||||
? Number(new Decimal(att.value).toFixed(2))
|
||||
: null;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
return this.allBaseCase;
|
||||
} catch(error) {
|
||||
if(error.response?.status === 404) {
|
||||
} catch (error) {
|
||||
if (error.response?.status === 404) {
|
||||
this.infinite404 = 404;
|
||||
return;
|
||||
}
|
||||
apiError(error, 'Failed to load the Base Trace Detail.');
|
||||
};
|
||||
apiError(error, "Failed to load the Base Trace Detail.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* fetch Filter Parameters api.
|
||||
@@ -277,11 +301,13 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
this.allFilterTimeframe.x_axis.min_base = min;
|
||||
this.allFilterTimeframe.x_axis.max_base = max;
|
||||
// Convert to a time format without seconds
|
||||
this.allFilterTimeframe.x_axis.min = min !== null ? moment(min).format('YYYY/MM/DD HH:mm') : null;
|
||||
this.allFilterTimeframe.x_axis.max = max !== null ? moment(max).format('YYYY/MM/DD HH:mm') : null;
|
||||
} catch(error) {
|
||||
apiError(error, 'Failed to load the Filter Parameters.');
|
||||
};
|
||||
this.allFilterTimeframe.x_axis.min =
|
||||
min !== null ? moment(min).format("YYYY/MM/DD HH:mm") : null;
|
||||
this.allFilterTimeframe.x_axis.max =
|
||||
max !== null ? moment(max).format("YYYY/MM/DD HH:mm") : null;
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to load the Filter Parameters.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Test if the Filter Rules Result in Any Data
|
||||
@@ -291,11 +317,11 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
const api = `/api/filters/has-result?log_id=${logId}`;
|
||||
|
||||
try {
|
||||
const response = await apiClient.post(api, this.postRuleData)
|
||||
const response = await apiClient.post(api, this.postRuleData);
|
||||
this.hasResultRule = response.data.result;
|
||||
} catch(error) {
|
||||
apiError(error, 'Failed to load the Has Result.');
|
||||
};
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to load the Has Result.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Add a New Temporary Filter
|
||||
@@ -305,11 +331,11 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
const api = `/api/temp-filters?log_id=${logId}`;
|
||||
|
||||
try {
|
||||
const response = await apiClient.post(api, this.postRuleData)
|
||||
const response = await apiClient.post(api, this.postRuleData);
|
||||
this.tempFilterId = response.data.id;
|
||||
} catch(error) {
|
||||
apiError(error, 'Failed to add the Temporary Filters.');
|
||||
};
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to add the Temporary Filters.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Add a New Filter
|
||||
@@ -320,16 +346,16 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
const api = `/api/filters?log_id=${logId}`;
|
||||
const createFilterObj = {
|
||||
name: value,
|
||||
rules: this.postRuleData
|
||||
rules: this.postRuleData,
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await apiClient.post(api, createFilterObj);
|
||||
this.createFilterId = response.data.id;
|
||||
this.tempFilterId = null;
|
||||
}catch(error) {
|
||||
apiError(error, 'Failed to load the Filters.');
|
||||
};
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to load the Filters.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Get Filter Detail
|
||||
@@ -338,15 +364,15 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
async fetchFunnel(createFilterId) {
|
||||
const api = `/api/filters/${createFilterId}`;
|
||||
|
||||
if(createFilterId){
|
||||
if (createFilterId) {
|
||||
try {
|
||||
const response = await apiClient.get(api);
|
||||
this.temporaryData = response.data.rules;
|
||||
this.logId = response.data.log.id;
|
||||
this.filterName = response.data.name;
|
||||
this.baseLogId = response.data.log.id;
|
||||
}catch(error) {
|
||||
apiError(error, 'Failed to get Filter Detail.');
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to get Filter Detail.");
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -354,7 +380,7 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
* Update an Existing Filter
|
||||
*/
|
||||
async updateFilter() {
|
||||
const createFilterId = this.createFilterId
|
||||
const createFilterId = this.createFilterId;
|
||||
const api = `/api/filters/${createFilterId}`;
|
||||
const data = this.postRuleData;
|
||||
|
||||
@@ -362,9 +388,9 @@ export const useAllMapDataStore = defineStore('allMapDataStore', {
|
||||
const response = await apiClient.put(api, data);
|
||||
this.isUpdateFilter = response.status === 200;
|
||||
this.tempFilterId = null;
|
||||
}catch(error) {
|
||||
apiError(error, 'Failed to update an Existing Filter.');
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to update an Existing Filter.");
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user