Replace loose equality (== null, != null) with strict equality

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 09:22:36 +08:00
parent 3eec131ae0
commit 64372c7043
8 changed files with 20 additions and 20 deletions

View File

@@ -91,7 +91,7 @@
</section> </section>
<!-- Loop group --> <!-- Loop group -->
<section> <section>
<div v-if="data.loops == null"></div> <div v-if="data.loops === null"></div>
<div v-else> <div v-else>
<p class="h2 text-base">Loop List</p> <p class="h2 text-base">Loop List</p>
<div class="border rounded border-neutral-300 p-2 bg-neutral-10 w-full"> <div class="border rounded border-neutral-300 p-2 bg-neutral-10 w-full">
@@ -138,12 +138,12 @@
</div> </div>
<div v-else> <div v-else>
<div> <div>
<div v-if="(data.issues?.length == 0 || data.issues == null) && data.timeTrend.chart == null"></div> <div v-if="(data.issues?.length === 0 || data.issues === null) && data.timeTrend.chart === null"></div>
<p v-else="data.loops === null" class="h2 text-base">Non-conformance Issues</p> <p v-else="data.loops === null" class="h2 text-base">Non-conformance Issues</p>
</div> </div>
<div class="flex w-full" :class="data.issues === null || data.issues?.length === 0 ? '' : 'gap-4'"> <div class="flex w-full" :class="data.issues === null || data.issues?.length === 0 ? '' : 'gap-4'">
<!-- Issues chart --> <!-- Issues chart -->
<div v-if="data.timeTrend.chart != null" class="border rounded border-neutral-300 p-2 bg-neutral-10" :class="data.issues === null || data.issues?.length === 0 ? 'w-full' : 'w-1/2'"> <div v-if="data.timeTrend.chart !== null" class="border rounded border-neutral-300 p-2 bg-neutral-10" :class="data.issues === null || data.issues?.length === 0 ? 'w-full' : 'w-1/2'">
<p class="h2 p-2 flex justify-between items-center"> <p class="h2 p-2 flex justify-between items-center">
<span>Time Trend<span class="material-symbols-outlined !text-sm align-middle ml-2" v-tooltip.bottom="tooltip.timeTrend">info</span></span> <span>Time Trend<span class="material-symbols-outlined !text-sm align-middle ml-2" v-tooltip.bottom="tooltip.timeTrend">info</span></span>
<span class="text-2xl"><span class="text-cfm-secondary">{{ data.timeTrend.not_conforming }}</span>&nbsp/&nbsp{{ data.timeTrend.total }}</span> <span class="text-2xl"><span class="text-cfm-secondary">{{ data.timeTrend.not_conforming }}</span>&nbsp/&nbsp{{ data.timeTrend.total }}</span>
@@ -284,7 +284,7 @@ export default {
watch: { watch: {
conformanceTempReportData: { conformanceTempReportData: {
handler: function(newValue) { handler: function(newValue) {
if(newValue?.rule && newValue.rule.min != null) { if(newValue?.rule && newValue.rule.min !== null) {
this.selectDurationTime = { this.selectDurationTime = {
min: newValue.rule.min, min: newValue.rule.min,
max: newValue.rule.max, max: newValue.rule.max,

View File

@@ -40,12 +40,12 @@ export default {
handler: function(newValue, oldValue) { handler: function(newValue, oldValue) {
this.durationMax = null this.durationMax = null
this.durationMin = null this.durationMin = null
if(newValue == null) { if(newValue === null) {
this.timeData = { this.timeData = {
min: 0, min: 0,
max: 0 max: 0
}; };
}else if(newValue != null) { }else if(newValue !== null) {
this.timeData = { this.timeData = {
min: newValue.min, min: newValue.min,
max: newValue.max max: newValue.max

View File

@@ -141,7 +141,7 @@ export default {
if(newValue) this.createCy(); if(newValue) this.createCy();
}, },
taskSeq: function(newValue){ taskSeq: function(newValue){
if (newValue != null) this.createCy(); if (newValue !== null) this.createCy();
}, },
traceId: function(newValue) { traceId: function(newValue) {
// 當 traceId 屬性變化時更新 showTraceId // 當 traceId 屬性變化時更新 showTraceId
@@ -199,7 +199,7 @@ export default {
// 避免每次渲染都重複累加 // 避免每次渲染都重複累加
this.processMap.nodes = []; this.processMap.nodes = [];
// 將 api call 回來的資料帶進 node // 將 api call 回來的資料帶進 node
if(this.taskSeq != null) { if(this.taskSeq !== null) {
this.taskSeq.forEach((node, index) => { this.taskSeq.forEach((node, index) => {
this.processMap.nodes.push({ this.processMap.nodes.push({
data: { data: {
@@ -220,7 +220,7 @@ export default {
*/ */
setEdgesData(){ setEdgesData(){
this.processMap.edges = []; this.processMap.edges = [];
if(this.taskSeq != null) { if(this.taskSeq !== null) {
this.taskSeq.forEach((edge, index) => { this.taskSeq.forEach((edge, index) => {
this.processMap.edges.push({ this.processMap.edges.push({
data: { data: {
@@ -244,7 +244,7 @@ export default {
this.setNodesData(); this.setNodesData();
this.setEdgesData(); this.setEdgesData();
if(graphId != null) cytoscapeMapTrace(this.processMap.nodes, this.processMap.edges, graphId); if(graphId !== null) cytoscapeMapTrace(this.processMap.nodes, this.processMap.edges, graphId);
}); });
}, },
/** /**

View File

@@ -543,7 +543,7 @@ export default {
case 'int': case 'int':
case 'float': case 'float':
case 'date': case 'date':
return !(this.selectAttribute?.key && this.selectAttribute?.min != null && this.selectAttribute?.max != null); return !(this.selectAttribute?.key && this.selectAttribute?.min !== null && this.selectAttribute?.max !== null);
default: default:
return true; return true;
} }

View File

@@ -131,8 +131,8 @@ export default defineStore('allMapDataStore', {
let api = ''; let api = '';
// 先判斷暫存 再判斷 filter 最後 log // 先判斷暫存 再判斷 filter 最後 log
if(tempFilterId != null) api = `/api/temp-filters/${tempFilterId}/discover`; if(tempFilterId !== null) api = `/api/temp-filters/${tempFilterId}/discover`;
else if(createFilterId!= null) api = `/api/filters/${createFilterId}/discover`; else if(createFilterId!== null) api = `/api/filters/${createFilterId}/discover`;
else api = `/api/logs/${logId}/discover`; else api = `/api/logs/${logId}/discover`;
try { try {
@@ -157,8 +157,8 @@ export default defineStore('allMapDataStore', {
let api = ''; let api = '';
// 先判斷暫存 再判斷 filter 最後 log // 先判斷暫存 再判斷 filter 最後 log
if(tempFilterId != null) api = `/api/temp-filters/${tempFilterId}/traces`; if(tempFilterId !== null) api = `/api/temp-filters/${tempFilterId}/traces`;
else if(createFilterId!= null) api = `/api/filters/${createFilterId}/traces`; else if(createFilterId!== null) api = `/api/filters/${createFilterId}/traces`;
else api = `/api/logs/${logId}/traces`; else api = `/api/logs/${logId}/traces`;
try { try {
@@ -185,8 +185,8 @@ export default defineStore('allMapDataStore', {
let api = ''; let api = '';
// 先判斷暫存 再判斷 filter 最後 log // 先判斷暫存 再判斷 filter 最後 log
if(tempFilterId != null) api = `/api/temp-filters/${tempFilterId}/traces/${traceId}?start=${start}&page_size=20`; if(tempFilterId !== null) api = `/api/temp-filters/${tempFilterId}/traces/${traceId}?start=${start}&page_size=20`;
else if(createFilterId!= null) api = `/api/filters/${createFilterId}/traces/${traceId}?start=${start}&page_size=20`; else if(createFilterId!== null) api = `/api/filters/${createFilterId}/traces/${traceId}?start=${start}&page_size=20`;
else api = `/api/logs/${logId}/traces/${traceId}?start=${start}&page_size=20`; else api = `/api/logs/${logId}/traces/${traceId}?start=${start}&page_size=20`;
try { try {

View File

@@ -255,7 +255,7 @@ export default defineStore('filesStore', {
async deleteFile(type, id) { async deleteFile(type, id) {
let api; let api;
if(id == null || isNaN(id)) { if(id === null || id === undefined || isNaN(id)) {
console.error('Delete File API Error: invalid id'); console.error('Delete File API Error: invalid id');
return; return;
}; };

View File

@@ -357,7 +357,7 @@
}, },
allFiles: { allFiles: {
handler(newValue) { handler(newValue) {
if(newValue != null) this.compareData = JSON.parse(JSON.stringify(newValue)); if(newValue !== null) this.compareData = JSON.parse(JSON.stringify(newValue));
} }
}, },
reallyDeleteData: { reallyDeleteData: {

View File

@@ -320,7 +320,7 @@ export default {
beforeRouteEnter(to, from, next){ beforeRouteEnter(to, from, next){
// 要有 uploadID 才能進來 // 要有 uploadID 才能進來
next(vm => { next(vm => {
if(vm.uploadId == null) { if(vm.uploadId === null) {
vm.$router.push({name: 'Files', replace: true}); vm.$router.push({name: 'Files', replace: true});
vm.$toast.default('Please upload your file.', {position: 'bottom'}); vm.$toast.default('Please upload your file.', {position: 'bottom'});
} }