sonar 12 left

This commit is contained in:
Cindy Chang
2024-08-08 10:15:16 +08:00
parent 85151884fe
commit e313b92521
6 changed files with 28 additions and 22 deletions

View File

@@ -201,6 +201,7 @@ export default defineStore('allMapDataStore', {
break;
case 'float':
att.value = att.value !== null ? Number(new Decimal(att.value).toFixed(2)) : null;
break;
default:
break;
}
@@ -209,7 +210,10 @@ export default defineStore('allMapDataStore', {
});
return this.allCase;
} catch(error) {
if(error.response.status === 404) return this.infinite404 = 404;
if(error.response.status === 404) {
this.infinite404 = 404;
return;
}
apiError(error, 'Failed to load the Trace Detail.');
};
},
@@ -236,6 +240,7 @@ export default defineStore('allMapDataStore', {
break;
case 'float':
att.value = att.value !== null ? Number(new Decimal(att.value).toFixed(2)) : null;
break;
default:
break;
}
@@ -244,7 +249,10 @@ export default defineStore('allMapDataStore', {
});
return this.allBaseCase;
} catch(error) {
if(error.response.status === 404) return this.infinite404 = 404;
if(error.response.status === 404) {
this.infinite404 = 404;
return;
}
apiError(error, 'Failed to load the Base Trace Detail.');
};
},

View File

@@ -267,7 +267,11 @@ export default defineStore('conformanceStore', {
}
try {
const response = await this.$axios.get(api);
!getRouteFile ? this.allConformanceTempReportData = response.data : this.allRouteFile = response.data.file;
if(!getRouteFile) {
this.allConformanceTempReportData = response.data
} else {
this.allRouteFile = response.data.file;
}
} catch(error) {
apiError(error, 'Failed to Get the Temporary Log Conformance Report.');
}
@@ -337,7 +341,10 @@ export default defineStore('conformanceStore', {
this.allCases = response.data.cases;
return response.data.cases;
} catch(error) {
if(error.response.status === 404) return this.infinite404 = 404;
if(error.response.status === 404) {
this.infinite404 = 404;
return;
}
apiError(error, 'Failed to Get the detail of a temporary log conformance issue.');
};
},
@@ -390,7 +397,10 @@ export default defineStore('conformanceStore', {
this.allLoopCases = response.data.cases;
return response.data.cases;
} catch(error) {
if(error.response.status === 404) return this.infinite404 = 404;
if(error.response.status === 404) {
this.infinite404 = 404;
return;
}
apiError(error, 'Failed to Get the detail of a temporary log conformance loop.');
};
},

View File

@@ -115,7 +115,7 @@ export default defineStore('loginStore', {
const api = '/api/my-account';
try {
const response = await axios.get(api);
await axios.get(api);
} catch(error) {
this.$router.push('/login');
};

View File

@@ -441,7 +441,6 @@ console.log("TODO:", datasetsPrimary, )
let yDataPrimary;
let labelPrimary = chartData.data[0].label;
let datasetsSecondary = chartData.data[1].data;
// let xDataSecondary;
let yDataSecondary;
let labelSecondary = chartData.data[1].label;
let primeVueSetData = {};
@@ -462,7 +461,6 @@ console.log("TODO:", datasetsPrimary, )
y: value.y === null ? null : value.y * 100
}
});
// xDataSecondary = datasetsSecondary.map(i => i.x);
yDataSecondary = datasetsSecondary.map(i => i.y);
primeVueSetData = {
@@ -498,8 +496,7 @@ console.log("TODO:", datasetsPrimary, )
return `${content.x}: ${context[0].label}`;
},
label: function(context) {
let value = context.parsed.y;
value = `${(context.parsed.y * 10).toFixed(2)}%`;
let value = `${(context.parsed.y * 10).toFixed(2)}%`;
switch (context.datasetIndex) {
case 0: // Primary
return `${labelPrimary}: ${value}`;
@@ -620,9 +617,7 @@ console.log("TODO:", datasetsPrimary, )
switch (xUnit) {
case 'date':
primeVueSetOption.plugins.tooltip.callbacks.label = function(context) {
let value = context.parsed.y;
value = context.parsed.x === null ? "n/a" : getSimpleTimeLabel(context.parsed.x, 2);
let value = context.parsed.x === null ? "n/a" : getSimpleTimeLabel(context.parsed.x, 2);
switch (context.datasetIndex) {
case 0: // Primary
return `${labelPrimary}: ${value}`;

View File

@@ -18,14 +18,6 @@
</span>
</li>
</ul>
<!-- <ul class="flex flex-col justify-center items-center">
<li class="inline-flex items-center justify-center border border-neutral-500 rounded-full w-9 h-9 cursor-pointer bg-neutral-50 drop-shadow hover:border-primary">
<span class="material-symbols-outlined !text-2xl text-neutral-500 hover:text-primary p-1.5">
highlight
</span>
</li>
</ul> -->
</div>
<!-- Cytoscape Map -->
@@ -253,7 +245,7 @@ export default {
*/
async switchTraceId(e) {
if(e.id == this.traceId) return;
// if(e.count >= 1000) this.isLoading = true; // 超過 1000 筆要 loading 畫面
// 超過 1000 筆要 loading 畫面
this.isLoading = true; // 都要 loading 畫面
this.traceId = e.id;
await this.allMapDataStore.getTraceDetail();

View File

@@ -483,6 +483,7 @@
switch (i.type) {
case 'log-check':
i.type = 'rule';
break;
case 'filter-check':
i.type = 'rule';
break;