sonar 41 left

This commit is contained in:
Cindy Chang
2024-08-02 11:15:15 +08:00
parent a33eaa3a41
commit 86cfb409c3
7 changed files with 33 additions and 21 deletions

View File

@@ -19,6 +19,7 @@
v-closable="{id: size, handler: onClose}"> v-closable="{id: size, handler: onClose}">
<div class="duration-box" v-for="(unit, index) in inputTypes" :key="unit"> <div class="duration-box" v-for="(unit, index) in inputTypes" :key="unit">
<input <input
id="input_duration_dhms"
type="text" type="text"
class="duration duration-val input-dhms-field" class="duration duration-val input-dhms-field"
:data-index="index" :data-index="index"
@@ -32,7 +33,7 @@
@keyup="onKeyUp" @keyup="onKeyUp"
v-model="inputTimeFields[index]" v-model="inputTimeFields[index]"
/> />
<label class="duration">{{ tUnits[unit].dsp }}</label> <label class="duration" for="input_duration_dhms">{{ tUnits[unit].dsp }}</label>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -266,7 +266,7 @@ export async function uploadFailedSecond(detail) {
detail.forEach(i => { detail.forEach(i => {
let content = ''; let content = '';
let key = '';
switch (i.type) { switch (i.type) {
case 'too_many': case 'too_many':
manySrt = 'There are more errors.'; manySrt = 'There are more errors.';
@@ -278,8 +278,6 @@ export async function uploadFailedSecond(detail) {
content = `<li>Data malformed in Timestamp Column: (Row #${i.loc[1]}, "${i.input}")</li>`; content = `<li>Data malformed in Timestamp Column: (Row #${i.loc[1]}, "${i.input}")</li>`;
break; break;
case 'missing': case 'missing':
let key = '';
switch (i.loc[2]) { switch (i.loc[2]) {
case 'case id': case 'case id':
key = 'Case ID'; key = 'Case ID';

View File

@@ -113,10 +113,17 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu
// 可使用 parseInt(整數) parseFloat(浮點數) 將字串轉為數字 // 可使用 parseInt(整數) parseFloat(浮點數) 將字串轉為數字
// Relative 要轉為百分比 % // Relative 要轉為百分比 %
if(node.data('type') === 'activity') { if(node.data('type') === 'activity') {
let textInt;
let textFloat;
let textDurRel;
let timeLabelInt;
let timeLabelFloat;
let textTimeLabel;
switch(dataLayerType) { switch(dataLayerType) {
case 'freq': // Frequency case 'freq': // Frequency
let textInt = dataLayerOption === 'rel_freq' ? text + optionValue * 100 + "%" : text + optionValue; textInt = dataLayerOption === 'rel_freq' ? text + optionValue * 100 + "%" : text + optionValue;
let textFloat = dataLayerOption === 'rel_freq'? text + (optionValue * 100).toFixed(2) + "%" : text + optionValue.toFixed(2); textFloat = dataLayerOption === 'rel_freq'? text + (optionValue * 100).toFixed(2) + "%" : text + optionValue.toFixed(2);
// 判斷是否為整數,若非整數要取小數點後面兩個值。 // 判斷是否為整數,若非整數要取小數點後面兩個值。
text = Math.trunc(optionValue) === optionValue ? textInt : textFloat; text = Math.trunc(optionValue) === optionValue ? textInt : textFloat;
@@ -124,13 +131,13 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu
case 'duration': // Duration 除了 Relative 為百分比 % ,其他要轉變時間單位。 case 'duration': // Duration 除了 Relative 為百分比 % ,其他要轉變時間單位。
// Relative % // Relative %
let textDurRel = text + (optionValue * 100).toFixed(2) + "%"; textDurRel = text + (optionValue * 100).toFixed(2) + "%";
// Timelabel // Timelabel
let timeLabelInt = text + getTimeLabel(optionValue); timeLabelInt = text + getTimeLabel(optionValue);
let timeLabelFloat = text + getTimeLabel(optionValue.toFixed(2)); timeLabelFloat = text + getTimeLabel(optionValue.toFixed(2));
// 判斷是否為整數,若非整數要取小數點後面兩個值。 // 判斷是否為整數,若非整數要取小數點後面兩個值。
let textTimeLabel = Math.trunc(optionValue) === optionValue ? timeLabelInt : timeLabelFloat; textTimeLabel = Math.trunc(optionValue) === optionValue ? timeLabelInt : timeLabelFloat;
text = dataLayerOption === 'rel_duration' ? textDurRel : textTimeLabel; text = dataLayerOption === 'rel_duration' ? textDurRel : textTimeLabel;
break; break;
@@ -169,13 +176,18 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu
'content': function(edge) { // 關係線顯示的文字 'content': function(edge) { // 關係線顯示的文字
let optionValue = edge.data(`${dataLayerType}.${dataLayerOption}`); let optionValue = edge.data(`${dataLayerType}.${dataLayerOption}`);
let result = ''; let result = '';
let edgeInt;
let edgeFloat;
let edgeDurRel;
let timeLabelInt;
let timeLabelFloat;
let edgeTimeLabel;
if(optionValue === '') return optionValue; if(optionValue === '') return optionValue;
switch(dataLayerType) { switch(dataLayerType) {
case 'freq': case 'freq':
let edgeInt = dataLayerOption === 'rel_freq' ? optionValue * 100 + "%" : optionValue; edgeInt = dataLayerOption === 'rel_freq' ? optionValue * 100 + "%" : optionValue;
let edgeFloat = dataLayerOption === 'rel_freq' ? (optionValue * 100).toFixed(2) + "%" : optionValue.toFixed(2); edgeFloat = dataLayerOption === 'rel_freq' ? (optionValue * 100).toFixed(2) + "%" : optionValue.toFixed(2);
// 判斷是否為整數,若非整數要取小數點後面兩個值。 // 判斷是否為整數,若非整數要取小數點後面兩個值。
result = Math.trunc(optionValue) === optionValue ? edgeInt : edgeFloat; result = Math.trunc(optionValue) === optionValue ? edgeInt : edgeFloat;
@@ -183,11 +195,11 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu
case 'duration': // Duration 除了 Relative 為百分比 % ,其他要轉變時間單位。 case 'duration': // Duration 除了 Relative 為百分比 % ,其他要轉變時間單位。
// Relative % // Relative %
let edgeDurRel = (optionValue * 100).toFixed(2) + "%"; edgeDurRel = (optionValue * 100).toFixed(2) + "%";
// Timelabel // Timelabel
let timeLabelInt = getTimeLabel(optionValue); timeLabelInt = getTimeLabel(optionValue);
let timeLabelFloat = getTimeLabel(optionValue.toFixed(2)); timeLabelFloat = getTimeLabel(optionValue.toFixed(2));
let edgeTimeLabel = Math.trunc(optionValue) === optionValue ? timeLabelInt : timeLabelFloat; edgeTimeLabel = Math.trunc(optionValue) === optionValue ? timeLabelInt : timeLabelFloat;
result = dataLayerOption === 'rel_duration' ? edgeDurRel : edgeTimeLabel; result = dataLayerOption === 'rel_duration' ? edgeDurRel : edgeTimeLabel;
break; break;

View File

@@ -99,7 +99,7 @@ export default {
// .*$:匹配剩餘的字符,確保完整的提取。 // .*$:匹配剩餘的字符,確保完整的提取。
// |^.*$:在找不到 "luciaToken" 的情況下,匹配整個字符串。 // |^.*$:在找不到 "luciaToken" 的情況下,匹配整個字符串。
// 實際應用 // 實際應用
const token = document.cookie.replace(/(?:(?:^|.*;\s*)luciaToken\s*\=\s*([^;]*).*$)|^.*$/, "$1"); const token = document.cookie.replace(/(?:(?:^|.*;\s*)luciaToken\s*=\s*([^;]*).*$)|^.*$/, "$1");
axios.defaults.headers.common['Authorization'] = `Bearer ${token}`; axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
switch (to.params.type) { switch (to.params.type) {

View File

@@ -468,7 +468,7 @@ export default {
if (isCheckPage) { if (isCheckPage) {
const conformanceStore = ConformanceStore(); const conformanceStore = ConformanceStore();
// Save token in Headers. // Save token in Headers.
const token = document.cookie.replace(/(?:(?:^|.*;\s*)luciaToken\s*\=\s*([^;]*).*$)|^.*$/, "$1"); const token = document.cookie.replace(/(?:(?:^|.*;\s*)luciaToken\s*=\s*([^;]*).*$)|^.*$/, "$1");
axios.defaults.headers.common['Authorization'] = `Bearer ${token}`; axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
switch (to.params.type) { switch (to.params.type) {

View File

@@ -912,7 +912,7 @@ export default {
if (isCheckPage) { if (isCheckPage) {
const conformanceStore = ConformanceStore(); const conformanceStore = ConformanceStore();
// Save token in Headers. // Save token in Headers.
const token = document.cookie.replace(/(?:(?:^|.*;\s*)luciaToken\s*\=\s*([^;]*).*$)|^.*$/, "$1"); const token = document.cookie.replace(/(?:(?:^|.*;\s*)luciaToken\s*=\s*([^;]*).*$)|^.*$/, "$1");
axios.defaults.headers.common['Authorization'] = `Bearer ${token}`; axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
switch (to.params.type) { switch (to.params.type) {

View File

@@ -36,6 +36,7 @@
<table class="text-sm border-separate border-spacing-0 h-full overflow-y-auto overflow-x-auto scrollbar"> <table class="text-sm border-separate border-spacing-0 h-full overflow-y-auto overflow-x-auto scrollbar">
<caption class="hidden">Upload</caption> <caption class="hidden">Upload</caption>
<thead class="sticky top-0 bg-neutral-10"> <thead class="sticky top-0 bg-neutral-10">
<tr class="hidden"><th></th></tr>
<tr> <tr>
<td v-for="(item, index) in uploadDetail?.columns" :key="index" class="border border-neutral-500 p-2 truncate max-w-[198px]">{{ item }}</td> <td v-for="(item, index) in uploadDetail?.columns" :key="index" class="border border-neutral-500 p-2 truncate max-w-[198px]">{{ item }}</td>
</tr> </tr>