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>
<!-- Loop group -->
<section>
<div v-if="data.loops == null"></div>
<div v-if="data.loops === null"></div>
<div v-else>
<p class="h2 text-base">Loop List</p>
<div class="border rounded border-neutral-300 p-2 bg-neutral-10 w-full">
@@ -138,12 +138,12 @@
</div>
<div v-else>
<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>
</div>
<div class="flex w-full" :class="data.issues === null || data.issues?.length === 0 ? '' : 'gap-4'">
<!-- 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">
<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>
@@ -284,7 +284,7 @@ export default {
watch: {
conformanceTempReportData: {
handler: function(newValue) {
if(newValue?.rule && newValue.rule.min != null) {
if(newValue?.rule && newValue.rule.min !== null) {
this.selectDurationTime = {
min: newValue.rule.min,
max: newValue.rule.max,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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