Apply repository-wide ESLint auto-fix formatting pass
Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
+146
-110
@@ -11,10 +11,10 @@
|
||||
|
||||
import { defineStore } from "pinia";
|
||||
import moment from "moment";
|
||||
import { Decimal } from 'decimal.js';
|
||||
import abbreviateNumber from '@/module/abbreviateNumber.js';
|
||||
import { Decimal } from "decimal.js";
|
||||
import abbreviateNumber from "@/module/abbreviateNumber.js";
|
||||
import apiClient from "@/api/client.js";
|
||||
import apiError from '@/module/apiError.js';
|
||||
import apiError from "@/module/apiError.js";
|
||||
|
||||
/**
|
||||
* Returns the API base path for the current conformance check,
|
||||
@@ -23,13 +23,21 @@ import apiError from '@/module/apiError.js';
|
||||
* @returns {string} The API base path.
|
||||
*/
|
||||
function getCheckApiBase(state) {
|
||||
const { conformanceFilterTempCheckId, conformanceLogTempCheckId,
|
||||
conformanceFilterCreateCheckId, conformanceLogCreateCheckId } = state;
|
||||
if (conformanceFilterTempCheckId !== null) return `/api/temp-filter-checks/${conformanceFilterTempCheckId}`;
|
||||
if (conformanceLogTempCheckId !== null) return `/api/temp-log-checks/${conformanceLogTempCheckId}`;
|
||||
if (conformanceFilterCreateCheckId !== null) return `/api/filter-checks/${conformanceFilterCreateCheckId}`;
|
||||
if (conformanceLogCreateCheckId !== null) return `/api/log-checks/${conformanceLogCreateCheckId}`;
|
||||
return '';
|
||||
const {
|
||||
conformanceFilterTempCheckId,
|
||||
conformanceLogTempCheckId,
|
||||
conformanceFilterCreateCheckId,
|
||||
conformanceLogCreateCheckId,
|
||||
} = state;
|
||||
if (conformanceFilterTempCheckId !== null)
|
||||
return `/api/temp-filter-checks/${conformanceFilterTempCheckId}`;
|
||||
if (conformanceLogTempCheckId !== null)
|
||||
return `/api/temp-log-checks/${conformanceLogTempCheckId}`;
|
||||
if (conformanceFilterCreateCheckId !== null)
|
||||
return `/api/filter-checks/${conformanceFilterCreateCheckId}`;
|
||||
if (conformanceLogCreateCheckId !== null)
|
||||
return `/api/log-checks/${conformanceLogCreateCheckId}`;
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,13 +49,13 @@ function getCheckApiBase(state) {
|
||||
function getFileTypeApi(state) {
|
||||
const { conformanceFilterId, conformanceLogId } = state;
|
||||
if (conformanceFilterId !== null) {
|
||||
return { prefix: 'filter', idParam: `filter_id=${conformanceFilterId}` };
|
||||
return { prefix: "filter", idParam: `filter_id=${conformanceFilterId}` };
|
||||
}
|
||||
return { prefix: 'log', idParam: `log_id=${conformanceLogId}` };
|
||||
return { prefix: "log", idParam: `log_id=${conformanceLogId}` };
|
||||
}
|
||||
|
||||
/** Pinia store for conformance checking and rule management. */
|
||||
export const useConformanceStore = defineStore('conformanceStore', {
|
||||
export const useConformanceStore = defineStore("conformanceStore", {
|
||||
state: () => ({
|
||||
conformanceLogId: null, // Log file
|
||||
conformanceFilterId: null, // Filter file
|
||||
@@ -69,12 +77,12 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
allLoopTraces: null,
|
||||
allLoopTaskSeq: null,
|
||||
allLoopCases: null,
|
||||
selectedRuleType: 'Have activity', // radio
|
||||
selectedActivitySequence: 'Start & End', // radio
|
||||
selectedMode: 'Directly follows', // radio
|
||||
selectedProcessScope: 'End to end', // radio
|
||||
selectedActSeqMore: 'All', // radio
|
||||
selectedActSeqFromTo: 'From', // radio
|
||||
selectedRuleType: "Have activity", // radio
|
||||
selectedActivitySequence: "Start & End", // radio
|
||||
selectedMode: "Directly follows", // radio
|
||||
selectedProcessScope: "End to end", // radio
|
||||
selectedActSeqMore: "All", // radio
|
||||
selectedActSeqFromTo: "From", // radio
|
||||
infinite404: null,
|
||||
isStartSelected: null, // Whether start is selected in linked start & end selection
|
||||
isEndSelected: null, // Whether end is selected in linked start & end selection
|
||||
@@ -83,109 +91,119 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
conformanceFileName: null, // File name displayed in the save success modal
|
||||
}),
|
||||
getters: {
|
||||
conformanceAllTasks: state => {
|
||||
conformanceAllTasks: (state) => {
|
||||
return state.allConformanceTask;
|
||||
},
|
||||
conformanceTask: state => {
|
||||
return state.allConformanceTask.map(i => i.label);
|
||||
conformanceTask: (state) => {
|
||||
return state.allConformanceTask.map((i) => i.label);
|
||||
},
|
||||
cfmSeqStart: state => {
|
||||
cfmSeqStart: (state) => {
|
||||
return state.allCfmSeqStart;
|
||||
},
|
||||
cfmSeqEnd: state => {
|
||||
cfmSeqEnd: (state) => {
|
||||
return state.allCfmSeqEnd;
|
||||
},
|
||||
cfmPtEteWhole: state => {
|
||||
cfmPtEteWhole: (state) => {
|
||||
return state.allProcessingTime.end_to_end.whole;
|
||||
},
|
||||
cfmPtEteStart: state => {
|
||||
cfmPtEteStart: (state) => {
|
||||
return state.allProcessingTime.end_to_end.starts_with;
|
||||
},
|
||||
cfmPtEteEnd: state => {
|
||||
cfmPtEteEnd: (state) => {
|
||||
return state.allProcessingTime.end_to_end.ends_with;
|
||||
},
|
||||
cfmPtEteSE: state => {
|
||||
cfmPtEteSE: (state) => {
|
||||
return state.allProcessingTime.end_to_end.start_end;
|
||||
},
|
||||
cfmPtPStart: state => {
|
||||
cfmPtPStart: (state) => {
|
||||
return state.allProcessingTime.partial.starts_with;
|
||||
},
|
||||
cfmPtPEnd: state => {
|
||||
cfmPtPEnd: (state) => {
|
||||
return state.allProcessingTime.partial.ends_with;
|
||||
},
|
||||
cfmPtPSE: state => {
|
||||
cfmPtPSE: (state) => {
|
||||
return state.allProcessingTime.partial.start_end;
|
||||
},
|
||||
cfmWtEteWhole: state => {
|
||||
cfmWtEteWhole: (state) => {
|
||||
return state.allWaitingTime.end_to_end.whole;
|
||||
},
|
||||
cfmWtEteStart: state => {
|
||||
cfmWtEteStart: (state) => {
|
||||
return state.allWaitingTime.end_to_end.starts_with;
|
||||
},
|
||||
cfmWtEteEnd: state => {
|
||||
cfmWtEteEnd: (state) => {
|
||||
return state.allWaitingTime.end_to_end.ends_with;
|
||||
},
|
||||
cfmWtEteSE: state => {
|
||||
cfmWtEteSE: (state) => {
|
||||
return state.allWaitingTime.end_to_end.start_end;
|
||||
},
|
||||
cfmWtPStart: state => {
|
||||
cfmWtPStart: (state) => {
|
||||
return state.allWaitingTime.partial.starts_with;
|
||||
},
|
||||
cfmWtPEnd: state => {
|
||||
cfmWtPEnd: (state) => {
|
||||
return state.allWaitingTime.partial.ends_with;
|
||||
},
|
||||
cfmWtPSE: state => {
|
||||
cfmWtPSE: (state) => {
|
||||
return state.allWaitingTime.partial.start_end;
|
||||
},
|
||||
cfmCtEteWhole: state => {
|
||||
cfmCtEteWhole: (state) => {
|
||||
return state.allCycleTime.end_to_end.whole;
|
||||
},
|
||||
cfmCtEteStart: state => {
|
||||
cfmCtEteStart: (state) => {
|
||||
return state.allCycleTime.end_to_end.starts_with;
|
||||
},
|
||||
cfmCtEteEnd: state => {
|
||||
cfmCtEteEnd: (state) => {
|
||||
return state.allCycleTime.end_to_end.ends_with;
|
||||
},
|
||||
cfmCtEteSE: state => {
|
||||
cfmCtEteSE: (state) => {
|
||||
return state.allCycleTime.end_to_end.start_end;
|
||||
},
|
||||
conformanceTempReportData: state => {
|
||||
conformanceTempReportData: (state) => {
|
||||
return state.allConformanceTempReportData;
|
||||
},
|
||||
routeFile: state => {
|
||||
routeFile: (state) => {
|
||||
return state.allRouteFile;
|
||||
},
|
||||
issueTraces: state => {
|
||||
issueTraces: (state) => {
|
||||
return state.allIssueTraces;
|
||||
},
|
||||
taskSeq: state => {
|
||||
taskSeq: (state) => {
|
||||
return state.allTaskSeq;
|
||||
},
|
||||
cases: state => {
|
||||
if(state.allCases !== null){
|
||||
return state.allCases.map(c => {
|
||||
const facets = c.facets.map(fac => {
|
||||
cases: (state) => {
|
||||
if (state.allCases !== null) {
|
||||
return state.allCases.map((c) => {
|
||||
const facets = c.facets.map((fac) => {
|
||||
const copy = { ...fac };
|
||||
switch(copy.type) {
|
||||
case 'dummy': //sonar-qube
|
||||
case 'duration-list':
|
||||
copy.value = copy.value.map(v => v !== null ? abbreviateNumber(new Decimal(v.toFixed(2))) : null);
|
||||
copy.value = (copy.value).map(v => v.trim()).join(', ');
|
||||
switch (copy.type) {
|
||||
case "dummy": //sonar-qube
|
||||
case "duration-list":
|
||||
copy.value = copy.value.map((v) =>
|
||||
v !== null
|
||||
? abbreviateNumber(new Decimal(v.toFixed(2)))
|
||||
: null,
|
||||
);
|
||||
copy.value = copy.value.map((v) => v.trim()).join(", ");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
return copy;
|
||||
});
|
||||
const attributes = c.attributes.map(att => {
|
||||
const attributes = c.attributes.map((att) => {
|
||||
const copy = { ...att };
|
||||
switch (copy.type) {
|
||||
case 'date':
|
||||
copy.value = copy.value !== null ? moment(copy.value).format('YYYY/MM/DD HH:mm:ss') : null;
|
||||
case "date":
|
||||
copy.value =
|
||||
copy.value !== null
|
||||
? moment(copy.value).format("YYYY/MM/DD HH:mm:ss")
|
||||
: null;
|
||||
break;
|
||||
case "float":
|
||||
copy.value =
|
||||
copy.value !== null
|
||||
? new Decimal(copy.value).toFixed(2)
|
||||
: null;
|
||||
break;
|
||||
case 'float':
|
||||
copy.value = copy.value !== null ? new Decimal(copy.value).toFixed(2) : null;
|
||||
break
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -193,32 +211,38 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
});
|
||||
return {
|
||||
...c,
|
||||
started_at: moment(c.started_at).format('YYYY/MM/DD HH:mm'),
|
||||
completed_at: moment(c.completed_at).format('YYYY/MM/DD HH:mm'),
|
||||
started_at: moment(c.started_at).format("YYYY/MM/DD HH:mm"),
|
||||
completed_at: moment(c.completed_at).format("YYYY/MM/DD HH:mm"),
|
||||
facets,
|
||||
attributes,
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
},
|
||||
loopTraces: state => {
|
||||
loopTraces: (state) => {
|
||||
return state.allLoopTraces;
|
||||
},
|
||||
loopTaskSeq: state => {
|
||||
loopTaskSeq: (state) => {
|
||||
return state.allLoopTaskSeq;
|
||||
},
|
||||
loopCases: state => {
|
||||
if(state.allLoopCases !== null){
|
||||
return state.allLoopCases.map(c => {
|
||||
const attributes = c.attributes.map(att => {
|
||||
loopCases: (state) => {
|
||||
if (state.allLoopCases !== null) {
|
||||
return state.allLoopCases.map((c) => {
|
||||
const attributes = c.attributes.map((att) => {
|
||||
const copy = { ...att };
|
||||
switch (copy.type) {
|
||||
case 'date':
|
||||
copy.value = copy.value !== null ? moment(copy.value).format('YYYY/MM/DD HH:mm:ss') : null;
|
||||
case "date":
|
||||
copy.value =
|
||||
copy.value !== null
|
||||
? moment(copy.value).format("YYYY/MM/DD HH:mm:ss")
|
||||
: null;
|
||||
break;
|
||||
case "float":
|
||||
copy.value =
|
||||
copy.value !== null
|
||||
? new Decimal(copy.value).toFixed(2)
|
||||
: null;
|
||||
break;
|
||||
case 'float':
|
||||
copy.value = copy.value !== null ? new Decimal(copy.value).toFixed(2) : null;
|
||||
break
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -226,12 +250,12 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
});
|
||||
return {
|
||||
...c,
|
||||
started_at: moment(c.started_at).format('YYYY/MM/DD HH:mm'),
|
||||
completed_at: moment(c.completed_at).format('YYYY/MM/DD HH:mm'),
|
||||
started_at: moment(c.started_at).format("YYYY/MM/DD HH:mm"),
|
||||
completed_at: moment(c.completed_at).format("YYYY/MM/DD HH:mm"),
|
||||
attributes,
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
@@ -249,8 +273,8 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
this.allProcessingTime = response.data.processing_time;
|
||||
this.allWaitingTime = response.data.waiting_time;
|
||||
this.allCycleTime = response.data.cycle_time;
|
||||
} catch(error) {
|
||||
apiError(error, 'Failed to load the Conformance Parameters.');
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to load the Conformance Parameters.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
@@ -263,13 +287,13 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
|
||||
try {
|
||||
const response = await apiClient.post(api, data);
|
||||
if (prefix === 'filter') {
|
||||
if (prefix === "filter") {
|
||||
this.conformanceFilterTempCheckId = response.data.id;
|
||||
} else {
|
||||
this.conformanceLogTempCheckId = response.data.id;
|
||||
}
|
||||
} catch(error) {
|
||||
apiError(error, 'Failed to add the Temporary Check for a file.');
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to add the Temporary Check for a file.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
@@ -280,13 +304,13 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
const api = getCheckApiBase(this);
|
||||
try {
|
||||
const response = await apiClient.get(api);
|
||||
if(!getRouteFile) {
|
||||
this.allConformanceTempReportData = response.data
|
||||
if (!getRouteFile) {
|
||||
this.allConformanceTempReportData = response.data;
|
||||
} else {
|
||||
this.allRouteFile = response.data.file;
|
||||
}
|
||||
} catch(error) {
|
||||
apiError(error, 'Failed to Get the Temporary Log Conformance Report.');
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to Get the Temporary Log Conformance Report.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
@@ -298,9 +322,12 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
try {
|
||||
const response = await apiClient.get(api);
|
||||
this.allIssueTraces = response.data.traces;
|
||||
} catch(error) {
|
||||
apiError(error, 'Failed to Get the detail of a temporary log conformance issue.');
|
||||
};
|
||||
} catch (error) {
|
||||
apiError(
|
||||
error,
|
||||
"Failed to Get the detail of a temporary log conformance issue.",
|
||||
);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Get the Trace Details of a Temporary Log Conformance lssue.
|
||||
@@ -315,13 +342,16 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
this.allTaskSeq = response.data.task_seq;
|
||||
this.allCases = response.data.cases;
|
||||
return response.data.cases;
|
||||
} catch(error) {
|
||||
if(error.response?.status === 404) {
|
||||
} catch (error) {
|
||||
if (error.response?.status === 404) {
|
||||
this.infinite404 = 404;
|
||||
return;
|
||||
}
|
||||
apiError(error, 'Failed to Get the detail of a temporary log conformance issue.');
|
||||
};
|
||||
apiError(
|
||||
error,
|
||||
"Failed to Get the detail of a temporary log conformance issue.",
|
||||
);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Get the Details of a Temporary Log Conformance Loop.
|
||||
@@ -332,9 +362,12 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
try {
|
||||
const response = await apiClient.get(api);
|
||||
this.allLoopTraces = response.data.traces;
|
||||
} catch(error) {
|
||||
apiError(error, 'Failed to Get the detail of a temporary log conformance loop.');
|
||||
};
|
||||
} catch (error) {
|
||||
apiError(
|
||||
error,
|
||||
"Failed to Get the detail of a temporary log conformance loop.",
|
||||
);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Get the Trace Details of a Temporary Log Conformance Loops.
|
||||
@@ -349,13 +382,16 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
this.allLoopTaskSeq = response.data.task_seq;
|
||||
this.allLoopCases = response.data.cases;
|
||||
return response.data.cases;
|
||||
} catch(error) {
|
||||
if(error.response?.status === 404) {
|
||||
} catch (error) {
|
||||
if (error.response?.status === 404) {
|
||||
this.infinite404 = 404;
|
||||
return;
|
||||
}
|
||||
apiError(error, 'Failed to Get the detail of a temporary log conformance loop.');
|
||||
};
|
||||
apiError(
|
||||
error,
|
||||
"Failed to Get the detail of a temporary log conformance loop.",
|
||||
);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Add a New Log Conformance Check, Save the log file.
|
||||
@@ -366,21 +402,21 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
const api = `/api/${prefix}-checks?${idParam}`;
|
||||
const data = {
|
||||
name: value,
|
||||
rule: this.conformanceRuleData
|
||||
rule: this.conformanceRuleData,
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await apiClient.post(api, data);
|
||||
if (prefix === 'filter') {
|
||||
if (prefix === "filter") {
|
||||
this.conformanceFilterCreateCheckId = response.data.id;
|
||||
this.conformanceFilterTempCheckId = null;
|
||||
} else {
|
||||
this.conformanceLogCreateCheckId = response.data.id;
|
||||
this.conformanceLogTempCheckId = null;
|
||||
}
|
||||
}catch(error) {
|
||||
apiError(error, 'Failed to add the Conformance Check for a file.');
|
||||
};
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to add the Conformance Check for a file.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Update an Existing Conformance Check, log and filter
|
||||
@@ -394,8 +430,8 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
this.isUpdateConformance = response.status === 200;
|
||||
this.conformanceLogTempCheckId = null;
|
||||
this.conformanceFilterTempCheckId = null;
|
||||
}catch(error) {
|
||||
apiError(error, 'Failed to update an Existing Conformance.');
|
||||
} catch (error) {
|
||||
apiError(error, "Failed to update an Existing Conformance.");
|
||||
}
|
||||
},
|
||||
/**
|
||||
@@ -406,4 +442,4 @@ export const useConformanceStore = defineStore('conformanceStore', {
|
||||
this.conformanceLogCreateCheckId = createCheckID;
|
||||
},
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user