Browse Source

fix(gui-v2): lint

pull/3051/head
Wing-Kam Wong 2 years ago
parent
commit
1fddc7c9e5
  1. 10
      packages/nc-gui-v2/components/dlg/QuickImport.vue
  2. 22
      packages/nc-gui-v2/components/template/Editor.vue

10
packages/nc-gui-v2/components/dlg/QuickImport.vue

@ -10,13 +10,7 @@ import MdiLinkVariantIcon from '~icons/mdi/link-variant'
import MdiCodeJSONIcon from '~icons/mdi/code-json'
import { fieldRequiredValidator, importCsvUrlValidator, importExcelUrlValidator, importUrlValidator } from '~/utils/validation'
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils'
import {
CSVTemplateAdapter,
ExcelTemplateAdapter,
ExcelUrlTemplateAdapter,
JSONTemplateAdapter,
JSONUrlTemplateAdapter,
} from '~/utils/parsers'
import { ExcelTemplateAdapter, ExcelUrlTemplateAdapter, JSONTemplateAdapter, JSONUrlTemplateAdapter } from '~/utils/parsers'
import { useProject } from '#imports'
interface Props {
@ -77,7 +71,7 @@ const validators = computed(() => {
}
})
const { resetFields, validate, validateInfos } = useForm(importState, validators)
const { validate, validateInfos } = useForm(importState, validators)
const importMeta = computed(() => {
if (IsImportTypeExcel.value) {

22
packages/nc-gui-v2/components/template/Editor.vue

@ -194,7 +194,7 @@ function missingRequiredColumnsValidation() {
}
function atLeastOneEnabledValidation() {
if (srcDestMapping.value.filter((v) => v.enabled === true).length == 0) {
if (srcDestMapping.value.filter((v) => v.enabled === true).length === 0) {
notification.error({
message: 'At least one column has to be selected',
duration: 3,
@ -263,22 +263,22 @@ function fieldsValidation(record: Record<string, any>) {
case UITypes.Checkbox:
if (
importData[tableName].slice(0, maxRowsToParse).some((r: Record<string, any>) => {
if ((r: Record<string, any>) => r[record.srcCn] !== null && r[record.srcCn] !== undefined) {
if (r[record.srcCn] !== null && r[record.srcCn] !== undefined) {
let input = r[record.srcCn]
if (typeof input === 'string') {
input = input.replace(/["']/g, '').toLowerCase().trim()
return !(
input == 'false' ||
input == 'no' ||
input == 'n' ||
input == '0' ||
input == 'true' ||
input == 'yes' ||
input == 'y' ||
input == '1'
input === 'false' ||
input === 'no' ||
input === 'n' ||
input === '0' ||
input === 'true' ||
input === 'yes' ||
input === 'y' ||
input === '1'
)
}
return input != 1 && input != 0 && input != true && input != false
return input !== 1 && input !== 0 && input !== true && input !== false
}
return false
})

Loading…
Cancel
Save