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 MdiCodeJSONIcon from '~icons/mdi/code-json'
import { fieldRequiredValidator, importCsvUrlValidator, importExcelUrlValidator, importUrlValidator } from '~/utils/validation' import { fieldRequiredValidator, importCsvUrlValidator, importExcelUrlValidator, importUrlValidator } from '~/utils/validation'
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' import { extractSdkResponseErrorMsg } from '~/utils/errorUtils'
import { import { ExcelTemplateAdapter, ExcelUrlTemplateAdapter, JSONTemplateAdapter, JSONUrlTemplateAdapter } from '~/utils/parsers'
CSVTemplateAdapter,
ExcelTemplateAdapter,
ExcelUrlTemplateAdapter,
JSONTemplateAdapter,
JSONUrlTemplateAdapter,
} from '~/utils/parsers'
import { useProject } from '#imports' import { useProject } from '#imports'
interface Props { 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(() => { const importMeta = computed(() => {
if (IsImportTypeExcel.value) { if (IsImportTypeExcel.value) {

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

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

Loading…
Cancel
Save