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

View File

@@ -267,7 +267,11 @@ export default defineStore('conformanceStore', {
} }
try { try {
const response = await this.$axios.get(api); 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) { } catch(error) {
apiError(error, 'Failed to Get the Temporary Log Conformance Report.'); apiError(error, 'Failed to Get the Temporary Log Conformance Report.');
} }
@@ -337,7 +341,10 @@ export default defineStore('conformanceStore', {
this.allCases = response.data.cases; this.allCases = response.data.cases;
return response.data.cases; return response.data.cases;
} catch(error) { } 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.'); 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; this.allLoopCases = response.data.cases;
return response.data.cases; return response.data.cases;
} catch(error) { } 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.'); 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'; const api = '/api/my-account';
try { try {
const response = await axios.get(api); await axios.get(api);
} catch(error) { } catch(error) {
this.$router.push('/login'); this.$router.push('/login');
}; };

View File

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

View File

@@ -18,14 +18,6 @@
</span> </span>
</li> </li>
</ul> </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> </div>
<!-- Cytoscape Map --> <!-- Cytoscape Map -->
@@ -253,7 +245,7 @@ export default {
*/ */
async switchTraceId(e) { async switchTraceId(e) {
if(e.id == this.traceId) return; if(e.id == this.traceId) return;
// if(e.count >= 1000) this.isLoading = true; // 超過 1000 筆要 loading 畫面 // 超過 1000 筆要 loading 畫面
this.isLoading = true; // 都要 loading 畫面 this.isLoading = true; // 都要 loading 畫面
this.traceId = e.id; this.traceId = e.id;
await this.allMapDataStore.getTraceDetail(); await this.allMapDataStore.getTraceDetail();

View File

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