Browse Source

chore: fix lint

Signed-off-by: Wing-Kam Wong <wingkwong.code@gmail.com>
pull/1802/head
Wing-Kam Wong 2 years ago
parent
commit
180accda2a
  1. 2
      packages/nc-gui/components/importantAnnouncement.vue
  2. 2
      packages/nc-gui/components/project/appStore/inputs/checkboxField.vue
  3. 1
      packages/nc-gui/components/project/auditTab/db.vue
  4. 1
      packages/nc-gui/components/project/spreadsheet/components/editColumn/lookupOptions.vue
  5. 7
      packages/nc-gui/components/project/spreadsheet/components/editableCell.vue
  6. 4
      packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue
  7. 8
      packages/nc-gui/components/project/spreadsheet/components/moreActions.vue
  8. 28
      packages/nc-gui/components/project/spreadsheet/helpers/imageExt.js
  9. 1
      packages/nc-gui/components/project/tableTabs/aclTsFileDbChild.vue
  10. 17
      packages/nc-gui/components/templates/help.vue
  11. 1
      packages/nc-gui/components/trialExpired.vue
  12. 41
      packages/nc-gui/helpers/index.js
  13. 2
      packages/nc-gui/layouts/default.vue
  14. 3
      packages/nc-gui/layouts/public.vue
  15. 2
      packages/nc-gui/pages/projects/index.vue
  16. 74
      packages/nc-gui/plugins/i18n.js
  17. 4
      packages/nc-gui/store/app.js
  18. 1
      packages/nc-gui/xc.js

2
packages/nc-gui/components/importantAnnouncement.vue

@ -67,7 +67,7 @@ export default {
set(val) { set(val) {
return this.$store.commit('app/MutHiddenAnnouncement', val ? null : true) return this.$store.commit('app/MutHiddenAnnouncement', val ? null : true)
} }
}, }
}, },
mounted() { mounted() {
setTimeout(() => { setTimeout(() => {

2
packages/nc-gui/components/project/appStore/inputs/checkboxField.vue

@ -28,7 +28,7 @@ export default {
const $listeners = {} const $listeners = {}
return $listeners return $listeners
} }
}, }
} }
</script> </script>

1
packages/nc-gui/components/project/auditTab/db.vue

@ -407,7 +407,6 @@ export default {
}, },
async migrationUp(steps = 99999999999) { async migrationUp(steps = 99999999999) {
try { try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'migrationsUp', { await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'migrationsUp', {
env: this.nodes.env, env: this.nodes.env,
dbAlias: this.nodes.dbAlias, dbAlias: this.nodes.dbAlias,

1
packages/nc-gui/components/project/spreadsheet/components/editColumn/lookupOptions.vue

@ -78,7 +78,6 @@ export default {
})) }))
return refTables return refTables
}, },
columnList() { columnList() {
return (( return ((

7
packages/nc-gui/components/project/spreadsheet/components/editableCell.vue

@ -184,10 +184,8 @@ export default {
this.$emit('input', val) this.$emit('input', val)
if (this.isAttachment || this.isEnum || this.isBoolean || this.isSet || this.isTime || this.isDateTime || this.isDate) { if (this.isAttachment || this.isEnum || this.isBoolean || this.isSet || this.isTime || this.isDateTime || this.isDate) {
this.syncData() this.syncData()
} else { } else if (!this.isCurrency) {
if (!this.isCurrency) { this.syncDataDebounce(this)
this.syncDataDebounce(this)
}
} }
} }
} }
@ -206,7 +204,6 @@ export default {
$listeners.cancel = this.$listeners.cancel $listeners.cancel = this.$listeners.cancel
} }
return $listeners return $listeners
} }

4
packages/nc-gui/components/project/spreadsheet/components/importExport/columnMappingModal.vue

@ -154,8 +154,8 @@ export default {
// check if the input contains null value for a required column // check if the input contains null value for a required column
if (v.pk ? !v.ai && !v.cdf : !v.cdf && v.rqd) { if (v.pk ? !v.ai && !v.cdf : !v.cdf && v.rqd) {
if (this.parsedCsv && this.parsedCsv.data && this.parsedCsv.data.slice(0, 500) if (this.parsedCsv && this.parsedCsv.data && this.parsedCsv.data.slice(0, 500)
.some(r => r[row.sourceCn] === null || r[row.sourceCn] === undefined || r[row.sourceCn] === "" )) { .some(r => r[row.sourceCn] === null || r[row.sourceCn] === undefined || r[row.sourceCn] === '')) {
return `null value violates not-null constraint` return 'null value violates not-null constraint'
} }
} }

8
packages/nc-gui/components/project/spreadsheet/components/moreActions.vue

@ -309,10 +309,10 @@ export default {
return res return res
}, {})) }, {}))
await this.$api.dbTableRow.bulkCreate( await this.$api.dbTableRow.bulkCreate(
'noco', 'noco',
this.projectName, this.projectName,
this.meta.title, this.meta.title,
batchData batchData
) )
progress += batchData.length progress += batchData.length
this.$store.commit('loader/MutMessage', `Importing data : ${progress}/${data.length}`) this.$store.commit('loader/MutMessage', `Importing data : ${progress}/${data.length}`)

28
packages/nc-gui/components/project/spreadsheet/helpers/imageExt.js

@ -1,22 +1,22 @@
const imageExt = [ const imageExt = [
"jpeg", 'jpeg',
"gif", 'gif',
"png", 'png',
"png", 'png',
"svg", 'svg',
"bmp", 'bmp',
"ico", 'ico',
"jpg", 'jpg',
"webp", 'webp'
]; ]
export default imageExt; export default imageExt
const isImage = (name) => { const isImage = (name) => {
return imageExt.some((e) => name.toLowerCase().endsWith(`.${e}`)); return imageExt.some(e => name.toLowerCase().endsWith(`.${e}`))
}; }
export { isImage }; export { isImage }
/** /**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd * @copyright Copyright (c) 2021, Xgene Cloud Ltd
* *

1
packages/nc-gui/components/project/tableTabs/aclTsFileDbChild.vue

@ -341,7 +341,6 @@ export default {
}, },
async save() { async save() {
try { try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcRoutesPolicyUpdate', { await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcRoutesPolicyUpdate', {
env: this.nodes.env, env: this.nodes.env,
dbAlias: this.nodes.dbAlias, dbAlias: this.nodes.dbAlias,

17
packages/nc-gui/components/templates/help.vue

@ -39,38 +39,39 @@ export default {
description: 'Add tables', description: 'Add tables',
mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>T</kbd>', mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>T</kbd>',
windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>T</kbd>' windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>T</kbd>'
},{ }, {
description: 'Add columns', description: 'Add columns',
mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>C</kbd>', mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>C</kbd>',
windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>C</kbd>' windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>C</kbd>'
},{ }, {
description: 'Add new column row', description: 'Add new column row',
mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>A</kbd>', mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>A</kbd>',
windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>A</kbd>' windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>A</kbd>'
},{ }, {
description: 'Table navigation', description: 'Table navigation',
mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>Arrow Down</kbd> <br>AND<br> <kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>Arrow Up</kbd>', mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>Arrow Down</kbd> <br>AND<br> <kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>Arrow Up</kbd>',
windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Arrow Down</kbd> <br>AND<br> <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Arrow Up</kbd>' windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Arrow Down</kbd> <br>AND<br> <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Arrow Up</kbd>'
},{ }, {
description: 'Column navigation', description: 'Column navigation',
mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>Arrow Right</kbd> <br>AND<br> <kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>Arrow Left</kbd>', mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>Arrow Right</kbd> <br>AND<br> <kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>Arrow Left</kbd>',
windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Arrow Right</kbd> <br>AND<br> <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Arrow Right</kbd>' windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Arrow Right</kbd> <br>AND<br> <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Arrow Right</kbd>'
},{ }, {
description: 'Copy json to clipboard', description: 'Copy json to clipboard',
mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>J</kbd>', mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>J</kbd>',
windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>J</kbd>' windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>J</kbd>'
},{ }, {
description: 'Submit template', description: 'Submit template',
mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>S</kbd>', mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>S</kbd>',
windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>S</kbd>' windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>S</kbd>'
},] }]
} }
}, },
computed: { computed: {
localState: { localState: {
get() { get() {
return this.value return this.value
}, set(val) { },
set(val) {
this.$emit('input', val) this.$emit('input', val)
} }
} }

1
packages/nc-gui/components/trialExpired.vue

@ -14,7 +14,6 @@
<script> <script>
export default { export default {
name: 'TrialExpired', name: 'TrialExpired',
methods: { methods: {

41
packages/nc-gui/helpers/index.js

@ -75,7 +75,7 @@ function GetCaretPosition(ctrl) {
export function validateTableName(v, isGQL) { export function validateTableName(v, isGQL) {
if (!v) { if (!v) {
return "Table name required"; return 'Table name required'
} }
// GraphQL naming convention // GraphQL naming convention
@ -83,67 +83,66 @@ export function validateTableName(v, isGQL) {
if (isGQL) { if (isGQL) {
if (/^[_A-Za-z][_0-9A-Za-z]*$/.test(v)) { if (/^[_A-Za-z][_0-9A-Za-z]*$/.test(v)) {
return true; return true
} }
if (/^[^_A-Za-z]/.test(v)) { if (/^[^_A-Za-z]/.test(v)) {
return "Name should start with an alphabet or _"; return 'Name should start with an alphabet or _'
} }
const m = v.match(/[^_A-Za-z\d]/g); const m = v.match(/[^_A-Za-z\d]/g)
if (m) { if (m) {
return `Following characters are not allowed ${m return `Following characters are not allowed ${m
.map((c) => JSON.stringify(c)) .map(c => JSON.stringify(c))
.join(", ")}`; .join(', ')}`
} }
} else { } else {
// exclude . / \ // exclude . / \
// rest all characters allowed // rest all characters allowed
// https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n0rfg6x1shw0ppn1cwhco6yn09f7.htm#:~:text=By%20default%2C%20MySQL%20encloses%20column,not%20truncate%20a%20longer%20name. // https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n0rfg6x1shw0ppn1cwhco6yn09f7.htm#:~:text=By%20default%2C%20MySQL%20encloses%20column,not%20truncate%20a%20longer%20name.
const m = v.match(/[./\\]/g); const m = v.match(/[./\\]/g)
if (m) { if (m) {
return `Following characters are not allowed ${m return `Following characters are not allowed ${m
.map((c) => JSON.stringify(c)) .map(c => JSON.stringify(c))
.join(", ")}`; .join(', ')}`
} }
return true; return true
} }
} }
export function validateColumnName(v, isGQL) { export function validateColumnName(v, isGQL) {
if (!v) { if (!v) {
return "Column name required"; return 'Column name required'
} }
// GraphQL naming convention // GraphQL naming convention
// http://spec.graphql.org/June2018/#Name // http://spec.graphql.org/June2018/#Name
if (isGQL) { if (isGQL) {
if (/^[_A-Za-z][_0-9A-Za-z]*$/.test(v)) { if (/^[_A-Za-z][_0-9A-Za-z]*$/.test(v)) {
return true; return true
} }
if (/^[^_A-Za-z]/.test(v)) { if (/^[^_A-Za-z]/.test(v)) {
return "Name should start with an alphabet or _"; return 'Name should start with an alphabet or _'
} }
const m = v.match(/[^_A-Za-z\d]/g); const m = v.match(/[^_A-Za-z\d]/g)
if (m) { if (m) {
return `Following characters are not allowed ${m return `Following characters are not allowed ${m
.map((c) => JSON.stringify(c)) .map(c => JSON.stringify(c))
.join(", ")}`; .join(', ')}`
} }
} else { } else {
// exclude . / \ // exclude . / \
// rest all characters allowed // rest all characters allowed
// https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n0rfg6x1shw0ppn1cwhco6yn09f7.htm#:~:text=By%20default%2C%20MySQL%20encloses%20column,not%20truncate%20a%20longer%20name. // https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n0rfg6x1shw0ppn1cwhco6yn09f7.htm#:~:text=By%20default%2C%20MySQL%20encloses%20column,not%20truncate%20a%20longer%20name.
const m = v.match(/[./\\]/g); const m = v.match(/[./\\]/g)
if (m) { if (m) {
return `Following characters are not allowed ${m return `Following characters are not allowed ${m
.map((c) => JSON.stringify(c)) .map(c => JSON.stringify(c))
.join(", ")}`; .join(', ')}`
} }
return true; return true
} }
} }

2
packages/nc-gui/layouts/default.vue

@ -271,8 +271,8 @@
</template> </template>
<script> <script>
import ReleaseInfo from '@/components/releaseInfo'
import { mapGetters, mapActions, mapMutations } from 'vuex' import { mapGetters, mapActions, mapMutations } from 'vuex'
import ReleaseInfo from '@/components/releaseInfo'
import 'splitpanes/dist/splitpanes.css' import 'splitpanes/dist/splitpanes.css'
import XBtn from '../components/global/xBtn' import XBtn from '../components/global/xBtn'
import dlgUnexpectedError from '../components/utils/dlgUnexpectedError' import dlgUnexpectedError from '../components/utils/dlgUnexpectedError'

3
packages/nc-gui/layouts/public.vue

@ -14,7 +14,8 @@
<template #activator="{ on }"> <template #activator="{ on }">
<v-btn <v-btn
to="/projects" to="/projects"
icon class="pa-1 brand-icon nc-noco-brand-icon" icon
class="pa-1 brand-icon nc-noco-brand-icon"
v-on="on" v-on="on"
> >
<v-img :src="require('~/assets/img/icons/512x512-trans.png')" max-height="30px" max-width="30px" /> <v-img :src="require('~/assets/img/icons/512x512-trans.png')" max-height="30px" max-width="30px" />

2
packages/nc-gui/pages/projects/index.vue

@ -874,7 +874,6 @@ export default {
this.statusUpdatingProjectId = projectId this.statusUpdatingProjectId = projectId
this.projectStatusUpdating = true this.projectStatusUpdating = true
try { try {
await this.$api.project.delete(projectId) await this.$api.project.delete(projectId)
this.$toast this.$toast
.success(`Project '${project.title}' deleted successfully`) .success(`Project '${project.title}' deleted successfully`)
@ -950,7 +949,6 @@ export default {
this.loaded = true this.loaded = true
}, },
async projectRouteHandler(project, count) { async projectRouteHandler(project, count) {
if (!this.deleteBtnClicked) { if (!this.deleteBtnClicked) {
await this.$router.push({ await this.$router.push({
path: `/nc/${project.id}` path: `/nc/${project.id}`

74
packages/nc-gui/plugins/i18n.js

@ -1,10 +1,10 @@
// plugins/i18n.js // plugins/i18n.js
import Vue from "vue"; import Vue from 'vue'
import VueI18n from "vue-i18n"; import VueI18n from 'vue-i18n'
// Tell Vue to use our plugin // Tell Vue to use our plugin
Vue.use(VueI18n); Vue.use(VueI18n)
export default ({ app, store }) => { export default ({ app, store }) => {
// Set the i18n instance on app // Set the i18n instance on app
@ -14,49 +14,49 @@ export default ({ app, store }) => {
locale: store.state.windows.language, locale: store.state.windows.language,
// Set the fallback locale in case the current locale can't be found // Set the fallback locale in case the current locale can't be found
fallbackLocale: "en", fallbackLocale: 'en',
// Associate each locale to a content file // Associate each locale to a content file
messages: { messages: {
en: require("~/lang/en.json"), en: require('~/lang/en.json'),
zh_HK: require("~/lang/zh_HK.json"), zh_HK: require('~/lang/zh_HK.json'),
zh_TW: require("~/lang/zh_TW.json"), zh_TW: require('~/lang/zh_TW.json'),
zh_CN: require("~/lang/zh_CN.json"), zh_CN: require('~/lang/zh_CN.json'),
ja: require("~/lang/ja.json"), ja: require('~/lang/ja.json'),
fr: require("~/lang/fr.json"), fr: require('~/lang/fr.json'),
es: require("~/lang/es.json"), es: require('~/lang/es.json'),
de: require("~/lang/de.json"), de: require('~/lang/de.json'),
id: require("~/lang/id.json"), id: require('~/lang/id.json'),
it_IT: require("~/lang/it_IT.json"), it_IT: require('~/lang/it_IT.json'),
ko: require("~/lang/ko.json"), ko: require('~/lang/ko.json'),
lv: require("~/lang/lv.json"), lv: require('~/lang/lv.json'),
nl: require("~/lang/nl.json"), nl: require('~/lang/nl.json'),
ru: require("~/lang/ru.json"), ru: require('~/lang/ru.json'),
sv: require("~/lang/sv.json"), sv: require('~/lang/sv.json'),
da: require("~/lang/da.json"), da: require('~/lang/da.json'),
vi: require("~/lang/vi.json"), vi: require('~/lang/vi.json'),
no: require("~/lang/no.json"), no: require('~/lang/no.json'),
iw: require("~/lang/iw.json"), iw: require('~/lang/iw.json'),
fi: require("~/lang/fi.json"), fi: require('~/lang/fi.json'),
uk: require("~/lang/uk.json"), uk: require('~/lang/uk.json'),
hr: require("~/lang/hr.json"), hr: require('~/lang/hr.json'),
th: require("~/lang/th.json"), th: require('~/lang/th.json'),
sl: require("~/lang/sl.json"), sl: require('~/lang/sl.json'),
pt_BR: require("~/lang/pt_BR.json"), pt_BR: require('~/lang/pt_BR.json'),
fa: require("~/lang/fa.json"), fa: require('~/lang/fa.json'),
tr: require("~/lang/tr.json"), tr: require('~/lang/tr.json')
}, }
}); })
store.watch( store.watch(
(state) => state.windows.language, state => state.windows.language,
(language) => { (language) => {
if (app.i18n.availableLocales.includes(language)) { if (app.i18n.availableLocales.includes(language)) {
app.i18n.locale = language; app.i18n.locale = language
} }
} }
); )
}; }
/** /**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd * @copyright Copyright (c) 2021, Xgene Cloud Ltd
* *

4
packages/nc-gui/store/app.js

@ -2,7 +2,7 @@ export const state = () => ({
releaseVersion: null, releaseVersion: null,
hiddenRelease: null, hiddenRelease: null,
latestRelease: null, latestRelease: null,
hiddenAnnouncement: null, hiddenAnnouncement: null
}) })
export const mutations = { export const mutations = {
@ -17,7 +17,7 @@ export const mutations = {
}, },
MutHiddenAnnouncement(state, hiddenAnnouncement) { MutHiddenAnnouncement(state, hiddenAnnouncement) {
state.hiddenAnnouncement = hiddenAnnouncement state.hiddenAnnouncement = hiddenAnnouncement
}, }
} }
/** /**

1
packages/nc-gui/xc.js

@ -2,7 +2,6 @@
function initApp(config) { function initApp(config) {
const nuxtApp = document.createElement('div') const nuxtApp = document.createElement('div')
nuxtApp.id = '__nuxt' nuxtApp.id = '__nuxt'
document.querySelector(config.selector).appendChild(nuxtApp); document.querySelector(config.selector).appendChild(nuxtApp);
[ [

Loading…
Cancel
Save