Browse Source

chore: fix lint

Signed-off-by: Wing-Kam Wong <wingkwong.code@gmail.com>
pull/1802/head
Wing-Kam Wong 3 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) {
return this.$store.commit('app/MutHiddenAnnouncement', val ? null : true)
}
},
}
},
mounted() {
setTimeout(() => {

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

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

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

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

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

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

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

@ -184,10 +184,8 @@ export default {
this.$emit('input', val)
if (this.isAttachment || this.isEnum || this.isBoolean || this.isSet || this.isTime || this.isDateTime || this.isDate) {
this.syncData()
} else {
if (!this.isCurrency) {
this.syncDataDebounce(this)
}
} else if (!this.isCurrency) {
this.syncDataDebounce(this)
}
}
}
@ -206,7 +204,6 @@ export default {
$listeners.cancel = this.$listeners.cancel
}
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
if (v.pk ? !v.ai && !v.cdf : !v.cdf && v.rqd) {
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] === "" )) {
return `null value violates not-null constraint`
.some(r => r[row.sourceCn] === null || r[row.sourceCn] === undefined || r[row.sourceCn] === '')) {
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
}, {}))
await this.$api.dbTableRow.bulkCreate(
'noco',
this.projectName,
this.meta.title,
batchData
'noco',
this.projectName,
this.meta.title,
batchData
)
progress += batchData.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 = [
"jpeg",
"gif",
"png",
"png",
"svg",
"bmp",
"ico",
"jpg",
"webp",
];
'jpeg',
'gif',
'png',
'png',
'svg',
'bmp',
'ico',
'jpg',
'webp'
]
export default imageExt;
export default imageExt
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
*

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

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

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

@ -39,38 +39,39 @@ export default {
description: 'Add tables',
mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>T</kbd>',
windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>T</kbd>'
},{
}, {
description: 'Add columns',
mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>C</kbd>',
windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>C</kbd>'
},{
}, {
description: 'Add new column row',
mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>A</kbd>',
windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>A</kbd>'
},{
}, {
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>',
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',
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>'
},{
}, {
description: 'Copy json to clipboard',
mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>J</kbd>',
windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>J</kbd>'
},{
}, {
description: 'Submit template',
mac: '<kbd>Command</kbd> + <kbd>Control</kbd> + <kbd>S</kbd>',
windows: '<kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>S</kbd>'
},]
}]
}
},
computed: {
localState: {
get() {
return this.value
}, set(val) {
},
set(val) {
this.$emit('input', val)
}
}

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

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

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

@ -75,7 +75,7 @@ function GetCaretPosition(ctrl) {
export function validateTableName(v, isGQL) {
if (!v) {
return "Table name required";
return 'Table name required'
}
// GraphQL naming convention
@ -83,67 +83,66 @@ export function validateTableName(v, isGQL) {
if (isGQL) {
if (/^[_A-Za-z][_0-9A-Za-z]*$/.test(v)) {
return true;
return true
}
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) {
return `Following characters are not allowed ${m
.map((c) => JSON.stringify(c))
.join(", ")}`;
.map(c => JSON.stringify(c))
.join(', ')}`
}
} else {
// exclude . / \
// 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.
const m = v.match(/[./\\]/g);
const m = v.match(/[./\\]/g)
if (m) {
return `Following characters are not allowed ${m
.map((c) => JSON.stringify(c))
.join(", ")}`;
.map(c => JSON.stringify(c))
.join(', ')}`
}
return true;
return true
}
}
export function validateColumnName(v, isGQL) {
if (!v) {
return "Column name required";
return 'Column name required'
}
// GraphQL naming convention
// http://spec.graphql.org/June2018/#Name
if (isGQL) {
if (/^[_A-Za-z][_0-9A-Za-z]*$/.test(v)) {
return true;
return true
}
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) {
return `Following characters are not allowed ${m
.map((c) => JSON.stringify(c))
.join(", ")}`;
.map(c => JSON.stringify(c))
.join(', ')}`
}
} else {
// exclude . / \
// 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.
const m = v.match(/[./\\]/g);
const m = v.match(/[./\\]/g)
if (m) {
return `Following characters are not allowed ${m
.map((c) => JSON.stringify(c))
.join(", ")}`;
.map(c => JSON.stringify(c))
.join(', ')}`
}
return true;
return true
}
}

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

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

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

@ -14,7 +14,8 @@
<template #activator="{ on }">
<v-btn
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-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.projectStatusUpdating = true
try {
await this.$api.project.delete(projectId)
this.$toast
.success(`Project '${project.title}' deleted successfully`)
@ -950,7 +949,6 @@ export default {
this.loaded = true
},
async projectRouteHandler(project, count) {
if (!this.deleteBtnClicked) {
await this.$router.push({
path: `/nc/${project.id}`

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

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

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

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

1
packages/nc-gui/xc.js

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

Loading…
Cancel
Save