Replace let with const where variable is never reassigned
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -397,7 +397,7 @@ export async function uploadloader() {
|
|||||||
* @param { string } baseName 改名前的檔名
|
* @param { string } baseName 改名前的檔名
|
||||||
*/
|
*/
|
||||||
export async function renameModal(rename, type, id, baseName) {
|
export async function renameModal(rename, type, id, baseName) {
|
||||||
let fileName = baseName;
|
const fileName = baseName;
|
||||||
const { value, isConfirmed } = await Swal.fire({
|
const { value, isConfirmed } = await Swal.fire({
|
||||||
title: 'RENAME',
|
title: 'RENAME',
|
||||||
input: 'text',
|
input: 'text',
|
||||||
@@ -444,7 +444,7 @@ export async function deleteFileModal(files, type, id, name) {
|
|||||||
const filesStore = FilesStore();
|
const filesStore = FilesStore();
|
||||||
|
|
||||||
const safeName = escapeHtml(name);
|
const safeName = escapeHtml(name);
|
||||||
let htmlText = files.length === 0 ? `Do you really want to delete <span class="text-primary">${safeName}</span>?` : `<div class="text-left mx-4 space-y-1"><p class="mb-2">Do you really want to delete <span class="text-primary">${safeName}</span>?</p><p>The following dependent file(s) will also be deleted:</p><ul class="list-disc ml-6">${files}</ul></div>`;
|
const htmlText = files.length === 0 ? `Do you really want to delete <span class="text-primary">${safeName}</span>?` : `<div class="text-left mx-4 space-y-1"><p class="mb-2">Do you really want to delete <span class="text-primary">${safeName}</span>?</p><p>The following dependent file(s) will also be deleted:</p><ul class="list-disc ml-6">${files}</ul></div>`;
|
||||||
|
|
||||||
const deleteCustomClass = { ...customClass };
|
const deleteCustomClass = { ...customClass };
|
||||||
deleteCustomClass.confirmButton = '!inline-block !rounded-full !text-sm !font-medium !text-center !align-middle !transition-colors !duration-300 !px-5 !py-2 !w-[100px] !h-[40px] !text-danger !bg-neutral-10 !border !border-danger';
|
deleteCustomClass.confirmButton = '!inline-block !rounded-full !text-sm !font-medium !text-center !align-middle !transition-colors !duration-300 !px-5 !py-2 !w-[100px] !h-[40px] !text-danger !bg-neutral-10 !border !border-danger';
|
||||||
|
|||||||
@@ -9,9 +9,8 @@ const TOFIXED_DEICMAL = 1;
|
|||||||
*/
|
*/
|
||||||
export const getStepSizeOfYTicks = (maxTimeInSecond, numOfParts) => {
|
export const getStepSizeOfYTicks = (maxTimeInSecond, numOfParts) => {
|
||||||
const {unitToUse, timeValue} = getTimeUnitAndValueToUse(maxTimeInSecond);
|
const {unitToUse, timeValue} = getTimeUnitAndValueToUse(maxTimeInSecond);
|
||||||
let resultStepSize;
|
|
||||||
const getLarger = 1 + (1 / (numOfParts - 1));
|
const getLarger = 1 + (1 / (numOfParts - 1));
|
||||||
resultStepSize = (timeValue * getLarger / numOfParts);
|
const resultStepSize = (timeValue * getLarger / numOfParts);
|
||||||
|
|
||||||
return {resultStepSize, unitToUse};
|
return {resultStepSize, unitToUse};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,9 +125,9 @@ export default defineStore('allMapDataStore', {
|
|||||||
* fetch discover api, include '/process-map, /bpmn, /stats, /insights'.
|
* fetch discover api, include '/process-map, /bpmn, /stats, /insights'.
|
||||||
*/
|
*/
|
||||||
async getAllMapData() {
|
async getAllMapData() {
|
||||||
let logId = this.logId;
|
const logId = this.logId;
|
||||||
let tempFilterId = this.tempFilterId;
|
const tempFilterId = this.tempFilterId;
|
||||||
let createfilterId = this.createFilterId
|
const createfilterId = this.createFilterId
|
||||||
let api = '';
|
let api = '';
|
||||||
|
|
||||||
// 先判斷暫存 再判斷 filter 最後 log
|
// 先判斷暫存 再判斷 filter 最後 log
|
||||||
@@ -149,11 +149,11 @@ export default defineStore('allMapDataStore', {
|
|||||||
* fetch trace api.
|
* fetch trace api.
|
||||||
*/
|
*/
|
||||||
async getAllTrace() {
|
async getAllTrace() {
|
||||||
let logId = this.logId;
|
const logId = this.logId;
|
||||||
let tempFilterId = this.tempFilterId;
|
const tempFilterId = this.tempFilterId;
|
||||||
let createfilterId = this.createFilterId;
|
const createfilterId = this.createFilterId;
|
||||||
let baseLogId = this.baseLogId;
|
const baseLogId = this.baseLogId;
|
||||||
let baseApi = `/api/logs/${baseLogId}/traces`;
|
const baseApi = `/api/logs/${baseLogId}/traces`;
|
||||||
let api = '';
|
let api = '';
|
||||||
|
|
||||||
// 先判斷暫存 再判斷 filter 最後 log
|
// 先判斷暫存 再判斷 filter 最後 log
|
||||||
@@ -177,11 +177,11 @@ export default defineStore('allMapDataStore', {
|
|||||||
* fetch trace detail api.
|
* fetch trace detail api.
|
||||||
*/
|
*/
|
||||||
async getTraceDetail() {
|
async getTraceDetail() {
|
||||||
let logId = this.logId;
|
const logId = this.logId;
|
||||||
let traceId = this.traceId;
|
const traceId = this.traceId;
|
||||||
let tempFilterId = this.tempFilterId;
|
const tempFilterId = this.tempFilterId;
|
||||||
let createfilterId = this.createFilterId;
|
const createfilterId = this.createFilterId;
|
||||||
let start = this.infiniteStart;
|
const start = this.infiniteStart;
|
||||||
let api = '';
|
let api = '';
|
||||||
|
|
||||||
// 先判斷暫存 再判斷 filter 最後 log
|
// 先判斷暫存 再判斷 filter 最後 log
|
||||||
@@ -223,10 +223,10 @@ export default defineStore('allMapDataStore', {
|
|||||||
* fetch base log trace detail api.
|
* fetch base log trace detail api.
|
||||||
*/
|
*/
|
||||||
async getBaseTraceDetail() {
|
async getBaseTraceDetail() {
|
||||||
let logId = this.baseLogId;
|
const logId = this.baseLogId;
|
||||||
let traceId = this.baseTraceId;
|
const traceId = this.baseTraceId;
|
||||||
let start = this.baseInfiniteStart;
|
const start = this.baseInfiniteStart;
|
||||||
let api = `/api/logs/${logId}/traces/${traceId}?start=${start}&page_size=20`;
|
const api = `/api/logs/${logId}/traces/${traceId}?start=${start}&page_size=20`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await this.$axios.get(api);
|
const response = await this.$axios.get(api);
|
||||||
@@ -262,7 +262,7 @@ export default defineStore('allMapDataStore', {
|
|||||||
* fetch Filter Parameters api.
|
* fetch Filter Parameters api.
|
||||||
*/
|
*/
|
||||||
async getFilterParams() {
|
async getFilterParams() {
|
||||||
let logId = this.logId;
|
const logId = this.logId;
|
||||||
const api = `/api/filters/params?log_id=${logId}`;
|
const api = `/api/filters/params?log_id=${logId}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -274,8 +274,8 @@ export default defineStore('allMapDataStore', {
|
|||||||
this.allFilterTrace = response.data.trace;
|
this.allFilterTrace = response.data.trace;
|
||||||
this.allFilterAttrs = response.data.attrs;
|
this.allFilterAttrs = response.data.attrs;
|
||||||
|
|
||||||
let min = this.allFilterTimeframe.x_axis.min;
|
const min = this.allFilterTimeframe.x_axis.min;
|
||||||
let max = this.allFilterTimeframe.x_axis.max;
|
const max = this.allFilterTimeframe.x_axis.max;
|
||||||
// 給 Chart.js 原始資料,格式不同的畫會錯誤輸出
|
// 給 Chart.js 原始資料,格式不同的畫會錯誤輸出
|
||||||
this.allFilterTimeframe.x_axis.min_base = min;
|
this.allFilterTimeframe.x_axis.min_base = min;
|
||||||
this.allFilterTimeframe.x_axis.max_base = max;
|
this.allFilterTimeframe.x_axis.max_base = max;
|
||||||
@@ -290,7 +290,7 @@ export default defineStore('allMapDataStore', {
|
|||||||
* Test if the Filter Rules Result in Any Data
|
* Test if the Filter Rules Result in Any Data
|
||||||
*/
|
*/
|
||||||
async checkHasResult() {
|
async checkHasResult() {
|
||||||
let logId = this.logId;
|
const logId = this.logId;
|
||||||
const api = `/api/filters/has-result?log_id=${logId}`;
|
const api = `/api/filters/has-result?log_id=${logId}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -304,7 +304,7 @@ export default defineStore('allMapDataStore', {
|
|||||||
* Add a New Temporary Filter
|
* Add a New Temporary Filter
|
||||||
*/
|
*/
|
||||||
async addTempFilterId() {
|
async addTempFilterId() {
|
||||||
let logId = this.logId;
|
const logId = this.logId;
|
||||||
const api = `/api/temp-filters?log_id=${logId}`;
|
const api = `/api/temp-filters?log_id=${logId}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -319,9 +319,9 @@ export default defineStore('allMapDataStore', {
|
|||||||
* @param {string} value file's name
|
* @param {string} value file's name
|
||||||
*/
|
*/
|
||||||
async addFilterId(value) {
|
async addFilterId(value) {
|
||||||
let logId = this.logId;
|
const logId = this.logId;
|
||||||
const api = `/api/filters?log_id=${logId}`;
|
const api = `/api/filters?log_id=${logId}`;
|
||||||
let createFilterObj = {
|
const createFilterObj = {
|
||||||
name: value,
|
name: value,
|
||||||
rules: this.postRuleData
|
rules: this.postRuleData
|
||||||
};
|
};
|
||||||
@@ -357,7 +357,7 @@ export default defineStore('allMapDataStore', {
|
|||||||
* Update an Existing Filter
|
* Update an Existing Filter
|
||||||
*/
|
*/
|
||||||
async updateFilter() {
|
async updateFilter() {
|
||||||
let createFilterId = this.createFilterId
|
const createFilterId = this.createFilterId
|
||||||
const api = `/api/filters/${createFilterId}`;
|
const api = `/api/filters/${createFilterId}`;
|
||||||
const data = this.postRuleData;
|
const data = this.postRuleData;
|
||||||
|
|
||||||
|
|||||||
@@ -189,8 +189,8 @@ export default defineStore('conformanceStore', {
|
|||||||
* fetch Log Conformance Parameters api for Rule Settings.
|
* fetch Log Conformance Parameters api for Rule Settings.
|
||||||
*/
|
*/
|
||||||
async getConformanceParams() {
|
async getConformanceParams() {
|
||||||
let logId = this.conformanceLogId;
|
const logId = this.conformanceLogId;
|
||||||
let filterId = this.conformanceFilterId;
|
const filterId = this.conformanceFilterId;
|
||||||
let api = '';
|
let api = '';
|
||||||
|
|
||||||
// 先判斷 filter 檔,再判斷 log 檔。
|
// 先判斷 filter 檔,再判斷 log 檔。
|
||||||
@@ -217,8 +217,8 @@ export default defineStore('conformanceStore', {
|
|||||||
* @param {object} data 送給後端的 data
|
* @param {object} data 送給後端的 data
|
||||||
*/
|
*/
|
||||||
async addConformanceCheckId(data) {
|
async addConformanceCheckId(data) {
|
||||||
let logId = this.conformanceLogId;
|
const logId = this.conformanceLogId;
|
||||||
let filterId = this.conformanceFilterId;
|
const filterId = this.conformanceFilterId;
|
||||||
let api = '';
|
let api = '';
|
||||||
|
|
||||||
// 先判斷 filter 檔,再判斷 log 檔。
|
// 先判斷 filter 檔,再判斷 log 檔。
|
||||||
@@ -246,10 +246,10 @@ export default defineStore('conformanceStore', {
|
|||||||
* @param {boolean} getRouteFile 是否為了取得 route file 而呼叫?使用在非 Conformance page
|
* @param {boolean} getRouteFile 是否為了取得 route file 而呼叫?使用在非 Conformance page
|
||||||
*/
|
*/
|
||||||
async getConformanceReport(getRouteFile = false) {
|
async getConformanceReport(getRouteFile = false) {
|
||||||
let logTempCheckId = this.conformanceLogTempCheckId;
|
const logTempCheckId = this.conformanceLogTempCheckId;
|
||||||
let filterTempCheckId = this.conformanceFilterTempCheckId;
|
const filterTempCheckId = this.conformanceFilterTempCheckId;
|
||||||
let logCreateCheckId = this.conformanceLogCreateCheckId;
|
const logCreateCheckId = this.conformanceLogCreateCheckId;
|
||||||
let filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
const filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
||||||
let api = '';
|
let api = '';
|
||||||
|
|
||||||
// 先判斷 Temp 再判斷原 ID;先判斷 filter 檔,再判斷 log 檔。
|
// 先判斷 Temp 再判斷原 ID;先判斷 filter 檔,再判斷 log 檔。
|
||||||
@@ -281,10 +281,10 @@ export default defineStore('conformanceStore', {
|
|||||||
* @param {number} issueNo Issues 編號
|
* @param {number} issueNo Issues 編號
|
||||||
*/
|
*/
|
||||||
async getConformanceIssue(issueNo) {
|
async getConformanceIssue(issueNo) {
|
||||||
let logTempCheckId = this.conformanceLogTempCheckId;
|
const logTempCheckId = this.conformanceLogTempCheckId;
|
||||||
let filterTempCheckId = this.conformanceFilterTempCheckId;
|
const filterTempCheckId = this.conformanceFilterTempCheckId;
|
||||||
let logCreateCheckId = this.conformanceLogCreateCheckId;
|
const logCreateCheckId = this.conformanceLogCreateCheckId;
|
||||||
let filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
const filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
||||||
let api = '';
|
let api = '';
|
||||||
|
|
||||||
// 先判斷 filter 檔,再判斷 log 檔。
|
// 先判斷 filter 檔,再判斷 log 檔。
|
||||||
@@ -315,10 +315,10 @@ export default defineStore('conformanceStore', {
|
|||||||
* @param {number} start Trace 要從哪個編號開始載入
|
* @param {number} start Trace 要從哪個編號開始載入
|
||||||
*/
|
*/
|
||||||
async getConformanceTraceDetail(issueNo, traceId, start) {
|
async getConformanceTraceDetail(issueNo, traceId, start) {
|
||||||
let logTempCheckId = this.conformanceLogTempCheckId;
|
const logTempCheckId = this.conformanceLogTempCheckId;
|
||||||
let filterTempCheckId = this.conformanceFilterTempCheckId;
|
const filterTempCheckId = this.conformanceFilterTempCheckId;
|
||||||
let logCreateCheckId = this.conformanceLogCreateCheckId;
|
const logCreateCheckId = this.conformanceLogCreateCheckId;
|
||||||
let filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
const filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
||||||
let api = '';
|
let api = '';
|
||||||
|
|
||||||
// 先判斷 filter 檔,再判斷 log 檔。
|
// 先判斷 filter 檔,再判斷 log 檔。
|
||||||
@@ -353,10 +353,10 @@ export default defineStore('conformanceStore', {
|
|||||||
* @param {number} loopNo loop 編號
|
* @param {number} loopNo loop 編號
|
||||||
*/
|
*/
|
||||||
async getConformanceLoop(loopNo) {
|
async getConformanceLoop(loopNo) {
|
||||||
let logTempCheckId = this.conformanceLogTempCheckId;
|
const logTempCheckId = this.conformanceLogTempCheckId;
|
||||||
let filterTempCheckId = this.conformanceFilterTempCheckId;
|
const filterTempCheckId = this.conformanceFilterTempCheckId;
|
||||||
let logCreateCheckId = this.conformanceLogCreateCheckId;
|
const logCreateCheckId = this.conformanceLogCreateCheckId;
|
||||||
let filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
const filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
||||||
let api = '';
|
let api = '';
|
||||||
|
|
||||||
// 先判斷 filter 檔,再判斷 log 檔。
|
// 先判斷 filter 檔,再判斷 log 檔。
|
||||||
@@ -379,10 +379,10 @@ export default defineStore('conformanceStore', {
|
|||||||
* @param {number} start Trace 要從哪個編號開始載入
|
* @param {number} start Trace 要從哪個編號開始載入
|
||||||
*/
|
*/
|
||||||
async getConformanceLoopsTraceDetail(loopNo, traceId, start) {
|
async getConformanceLoopsTraceDetail(loopNo, traceId, start) {
|
||||||
let logTempCheckId = this.conformanceLogTempCheckId;
|
const logTempCheckId = this.conformanceLogTempCheckId;
|
||||||
let filterTempCheckId = this.conformanceFilterTempCheckId;
|
const filterTempCheckId = this.conformanceFilterTempCheckId;
|
||||||
let logCreateCheckId = this.conformanceLogCreateCheckId;
|
const logCreateCheckId = this.conformanceLogCreateCheckId;
|
||||||
let filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
const filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
||||||
let api = '';
|
let api = '';
|
||||||
|
|
||||||
// 先判斷 filter 檔,再判斷 log 檔。
|
// 先判斷 filter 檔,再判斷 log 檔。
|
||||||
@@ -409,10 +409,10 @@ export default defineStore('conformanceStore', {
|
|||||||
* @param {string} value file's name
|
* @param {string} value file's name
|
||||||
*/
|
*/
|
||||||
async addConformanceCreateCheckId(value) {
|
async addConformanceCreateCheckId(value) {
|
||||||
let logId = this.conformanceLogId;
|
const logId = this.conformanceLogId;
|
||||||
let filterId = this.conformanceFilterId;
|
const filterId = this.conformanceFilterId;
|
||||||
let api = '';
|
let api = '';
|
||||||
let data = {
|
const data = {
|
||||||
name: value,
|
name: value,
|
||||||
rule: this.conformanceRuleData
|
rule: this.conformanceRuleData
|
||||||
};
|
};
|
||||||
@@ -439,8 +439,8 @@ export default defineStore('conformanceStore', {
|
|||||||
* Update an Existing Conformance Check, log and filter
|
* Update an Existing Conformance Check, log and filter
|
||||||
*/
|
*/
|
||||||
async updateConformance() {
|
async updateConformance() {
|
||||||
let logCreateCheckId = this.conformanceLogCreateCheckId;
|
const logCreateCheckId = this.conformanceLogCreateCheckId;
|
||||||
let filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
const filterCreateCheckId = this.conformanceFilterCreateCheckId;
|
||||||
let api = '';
|
let api = '';
|
||||||
const data = this.conformanceRuleData;
|
const data = this.conformanceRuleData;
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ export default defineStore('filesStore', {
|
|||||||
*/
|
*/
|
||||||
allFiles: state => {
|
allFiles: state => {
|
||||||
let result = state.allEventFiles;
|
let result = state.allEventFiles;
|
||||||
let data = state.switchFilesTagData;
|
const data = state.switchFilesTagData;
|
||||||
let filesTag = state.filesTag;
|
const filesTag = state.filesTag;
|
||||||
|
|
||||||
result = result.filter(file => data[filesTag].includes(file.fileType));
|
result = result.filter(file => data[filesTag].includes(file.fileType));
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ export default defineStore('filesStore', {
|
|||||||
if(error.response.status === 422) {
|
if(error.response.status === 422) {
|
||||||
// msg: 'not in UTF-8' | 'insufficient columns' | 'the csv file is empty' | 'the filename does not ends with .csv'
|
// msg: 'not in UTF-8' | 'insufficient columns' | 'the csv file is empty' | 'the filename does not ends with .csv'
|
||||||
// type: 'encoding' | 'insufficient_columns' | 'empty' | 'name_suffix'
|
// type: 'encoding' | 'insufficient_columns' | 'empty' | 'name_suffix'
|
||||||
let detail = error.response.data.detail;
|
const detail = error.response.data.detail;
|
||||||
|
|
||||||
uploadFailedFirst(detail[0].type, detail[0].msg, detail[0].loc[2]);
|
uploadFailedFirst(detail[0].type, detail[0].msg, detail[0].loc[2]);
|
||||||
} else {
|
} else {
|
||||||
@@ -170,7 +170,7 @@ export default defineStore('filesStore', {
|
|||||||
this.$router.push({name: 'Files'});
|
this.$router.push({name: 'Files'});
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
if(error.response.status === 422) {
|
if(error.response.status === 422) {
|
||||||
let detail = [...error.response.data.detail];
|
const detail = [...error.response.data.detail];
|
||||||
|
|
||||||
uploadFailedSecond(detail);
|
uploadFailedSecond(detail);
|
||||||
} else {
|
} else {
|
||||||
@@ -194,7 +194,7 @@ export default defineStore('filesStore', {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let api;
|
let api;
|
||||||
let data = {"name": fileName};
|
const data = {"name": fileName};
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'log':
|
case 'log':
|
||||||
|
|||||||
Reference in New Issue
Block a user