sonar qube; ternary if

This commit is contained in:
Cindy Chang
2024-07-16 15:42:30 +08:00
parent 6a689e419c
commit 07d6e75a6a
4 changed files with 13 additions and 69 deletions

View File

@@ -45,7 +45,13 @@ export function setLineChartData(baseData, xMax, xMin, isPercent, yMax, yMin) {
mf = mf >= 1 ? 1 : mf <= 0 ? 0 : mf;
}
else {
mf = mf >= yMax ? yMax : mf <= yMin ? yMin : mf;
if (mf >= yMax) {
mf = yMax;
} else if (mf <= yMin) {
mf = yMin;
} else {
mf = mf;
}
}
// 添加最小值

View File

@@ -41,7 +41,6 @@ export default defineStore('pageAdminStore', {
* @param {string} prevPage
*/
setPrevioiusPage(prevPage) {
// console.log('setPrevioiusPage()', prevPage);
this.previousPage = mapPageNameToCapitalUnifiedName(prevPage);
},
/**

View File

@@ -147,7 +147,7 @@ import PerformanceStore from '@/stores/performance.js';
import ConformanceStore from '@/stores/conformance.js';
import StatusBar from '@/components/Discover/StatusBar.vue';
import { setLineChartData } from '@/module/setChartData.js';
import { simpleTimeLabel, followTimeLabel, getDateLabelByMinMaxDate,
import { simpleTimeLabel, followTimeLabel,
setTimeStringFormatBaseOnTimeDifference,
mapTimestampToAxisTicksByFormat,
getStepSizeOfYTicks,
@@ -157,58 +157,6 @@ import FreqChart from './FreqChart.vue';
import { PRIME_VUE_TICKS_LIMIT } from '../../../constants/constants.js';
const primeVueTicksLimit = PRIME_VUE_TICKS_LIMIT;
const knownScaleLineChartOptions = {
x: {
type: 'time',
title: {
display: true,
color: '#334155',
font: {
size: 12,
lineHeight: 2
}
},
time: {
displayFormats: {
second: 'h:mm:ss', // ex: 1:11:11
minute: 'M/d h:mm', // ex: 1/1 1:11
hour: 'M/d h:mm', // ex: 1/1 1:11
day: 'M/d h', // ex: 1/1 1
month: 'y/M/d', // ex: 1911/1/1
},
round: true
},
ticks: {
display: true,
maxRotation: 0, // 不旋轉 lable 0~50
color: '#64748b',
source: 'labels', // 依比例彈性顯示 label 數量
},
border: {
color: '#64748b',
},
},
y: {
beginAtZero: true, // scale 包含 0
title: {
display: true,
color: '#334155',
font: {
size: 12,
lineHeight: 2
},
},
ticks:{
},
grid: {
color: '#64748b',
},
border: {
display: false, // 隱藏左側多出來的線
},
},
}
export default {
setup() {
@@ -830,7 +778,10 @@ export default {
callbacks: {
title: function(context) {
return `${content.x}: ${getMoment(context[0].parsed.x)}`;
}
},
label:function(context) {
return `${content.y}: ${getSimpleTimeLabel(context.parsed.y, 2)}`;
},
},
},
title: {
@@ -903,15 +854,6 @@ export default {
}
},
},
plugins: {
tooltip: {
callbacks:{
label:function(context) {
return `${content.y}: ${getSimpleTimeLabel(context.parsed.y, 2)}`;
},
},
},
},
};
return [primeVueSetData, primeVueSetOption]

View File

@@ -33,12 +33,10 @@ export default {
const allMapDataStore = AllMapDataStore();
const conformanceStore = ConformanceStore();
const pageAdminStore = PageAdminStore();
const loginStore = LoginStore();
const { tempFilterId, createFilterId, temporaryData, postRuleData, ruleData } = storeToRefs(allMapDataStore);
const { conformanceLogTempCheckId, conformanceFilterTempCheckId } = storeToRefs(conformanceStore);
const router = useRouter();
const { isLoggedIn, auth } = storeToRefs(loginStore);
``
const setHighlightedNavItemOnLanding = () => {
const currentPath = router.currentRoute.value.path;
const pathSegments: string[] = currentPath.split('/').filter(segment => segment !== '');
@@ -129,7 +127,6 @@ export default {
},
// Remember, Swal modal handling is called before beforeRouteUpdate
beforeRouteUpdate(to, from, next) {
// console.log("beforeRouteUpdate", from.name, "to:", to.name);
this.setPrevioiusPage(from.name);
// 離開 Map 頁時判斷是否有無資料和需要存檔