Browse Source

refactor(gui): update eslint rules

Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com>
pull/360/head
Pranav C 3 years ago
parent
commit
59f55e4595
  1. 8
      packages/nc-gui/.eslintrc.json
  2. 25
      packages/nc-gui/components/apiClient/headers.vue
  3. 24
      packages/nc-gui/components/apiClient/params.vue
  4. 6
      packages/nc-gui/components/apiClient/perfTest.vue
  5. 14
      packages/nc-gui/components/apiOverlay.vue
  6. 2
      packages/nc-gui/components/auth.routes.js
  7. 10
      packages/nc-gui/components/auth/apiTokens.vue
  8. 6
      packages/nc-gui/components/auth/authHooks.vue
  9. 18
      packages/nc-gui/components/auth/roles.vue
  10. 44
      packages/nc-gui/components/auth/userManagement.vue
  11. 2
      packages/nc-gui/components/authTab.vue
  12. 8
      packages/nc-gui/components/changeEnv.vue
  13. 100
      packages/nc-gui/components/createOrEditProject.vue
  14. 8
      packages/nc-gui/components/global/recursiveMenu.vue
  15. 28
      packages/nc-gui/components/global/xAutoComplete.vue
  16. 4
      packages/nc-gui/components/global/xIcon.vue
  17. 16
      packages/nc-gui/components/monaco/Monaco.vue
  18. 40
      packages/nc-gui/components/monaco/MonacoSqlEditor.vue
  19. 2
      packages/nc-gui/components/monaco/sqlAutoCompletions.js
  20. 10
      packages/nc-gui/components/notification.vue
  21. 36
      packages/nc-gui/components/project/apis.vue
  22. 18
      packages/nc-gui/components/project/appStore.vue
  23. 4
      packages/nc-gui/components/project/appStore/FormInput.vue
  24. 18
      packages/nc-gui/components/project/appStore/appInstall.vue
  25. 22
      packages/nc-gui/components/project/appStore/inputs/attachment.vue
  26. 10
      packages/nc-gui/components/project/appStore/inputs/longTextField.vue
  27. 6
      packages/nc-gui/components/project/appStore/inputs/passwordField.vue
  28. 6
      packages/nc-gui/components/project/appStore/inputs/textField.vue
  29. 6
      packages/nc-gui/components/project/appStoreOld.vue
  30. 6
      packages/nc-gui/components/project/auditTab/audit.vue
  31. 34
      packages/nc-gui/components/project/auditTab/db.vue
  32. 18
      packages/nc-gui/components/project/cronJobs.vue
  33. 24
      packages/nc-gui/components/project/dlgs/dlgAddRelation.vue
  34. 16
      packages/nc-gui/components/project/dlgs/dlgTriggerAddEdit.vue
  35. 8
      packages/nc-gui/components/project/functionTab/functionAcl.vue
  36. 24
      packages/nc-gui/components/project/functionTab/functionQuery.vue
  37. 8
      packages/nc-gui/components/project/gqlHandlerCodeEditor.vue
  38. 10
      packages/nc-gui/components/project/graphqlClient.vue
  39. 2
      packages/nc-gui/components/project/grpcClient.vue
  40. 8
      packages/nc-gui/components/project/grpcHandlerCodeEditor.vue
  41. 8
      packages/nc-gui/components/project/procedureTab/procedureAcl.vue
  42. 24
      packages/nc-gui/components/project/procedureTab/procedureQuery.vue
  43. 12
      packages/nc-gui/components/project/projectMetadata/disableOrEnableModels.vue
  44. 28
      packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableFunctions.vue
  45. 28
      packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableProcedures.vue
  46. 12
      packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableRelations.vue
  47. 28
      packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableTables.vue
  48. 28
      packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableViews.vue
  49. 10
      packages/nc-gui/components/project/projectMetadata/uiAcl/toggleFunctionUIAcl.vue
  50. 10
      packages/nc-gui/components/project/projectMetadata/uiAcl/toggleProcedureUIAcl.vue
  51. 10
      packages/nc-gui/components/project/projectMetadata/uiAcl/toggleRelationsUIAcl.vue
  52. 10
      packages/nc-gui/components/project/projectMetadata/uiAcl/toggleTableUIAcl.vue
  53. 10
      packages/nc-gui/components/project/projectMetadata/uiAcl/toggleViewUIAcl.vue
  54. 8
      packages/nc-gui/components/project/restHandlerCodeEditor.vue
  55. 30
      packages/nc-gui/components/project/seed.vue
  56. 24
      packages/nc-gui/components/project/sequence.vue
  57. 26
      packages/nc-gui/components/project/settings/appearance.vue
  58. 4
      packages/nc-gui/components/project/settings/env.vue
  59. 10
      packages/nc-gui/components/project/settings/logs.vue
  60. 42
      packages/nc-gui/components/project/settings/versionAndUpdate.vue
  61. 18
      packages/nc-gui/components/project/settings/xcMeta.vue
  62. 2
      packages/nc-gui/components/project/spreadsheet/apis/apiFactory.js
  63. 50
      packages/nc-gui/components/project/spreadsheet/apis/gqlApi.js
  64. 4
      packages/nc-gui/components/project/spreadsheet/apis/grpcApi.js
  65. 24
      packages/nc-gui/components/project/spreadsheet/apis/restApi.js
  66. 2
      packages/nc-gui/components/project/spreadsheet/components/cell/attachmentCell.vue
  67. 2
      packages/nc-gui/components/project/spreadsheet/components/cell/enumCell.vue
  68. 2
      packages/nc-gui/components/project/spreadsheet/components/cell/setListCell.vue
  69. 8
      packages/nc-gui/components/project/spreadsheet/components/columnFilter.vue
  70. 12
      packages/nc-gui/components/project/spreadsheet/components/columnFilterMenu.vue
  71. 38
      packages/nc-gui/components/project/spreadsheet/components/editColumn.vue
  72. 10
      packages/nc-gui/components/project/spreadsheet/components/editColumn/customSelectOptions.vue
  73. 16
      packages/nc-gui/components/project/spreadsheet/components/editColumn/linkedToAnotherOptions.vue
  74. 18
      packages/nc-gui/components/project/spreadsheet/components/editColumn/relationOptions.vue
  75. 12
      packages/nc-gui/components/project/spreadsheet/components/editVirtualColumn.vue
  76. 14
      packages/nc-gui/components/project/spreadsheet/components/editableCell.vue
  77. 8
      packages/nc-gui/components/project/spreadsheet/components/editableCell/booleanCell.vue
  78. 8
      packages/nc-gui/components/project/spreadsheet/components/editableCell/datePickerCell.vue
  79. 8
      packages/nc-gui/components/project/spreadsheet/components/editableCell/dateTimePickerCell.vue
  80. 24
      packages/nc-gui/components/project/spreadsheet/components/editableCell/editableAttachmentCell.vue
  81. 10
      packages/nc-gui/components/project/spreadsheet/components/editableCell/enumListEditableCell.vue
  82. 12
      packages/nc-gui/components/project/spreadsheet/components/editableCell/enumRadioEditableCell.vue
  83. 8
      packages/nc-gui/components/project/spreadsheet/components/editableCell/floatCell.vue
  84. 8
      packages/nc-gui/components/project/spreadsheet/components/editableCell/integerCell.vue
  85. 12
      packages/nc-gui/components/project/spreadsheet/components/editableCell/jsonCell.vue
  86. 14
      packages/nc-gui/components/project/spreadsheet/components/editableCell/setListCheckboxCell.vue
  87. 10
      packages/nc-gui/components/project/spreadsheet/components/editableCell/setListEditableCell.vue
  88. 10
      packages/nc-gui/components/project/spreadsheet/components/editableCell/textAreaCell.vue
  89. 12
      packages/nc-gui/components/project/spreadsheet/components/editableCell/textAreaCellOld.vue
  90. 8
      packages/nc-gui/components/project/spreadsheet/components/editableCell/textCell.vue
  91. 8
      packages/nc-gui/components/project/spreadsheet/components/editableCell/timePickerCell.vue
  92. 40
      packages/nc-gui/components/project/spreadsheet/components/expandedForm.vue
  93. 2
      packages/nc-gui/components/project/spreadsheet/components/extras.vue
  94. 24
      packages/nc-gui/components/project/spreadsheet/components/fieldsMenu.vue
  95. 4
      packages/nc-gui/components/project/spreadsheet/components/headerCell.vue
  96. 2
      packages/nc-gui/components/project/spreadsheet/components/lockMenu.vue
  97. 4
      packages/nc-gui/components/project/spreadsheet/components/pagination.vue
  98. 8
      packages/nc-gui/components/project/spreadsheet/components/sharedViewsList.vue
  99. 8
      packages/nc-gui/components/project/spreadsheet/components/sortListMenu.vue
  100. 40
      packages/nc-gui/components/project/spreadsheet/components/spreadsheetNavDrawer.vue
  101. Some files were not shown because too many files have changed in this diff Show More

8
packages/nc-gui/.eslintrc.json

@ -13,9 +13,11 @@
],
"rules": {
"no-console": "off",
// "space-before-function-paren": "off",
"require-await": "off",
"vue/no-mutating-props": "off"
"space-before-function-paren": [
"error",
"never"
],
"require-await": "off"
},
"parserOptions": {
"parser": "babel-eslint",

25
packages/nc-gui/components/apiClient/headers.vue

@ -1,4 +1,5 @@
<template>
<!-- eslint-disable -->
<!-- todo: update prop mutation with emit --><template>
<v-container fluid>
<v-simple-table class="ignore-height-style" dense>
<template #default>
@ -79,38 +80,38 @@ import draggable from 'vuedraggable'
export default {
directives: {},
components: { draggable },
validate ({ params }) {
validate({ params }) {
return true
},
props: { value: Array, env: String },
data () {
data() {
return {
headerListAuto: ['A-IM', 'Accept', 'Accept-Charset', 'Accept-Encoding', 'Accept-Language', 'Accept-Datetime', 'Access-Control-Request-Method', 'Access-Control-Request-Headers', 'Authorization', 'Cache-Control', 'Connection', 'Content-Length', 'Content-Type', 'Cookie', 'Date', 'Expect', 'Forwarded', 'From', 'Host', 'If-Match', 'If-Modified-Since', 'If-None-Match', 'If-Range', 'If-Unmodified-Since', 'Max-Forwards', 'Origin', 'Pragma', 'Proxy-Authorization', 'Range', 'Referer', 'TE', 'User-Agent', 'Upgrade', 'Via', 'Warning', 'Non-standard headers', 'Dnt', 'X-Requested-With', 'X-CSRF-Token']
}
},
head () {
head() {
return {}
},
computed: {
headersList: {
// two way binding(v-model)
get () {
get() {
return this.value
},
set (value) {
set(value) {
this.$emit('input', value)
}
}
},
watch: {
value: {
handler (val) {
handler(val) {
// keeps at least one param row
if (!val || !val.length) { this.$emit('input', [{ name: '', value: '', enabled: true }]) }
}
}
},
created () {
created() {
// keeps at least one param row
if (!this.value || !this.value.length) {
this.$emit('input', [{
@ -120,15 +121,15 @@ export default {
}])
}
},
mounted () {
mounted() {
},
beforeDestroy () {
beforeDestroy() {
},
methods: {},
beforeCreated () {
beforeCreated() {
},
destroy () {
destroy() {
}
}
</script>

24
packages/nc-gui/components/apiClient/params.vue

@ -1,3 +1,5 @@
<!-- eslint-disable -->
<!-- todo: update prop mutation with emit -->
<template>
<v-container fluid>
<v-simple-table class="ignore-height-style params-table" style="" dense>
@ -79,36 +81,36 @@ import draggable from 'vuedraggable'
export default {
directives: {},
components: { draggable },
validate ({ params }) {
validate({ params }) {
return true
},
props: { value: Array, env: String },
data () {
data() {
return {}
},
head () {
head() {
return {}
},
computed: {
paramList: {
// two way binding(v-model)
get () {
get() {
return this.value
},
set (value) {
set(value) {
this.$emit('input', value)
}
}
},
watch: {
value: {
handler (val) {
handler(val) {
// keeps at least one param row
if (!val || !val.length) { this.$emit('input', [{ name: '', value: '', enabled: true }]) }
}
}
},
created () {
created() {
// creating value if not exist
if (!this.value || !this.value.length) {
this.$emit('input', [{
@ -118,15 +120,15 @@ export default {
}])
}
},
mounted () {
mounted() {
},
beforeDestroy () {
beforeDestroy() {
},
methods: {},
beforeCreated () {
beforeCreated() {
},
destroy () {
destroy() {
}
}
</script>

6
packages/nc-gui/components/apiClient/perfTest.vue

@ -94,16 +94,16 @@ export default {
},
computed: {
perf: {
get () {
get() {
return { ...(this.value || {}) }
},
set (value) {
set(value) {
this.$emit('input', value)
}
}
},
methods: {
open (url) {
open(url) {
// shell.openExternal(url)
}
}

14
packages/nc-gui/components/apiOverlay.vue

@ -127,20 +127,20 @@ export default {
apis: 0
}),
computed: {
rowsCount () {
rowsCount() {
return this.databaseList ? Math.ceil(this.databaseList.length / 5) : 0
},
databaseCount () {
databaseCount() {
return this.databaseList ? this.databaseList.length : 0
},
cost () {
cost() {
if (!this.apis) { return 0 }
const cost = Math.round(this.perHourCost * (this.apis / this.apisPerHour))
return (cost + '').replace(/\d(?=(?:\d{3})+$)/g, '$&,')
},
hoursSaved () {
hoursSaved() {
if (!this.apis) { return 0 }
const hours = Math.round(this.apis / this.apisPerHour)
@ -148,16 +148,16 @@ export default {
return (hours + '').replace(/\d(?=(?:\d{3})+$)/g, '$&,')
}
},
created () {
created() {
this.initSocketClient()
},
beforeDestroy () {
beforeDestroy() {
if (this.client) {
this.client.disconnect()
}
},
methods: {
initSocketClient () {
initSocketClient() {
try {
this.client = require('socket.io-client')(`ws://${window.location.hostname}:8083`)
const self = this

2
packages/nc-gui/components/auth.routes.js

@ -50,7 +50,7 @@ authorizedRoutes['/user/password/reset/form'] = true
// freeRoutes['user/authentication/signin'] = true;
// freeRoutes['user/authentication/signup'] = true;
exports.allowed = function (store, path) {
exports.allowed = function(store, path) {
// console.log('store.getters.GtrUser',store.getters.GtrUser);
// console.log('path',path);

10
packages/nc-gui/components/auth/apiTokens.vue

@ -140,18 +140,18 @@ export default {
tokenObj: {},
valid: true
}),
created () {
created() {
this.loadApiTokens()
},
methods: {
copyToken (token) {
copyToken(token) {
this.$clipboard(token)
this.$toast.info('Copied to clipboard').goAway(1000)
},
async loadApiTokens () {
async loadApiTokens() {
this.tokens = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcApiTokenList'])
},
async generateToken () {
async generateToken() {
try {
this.newTokenDialog = false
this.tokens = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcApiTokenCreate', this.tokenObj])
@ -162,7 +162,7 @@ export default {
this.$toast.error(e.message).goAway(3000)
}
},
async deleteToken (item) {
async deleteToken(item) {
try {
this.tokens = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcApiTokenDelete', { id: item.id }])
this.$toast.success('Token deleted successfully').goAway(3000)

6
packages/nc-gui/components/auth/authHooks.vue

@ -55,16 +55,16 @@ export default {
data: () => ({
data: {}
}),
async created () {
async created() {
await this.loadHook()
},
methods: {
async loadHook () {
async loadHook() {
this.data = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.nodes.dbAlias
}, 'xcAuthHookGet'])
},
async save () {
async save() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.nodes.dbAlias

18
packages/nc-gui/components/auth/roles.vue

@ -201,7 +201,7 @@ export default {
}),
computed: {
operations () {
operations() {
return [
'create',
'read',
@ -209,16 +209,16 @@ export default {
'delete'
]
},
customRolesCount () {
customRolesCount() {
return (this.roles && this.roles.filter(r => r.type !== 'SYSTEM').length) || 0
}
},
async created () {
async created() {
await this.loadRoles()
await this.loadAggrAcl()
},
methods: {
async loadRoles () {
async loadRoles() {
try {
this.roles = (await this.$axios.get('/admin/roles', {
headers: {
@ -234,7 +234,7 @@ export default {
this.edited = false
},
async loadAggrAcl () {
async loadAggrAcl() {
/* try {
this.aggrAcl = await this.$store.dispatch('sqlMgr/ActSqlOp', [
// todo: manage dbAlias or get aggregated
@ -244,7 +244,7 @@ export default {
} catch (e) {
} */
},
addRole () {
addRole() {
this.roles.push({
title: ('role name ' + (this.customRolesCount || '')).trim(),
description: 'Role description'
@ -252,7 +252,7 @@ export default {
this.edited = true
this.scrollAndFocusLastRow()
},
async save () {
async save() {
try {
await this.$axios.put('/admin/roles', { roles: this.roles }, {
headers: {
@ -281,7 +281,7 @@ export default {
await this.loadRoles()
await this.loadAggrAcl()
},
async confirmDelete (hideDialog) {
async confirmDelete(hideDialog) {
if (hideDialog) {
this.showConfirmDlg = false
return
@ -303,7 +303,7 @@ export default {
}
this.showConfirmDlg = false
},
scrollAndFocusLastRow () {
scrollAndFocusLastRow() {
this.$nextTick(() => {
document.querySelector('.project-container').scrollTop = 9999
const menuActivator = this.$el && this.$el.querySelector('tr:last-child .v-small-dialog__activator__content')

44
packages/nc-gui/components/auth/userManagement.vue

@ -537,10 +537,10 @@ export default {
}),
computed: {
inviteUrl () {
inviteUrl() {
return this.invite_token ? `${location.origin}${location.pathname}#/user/authentication/signup/${this.invite_token.invite_token}` : null
},
rolesColors () {
rolesColors() {
const colors = this.$store.state.windows.darkTheme ? enumColor.dark : enumColor.light
return this.roles.reduce((o, r, i) => {
o[r] = colors[i % colors.length]
@ -548,32 +548,32 @@ export default {
}, {})
},
selectedRoles: {
get () {
get() {
return this.selectedUser && this.selectedUser.roles ? this.selectedUser.roles.split(',') : []
},
set (roles) {
set(roles) {
if (this.selectedUser) {
this.selectedUser.roles = roles.filter(Boolean).join(',')
}
}
},
selectedUserIndex: {
get () {
get() {
return this.users ? this.users.findIndex(u => u.email === this.selectedUser.email) : -1
},
set (i) {
set(i) {
this.selectedUser = this.users[i]
}
}
},
watch: {
options: {
async handler () {
async handler() {
await this.loadUsers()
},
deep: true
},
userEditDialog (v) {
userEditDialog(v) {
if (v && (this.selectedUser && !this.selectedUser.id)) {
this.$nextTick(() => {
setTimeout(() => {
@ -583,23 +583,23 @@ export default {
}
}
},
async created () {
async created() {
this.$eventBus.$on('show-add-user', this.addUser)
await this.loadUsers()
await this.loadRoles()
},
beforeDestroy () {
beforeDestroy() {
this.$eventBus.$off('show-add-user', this.addUser)
},
methods: {
simpleAnim () {
simpleAnim() {
const count = 30
const defaults = {
origin: { y: 0.7 },
zIndex: 9999999
}
function fire (particleRatio, opts) {
function fire(particleRatio, opts) {
window.confetti(Object.assign({}, defaults, opts, {
particleCount: Math.floor(count * particleRatio)
}))
@ -628,11 +628,11 @@ export default {
startVelocity: 45
})
},
getInviteUrl (token) {
getInviteUrl(token) {
return token ? `${location.origin}${location.pathname}#/user/authentication/signup/${token}` : null
},
clipboard (str) {
clipboard(str) {
const el = document.createElement('textarea')
el.addEventListener('focusin', e => e.stopPropagation())
el.value = str
@ -641,7 +641,7 @@ export default {
document.execCommand('copy')
document.body.removeChild(el)
},
async rensendInvite (id) {
async rensendInvite(id) {
try {
await this.$axios.post('/admin/resendInvite/' + id, {
projectName: this.$store.getters['project/GtrProjectName']
@ -659,7 +659,7 @@ export default {
this.$toast.error(e.response.data.msg).goAway(3000)
}
},
async loadUsers () {
async loadUsers() {
try {
const { page = 1, itemsPerPage = 20 } = this.options
const data = (await this.$axios.get('/admin', {
@ -682,7 +682,7 @@ export default {
console.log(e)
}
},
async loadRoles () {
async loadRoles() {
try {
this.roles = (await this.$axios.get('/admin/roles', {
headers: {
@ -696,7 +696,7 @@ export default {
console.log(e)
}
},
async deleteUser (id) {
async deleteUser(id) {
try {
await this.$axios.delete('/admin/' + id, {
params: {
@ -714,7 +714,7 @@ export default {
}
},
async confirmDelete (hideDialog) {
async confirmDelete(hideDialog) {
if (hideDialog) {
this.showConfirmDlg = false
return
@ -722,14 +722,14 @@ export default {
await this.deleteUser(this.deleteId)
this.showConfirmDlg = false
},
addUser () {
addUser() {
this.invite_token = null
this.selectedUser = {
roles: 'editor'
}
this.userEditDialog = true
},
async inviteUser (email) {
async inviteUser(email) {
try {
await this.$axios.post('/admin', {
email,
@ -746,7 +746,7 @@ export default {
this.$toast.error(e.response.data.msg).goAway(3000)
}
},
async saveUser () {
async saveUser() {
if (this.loading || !this.valid || !this.selectedUser) {
return
}

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

@ -53,7 +53,7 @@ export default {
data: () => ({
showConfirmDlg: false
}),
async created () {},
async created() {},
methods: {}
}
</script>

8
packages/nc-gui/components/changeEnv.vue

@ -52,15 +52,15 @@ export default {
envList: 'project/GtrEnvList'
}),
dialogShow: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
}
}
},
mounted () {
mounted() {
const unserializedList = this.$store.state.project.unserializedList
this.selectedEnv = (unserializedList[0] &&
unserializedList[0].projectJson &&
@ -73,7 +73,7 @@ export default {
}, (value) => { this.selectedEnv = value })
},
methods: {
async changeEnv () {
async changeEnv() {
this.progressbar = true
await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'projectChangeEnv', { env: this.selectedEnv }])
await new Promise((resolve) => {

100
packages/nc-gui/components/createOrEditProject.vue

@ -1011,7 +1011,7 @@ export default {
},
mixins: [colors],
layout: 'empty',
data () {
data() {
return {
testSuccess: false,
projectCreated: false,
@ -1369,23 +1369,23 @@ export default {
},
computed: {
...mapGetters({ sqlMgr: 'sqlMgr/sqlMgr' }),
isTitle () {
isTitle() {
return this.project.title && this.project.title.trim().length
},
envStatusValid () {
envStatusValid() {
return (
this.project.envs &&
Object.values(this.project.envs).every(this.getEnvironmentStatusAggregatedNew)
)
},
typeIcon () {
typeIcon() {
if (this.project.projectType) {
return this.projectTypes.find(({ value }) => value === this.project.projectType)
} else {
return { icon: 'mdi-server', iconColor: 'primary' }
}
},
databaseNamesReverse () {
databaseNamesReverse() {
return Object.entries(this.databaseNames).reduce((newObj, [value, key]) => {
newObj[key] = value
return newObj
@ -1393,7 +1393,7 @@ export default {
}
},
methods: {
async enableAllSchemas () {
async enableAllSchemas() {
this.$toast.info('Enabled all schemas').goAway(3000)
this.allSchemas = true
await this.$axios({
@ -1405,23 +1405,23 @@ export default {
...mapActions({
loadProjects: 'project/loadProjects'
}),
onAdvancePanelToggle () {
onAdvancePanelToggle() {
if (this.$refs.monacoEditor) {
setTimeout(() => this.$refs.monacoEditor.resizeLayout(), 400)
}
},
getProjectEditTooltip () {
getProjectEditTooltip() {
// return `Opens ${path.join(this.project.folder, 'config.xc.json')} and edit - its really simple`;
},
openJsonInSystemEditor () {
openJsonInSystemEditor() {
// shell.openItem(path.join(this.project.folder, 'config.xc.json'));
},
readFileContent (db, obj, key, index) {
readFileContent(db, obj, key, index) {
readFile(this.$refs[`${key}FilePath`][index], (data) => {
Vue.set(db.connection[obj], key, data)
})
},
selectFile (db, obj, key, index) {
selectFile(db, obj, key, index) {
this.$refs[key][index].click()
// console.log(obj, key);
@ -1437,7 +1437,7 @@ export default {
// Vue.set(db.connection[obj], key, file[0].toString())
// }
},
onPanelToggle (panelIndex, envKey) {
onPanelToggle(panelIndex, envKey) {
this.$nextTick(() => {
if (this.panel !== undefined) {
const panelContainer = this.$refs.panelContainer
@ -1455,14 +1455,14 @@ export default {
}
})
},
scrollToTop () {
scrollToTop() {
document.querySelector('html').scrollTop = 0
},
showDBTabInEnvPanel (panelIndex, tabIndex) {
showDBTabInEnvPanel(panelIndex, tabIndex) {
this.panel = panelIndex
Vue.set(this.databases, panelIndex, tabIndex)
},
getProjectJson () {
getProjectJson() {
console.log('Project json before creating', this.project)
/**
@ -1574,7 +1574,7 @@ export default {
return xcConfig
},
constructProjectJsonFromProject (project) {
constructProjectJsonFromProject(project) {
// const {projectJson: envs, ...rest} = project;
// let p = {...rest, ...envs};
@ -1634,7 +1634,7 @@ export default {
delete p.mailer
},
async createOrUpdateProject () {
async createOrUpdateProject() {
const projectJson = this.getProjectJson()
delete projectJson.folder
@ -1693,7 +1693,7 @@ export default {
this.projectReloading = false
},
mtdDialogGetEnvNameSubmit (envName, cookie) {
mtdDialogGetEnvNameSubmit(envName, cookie) {
console.log(envName)
this.dialogGetEnvName.dialogShow = false
if (envName in this.project.envs) {
@ -1736,15 +1736,15 @@ export default {
})
}
},
mtdDialogGetEnvNameCancel () {
mtdDialogGetEnvNameCancel() {
console.log('mtdDialogGetTableNameCancel cancelled')
this.dialogGetEnvName.dialogShow = false
},
addNewEnvironment () {
addNewEnvironment() {
this.dialogGetEnvName.dialogShow = true
},
addNewDB (envKey, panelIndex) {
addNewDB(envKey, panelIndex) {
const len = this.project.envs[envKey].db.length
// eslint-disable-next-line no-unused-vars
const lastDbName = `${this.project.title}_${envKey}_${len}`
@ -1785,10 +1785,10 @@ export default {
this.databases[panelIndex] = newlyCreatedIndex
},
testConnectionMethodSubmit () {
testConnectionMethodSubmit() {
this.dialog.show = false
},
selectDir (ev) {
selectDir(ev) {
// console.log(ev)
// const file = dialog.showOpenDialog({
// properties: ['openDirectory']
@ -1799,7 +1799,7 @@ export default {
// this.userSelectedDir = true
// }
},
selectSqliteFile (db) {
selectSqliteFile(db) {
// console.log(ev)
// const file = dialog.showOpenDialog({
// properties: ["openFile"]
@ -1809,7 +1809,7 @@ export default {
// }
},
getDbStatusColor (db) {
getDbStatusColor(db) {
switch (db.ui.setup) {
case -1:
return 'red'
@ -1825,7 +1825,7 @@ export default {
}
},
getDbStatusTooltip (db) {
getDbStatusTooltip(db) {
switch (db.ui.setup) {
case -1:
return 'DB Connection NOT successful'
@ -1840,7 +1840,7 @@ export default {
break
}
},
async newTestConnection (db, env, panelIndex) {
async newTestConnection(db, env, panelIndex) {
console.log(this.project.envs[env][0])
if (
db.connection.host === 'localhost' &&
@ -1931,7 +1931,7 @@ export default {
}
},
sendAdvancedConfig (connection) {
sendAdvancedConfig(connection) {
if (!connection.ssl) { return false }
let sendAdvancedConfig = false
const sslOptions = Object.values(connection.ssl).filter(el => !!el)
@ -1944,7 +1944,7 @@ export default {
return sendAdvancedConfig
},
handleSSL (db, creating = true) {
handleSSL(db, creating = true) {
console.log('handleSSL', db)
const sendAdvancedConfig = this.sendAdvancedConfig(db.connection)
if (!sendAdvancedConfig) {
@ -1963,8 +1963,8 @@ export default {
// }
}
},
getDatabaseForTestConnection (dbType) {},
async testConnection (db, env, panelIndex) {
getDatabaseForTestConnection(dbType) {},
async testConnection(db, env, panelIndex) {
this.$store.commit('notification/MutToggleProgressBar', true)
try {
if (!(await this.newTestConnection(db, env, panelIndex))) {
@ -2020,17 +2020,17 @@ export default {
this.$store.commit('notification/MutToggleProgressBar', false)
}
},
getEnvironmentStatusAggregated (dbs) {
getEnvironmentStatusAggregated(dbs) {
return dbs.every(db => db.ui.setup === 1)
},
getEnvironmentStatusAggregatedNew (dbs) {
getEnvironmentStatusAggregatedNew(dbs) {
return dbs.db.every(db => db.ui.setup === 1)
},
openFirstPanel () {
openFirstPanel() {
if (!this.edit) { this.panel = 0 }
},
onDatabaseTypeChanged (client, db1, index, env) {
onDatabaseTypeChanged(client, db1, index, env) {
for (const env in this.project.envs) {
if (this.project.envs[env].db.length > index) {
const db = this.project.envs[env].db[index]
@ -2071,13 +2071,13 @@ export default {
}
}
},
selectDatabaseClient (database, index = 0) {
selectDatabaseClient(database, index = 0) {
if (this.client) { this.client[index] = database }
},
setDBStatus (db, status) {
setDBStatus(db, status) {
db.ui.setup = status
},
removeDBFromEnv (db, env, panelIndex, dbIndex) {
removeDBFromEnv(db, env, panelIndex, dbIndex) {
console.log(db, env, panelIndex, dbIndex)
for (const env in this.project.envs) {
@ -2086,15 +2086,15 @@ export default {
}
}
},
removeEnv (envKey) {
removeEnv(envKey) {
delete this.project.envs[envKey]
Vue.set(this.project, 'envs', { ...this.project.envs })
}
},
fetch ({ store, params }) {},
beforeCreated () {},
fetch({ store, params }) {},
beforeCreated() {},
watch: {
'project.title' (newValue, oldValue) {
'project.title'(newValue, oldValue) {
if (!newValue) { return }
if (!this.edit) {
// Vue.set(this.project, 'folder', slash(path.join(this.baseFolder, newValue)))
@ -2121,7 +2121,7 @@ export default {
},
'project.envs': {
deep: true,
handler (envs) {
handler(envs) {
if (typeof envs === 'object' && envs) {
Object.entries(envs).forEach(([key, env]) => {
let res = 1
@ -2153,7 +2153,7 @@ export default {
}
}
},
async created () {
async created() {
this.compErrorMessage =
this.compErrorMessages[Math.floor(Math.random() * this.compErrorMessages.length)]
@ -2218,8 +2218,8 @@ export default {
// }
}
},
beforeMount () {},
mounted () {
beforeMount() {},
mounted() {
this.$set(
this.project,
'title',
@ -2236,12 +2236,12 @@ export default {
input.focus()
})
},
beforeDestroy () {},
destroy () {},
validate ({ params }) {
beforeDestroy() {},
destroy() {},
validate({ params }) {
return true
},
head () {
head() {
return {
title: this.$t('projects.ext_db.head.title')
}

8
packages/nc-gui/components/global/recursiveMenu.vue

@ -82,23 +82,23 @@ export default {
positionX: Number,
positionY: Number
},
data () {
data() {
return {
active: false
}
},
watch: {
// two way binding of v-model
value (v) {
value(v) {
this.active = v
},
active (v) {
active(v) {
this.$emit('input', v)
}
},
methods: {
// event propagating to parent v-menu(click event)
onSubMenuClick (event) {
onSubMenuClick(event) {
this.$emit('click', event)
// hiding parent menu
this.active = false

28
packages/nc-gui/components/global/xAutoComplete.vue

@ -43,7 +43,7 @@ export default {
env: String,
styles: [Array, Object, String]
},
data () {
data() {
return {
show: false,
x: 0,
@ -56,35 +56,35 @@ export default {
},
computed: {
// filtered list based on input
items () {
items() {
return this.envValues.filter(s => s.includes(this.activeValue))
},
// for setting menu width to textfield width
width () {
width() {
return this.input && this.input.clientWidth
},
// extracting class names from root element
classNames () {
classNames() {
return this.el && this.el.className
},
// v-model for the text filed
autocomplete: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
}
},
// extracting current env keys
envValues () {
envValues() {
const envObj = this.isDashboard ? this.$store.getters['project/GtrApiEnvironment'] : this.$store.getters['project/GtrDefaultApiEnvironment']
return envObj && envObj[this.env] ? Object.keys(envObj[this.env]) : []
},
isEnvFound () {
isEnvFound() {
return /{{\s*\w+\s*}}/.test(this.value)
},
isEnvUsageValid () {
isEnvUsageValid() {
const re = /{{\s*(\w+)\s*}}/g
let m
// eslint-disable-next-line no-cond-assign
@ -94,16 +94,16 @@ export default {
return true
}
},
mounted () {
mounted() {
this.el = this.$el
// getting input element reference
this.input = this.$refs.input && this.$refs.input.$el.querySelector('input')
},
created () {
created() {
},
methods: {
// handling input event
onInput (v) {
onInput(v) {
this.curPos = this.input.selectionStart || 0
// extracting string from beginning to caret position
// then using regex to check and extract certain pattern like
@ -119,7 +119,7 @@ export default {
this.show = false
}
},
onKeyup (e) {
onKeyup(e) {
const menu = this.$refs.autoMenu
// handlig up and down keys
if (this.show && (e.which === 40 || e.which === 38)) {
@ -132,7 +132,7 @@ export default {
menu.onKeyDown(e)
}
},
onSelect (item) {
onSelect(item) {
// appending menu value to the input
this.input.setRangeText(
// add closing only when its necessary

4
packages/nc-gui/components/global/xIcon.vue

@ -49,12 +49,12 @@ export default {
iconClass: String
},
computed: {
colors () {
colors() {
return this.color ? (Array.isArray(this.color) ? this.color : this.color.split(' ')) : []
}
},
methods: {
triggerClick (...args) {
triggerClick(...args) {
this.$emit('click', ...args)
}
}

16
packages/nc-gui/components/monaco/Monaco.vue

@ -34,7 +34,7 @@ export default {
// sqlFormatter
},
props: ['code', 'cssStyle', 'readOnly', 'heading'],
data () {
data() {
return {
codeLocal: `${this.code || ''}`,
selection: null,
@ -45,23 +45,23 @@ export default {
},
computed: {},
watch: {
codeLocal (newValue) {
codeLocal(newValue) {
// INFO: for updating value of prop `code` in parent comp
// console.log("update:code Event Emitted", newValue);
this.$emit('update:code', newValue)
},
code (newValue) {
code(newValue) {
this.codeLocal = newValue
}
},
beforeCreate () {
beforeCreate() {
// console.log(MonacoEditor)
},
created () {
created() {
//
},
methods: {
selectionFn () {
selectionFn() {
const editor = this.$refs.editor.getMonaco()
const range = editor.getSelection()
const selectedText = editor.getModel().getValueInRange(range)
@ -69,7 +69,7 @@ export default {
this.selection = selectedText
this.selectionRange = range
},
pretify () {
pretify() {
// console.log("this.code", this.code);
const editor = this.$refs.editor.getMonaco()
@ -94,7 +94,7 @@ export default {
editor.executeEdits('sqlFormatter', [op])
}
},
toggleMiniMap () {
toggleMiniMap() {
const editor = this.$refs.editor.getMonaco()
this.minimap.enabled = !this.minimap.enabled
editor.updateOptions({

40
packages/nc-gui/components/monaco/MonacoSqlEditor.vue

@ -35,7 +35,7 @@ export default {
// sqlFormatter
},
props: ['code', 'cssStyle', 'readOnly', 'heading', 'tables', 'columnNames', 'columnNameCbk'],
data () {
data() {
const vm = this
return {
codeLocal: `${this.code || ''}`,
@ -60,7 +60,7 @@ export default {
contextMenuOrder: 1.5,
// Method that will be executed when the action is triggered.
// @param editor The editor instance is passed in as a convinience
run (ed) {
run(ed) {
vm.pretify()
}
}, {
@ -80,7 +80,7 @@ export default {
contextMenuOrder: 1.5,
// Method that will be executed when the action is triggered.
// @param editor The editor instance is passed in as a convinience
run (ed) {
run(ed) {
vm.$emit('execute', ed)
}
}, {
@ -93,7 +93,7 @@ export default {
keybindingContext: null,
contextMenuGroupId: 'navigation',
contextMenuOrder: 1.5,
run (ed) {
run(ed) {
vm.$emit('runAll', ed)
}
}, {
@ -106,7 +106,7 @@ export default {
keybindingContext: null,
contextMenuGroupId: 'navigation',
contextMenuOrder: 1.5,
run (ed) {
run(ed) {
vm.$emit('bookmark', ed)
}
}, {
@ -119,7 +119,7 @@ export default {
keybindingContext: null,
contextMenuGroupId: 'navigation',
contextMenuOrder: 1.5,
run (ed) {
run(ed) {
vm.$emit('searchHistory', ed)
}
}, {
@ -132,7 +132,7 @@ export default {
keybindingContext: null,
contextMenuGroupId: 'navigation',
contextMenuOrder: 1.5,
run (ed) {
run(ed) {
vm.$emit('toggleBookmark', ed)
}
}, {
@ -145,7 +145,7 @@ export default {
keybindingContext: null,
contextMenuGroupId: 'navigation',
contextMenuOrder: 1.5,
run (ed) {
run(ed) {
vm.$emit('openFile', ed)
}
}, {
@ -158,7 +158,7 @@ export default {
keybindingContext: null,
contextMenuGroupId: 'navigation',
contextMenuOrder: 1.5,
run (ed) {
run(ed) {
vm.$emit('saveFile', ed)
}
}, {
@ -171,7 +171,7 @@ export default {
keybindingContext: null,
contextMenuGroupId: 'navigation',
contextMenuOrder: 1.5,
run (ed) {
run(ed) {
vm.$emit('clearEditor', ed)
}
}]
@ -180,23 +180,23 @@ export default {
},
computed: {},
watch: {
codeLocal (newValue) {
codeLocal(newValue) {
// INFO: for updating value of prop `code` in parent comp
// console.log("update:code Event Emitted", newValue);
this.$emit('update:code', newValue)
},
code (newValue) {
code(newValue) {
this.codeLocal = newValue
}
},
beforeCreate () {
beforeCreate() {
// console.log(MonacoEditor)
},
created () {
created() {
//
},
methods: {
selectionFn () {
selectionFn() {
const editor = this.$refs.editor.getMonaco()
const range = editor.getSelection()
const selectedText = editor.getModel().getValueInRange(range)
@ -204,7 +204,7 @@ export default {
this.selection = selectedText
this.selectionRange = range
},
pretify () {
pretify() {
// console.log("this.code", this.code);
const editor = this.$refs.editor.getMonaco()
@ -229,7 +229,7 @@ export default {
editor.executeEdits('sqlFormatter', [op])
}
},
toggleMiniMap () {
toggleMiniMap() {
const editor = this.$refs.editor.getMonaco()
this.minimap.enabled = !this.minimap.enabled
editor.updateOptions({
@ -238,13 +238,13 @@ export default {
}
})
},
getCurrentQuery () {
getCurrentQuery() {
return this.$refs.editor.getCurrentQuery()
},
getAllContent () {
getAllContent() {
return this.$refs.editor.getAllContent()
},
focus () {
focus() {
this.$refs.editor.focus()
}
}

2
packages/nc-gui/components/monaco/sqlAutoCompletions.js

@ -1,4 +1,4 @@
export default function (monaco) {
export default function(monaco) {
return [
{
insertText: 'ALTER ',

10
packages/nc-gui/components/notification.vue

@ -93,18 +93,18 @@ export default {
GetHasErrors: 'notification/GetHasErrors',
GetPendingStatus: 'notification/GetPendingStatus'
}),
notificationList () {
notificationList() {
return this.$store.state.notification.list
}
},
filters: {
capitalize (value) {
capitalize(value) {
if (!value) { return '' }
value = value.toString()
return value.charAt(0).toUpperCase() + value.slice(1)
}
},
data () {
data() {
return {
notificationIcons: {
success: {
@ -126,7 +126,7 @@ export default {
}
},
methods: {
timeDifference (previous) {
timeDifference(previous) {
const current = Date.now()
const msPerMinute = 60 * 1000
const msPerHour = msPerMinute * 60
@ -150,7 +150,7 @@ export default {
return 'approximately ' + Math.round(elapsed / msPerYear) + ' years ago'
}
},
clearNotification () {
clearNotification() {
this.$store.commit('notification/MutListClearFinished')
}

36
packages/nc-gui/components/project/apis.vue

@ -166,7 +166,7 @@ import { mapGetters, mapActions } from 'vuex'
export default {
components: {},
data () {
data() {
return {
// portNumber: 3000,
@ -179,11 +179,11 @@ export default {
tabs: 'tabs/list'
}),
server1 () {
server1() {
return this.$store.state.apiServer.servers[this.nodes.key]
},
portNumber () {
portNumber() {
return this.server1 ? this.server1.portNumber : 3000
}
@ -194,11 +194,11 @@ export default {
changeActiveTab: 'tabs/changeActiveTab'
}),
openWebUrl (url) {
openWebUrl(url) {
// shell.openExternal(url)
},
openUrl (url) {
openUrl(url) {
const _nodes = { ...this.nodes }
_nodes.key = _nodes.dbKey + '.apiClient'
_nodes.type = 'apiClientDir'
@ -217,7 +217,7 @@ export default {
}
},
async startServer () {
async startServer() {
try {
const args = { ...this.nodes }
args.portNumber = this.server1 ? this.server1.portNumber : 3000
@ -231,7 +231,7 @@ export default {
}
},
async stopServer () {
async stopServer() {
try {
const args = { ...this.nodes }
args.portNumber = parseInt(this.server1.portNumber)
@ -245,7 +245,7 @@ export default {
}
},
async getCloudUrl () {
async getCloudUrl() {
try {
const args = { ...this.nodes }
args.portNumber = parseInt(this.server1.portNumber)
@ -259,7 +259,7 @@ export default {
}
},
async sendNotification () {
async sendNotification() {
try {
const args = { ...this.nodes }
await this.$store.dispatch('apiServer/cloudSendNotification', args)
@ -269,33 +269,33 @@ export default {
throw e
}
},
clipboardSuccessHandler ({ value, event }) {
clipboardSuccessHandler({ value, event }) {
this.$toast.info('Copied to clipboard.').goAway(1000)
},
clipboardErrorHandler ({ value, event }) {
clipboardErrorHandler({ value, event }) {
this.$toast.info('Clipboard copying failed.').goAway(1000)
}
},
beforeCreated () {
beforeCreated() {
},
watch: {},
async created () {
async created() {
// this.server.serverLive = await this.sqlMgr.projectAPIServerIsLive();
},
mounted () {
mounted() {
},
beforeDestroy () {
beforeDestroy() {
},
destroy () {
destroy() {
},
directives: {},
validate ({ params }) {
validate({ params }) {
return true
},
head () {
head() {
return {}
},
props: ['nodes']

18
packages/nc-gui/components/project/appStore.vue

@ -196,27 +196,27 @@ export default {
}
}),
computed: {
filters () {
filters() {
return this.apps.reduce((arr, app) => arr.concat(app.tags || []), []).filter((f, i, arr) => i === arr.indexOf(f)).sort()
},
filteredApps () {
filteredApps() {
return this.apps.filter(app => (!this.query.trim() || app.name.toLowerCase().includes(this.query.trim().toLowerCase())) &&
(!this.selectedTags.length || this.selectedTags.some(t => app.tags && app.tags.includes(t)))
)
}
},
async created () {
async created() {
await this.loadPluginList()
this.readPluginDefaults()
},
methods: {
async readPluginDefaults () {
async readPluginDefaults() {
try {
this.defaultConfig = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcPluginDemoDefaults'])
} catch (e) {
}
},
async confirmResetPlugin () {
async confirmResetPlugin() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcPluginSet', {
input: null,
@ -231,19 +231,19 @@ export default {
this.$toast.error(e.message).goAway(3000)
}
},
async saved () {
async saved() {
this.pluginInstallOverlay = false
await this.loadPluginList()
},
async installApp (app) {
async installApp(app) {
this.pluginInstallOverlay = true
this.installPlugin = app
},
async resetApp (app) {
async resetApp(app) {
this.pluginUninstallModal = true
this.resetPluginRef = app
},
async loadPluginList () {
async loadPluginList() {
try {
const plugins = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcPluginList'])
plugins.push(...plugins.splice(0, 3))

4
packages/nc-gui/components/project/appStore/FormInput.vue

@ -32,10 +32,10 @@ export default {
},
computed: {
localState: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
}
}

18
packages/nc-gui/components/project/appStore/appInstall.vue

@ -107,22 +107,22 @@ export default {
testing: false
}),
watch: {
async id () {
async id() {
this.settings = {}
await this.readPluginDetails()
}
},
async created () {
async created() {
await this.readPluginDetails()
},
methods: {
simpleAnim () {
simpleAnim() {
const count = 200
const defaults = {
origin: { y: 0.7 }
}
function fire (particleRatio, opts) {
function fire(particleRatio, opts) {
window.confetti(Object.assign({}, defaults, opts, {
particleCount: Math.floor(count * particleRatio)
}))
@ -151,7 +151,7 @@ export default {
startVelocity: 45
})
},
async saveSettings () {
async saveSettings() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcPluginSet', {
input: this.settings,
@ -166,7 +166,7 @@ export default {
this.$toast.error(e.message).goAway(3000)
}
},
async testSettings () {
async testSettings() {
this.testing = true
try {
const res = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcPluginTest', {
@ -185,7 +185,7 @@ export default {
}
this.testing = false
},
async doAction (action) {
async doAction(action) {
switch (action.key) {
case 'save' :
await this.saveSettings()
@ -197,7 +197,7 @@ export default {
break
}
},
async readPluginDetails () {
async readPluginDetails() {
try {
this.plugin = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcPluginRead', {
title: this.title
@ -208,7 +208,7 @@ export default {
} catch (e) {
}
},
copyDefault () {
copyDefault() {
if (this.plugin.title.replace(/\s/g, '_').toLowerCase() in this.defaultConfig) {
const data = this.defaultConfig[this.plugin.title.replace(/\s/g, '_').toLowerCase()]
this.settings = JSON.parse(JSON.stringify(data))

22
packages/nc-gui/components/project/appStore/inputs/attachment.vue

@ -196,7 +196,7 @@ export default {
selectedImage: null
}),
watch: {
value (val) {
value(val) {
try {
this.localState = (typeof val === 'string' ? JSON.parse(val) : val) || []
} catch (e) {
@ -209,7 +209,7 @@ export default {
// }
// }
},
created () {
created() {
try {
this.localState = (typeof this.value === 'string' ? JSON.parse(this.value) : this.value) || []
} catch (e) {
@ -217,30 +217,30 @@ export default {
}
document.addEventListener('keydown', this.onArrowDown)
},
beforeDestroy () {
beforeDestroy() {
document.removeEventListener('keydown', this.onArrowDown)
},
mounted () {
mounted() {
},
methods: {
openUrl (url, target) {
openUrl(url, target) {
window.open(url, target)
},
isImage,
hideIfVisible () {
hideIfVisible() {
if (this.showImage) {
this.showImage = false
}
},
selectImage (selectedImage, i) {
selectImage(selectedImage, i) {
this.showImage = true
this.carousel = i
this.selectedImage = selectedImage
},
addFile () {
addFile() {
this.$refs.file.click()
},
async onFileSelection () {
async onFileSelection() {
if (!this.$refs.file.files || !this.$refs.file.files.length) {
return
}
@ -256,12 +256,12 @@ export default {
this.$emit('input', JSON.stringify(this.localState))
this.$emit('update')
},
removeItem (i) {
removeItem(i) {
this.localState.splice(i, 1)
this.$emit('input', JSON.stringify(this.localState))
this.$emit('update')
},
onArrowDown (e) {
onArrowDown(e) {
if (!this.showImage) { return }
e = e || window.event
// eslint-disable-next-line eqeqeq

10
packages/nc-gui/components/project/appStore/inputs/longTextField.vue

@ -23,22 +23,22 @@ export default {
},
computed: {
localState: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
}
},
parentListeners () {
parentListeners() {
const $listeners = {}
return $listeners
}
},
created () {
created() {
this.localState = this.value
},
mounted () {
mounted() {
this.$refs.textarea.focus()
}
}

6
packages/nc-gui/components/project/appStore/inputs/passwordField.vue

@ -32,14 +32,14 @@ export default {
}),
computed: {
localState: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
}
},
parentListeners () {
parentListeners() {
const $listeners = {}
return $listeners
}

6
packages/nc-gui/components/project/appStore/inputs/textField.vue

@ -22,14 +22,14 @@ export default {
},
computed: {
localState: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
}
},
parentListeners () {
parentListeners() {
const $listeners = {}
return $listeners
}

6
packages/nc-gui/components/project/appStoreOld.vue

@ -308,17 +308,17 @@ export default {
]
}),
computed: {
filters () {
filters() {
return this.apps.reduce((arr, app) => arr.concat(app.tags || []), []).filter((f, i, arr) => i === arr.indexOf(f)).sort()
},
filteredApps () {
filteredApps() {
return this.apps.filter(app => (!this.query.trim() || app.name.toLowerCase().includes(this.query.trim().toLowerCase())) &&
(!this.selectedTags.length || this.selectedTags.some(t => app.tags && app.tags.includes(t)))
)
}
},
methods: {
installApp () {
installApp() {
this.$toast.info('Coming soon after seed funding.').goAway(5000)
}
}

6
packages/nc-gui/components/project/auditTab/audit.vue

@ -90,11 +90,11 @@ export default {
limit: 25,
page: 1
}),
created () {
created() {
this.loadAudits()
},
methods: {
async loadAudits () {
async loadAudits() {
const { list, count } = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcAuditList', {
limit: this.limit,
offset: this.limit * (this.page - 1)
@ -102,7 +102,7 @@ export default {
this.audits = list
this.count = count
},
calculateDiff (date) {
calculateDiff(date) {
return dayjs.utc(date).fromNow()
}
}

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

@ -242,7 +242,7 @@ export default {
Splitpanes,
Pane
},
data () {
data() {
return {
showUpAndDownBtns: false,
tableMigrationFiles: {
@ -314,12 +314,12 @@ export default {
})
},
watch: {},
created () {
created() {
this.loadEnv()
},
mounted () {
mounted() {
},
beforeDestroy () {
beforeDestroy() {
},
methods: {
@ -327,12 +327,12 @@ export default {
// shell.openItem(path.join(this.currentProjectFolder, 'server', 'tool', this.nodes.dbAlias, 'migrations'));
// },
isMigrationButtonEnabled (name) {
isMigrationButtonEnabled(name) {
console.log('menu -- - ', name)
return this.nodes.dbConnection.client === 'sqlite3' && name === 'Migration Down'
},
async getMigrationFiles (migration) {
async getMigrationFiles(migration) {
this.selectedMigration.migration = ''
this.selectedMigration.up = ''
this.selectedMigration.down = ''
@ -364,7 +364,7 @@ export default {
this.selectedMigration.down = result.data.object.down
},
async loadEnv () {
async loadEnv() {
try {
this.$store.commit('notification/MutToggleProgressBar', true)
const migrationArgs = {
@ -405,11 +405,11 @@ export default {
this.$store.commit('notification/MutToggleProgressBar', false)
}
},
async applyChanges () {
async applyChanges() {
},
async deleteView (action = '') {
async deleteView(action = '') {
},
async migrationUp (steps = 99999999999) {
async migrationUp(steps = 99999999999) {
try {
// await this.sqlMgr.migrator().migrationsUp({
// env: this.nodes.env,
@ -439,7 +439,7 @@ export default {
}
await this.loadEnv()
},
async migrationDown (steps = 99999999999) {
async migrationDown(steps = 99999999999) {
try {
// await this.sqlMgr.migrator().migrationsDown({
// env: this.nodes.env,
@ -468,7 +468,7 @@ export default {
}
await this.loadEnv()
},
findNextMigrationColor (item) {
findNextMigrationColor(item) {
if (item.nextMigration === 1) {
return 'orange'
} else if (item.nextMigration === 2) {
@ -478,7 +478,7 @@ export default {
}
return ''
},
findMigrationTextColor (item) {
findMigrationTextColor(item) {
// if (item.nextMigration === 1) {
// return "white--text";
// } else if (item.nextMigration === 2) {
@ -490,15 +490,15 @@ export default {
}
},
beforeCreated () {
beforeCreated() {
},
destroy () {
destroy() {
},
directives: {},
validate ({ params }) {
validate({ params }) {
return true
},
head () {
head() {
return {}
},
props: ['nodes']

18
packages/nc-gui/components/project/cronJobs.vue

@ -303,14 +303,14 @@ export default {
filter: '',
selectedItem: null
}),
async mounted () {
async mounted() {
await this.loadCrons()
},
methods: {
async editCronHandler (cron) {
async editCronHandler(cron) {
this.selectedItem = cron
},
async deleteCron (cron) {
async deleteCron(cron) {
if (cron.id) {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.dbAliasList[this.dbsTab].meta.dbAlias,
@ -326,7 +326,7 @@ export default {
this.selectedItem = null
}
},
async addNewCron () {
async addNewCron() {
this.crons = this.crons || []
this.crons.push(this.selectedItem = {
title: 'cron_job' + this.crons.length,
@ -336,7 +336,7 @@ export default {
cron_handler: ''
})
},
async loadCrons () {
async loadCrons() {
this.crons = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.dbAliasList[this.dbsTab].meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
@ -346,7 +346,7 @@ export default {
}
this.edited = false
},
async saveCron () {
async saveCron() {
this.updating = true
const errorCrons = []
try {
@ -392,14 +392,14 @@ export default {
...mapGetters({
dbAliasList: 'project/GtrDbAliasList'
}),
enableCountText () {
enableCountText() {
return ''
},
selectedItemIndex: {
get () {
get() {
return this.crons ? this.crons.indexOf(this.selectedItem) : -1
},
set (i) {
set(i) {
this.selectedItem = this.crons[i]
}
}

24
packages/nc-gui/components/project/dlgs/dlgAddRelation.vue

@ -1,7 +1,7 @@
<template>
<v-row justify="center">
<v-dialog
v-model="dialogShow"
:value="dialogShow"
persistent
max-width="600"
@keydown.esc="mtdDialogCancel()"
@ -117,7 +117,7 @@
import { mapGetters } from 'vuex'
export default {
data () {
data() {
return {
valid: false,
onUpdateDeleteOptions: [
@ -145,7 +145,7 @@ export default {
}
},
methods: {
async loadColumnList () {
async loadColumnList() {
if (!this.relation.parentTable) { return }
this.isRefColumnsLoading = true
// const client = await this.sqlMgr.projectGetSqlClient({
@ -181,7 +181,7 @@ export default {
this.isRefColumnsLoading = false
},
async loadTablesList () {
async loadTablesList() {
this.isRefTablesLoading = true
// const client = await this.sqlMgr.projectGetSqlClient({
// env: this.nodes.env,
@ -207,14 +207,14 @@ export default {
},
computed: { ...mapGetters({ sqlMgr: 'sqlMgr/sqlMgr' }) },
beforeCreated () {
beforeCreated() {
},
watch: {
'relation.parentTable' () {
'relation.parentTable'() {
this.loadColumnList()
}
},
async created () {
async created() {
await this.loadTablesList()
if (!this.relation.parentTable) {
@ -228,18 +228,18 @@ export default {
this.relation.parentTable = this.column.rtn
}
},
mounted () {
mounted() {
},
beforeDestroy () {
beforeDestroy() {
},
destroy () {
destroy() {
},
directives: {},
components: {},
validate ({ params }) {
validate({ params }) {
return true
},
head () {
head() {
return {}
},
props: [

16
packages/nc-gui/components/project/dlgs/dlgTriggerAddEdit.vue

@ -94,7 +94,7 @@ import MonacoEditor from '../../monaco/Monaco'
export default {
components: { MonacoEditor },
data () {
data() {
return {
valid: false,
formRules: {
@ -120,21 +120,21 @@ export default {
methods: {},
computed: { ...mapGetters({ sqlMgr: 'sqlMgr/sqlMgr' }) },
beforeCreated () {},
beforeCreated() {},
watch: {},
async created () {},
mounted () {
async created() {},
mounted() {
requestAnimationFrame(() => {
this.$refs.focus.focus()
})
},
beforeDestroy () {},
destroy () {},
beforeDestroy() {},
destroy() {},
directives: {},
validate ({ params }) {
validate({ params }) {
return true
},
head () {
head() {
return {}
},
props: [

8
packages/nc-gui/components/project/functionTab/functionAcl.vue

@ -95,15 +95,15 @@ export default {
data: null
}),
computed: {
roles () {
roles() {
return this.data ? Object.keys(this.data) : []
}
},
async created () {
async created() {
await this.loadAcl()
},
methods: {
async loadAcl () {
async loadAcl() {
this.loading = true
const result = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
env: this.nodes.env,
@ -115,7 +115,7 @@ export default {
this.loading = false
},
async save () {
async save() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
env: this.nodes.env,

24
packages/nc-gui/components/project/functionTab/functionQuery.vue

@ -79,7 +79,7 @@ import { SqlUI } from '../../../helpers/SqlUiFactory'
export default {
components: { MonacoEditor, dlgLabelSubmitCancel },
data () {
data() {
return {
functionData: {},
newFunction: !!this.nodes.newFunction,
@ -98,7 +98,7 @@ export default {
removeFunctionTab: 'tabs/removeFunctionTab'
}),
async handleKeyDown ({ metaKey, key, altKey, shiftKey, ctrlKey }) {
async handleKeyDown({ metaKey, key, altKey, shiftKey, ctrlKey }) {
console.log(metaKey, key, altKey, shiftKey, ctrlKey)
// cmd + s -> save
// cmd + l -> reload
@ -122,7 +122,7 @@ export default {
}
},
async loadFunction () {
async loadFunction() {
if (this.newFunction) {
this.functionData = {
function_name: this.nodes.function_name,
@ -153,7 +153,7 @@ export default {
this.functionData = result.data.list[0]
this.oldCreateFunction = `${this.functionData.create_function}` + ''
},
async applyChanges () {
async applyChanges() {
try {
if (this.newFunction) {
const result = await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
@ -204,7 +204,7 @@ export default {
throw e
}
},
async deleteFunction (action = '') {
async deleteFunction(action = '') {
try {
if (action === 'showDialog') {
this.dialogShow = true
@ -242,24 +242,24 @@ export default {
}
}
},
beforeCreated () {
beforeCreated() {
},
watch: {},
created () {
created() {
this.sqlUi = SqlUI.create(this.nodes.dbConnection)
},
mounted () {
mounted() {
this.loadFunction()
},
beforeDestroy () {
beforeDestroy() {
},
destroy () {
destroy() {
},
directives: {},
validate ({ params }) {
validate({ params }) {
return true
},
head () {
head() {
return {}
},
props: ['nodes']

8
packages/nc-gui/components/project/gqlHandlerCodeEditor.vue

@ -58,16 +58,16 @@ export default {
}),
computed: {
dialogShow: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
}
}
},
watch: {
async resolver (val) {
async resolver(val) {
try {
console.log('=============', this.functions)
this.code = JSON.parse(this.functions)[0]
@ -86,7 +86,7 @@ export default {
}
},
methods: {
async saveCode () {
async saveCode() {
try {
this.progressbar = true
await this.$store.dispatch('sqlMgr/ActSqlOp', [{

10
packages/nc-gui/components/project/graphqlClient.vue

@ -47,13 +47,13 @@
<script>
export default {
name: 'GraphqlClient',
data () {
data() {
return {
url: '',
webViewUrl: ''
}
},
async created () {
async created() {
if (this.$store.state.graphqlClient.list && this.$store.state.graphqlClient.list[0]) { this.webViewUrl = this.url = this.$store.state.graphqlClient.list[0].url }
try {
const { info } = (await this.$axios.get(`${this.$axios.defaults.baseURL}/nc/${this.$route.params.project_id}/projectApiInfo`, {
@ -68,14 +68,14 @@ export default {
} catch (e) {
}
},
mounted () {
mounted() {
},
methods: {
test () {
test() {
console.log('triggerd')
},
loadUrl () {
loadUrl() {
this.webViewUrl = this.url
if (this.url) { this.$store.commit('graphqlClient/MutListAdd', { url: this.url }) }
}

2
packages/nc-gui/components/project/grpcClient.vue

@ -20,7 +20,7 @@ export default {
loading: false
}),
methods: {
async download () {
async download() {
this.loading = true
let data
try {

8
packages/nc-gui/components/project/grpcHandlerCodeEditor.vue

@ -54,16 +54,16 @@ export default {
}),
computed: {
dialogShow: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
}
}
},
watch: {
async service (val) {
async service(val) {
try {
this.code = JSON.parse(this.serviceData.functions)[0]
} catch (e) {
@ -83,7 +83,7 @@ export default {
}
},
methods: {
async saveCode () {
async saveCode() {
try {
this.progressbar = true
await this.$store.dispatch('sqlMgr/ActSqlOp', [{

8
packages/nc-gui/components/project/procedureTab/procedureAcl.vue

@ -95,15 +95,15 @@ export default {
data: null
}),
computed: {
roles () {
roles() {
return this.data ? Object.keys(this.data) : []
}
},
async created () {
async created() {
await this.loadAcl()
},
methods: {
async loadAcl () {
async loadAcl() {
this.loading = true
const result = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
env: this.nodes.env,
@ -115,7 +115,7 @@ export default {
this.loading = false
},
async save () {
async save() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
env: this.nodes.env,

24
packages/nc-gui/components/project/procedureTab/procedureQuery.vue

@ -74,7 +74,7 @@ import dlgLabelSubmitCancel from '../../utils/dlgLabelSubmitCancel'
export default {
components: { MonacoEditor, dlgLabelSubmitCancel },
data () {
data() {
return {
procedure: {},
newProcedure: !!this.nodes.newProcedure,
@ -94,7 +94,7 @@ export default {
removeProcedureTab: 'tabs/removeProcedureTab'
}),
async handleKeyDown ({ metaKey, key, altKey, shiftKey, ctrlKey }) {
async handleKeyDown({ metaKey, key, altKey, shiftKey, ctrlKey }) {
console.log(metaKey, key, altKey, shiftKey, ctrlKey)
// cmd + s -> save
// cmd + l -> reload
@ -118,7 +118,7 @@ export default {
}
},
async loadProcedure () {
async loadProcedure() {
try {
this.$store.commit('notification/MutToggleProgressBar', true)
if (this.newProcedure) {
@ -158,7 +158,7 @@ export default {
this.$store.commit('notification/MutToggleProgressBar', false)
}
},
async applyChanges () {
async applyChanges() {
try {
if (this.newProcedure) {
const result = await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
@ -203,7 +203,7 @@ export default {
throw e
}
},
async deleteProcedure (action = '') {
async deleteProcedure(action = '') {
try {
if (action === 'showDialog') {
this.dialogShow = true
@ -240,23 +240,23 @@ export default {
}
}
},
beforeCreated () {
beforeCreated() {
},
watch: {},
created () {
created() {
this.loadProcedure()
},
mounted () {
mounted() {
},
beforeDestroy () {
beforeDestroy() {
},
destroy () {
destroy() {
},
directives: {},
validate ({ params }) {
validate({ params }) {
return true
},
head () {
head() {
return {}
},
props: ['nodes']

12
packages/nc-gui/components/project/projectMetadata/disableOrEnableModels.vue

@ -133,12 +133,12 @@ export default {
filter: '',
tables: null
}),
async mounted () {
async mounted() {
},
methods: {},
computed: {
dbsTab: {
set (tab) {
set(tab) {
if (!tab) {
// return this.$router.push({
// query: {}
@ -154,7 +154,7 @@ export default {
}
})
},
get () {
get() {
return this.$route.query.nested_1
}
@ -163,16 +163,16 @@ export default {
...mapGetters({
dbAliasList: 'project/GtrDbAliasList'
}),
enableCountText () {
enableCountText() {
return this.models
? `${this.models.filter(m => m.enabled).length}/${this.models.length} enabled`
: ''
},
isNewOrDeletedModelFound () {
isNewOrDeletedModelFound() {
return this.comparedModelList.some(m => m.new || m.deleted)
},
comparedModelList () {
comparedModelList() {
const res = []
const getPriority = (item) => {
if (item.new) { return 2 }

28
packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableFunctions.vue

@ -186,12 +186,12 @@ export default {
filter: '',
functions: null
}),
async mounted () {
async mounted() {
await this.loadModels()
await this.loadTableList()
},
methods: {
async addTableMeta (tables) {
async addTableMeta(tables) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -199,7 +199,7 @@ export default {
}, 'functionMetaCreate', {
tableNames: tables// this.comparedModelList.filter(t => t.new).map(t=>t.title)
}])
setTimeout(async () => {
setTimeout(async() => {
await this.loadModels()
this.$toast.success('Table metadata added successfully').goAway(3000)
}, 1000)
@ -207,7 +207,7 @@ export default {
this.$toast.error('Some error occurred').goAway(5000)
}
},
async deleteTableMeta (tables) {
async deleteTableMeta(tables) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -215,7 +215,7 @@ export default {
}, 'functioneMetaDelete', {
tableNames: tables
}])
setTimeout(async () => {
setTimeout(async() => {
await this.loadModels()
this.$toast.success('Table metadata deleted successfully').goAway(3000)
}, 1000)
@ -223,7 +223,7 @@ export default {
this.$toast.error('Some error occurred').goAway(5000)
}
},
async syncMetadata () {
async syncMetadata() {
const addTables = this.comparedModelList.filter(t => t.new).map(t => t.title)
const deleteTables = this.comparedModelList.filter(t => t.deleted).map(t => t.title)
if (addTables.length) {
@ -234,7 +234,7 @@ export default {
}
},
async recreateTableMeta (table) {
async recreateTableMeta(table) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -242,7 +242,7 @@ export default {
}, 'functionMetaRecreate', {
tn: table
}])
setTimeout(async () => {
setTimeout(async() => {
await this.loadModels()
this.$toast.success('Table metadata recreated successfully').goAway(3000)
}, 1000)
@ -250,7 +250,7 @@ export default {
this.$toast.error('Some error occurred').goAway(5000)
}
},
async loadModels () {
async loadModels() {
if (this.dbAliasList[this.dbsTab]) {
this.models = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -259,14 +259,14 @@ export default {
this.edited = false
}
},
async loadTableList () {
async loadTableList() {
this.functions = (await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
}, 'functionList'])).data.list
},
async saveModels () {
async saveModels() {
this.updating = true
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
@ -286,16 +286,16 @@ export default {
...mapGetters({
dbAliasList: 'project/GtrDbAliasList'
}),
enableCountText () {
enableCountText() {
return this.models
? `${this.models.filter(m => m.enabled).length}/${this.models.length} enabled`
: ''
},
isNewOrDeletedModelFound () {
isNewOrDeletedModelFound() {
return this.comparedModelList.some(m => m.new || m.deleted)
},
comparedModelList () {
comparedModelList() {
const res = []
const getPriority = (item) => {
if (item.new) { return 2 }

28
packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableProcedures.vue

@ -186,12 +186,12 @@ export default {
filter: '',
procedures: null
}),
async mounted () {
async mounted() {
await this.loadModels()
await this.loadTableList()
},
methods: {
async addTableMeta (tables) {
async addTableMeta(tables) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -199,7 +199,7 @@ export default {
}, 'procedureMetaCreate', {
tableNames: tables// this.comparedModelList.filter(t => t.new).map(t=>t.title)
}])
setTimeout(async () => {
setTimeout(async() => {
await this.loadModels()
this.$toast.success('Table metadata added successfully').goAway(3000)
}, 1000)
@ -207,7 +207,7 @@ export default {
this.$toast.error('Some error occurred').goAway(5000)
}
},
async deleteTableMeta (tables) {
async deleteTableMeta(tables) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -215,7 +215,7 @@ export default {
}, 'procedureMetaDelete', {
tableNames: tables
}])
setTimeout(async () => {
setTimeout(async() => {
await this.loadModels()
this.$toast.success('Table metadata deleted successfully').goAway(3000)
}, 1000)
@ -223,7 +223,7 @@ export default {
this.$toast.error('Some error occurred').goAway(5000)
}
},
async syncMetadata () {
async syncMetadata() {
const addTables = this.comparedModelList.filter(t => t.new).map(t => t.title)
const deleteTables = this.comparedModelList.filter(t => t.deleted).map(t => t.title)
if (addTables.length) {
@ -234,7 +234,7 @@ export default {
}
},
async recreateTableMeta (table) {
async recreateTableMeta(table) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -242,7 +242,7 @@ export default {
}, 'procedureMetaRecreate', {
tn: table
}])
setTimeout(async () => {
setTimeout(async() => {
await this.loadModels()
this.$toast.success('Table metadata recreated successfully').goAway(3000)
}, 1000)
@ -250,7 +250,7 @@ export default {
this.$toast.error('Some error occurred').goAway(5000)
}
},
async loadModels () {
async loadModels() {
if (this.dbAliasList[this.dbsTab]) {
this.models = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -259,14 +259,14 @@ export default {
this.edited = false
}
},
async loadTableList () {
async loadTableList() {
this.procedures = (await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
}, 'procedureList'])).data.list
},
async saveModels () {
async saveModels() {
this.updating = true
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
@ -286,16 +286,16 @@ export default {
...mapGetters({
dbAliasList: 'project/GtrDbAliasList'
}),
enableCountText () {
enableCountText() {
return this.models
? `${this.models.filter(m => m.enabled).length}/${this.models.length} enabled`
: ''
},
isNewOrDeletedModelFound () {
isNewOrDeletedModelFound() {
return this.comparedModelList.some(m => m.new || m.deleted)
},
comparedModelList () {
comparedModelList() {
const res = []
const getPriority = (item) => {
if (item.new) {

12
packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableRelations.vue

@ -113,18 +113,18 @@ export default {
search: ''
}),
computed: {
selectedCount () {
selectedCount() {
return `${this.relations.filter(({ enabled }) => enabled).length}/${this.relations.length}`
},
edited () {
edited() {
return this.relations.some(({ edited }) => edited)
}
},
async created () {
async created() {
await this.loadRelations()
},
methods: {
async loadRelations () {
async loadRelations() {
this.loading = true
try {
this.relations = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
@ -136,14 +136,14 @@ export default {
}
this.loading = false
},
toggleAll (toggle) {
toggleAll(toggle) {
this.toggle = !toggle
for (const rel of this.relations) {
this.$set(rel, 'edited', rel.edited || rel.enabled !== toggle)
this.$set(rel, 'enabled', toggle)
}
},
async save () {
async save() {
const editedRelations = this.relations.filter(({ edited }) => edited)
this.updating = true
try {

28
packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableTables.vue

@ -193,12 +193,12 @@ export default {
filter: '',
tables: null
}),
async mounted () {
async mounted() {
await this.loadModels()
await this.loadTableList()
},
methods: {
async addTableMeta (tables) {
async addTableMeta(tables) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -206,7 +206,7 @@ export default {
}, 'tableMetaCreate', {
tableNames: tables// this.comparedModelList.filter(t => t.new).map(t=>t.title)
}])
setTimeout(async () => {
setTimeout(async() => {
await this.loadModels()
this.$toast.success('Table metadata added successfully').goAway(3000)
}, 1000)
@ -214,7 +214,7 @@ export default {
this.$toast.error('Some error occurred').goAway(5000)
}
},
async deleteTableMeta (tables) {
async deleteTableMeta(tables) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -222,7 +222,7 @@ export default {
}, 'tableMetaDelete', {
tableNames: tables
}])
setTimeout(async () => {
setTimeout(async() => {
await this.loadModels()
this.$toast.success('Table metadata deleted successfully').goAway(3000)
}, 1000)
@ -230,7 +230,7 @@ export default {
this.$toast.error('Some error occurred').goAway(5000)
}
},
async syncMetadata () {
async syncMetadata() {
const addTables = this.comparedModelList.filter(t => t.new).map(t => t.title)
const deleteTables = this.comparedModelList.filter(t => t.deleted).map(t => t.title)
if (addTables.length) {
@ -241,7 +241,7 @@ export default {
}
},
async recreateTableMeta (table) {
async recreateTableMeta(table) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -249,7 +249,7 @@ export default {
}, 'tableMetaRecreate', {
tn: table
}])
setTimeout(async () => {
setTimeout(async() => {
await this.loadModels()
this.$toast.success('Table metadata recreated successfully').goAway(3000)
}, 1000)
@ -257,7 +257,7 @@ export default {
this.$toast[e.response?.status === 402 ? 'info' : 'error'](e.message).goAway(3000)
}
},
async loadModels () {
async loadModels() {
if (this.dbAliasList[this.dbsTab]) {
this.models = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -266,14 +266,14 @@ export default {
this.edited = false
}
},
async loadTableList () {
async loadTableList() {
this.tables = (await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
}, 'tableList', { force: true }])).data.list
},
async saveModels () {
async saveModels() {
this.updating = true
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
@ -293,16 +293,16 @@ export default {
...mapGetters({
dbAliasList: 'project/GtrDbAliasList'
}),
enableCountText () {
enableCountText() {
return this.models
? `${this.models.filter(m => m.enabled).length}/${this.models.length} enabled`
: ''
},
isNewOrDeletedModelFound () {
isNewOrDeletedModelFound() {
return this.comparedModelList.some(m => m.new || m.deleted)
},
comparedModelList () {
comparedModelList() {
const res = []
const getPriority = (item) => {
if (item.new) { return 2 }

28
packages/nc-gui/components/project/projectMetadata/sync/disableOrEnableViews.vue

@ -186,12 +186,12 @@ export default {
filter: '',
views: null
}),
async mounted () {
async mounted() {
await this.loadModels()
await this.loadTableList()
},
methods: {
async addTableMeta (tables) {
async addTableMeta(tables) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -199,7 +199,7 @@ export default {
}, 'viewMetaCreate', {
viewNames: tables// this.comparedModelList.filter(t => t.new).map(t=>t.title)
}])
setTimeout(async () => {
setTimeout(async() => {
await this.loadModels()
this.$toast.success('Table metadata added successfully').goAway(3000)
}, 1000)
@ -207,7 +207,7 @@ export default {
this.$toast.error('Some error occurred').goAway(5000)
}
},
async deleteTableMeta (tables) {
async deleteTableMeta(tables) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -215,7 +215,7 @@ export default {
}, 'viewMetaDelete', {
tableNames: tables
}])
setTimeout(async () => {
setTimeout(async() => {
await this.loadModels()
this.$toast.success('Table metadata deleted successfully').goAway(3000)
}, 1000)
@ -223,7 +223,7 @@ export default {
this.$toast.error('Some error occurred').goAway(5000)
}
},
async syncMetadata () {
async syncMetadata() {
const addTables = this.comparedModelList.filter(t => t.new).map(t => t.title)
const deleteTables = this.comparedModelList.filter(t => t.deleted).map(t => t.title)
if (addTables.length) {
@ -234,7 +234,7 @@ export default {
}
},
async recreateTableMeta (table) {
async recreateTableMeta(table) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -242,7 +242,7 @@ export default {
}, 'viewMetaRecreate', {
tn: table
}])
setTimeout(async () => {
setTimeout(async() => {
await this.loadModels()
this.$toast.success('Table metadata recreated successfully').goAway(3000)
}, 1000)
@ -250,7 +250,7 @@ export default {
this.$toast.error('Some error occurred').goAway(5000)
}
},
async loadModels () {
async loadModels() {
if (this.dbAliasList[this.dbsTab]) {
this.models = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -259,14 +259,14 @@ export default {
this.edited = false
}
},
async loadTableList () {
async loadTableList() {
this.views = (await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
}, 'viewList'])).data.list
},
async saveModels () {
async saveModels() {
this.updating = true
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
@ -286,16 +286,16 @@ export default {
...mapGetters({
dbAliasList: 'project/GtrDbAliasList'
}),
enableCountText () {
enableCountText() {
return this.models
? `${this.models.filter(m => m.enabled).length}/${this.models.length} enabled`
: ''
},
isNewOrDeletedModelFound () {
isNewOrDeletedModelFound() {
return this.comparedModelList.some(m => m.new || m.deleted)
},
comparedModelList () {
comparedModelList() {
const res = []
const getPriority = (item) => {
if (item.new) { return 2 }

10
packages/nc-gui/components/project/projectMetadata/uiAcl/toggleFunctionUIAcl.vue

@ -112,11 +112,11 @@ export default {
filter: '',
functions: null
}),
async mounted () {
async mounted() {
await this.loadFunctionList()
},
methods: {
async loadFunctionList () {
async loadFunctionList() {
this.functions = (await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
@ -124,7 +124,7 @@ export default {
type: 'function'
}]))
},
async save () {
async save() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -143,10 +143,10 @@ export default {
...mapGetters({
dbAliasList: 'project/GtrDbAliasList'
}),
edited () {
edited() {
return this.functions && this.functions.length && this.functions.some(t => t.edited)
},
roles () {
roles() {
return this.functions && this.functions.length ? Object.keys(this.functions[0].disabled) : []
}
}

10
packages/nc-gui/components/project/projectMetadata/uiAcl/toggleProcedureUIAcl.vue

@ -112,11 +112,11 @@ export default {
filter: '',
procedures: null
}),
async mounted () {
async mounted() {
await this.loadFunctionList()
},
methods: {
async loadFunctionList () {
async loadFunctionList() {
this.procedures = (await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
@ -124,7 +124,7 @@ export default {
type: 'procedure'
}]))
},
async save () {
async save() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -143,10 +143,10 @@ export default {
...mapGetters({
dbAliasList: 'project/GtrDbAliasList'
}),
edited () {
edited() {
return this.procedures && this.procedures.length && this.procedures.some(t => t.edited)
},
roles () {
roles() {
return this.procedures && this.procedures.length ? Object.keys(this.procedures[0].disabled) : []
}
}

10
packages/nc-gui/components/project/projectMetadata/uiAcl/toggleRelationsUIAcl.vue

@ -113,11 +113,11 @@ export default {
filter: '',
relations: null
}),
async mounted () {
async mounted() {
await this.loadViewList()
},
methods: {
async loadViewList () {
async loadViewList() {
this.relations = (await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
@ -125,7 +125,7 @@ export default {
type: 'relation'
}]))
},
async save () {
async save() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -144,10 +144,10 @@ export default {
...mapGetters({
dbAliasList: 'project/GtrDbAliasList'
}),
edited () {
edited() {
return this.relations && this.relations.length && this.relations.some(t => t.edited)
},
roles () {
roles() {
return this.relations && this.relations.length ? Object.keys(this.relations[0].disabled) : []
}
}

10
packages/nc-gui/components/project/projectMetadata/uiAcl/toggleTableUIAcl.vue

@ -119,11 +119,11 @@ export default {
filter: '',
tables: null
}),
async mounted () {
async mounted() {
await this.loadTableList()
},
methods: {
async loadTableList () {
async loadTableList() {
this.tables = (await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
@ -131,7 +131,7 @@ export default {
type: 'table'
}]))
},
async save () {
async save() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -150,10 +150,10 @@ export default {
...mapGetters({
dbAliasList: 'project/GtrDbAliasList'
}),
edited () {
edited() {
return this.tables && this.tables.length && this.tables.some(t => t.edited)
},
roles () {
roles() {
return this.tables && this.tables.length ? Object.keys(this.tables[0].disabled) : []
}
}

10
packages/nc-gui/components/project/projectMetadata/uiAcl/toggleViewUIAcl.vue

@ -110,11 +110,11 @@ export default {
filter: '',
views: null
}),
async mounted () {
async mounted() {
await this.loadViewList()
},
methods: {
async loadViewList () {
async loadViewList() {
this.views = (await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
@ -122,7 +122,7 @@ export default {
type: 'view'
}]))
},
async save () {
async save() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
@ -141,10 +141,10 @@ export default {
...mapGetters({
dbAliasList: 'project/GtrDbAliasList'
}),
edited () {
edited() {
return this.views && this.views.length && this.views.some(t => t.edited)
},
roles () {
roles() {
return this.views && this.views.length ? Object.keys(this.views[0].disabled) : []
}
}

8
packages/nc-gui/components/project/restHandlerCodeEditor.vue

@ -58,16 +58,16 @@ export default {
}),
computed: {
dialogShow: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
}
}
},
watch: {
async route (val) {
async route(val) {
try {
if (this.isMiddleware) {
this.code = JSON.parse(val.functions)[0]
@ -108,7 +108,7 @@ export default {
}
},
methods: {
async saveCode () {
async saveCode() {
try {
this.progressbar = true
if (this.isMiddleware) {

30
packages/nc-gui/components/project/seed.vue

@ -94,7 +94,7 @@ export default {
components: {
dlgLabelSubmitCancel
},
data () {
data() {
return {
settings: {},
dialogShow: false,
@ -105,7 +105,7 @@ export default {
...mapGetters({ sqlMgr: 'sqlMgr/sqlMgr' })
},
watch: {},
async created () {
async created() {
this.seedsFolder = this.sqlMgr.projectGetFolder({
env: this.nodes.env,
dbAlias: this.nodes.dbAlias
@ -126,12 +126,12 @@ export default {
this.settings = result.data
}
},
mounted () {
mounted() {
},
beforeDestroy () {
beforeDestroy() {
},
methods: {
async dlgAction (action = '') {
async dlgAction(action = '') {
console.log('dlgAction', action)
if (action === 'hideDialog') {
this.dialogShow = false
@ -140,7 +140,7 @@ export default {
await this.seedInit()
}
},
async seedInit () {
async seedInit() {
try {
const result = await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
{
@ -159,7 +159,7 @@ export default {
}
},
async seedTerm () {
async seedTerm() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
{
@ -176,9 +176,9 @@ export default {
}
},
async seedStart () {
async seedStart() {
try {
setTimeout(async () => {
setTimeout(async() => {
await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
{
env: this.nodes.env,
@ -195,7 +195,7 @@ export default {
}
},
async seedStop () {
async seedStop() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
{
@ -212,7 +212,7 @@ export default {
}
},
async seedSettingsUpdate () {
async seedSettingsUpdate() {
try {
this.settings.rows.value = +this.settings.rows.value > 100 ? 100 : this.settings.rows.value
@ -232,15 +232,15 @@ export default {
},
beforeCreated () {
beforeCreated() {
},
destroy () {
destroy() {
},
directives: {},
validate ({ params }) {
validate({ params }) {
return true
},
head () {
head() {
return {}
},
props: ['nodes']

24
packages/nc-gui/components/project/sequence.vue

@ -150,7 +150,7 @@ import dlgLabelSubmitCancel from '../utils/dlgLabelSubmitCancel'
export default {
components: { dlgLabelSubmitCancel },
data () {
data() {
return {
edited: false,
originalNodes: {},
@ -171,7 +171,7 @@ export default {
'project/loadSequencesFromParentTreeNode',
removeSequenceTab: 'tabs/removeSequenceTab'
}),
async loadSequences () {
async loadSequences() {
try {
this.$store.commit('notification/MutToggleProgressBar', true)
if (this.newSequence) {
@ -205,7 +205,7 @@ export default {
this.$store.commit('notification/MutToggleProgressBar', false)
}
},
async applyChanges () {
async applyChanges() {
try {
if (this.newSequence) {
const result = await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
@ -244,7 +244,7 @@ export default {
throw e
}
},
async deleteSequence (action = '') {
async deleteSequence(action = '') {
try {
if (action === 'showDialog') {
this.dialogShow = true
@ -279,12 +279,12 @@ export default {
throw e
}
},
sequenceNameChanged () {
sequenceNameChanged() {
console.log('changed', this.sequence.sequence_name.trim())
this.edited = this.sequence.sequence_name.trim() !== ''
}
},
beforeCreated () {
beforeCreated() {
},
watch: {
// 'sequence' : {
@ -296,21 +296,21 @@ export default {
// }
// }
},
async created () {
async created() {
this.originalNodes = { ...this.nodes }
await this.loadSequences()
},
mounted () {
mounted() {
},
beforeDestroy () {
beforeDestroy() {
},
destroy () {
destroy() {
},
directives: {},
validate ({ params }) {
validate({ params }) {
return true
},
head () {
head() {
return {}
},
props: ['nodes']

26
packages/nc-gui/components/project/settings/appearance.vue

@ -163,7 +163,7 @@ import themes from '../../../helpers/themes'
export default {
components: { },
data () {
data() {
return {
rightClickCount: 0,
tab: null,
@ -194,35 +194,35 @@ export default {
themes
}
},
fetch ({ store, params }) {
fetch({ store, params }) {
},
computed: {
language: {
get () {
get() {
return this.$store.state.windows.language
},
set (val) {
set(val) {
this.$store.commit('windows/MutLanguage', val)
}
},
showMetatable: {
get () {
get() {
return this.$store.state.windows.metatables
},
set (show) {
set(show) {
this.$store.commit('windows/MutMetatables', show)
}
},
showScreensaver: {
get () {
get() {
return this.$store.state.windows.screensaver
},
set (show) {
set(show) {
this.$store.commit('windows/MutScreensaver', show)
}
}
},
created () {
created() {
this.customTheme = { ...this.customTheme, ...this.$store.state.windows.customTheme }
this.item = this.$store.state.windows.themeName
this.$store.watch(
@ -239,23 +239,23 @@ export default {
})
},
methods: {
rightClick () {
rightClick() {
this.rightClickCount++
if (this.rightClickCount > 5) {
// require('electron').remote.getCurrentWindow().toggleDevTools();
this.rightClickCount = 0
}
},
async changeTheme (t, theme = 'Custom') {
async changeTheme(t, theme = 'Custom') {
this.item = theme
if (theme === 'Custom') { await this.$store.dispatch('windows/ActSetTheme', { theme: { ...t }, custom: true }) }
await this.$store.dispatch('windows/ActSetTheme', { theme: { ...t }, themeName: theme })
},
toggleDarkTheme () {
toggleDarkTheme() {
this.$store.commit('windows/MutToggleDarkMode')
}
},
beforeCreated () {
beforeCreated() {
}
}
</script>

4
packages/nc-gui/components/project/settings/env.vue

@ -48,7 +48,7 @@ export default {
envList: 'project/GtrEnvList'
})
},
mounted () {
mounted() {
const unserializedList = this.$store.state.project.unserializedList
this.selectedEnv = (unserializedList[0] &&
unserializedList[0].projectJson &&
@ -61,7 +61,7 @@ export default {
}, (value) => { this.selectedEnv = value })
},
methods: {
async changeEnv () {
async changeEnv() {
this.progressbar = true
await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'projectChangeEnv', { env: this.selectedEnv }])
await new Promise((resolve) => {

10
packages/nc-gui/components/project/settings/logs.vue

@ -81,19 +81,19 @@ export default {
}),
computed: {
toggleAll: {
get () {
get() {
return this.names && Object.values(this.names).some(v => v)
},
set (val) {
set(val) {
this.names && Object.keys(this.names).forEach(k => this.$set(this.names, k, val))
}
}
},
async created () {
async created() {
await this.load()
},
methods: {
async load () {
async load() {
this.loading = true
try {
const res = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcDebugGet'])
@ -103,7 +103,7 @@ export default {
this.loading = false
},
async save () {
async save() {
this.loading = true
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcDebugSet', this.names])

42
packages/nc-gui/components/project/settings/versionAndUpdate.vue

@ -77,7 +77,7 @@ import dlgLabelSubmitCancel from '../../utils/dlgLabelSubmitCancel'
export default {
components: { dlgLabelSubmitCancel },
data () {
data() {
return {
rightClickCount: 0,
enableAppRefresh: false,
@ -94,85 +94,85 @@ export default {
},
computed: {
checkForUpdate: {
get () {
get() {
return this.$store.state.windows.checkForUpdate
},
set (value) {
set(value) {
this.$store.commit('windows/MutCheckForUpdate', value)
}
},
autoUpdate: {
get () {
get() {
return this.$store.state.windows.downloadAndUpdateRelease
},
set (value) {
set(value) {
this.$store.commit('windows/MutDownloadAndUpdateRelease', value)
}
},
isGaEnabled: {
get () {
get() {
return this.$store.state.windows.isGaEnabled
},
set (value) {
set(value) {
this.$store.commit('windows/MutToggleGaEnabled', value)
}
},
isErrorReportingEnabled: {
get () {
get() {
return this.$store.state.windows.isErrorReportingEnabled
},
set (value) {
set(value) {
this.$store.commit('windows/MutToggleErrorReportingEnabled', value)
}
},
isTelemetryEnabled: {
get () {
get() {
return this.$store.state.windows.isErrorReportingEnabled
},
set (value) {
set(value) {
this.$store.commit('windows/MutToggleTelemetryEnabled', value)
}
},
dialogShow: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
}
},
language: {
get () {
get() {
return this.$store.state.windows.language
},
set (val) {
set(val) {
this.$store.commit('windows/MutSetLanguage', val)
}
}
},
methods: {
rightClick () {
rightClick() {
this.rightClickCount++
if (this.rightClickCount > 5) {
// require('electron').remote.getCurrentWindow().toggleDevTools();
this.rightClickCount = 0
}
},
async applicationRefresh () {
async applicationRefresh() {
localStorage.removeItem('vuex')
location.reload()
},
toggleGa (event) {
toggleGa(event) {
if (this.isGaEnabled) {
this.gaDialogShow = true
} else { this.isGaEnabled = true }
},
toggleLogReport (event) {
toggleLogReport(event) {
if (this.isErrorReportingEnabled) {
this.logReportDialogShow = true
} else { this.isErrorReportingEnabled = true }
},
logReportDialogFunction (action) {
logReportDialogFunction(action) {
if (action !== 'hideDialog' && this.$store.state.users.user && this.$store.state.users.user.email) {
this.isErrorReportingEnabled = false
} else {
@ -180,7 +180,7 @@ export default {
}
this.logReportDialogShow = false
},
gaDialogFunction (action) {
gaDialogFunction(action) {
if (action !== 'hideDialog') {
if (this.$store.state.users.user && this.$store.state.users.user.email) {
this.isGaEnabled = false

18
packages/nc-gui/components/project/settings/xcMeta.vue

@ -162,10 +162,10 @@ export default {
confirmMessage: ''
}),
methods: {
async exportMeta () {
async exportMeta() {
this.dialogShow = true
this.confirmMessage = 'Do you want to export metadata from meta tables?'
this.confirmAction = async (act) => {
this.confirmAction = async(act) => {
if (act === 'hideDialog') {
this.dialogShow = false
} else {
@ -187,10 +187,10 @@ export default {
}
}
},
async exportMetaZip () {
async exportMetaZip() {
this.dialogShow = true
this.confirmMessage = 'Do you want to export metadata from meta tables?'
this.confirmAction = async (act) => {
this.confirmAction = async(act) => {
if (act === 'hideDialog') {
this.dialogShow = false
} else {
@ -224,10 +224,10 @@ export default {
}
}
},
async resetMeta () {
async resetMeta() {
this.dialogShow = true
this.confirmMessage = 'Do you want to clear metadata from meta tables?'
this.confirmAction = async (act) => {
this.confirmAction = async(act) => {
if (act === 'hideDialog') {
this.dialogShow = false
} else {
@ -250,10 +250,10 @@ export default {
}
},
async importMeta () {
async importMeta() {
this.dialogShow = true
this.confirmMessage = 'Do you want to import metadata from meta directory?'
this.confirmAction = async (act) => {
this.confirmAction = async(act) => {
if (act === 'hideDialog') {
this.dialogShow = false
} else {
@ -275,7 +275,7 @@ export default {
}
}
},
async importMetaZip () {
async importMetaZip() {
if (this.$refs.importFile && this.$refs.importFile.files && this.$refs.importFile.files[0]) {
const zipFile = this.$refs.importFile.files[0]
this.loading = 'import-zip'

2
packages/nc-gui/components/project/spreadsheet/apis/apiFactory.js

@ -3,7 +3,7 @@ import GqlApi from '@/components/project/spreadsheet/apis/gqlApi'
import GrpcApi from '@/components/project/spreadsheet/apis/grpcApi'
export default class ApiFactory {
static create (type, table, columns, ctx, meta) {
static create(type, table, columns, ctx, meta) {
if (type === 'graphql') {
return new GqlApi(table, columns, meta, ctx)
} else if (type === 'grpc') {

50
packages/nc-gui/components/project/spreadsheet/apis/gqlApi.js

@ -1,7 +1,7 @@
import inflection from 'inflection'
export default class GqlApi {
constructor (table, columns, meta, $ctx) {
constructor(table, columns, meta, $ctx) {
// this.table = table;
this.columns = columns
this.meta = meta
@ -9,7 +9,7 @@ export default class GqlApi {
}
// todo: - get version letter and use table alias
async list (params) {
async list(params) {
const data = await this.post(`/nc/${this.$ctx.$route.params.project_id}/v1/graphql`, {
query: await this.gqlQuery(params),
variables: null
@ -17,7 +17,7 @@ export default class GqlApi {
return data.data.data[this.gqlQueryListName]
}
async count (params) {
async count(params) {
const data = await this.post(`/nc/${this.$ctx.$route.params.project_id}/v1/graphql`, {
query: this.gqlCountQuery(params),
variables: null
@ -25,7 +25,7 @@ export default class GqlApi {
return data.data.data[this.gqlQueryCountName]
}
post (url, params) {
post(url, params) {
return this.$axios({
url: `${this.$axios.defaults.baseURL}${url}`,
method: 'post',
@ -33,7 +33,7 @@ export default class GqlApi {
})
}
generateQueryParams (params) {
generateQueryParams(params) {
if (!params) { return '(where:"")' }
const res = []
if ('limit' in params) {
@ -57,35 +57,35 @@ export default class GqlApi {
return `(${res.join(',')})`
}
async gqlQuery (params) {
async gqlQuery(params) {
return `{${this.gqlQueryListName}${this.generateQueryParams(params)}{${this.gqlReqBody}${await this.gqlRelationReqBody(params)}}}`
}
gqlReadQuery (id) {
gqlReadQuery(id) {
return `{${this.gqlQueryReadName}(id:"${id}"){${this.gqlReqBody}}}`
}
gqlCountQuery (params) {
gqlCountQuery(params) {
return `{${this.gqlQueryCountName}${this.generateQueryParams(params)}}`
}
get gqlQueryListName () {
get gqlQueryListName() {
return `${this.meta._tn}List`
}
get gqlQueryReadName () {
get gqlQueryReadName() {
return `${this.meta._tn}Read`
}
get tableCamelized () {
get tableCamelized() {
return `${this.meta._tn}`
}
get gqlReqBody () {
get gqlReqBody() {
return `\n${this.columns.map(c => c._cn).join('\n')}\n`
}
async gqlRelationReqBody (params) {
async gqlRelationReqBody(params) {
let str = ''
if (params.hm) {
for (const child of params.hm.split(',')) {
@ -129,23 +129,23 @@ export default class GqlApi {
return str
}
get gqlQueryCountName () {
get gqlQueryCountName() {
return `${this.tableCamelized}Count`
}
get gqlMutationCreateName () {
get gqlMutationCreateName() {
return `${this.tableCamelized}Create`
}
get gqlMutationUpdateName () {
get gqlMutationUpdateName() {
return `${this.tableCamelized}Update`
}
get gqlMutationDeleteName () {
get gqlMutationDeleteName() {
return `${this.tableCamelized}Delete`
}
async paginatedList (params) {
async paginatedList(params) {
// const list = await this.list(params);
// const count = (await this.count({where: params.where || ''}));
const [list, count] = await Promise.all([
@ -158,7 +158,7 @@ export default class GqlApi {
return { list, count }
}
async update (id, data, oldData) {
async update(id, data, oldData) {
const data1 = await this.post(`/nc/${this.$ctx.$route.params.project_id}/v1/graphql`, {
query: `mutation update($id:String!, $data:${this.tableCamelized}Input){
${this.gqlMutationUpdateName}(id: $id, data: $data)
@ -180,7 +180,7 @@ export default class GqlApi {
return data1.data.data[this.gqlMutationUpdateName]
}
async insert (data) {
async insert(data) {
const data1 = await this.post(`/nc/${this.$ctx.$route.params.project_id}/v1/graphql`, {
query: `mutation create($data:${this.tableCamelized}Input){
${this.gqlMutationCreateName}(data: $data){${this.gqlReqBody}}
@ -192,7 +192,7 @@ export default class GqlApi {
return data1.data.data[this.gqlMutationCreateName]
}
async delete (id) {
async delete(id) {
const data1 = await this.post(`/nc/${this.$ctx.$route.params.project_id}/v1/graphql`, {
query: `mutation delete($id:String!){
${this.gqlMutationDeleteName}(id: $id)
@ -203,7 +203,7 @@ export default class GqlApi {
return data1.data.data[this.gqlMutationDeleteName]
}
async read (id) {
async read(id) {
const data = await this.post(`/nc/${this.$ctx.$route.params.project_id}/v1/graphql`, {
query: this.gqlReadQuery(id),
variables: null
@ -211,15 +211,15 @@ export default class GqlApi {
return data.data.data[this.gqlQueryReadName]
}
get $axios () {
get $axios() {
return this.$ctx.$axios
}
get table () {
get table() {
return this.meta && this.meta._tn && inflection.camelize(this.meta._tn)
}
async paginatedM2mNotChildrenList (params, assoc, pid) {
async paginatedM2mNotChildrenList(params, assoc, pid) {
const list = await this.post(`/nc/${this.$ctx.$route.params.project_id}/v1/graphql`, {
query: `query m2mNotChildren($pid: String!,$assoc:String!,$parent:String!, $limit:Int, $offset:Int){
m2mNotChildren(pid: $pid,assoc:$assoc,parent:$parent,limit:$limit, offset:$offset)

4
packages/nc-gui/components/project/spreadsheet/apis/grpcApi.js

@ -1,12 +1,12 @@
export default class GrpcApi {
constructor (table, ctx) {
constructor(table, ctx) {
this.table = table
this.ctx = ctx
}
// todo: - get version letter and use table alias
async paginatedList (params) {
async paginatedList(params) {
const result = await this.ctx.$store.dispatch('sqlMgr/ActSqlOp', [{
env: this.ctx.nodes.env,
dbAlias: this.ctx.nodes.dbAlias

24
packages/nc-gui/components/project/spreadsheet/apis/restApi.js

@ -1,22 +1,22 @@
export default class RestApi {
constructor (table, $ctx) {
constructor(table, $ctx) {
this.table = table
this.$ctx = $ctx
}
// todo: - get version letter and use table alias
async list (params) {
async list(params) {
// const data = await this.get(`/nc/${this.$ctx.$route.params.project_id}/api/v1/${this.table}`, params)
const data = await this.get(`/nc/${this.$ctx.$route.params.project_id}/api/v1/${this.table}`, params)
return data.data
}
async read (id) {
async read(id) {
const data = await this.get(`/nc/${this.$ctx.$route.params.project_id}/api/v1/${this.table}/${id}`)
return data.data
}
async count (params) {
async count(params) {
if (this.timeout) {
return this.timeout
}
@ -35,7 +35,7 @@ export default class RestApi {
}
}
get (url, params, extras = {}) {
get(url, params, extras = {}) {
return this.$axios({
url,
params,
@ -43,7 +43,7 @@ export default class RestApi {
})
}
async paginatedList (params) {
async paginatedList(params) {
// const list = await this.list(params);
// const count = (await this.count({where: params.where || ''})).count;
const [list, { count }] = await Promise.all([this.list(params), this.count({
@ -53,7 +53,7 @@ export default class RestApi {
return { list, count }
}
async paginatedM2mNotChildrenList (params, assoc, pid) {
async paginatedM2mNotChildrenList(params, assoc, pid) {
/// api/v1/Film/m2mNotChildren/film_actor/44
// const list = await this.list(params);
// const count = (await this.count({where: params.where || ''})).count;
@ -61,7 +61,7 @@ export default class RestApi {
return { list, count }
}
async update (id, data, oldData) {
async update(id, data, oldData) {
const res = await this.$axios({
method: 'put',
url: `/nc/${this.$ctx.$route.params.project_id}/api/v1/${this.table}/${id}`,
@ -79,7 +79,7 @@ export default class RestApi {
return res
}
async insert (data) {
async insert(data) {
return (await this.$axios({
method: 'post',
url: `/nc/${this.$ctx.$route.params.project_id}/api/v1/${this.table}`,
@ -87,18 +87,18 @@ export default class RestApi {
})).data
}
async delete (id) {
async delete(id) {
return this.$axios({
method: 'delete',
url: `/nc/${this.$ctx.$route.params.project_id}/api/v1/${this.table}/${id}`
})
}
get $axios () {
get $axios() {
return this.$ctx.$axios
}
get apiUrl () {
get apiUrl() {
return `${process.env.NODE_ENV === 'production'
? `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}`
: 'http://localhost:8080'}/nc/${this.$ctx.$route.params.project_id}/api/v1/${this.table}`

2
packages/nc-gui/components/project/spreadsheet/components/cell/attachmentCell.vue

@ -48,7 +48,7 @@ export default {
dragOver: false
}),
computed: {
localState () {
localState() {
try {
return JSON.parse(this.value) || []
} catch (e) {

2
packages/nc-gui/components/project/spreadsheet/components/cell/enumCell.vue

@ -18,7 +18,7 @@ export default {
name: 'EnumCell',
props: ['value', 'column'],
computed: {
colors () {
colors() {
const col = this.$store.state.windows.darkTheme ? colors.dark : colors.light
if (this.column && this.column.dtxp) {
return this.column.dtxp.split(',').map(v => v.replace(/^'|'$/g, '')).reduce((obj, v, i) => ({

2
packages/nc-gui/components/project/spreadsheet/components/cell/setListCell.vue

@ -21,7 +21,7 @@ export default {
props: ['value', 'column'],
computed: {
setValues () {
setValues() {
if (this.column && this.column.dtxp) {
return this.column.dtxp.split(',').map(v => v.replace(/^'|'$/g, ''))
}

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

@ -143,20 +143,20 @@ export default {
}),
watch: {
filters: {
handler (v) {
handler(v) {
this.$emit('input', v)
},
deep: true
},
value (v) {
value(v) {
this.filters = v || []
}
},
created () {
created() {
this.filters = this.value || []
},
methods: {
addFilter () {
addFilter() {
this.filters.push({
field: '',
op: '',

12
packages/nc-gui/components/project/spreadsheet/components/columnFilterMenu.vue

@ -63,33 +63,33 @@ export default {
}),
computed: {
autosave: {
set (v) {
set(v) {
this.$store.commit('windows/MutAutoApplyFilter', v)
},
get () {
get() {
return this.$store.state.windows.autoApplyFilter
}
}
},
watch: {
filters: {
handler (v) {
handler(v) {
if (this.autosave) {
this.$emit('input', v)
}
},
deep: true
},
autosave (v) {
autosave(v) {
if (!v) {
this.filters = JSON.parse(JSON.stringify(this.value || []))
}
},
value (v) {
value(v) {
this.filters = this.autosave ? v || [] : JSON.parse(JSON.stringify(v || []))
}
},
created () {
created() {
this.filters = this.autosave ? this.value || [] : JSON.parse(JSON.stringify(this.value || []))
},
methods: {}

38
packages/nc-gui/components/project/spreadsheet/components/editColumn.vue

@ -381,46 +381,46 @@ export default {
formulas: ['AVERAGE()', 'COUNT()', 'COUNTA()', 'COUNTALL()', 'SUM()', 'MIN()', 'MAX()', 'AND()', 'OR()', 'TRUE()', 'FALSE()', 'NOT()', 'XOR()', 'ISERROR()', 'IF()', 'LEN()', 'MID()', 'LEFT()', 'RIGHT()', 'FIND()', 'CONCATENATE()', 'T()', 'VALUE()', 'ARRAYJOIN()', 'ARRAYUNIQUE()', 'ARRAYCOMPACT()', 'ARRAYFLATTEN()', 'ROUND()', 'ROUNDUP()', 'ROUNDDOWN()', 'INT()', 'EVEN()', 'ODD()', 'MOD()', 'LOG()', 'EXP()', 'POWER()', 'SQRT()', 'CEILING()', 'FLOOR()', 'ABS()', 'RECORD_ID()', 'CREATED_TIME()', 'ERROR()', 'BLANK()', 'YEAR()', 'MONTH()', 'DAY()', 'HOUR()', 'MINUTE()', 'SECOND()', 'TODAY()', 'NOW()', 'WORKDAY()', 'DATETIME_PARSE()', 'DATETIME_FORMAT()', 'SET_LOCALE()', 'SET_TIMEZONE()', 'DATESTR()', 'TIMESTR()', 'TONOW()', 'FROMNOW()', 'DATEADD()', 'WEEKDAY()', 'WEEKNUM()', 'DATETIME_DIFF()', 'WORKDAY_DIFF()', 'IS_BEFORE()', 'IS_SAME()', 'IS_AFTER()', 'REPLACE()', 'REPT()', 'LOWER()', 'UPPER()', 'TRIM()', 'SUBSTITUTE()', 'SEARCH()', 'SWITCH()', 'LAST_MODIFIED_TIME()', 'ENCODE_URL_COMPONENT()', 'REGEX_EXTRACT()', 'REGEX_MATCH()', 'REGEX_REPLACE()']
}),
computed: {
isEditDisabled () {
isEditDisabled() {
return this.editColumn && this.sqlUi === SqliteUi
},
isSQLite () {
isSQLite() {
return this.sqlUi === SqliteUi
},
isMSSQL () {
isMSSQL() {
return this.sqlUi === MssqlUi
},
dataTypes () {
dataTypes() {
return this.sqlUi.getDataTypeListForUiType(this.newColumn)
},
isSelect () {
isSelect() {
return this.newColumn && (this.newColumn.uidt === 'MultiSelect' ||
this.newColumn.uidt === 'SingleSelect')
},
isRelation () {
isRelation() {
return this.newColumn && this.newColumn.uidt === 'ForeignKey'
},
isLinkToAnotherRecord () {
isLinkToAnotherRecord() {
return this.newColumn && this.newColumn.uidt === 'LinkToAnotherRecord'
},
relation () {
relation() {
return this.meta && this.column && this.meta.belongsTo && this.meta.belongsTo.find(bt => bt.cn === this.column.cn)
}
},
watch: {
column () {
column() {
this.genColumnData()
}
},
async created () {
async created() {
this.genColumnData()
// await this.loadDataTypes();
},
mounted () {
mounted() {
this.focusInput()
},
methods: {
onRelColumnSelect (colMeta) {
onRelColumnSelect(colMeta) {
Object.assign(this.newColumn, {
dt: colMeta.dt,
dtxp: colMeta.dtxp,
@ -428,7 +428,7 @@ export default {
un: colMeta.un
})
},
genColumnData () {
genColumnData() {
this.newColumn = this.column ? { ...this.column } : this.sqlUi.getNewColumn(this.meta.columns.length + 1)
this.newColumn.cno = this.newColumn.cn
},
@ -447,11 +447,11 @@ export default {
}
},
*/
close () {
close() {
this.$emit('close')
this.newColumn = {}
},
async save () {
async save() {
if (!this.$refs.form.validate()) {
return
}
@ -501,7 +501,7 @@ export default {
this.$emit('close')
},
onDataTypeChange () {
onDataTypeChange() {
this.newColumn.rqd = false
this.newColumn.pk = false
this.newColumn.ai = false
@ -516,7 +516,7 @@ export default {
this.newColumn.altered = this.newColumn.altered || 2
},
onUiTypeChange () {
onUiTypeChange() {
const colProp = this.sqlUi.getDataTypeForUiType(this.newColumn)
this.newColumn = {
...this.newColumn,
@ -534,14 +534,14 @@ export default {
this.newColumn.altered = this.newColumn.altered || 2
},
focusInput () {
focusInput() {
setTimeout(() => {
if (this.$refs.column && this.$refs.column.$el) {
this.$refs.column.$el.querySelector('input').focus()
}
}, 100)
},
async deleteRelation (action = '', column) {
async deleteRelation(action = '', column) {
try {
if (action === 'showDialog') {
this.relationDeleteDlg = true

10
packages/nc-gui/components/project/spreadsheet/components/editColumn/customSelectOptions.vue

@ -37,26 +37,26 @@ export default {
localState: []
}),
computed: {
colors () {
colors() {
return this.$store.state.windows.darkTheme ? colors.dark : colors.light
}
},
watch: {
localState: {
handler (v) {
handler(v) {
this.$emit('input', v.map(v => `'${v}'`).join(','))
},
deep: true
},
value () {
value() {
this.syncState()
}
},
mounted () {
mounted() {
this.syncState()
},
methods: {
syncState () {
syncState() {
this.localState = (this.value || '').split(',').map(v => v.replace(/^'|'$/g, ''))
}
}

16
packages/nc-gui/components/project/spreadsheet/components/editColumn/linkedToAnotherOptions.vue

@ -119,7 +119,7 @@ export default {
isRefColumnsLoading: false
}),
computed: {
onUpdateDeleteOptions () {
onUpdateDeleteOptions() {
if (this.isMSSQL) {
return ['NO ACTION']
}
@ -131,7 +131,7 @@ export default {
'SET DEFAULT'
]
},
tableRules () {
tableRules() {
return [
v => !!v || 'Required',
(v) => {
@ -149,7 +149,7 @@ export default {
]
}
},
async created () {
async created() {
await this.loadTablesList()
this.relation = {
childColumn: `${this.meta.tn}_id`,
@ -163,7 +163,7 @@ export default {
}
},
methods: {
async loadColumnList () {
async loadColumnList() {
this.isRefColumnsLoading = true
const result = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
env: this.nodes.env,
@ -186,7 +186,7 @@ export default {
this.isRefColumnsLoading = false
},
async loadTablesList () {
async loadTablesList() {
this.isRefTablesLoading = true
const result = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
@ -197,7 +197,7 @@ export default {
this.refTables = result.data.list.map(({ tn, _tn }) => ({ tn, _tn }))
this.isRefTablesLoading = false
},
async saveManyToMany () {
async saveManyToMany() {
// try {
// todo: toast
await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
@ -218,7 +218,7 @@ export default {
// throw e
// }
},
async saveRelation () {
async saveRelation() {
if (this.type === 'mm') {
await this.saveManyToMany()
return
@ -281,7 +281,7 @@ export default {
// throw e
// }
},
onColumnSelect () {
onColumnSelect() {
const col = this.refColumns.find(c => this.relation.parentColumn === c.cn)
this.$emit('onColumnSelect', col)
}

18
packages/nc-gui/components/project/spreadsheet/components/editColumn/relationOptions.vue

@ -102,7 +102,7 @@ export default {
}),
computed: {
onUpdateDeleteOptions () {
onUpdateDeleteOptions() {
if (this.isMSSQL) {
return [
'NO ACTION']
@ -117,14 +117,14 @@ export default {
}
},
watch: {
'column.cn' (c) {
'column.cn'(c) {
this.$set(this.relation, 'childColumn', c)
},
isSQLite (v) {
isSQLite(v) {
this.$set(this.relation, 'type', v ? 'virtual' : 'real')
}
},
async created () {
async created() {
await this.loadTablesList()
this.relation = {
childColumn: this.column.cn,
@ -137,11 +137,11 @@ export default {
type: this.isSQLite ? 'virtual' : 'real'
}
},
mounted () {
mounted() {
this.$set(this.relation, 'type', this.isSqlite ? 'virtual' : 'real')
},
methods: {
async loadColumnList () {
async loadColumnList() {
if (!this.relation.parentTable) { return }
this.isRefColumnsLoading = true
@ -166,7 +166,7 @@ export default {
this.isRefColumnsLoading = false
},
async loadTablesList () {
async loadTablesList() {
this.isRefTablesLoading = true
const result = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
@ -177,7 +177,7 @@ export default {
this.refTables = result.data.list.map(({ tn, _tn }) => ({ tn, _tn }))
this.isRefTablesLoading = false
},
async saveRelation () {
async saveRelation() {
// try {
await this.$store.dispatch('sqlMgr/ActSqlOpPlus', [
{
@ -191,7 +191,7 @@ export default {
// throw e
// }
},
onColumnSelect () {
onColumnSelect() {
const col = this.refColumns.find(c => this.relation.parentColumn === c.cn)
this.$emit('onColumnSelect', col)
}

12
packages/nc-gui/components/project/spreadsheet/components/editVirtualColumn.vue

@ -55,21 +55,21 @@ export default {
newColumn: {}
}),
watch: {
column (c) {
column(c) {
this.newColumn = { ...c }
}
},
async created () {
async created() {
},
mounted () {
mounted() {
this.newColumn = { ...this.column }
},
methods: {
close () {
close() {
this.$emit('input', false)
this.newColumn = {}
},
async save () {
async save() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
env: this.nodes.env,
@ -89,7 +89,7 @@ export default {
this.$emit('input', false)
},
focusInput () {
focusInput() {
setTimeout(() => {
if (this.$refs.column && this.$refs.column.$el) {
this.$refs.column.$el.querySelector('input').focus()

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

@ -157,20 +157,20 @@ export default {
destroyed: false
}),
mounted () {
mounted() {
// this.$refs.input.focus();
},
beforeDestroy () {
beforeDestroy() {
if (this.changed && !(this.isAttachment || this.isEnum || this.isBoolean || this.isSet || this.isTime)) {
this.$emit('change')
}
this.destroyed = true
},
methods: {
syncDataDebounce: debounce(async function (self) {
syncDataDebounce: debounce(async function(self) {
await self.syncData()
}, 1000),
syncData () {
syncData() {
if (!this.destroyed) {
this.$emit('update')
}
@ -178,16 +178,16 @@ export default {
},
computed: {
localState: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.changed = true
this.$emit('input', val)
this.syncDataDebounce(this)
}
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {

8
packages/nc-gui/components/project/spreadsheet/components/editableCell/booleanCell.vue

@ -13,16 +13,16 @@ export default {
},
computed: {
localState: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
// this.$emit('update');
}
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -35,7 +35,7 @@ export default {
return $listeners
}
},
mounted () {
mounted() {
this.$el.focus()
}
}

8
packages/nc-gui/components/project/spreadsheet/components/editableCell/datePickerCell.vue

@ -20,14 +20,14 @@ export default {
},
computed: {
localState: {
get () {
get() {
return typeof this.value === 'string' ? this.value.replace(/(\d)T(?=\d)/, '$1 ') : (this.value && new Date(this.value))
},
set (val) {
set(val) {
this.$emit('input', val && new Date(val).toJSON().slice(0, 10))
}
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -40,7 +40,7 @@ export default {
return $listeners
}
},
mounted () {
mounted() {
if (this.$el && this.$el.$el) {
this.$el.$el.focus()
}

8
packages/nc-gui/components/project/spreadsheet/components/editableCell/dateTimePickerCell.vue

@ -24,7 +24,7 @@ export default {
props: ['value', 'ignoreFocus'],
computed: {
localState: {
get () {
get() {
// todo : time value correction
if (/^\d{6,}$/.test(this.value)) {
@ -33,12 +33,12 @@ export default {
return /\dT\d/.test(this.value) ? new Date(this.value.replace(/(\d)T(?=\d)/, '$1 ')) : (this.value && new Date(this.value))
},
set (val) {
set(val) {
const uVal = val && new Date(val).toISOString().slice(0, 19).replace('T', ' ').replace(/(\d{1,2}:\d{1,2}):\d{1,2}$/, '$1')
this.$emit('input', uVal)
}
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -51,7 +51,7 @@ export default {
return $listeners
}
},
mounted () {
mounted() {
if (!this.ignoreFocus) {
this.$refs.picker.display = true
}

24
packages/nc-gui/components/project/spreadsheet/components/editableCell/editableAttachmentCell.vue

@ -223,7 +223,7 @@ export default {
dragOver: false
}),
watch: {
value (val, prev) {
value(val, prev) {
try {
this.localState = (typeof val === 'string' && val !== prev ? JSON.parse(val) : val) || []
} catch (e) {
@ -236,7 +236,7 @@ export default {
// }
// }
},
created () {
created() {
try {
this.localState = (typeof this.value === 'string' ? JSON.parse(this.value) : this.value) || []
} catch (e) {
@ -244,30 +244,30 @@ export default {
}
document.addEventListener('keydown', this.onArrowDown)
},
beforeDestroy () {
beforeDestroy() {
document.removeEventListener('keydown', this.onArrowDown)
},
mounted () {
mounted() {
},
methods: {
openUrl (url, target) {
openUrl(url, target) {
window.open(url, target)
},
isImage,
hideIfVisible () {
hideIfVisible() {
if (this.showImage) {
this.showImage = false
}
},
selectImage (selectedImage, i) {
selectImage(selectedImage, i) {
this.carousel = i
this.selectedImage = selectedImage
this.showImage = true
},
addFile () {
addFile() {
if (!this.isLocked) { this.$refs.file.click() }
},
async onFileSelection () {
async onFileSelection() {
if (!this.$refs.file.files || !this.$refs.file.files.length) {
return
}
@ -289,12 +289,12 @@ export default {
this.$emit('input', JSON.stringify(this.localState))
this.$emit('update')
},
removeItem (i) {
removeItem(i) {
this.localState.splice(i, 1)
this.$emit('input', JSON.stringify(this.localState))
this.$emit('update')
},
onArrowDown (e) {
onArrowDown(e) {
if (!this.showImage) { return }
e = e || window.event
// eslint-disable-next-line eqeqeq
@ -305,7 +305,7 @@ export default {
this.carousel = ++this.carousel % this.localState.length
}
},
async onFileDrop (e) {
async onFileDrop(e) {
this.dragOver = false
this.$refs.file.files = e.dataTransfer.files
await this.onFileSelection()

10
packages/nc-gui/components/project/spreadsheet/components/editableCell/enumListEditableCell.vue

@ -50,21 +50,21 @@ export default {
},
computed: {
localState: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
this.$emit('update')
}
},
enumValues () {
enumValues() {
if (this.column && this.column.dtxp) {
return this.column.dtxp.split(',').map(v => v.replace(/^'|'$/g, ''))
}
return []
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -77,7 +77,7 @@ export default {
return $listeners
}
},
mounted () {
mounted() {
// this.$el.focus();
// let event;
// event = document.createEvent('MouseEvents');

12
packages/nc-gui/components/project/spreadsheet/components/editableCell/enumRadioEditableCell.vue

@ -25,25 +25,25 @@ export default {
column: Object
},
computed: {
colors () {
colors() {
return this.$store.state.windows.darkTheme ? colors.dark : colors.light
},
localState: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
this.$emit('update')
}
},
enumValues () {
enumValues() {
if (this.column && this.column.dtxp) {
return this.column.dtxp.split(',').map(v => v.replace(/^'|'$/g, ''))
}
return []
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -55,7 +55,7 @@ export default {
return $listeners
}
},
mounted () {
mounted() {
// this.$el.focus();
// let event;
// event = document.createEvent('MouseEvents');

8
packages/nc-gui/components/project/spreadsheet/components/editableCell/floatCell.vue

@ -10,14 +10,14 @@ export default {
},
computed: {
localState: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', +val)
}
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -30,7 +30,7 @@ export default {
return $listeners
}
},
mounted () {
mounted() {
this.$el.focus()
}
}

8
packages/nc-gui/components/project/spreadsheet/components/editableCell/integerCell.vue

@ -10,14 +10,14 @@ export default {
},
computed: {
localState: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', parseInt(val, 10))
}
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -30,7 +30,7 @@ export default {
return $listeners
}
},
mounted () {
mounted() {
this.$el.focus()
}
}

12
packages/nc-gui/components/project/spreadsheet/components/editableCell/jsonCell.vue

@ -31,7 +31,7 @@ export default {
}),
computed: {
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -45,22 +45,22 @@ export default {
}
},
watch: {
value (val) {
value(val) {
this.localState = typeof val === 'string' ? JSON.parse(val) : val
},
localState (val) {
localState(val) {
if (this.isForm) {
this.$emit('input', JSON.stringify(val))
}
}
},
created () {
created() {
this.localState = typeof this.value === 'string' ? JSON.parse(this.value) : this.value
},
mounted () {
mounted() {
},
methods: {
save () {
save() {
this.$emit('input', JSON.stringify(this.localState))
}
}

14
packages/nc-gui/components/project/spreadsheet/components/editableCell/setListCheckboxCell.vue

@ -25,28 +25,28 @@ export default {
column: Object,
values: Array
},
data () {
data() {
},
computed: {
colors () {
colors() {
return this.$store.state.windows.darkTheme ? colors.dark : colors.light
},
localState: {
get () {
get() {
return (this.value && this.value.split(',')) || []
},
set (val) {
set(val) {
this.$emit('input', val.join(','))
this.$emit('update')
}
},
setValues () {
setValues() {
if (this.column && this.column.dtxp) {
return this.column.dtxp.split(',').map(v => v.replace(/^'|'$/g, ''))
}
return this.values || []
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -59,7 +59,7 @@ export default {
return $listeners
}
},
mounted () {
mounted() {
this.$el.focus()
const event = document.createEvent('MouseEvents')
event.initMouseEvent('mousedown', true, true, window)

10
packages/nc-gui/components/project/spreadsheet/components/editableCell/setListEditableCell.vue

@ -54,21 +54,21 @@ export default {
},
computed: {
localState: {
get () {
get() {
return this.value && this.value.split(',')
},
set (val) {
set(val) {
this.$emit('input', val.filter(v => this.setValues.includes(v)).join(','))
this.$emit('update')
}
},
setValues () {
setValues() {
if (this.column && this.column.dtxp) {
return this.column.dtxp.split(',').map(v => v.replace(/^'|'$/g, ''))
}
return []
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -81,7 +81,7 @@ export default {
return $listeners
}
},
mounted () {
mounted() {
// this.$el.focus();
// let event;
// event = document.createEvent('MouseEvents');

10
packages/nc-gui/components/project/spreadsheet/components/editableCell/textAreaCell.vue

@ -18,14 +18,14 @@ export default {
computed: {
localState: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
}
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -38,10 +38,10 @@ export default {
return $listeners
}
},
created () {
created() {
this.localState = this.value
},
mounted () {
mounted() {
this.$refs.textarea && this.$refs.textarea.focus()
}
}

12
packages/nc-gui/components/project/spreadsheet/components/editableCell/textAreaCellOld.vue

@ -32,7 +32,7 @@ export default {
}),
computed: {
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -46,23 +46,23 @@ export default {
}
},
watch: {
value (val) {
value(val) {
this.localState = val
},
localState (val) {
localState(val) {
if (this.isForm) {
this.$emit('input', val)
}
}
},
created () {
created() {
this.localState = this.value
},
mounted () {
mounted() {
this.$refs.textarea && this.$refs.textarea.focus()
},
methods: {
save () {
save() {
this.$emit('input', this.localState)
}
}

8
packages/nc-gui/components/project/spreadsheet/components/editableCell/textCell.vue

@ -10,14 +10,14 @@ export default {
},
computed: {
localState: {
get () {
get() {
return this.value
},
set (val) {
set(val) {
this.$emit('input', val)
}
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -34,7 +34,7 @@ export default {
return $listeners
}
},
mounted () {
mounted() {
this.$el.focus()
}
}

8
packages/nc-gui/components/project/spreadsheet/components/editableCell/timePickerCell.vue

@ -20,14 +20,14 @@ export default {
},
computed: {
localState: {
get () {
get() {
return typeof this.value === 'string' ? this.value.replace(/(\d)T(?=\d)/, '$1 ') : this.value
},
set (val) {
set(val) {
this.$emit('input', (new Date(val).toJSON() || '').slice(0, 10) || val)
}
},
parentListeners () {
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
@ -44,7 +44,7 @@ export default {
return $listeners
}
},
mounted () {
mounted() {
if (this.$el && this.$el.$el) {
this.$el.$el.focus()
}

40
packages/nc-gui/components/project/spreadsheet/components/expandedForm.vue

@ -251,7 +251,7 @@ export default {
props: {
breadcrumbs: {
type: Array,
default () {
default() {
return []
}
},
@ -275,7 +275,7 @@ export default {
queryParams: Object,
disabledColumns: {
type: Object,
default () {
default() {
return {}
}
}
@ -292,13 +292,13 @@ export default {
showSystemFields: false
}),
computed: {
primaryKey () {
primaryKey() {
return this.isNew ? '' : this.meta.columns.filter(c => c.pk).map(c => this.localState[c._cn]).join('___')
},
edited () {
edited() {
return !!Object.keys(this.changedColumns).length
},
fields () {
fields() {
if (this.availableColumns) { return this.availableColumns }
const hideCols = ['created_at', 'updated_at']
@ -311,44 +311,44 @@ export default {
) || []
}
},
isChanged () {
isChanged() {
return Object.values(this.changedColumns).some(Boolean)
},
localBreadcrumbs () {
localBreadcrumbs() {
return [...this.breadcrumbs, `${this.table} (${this.localState && this.localState[this.primaryValueColumn]})`]
}
},
watch: {
value (obj) {
value(obj) {
this.localState = { ...obj }
if (!this.isNew && this.toggleDrawer) {
this.getAuditsAndComments()
}
},
isNew (n) {
isNew(n) {
if (!n && this.toggleDrawer) {
this.getAuditsAndComments()
}
},
meta () {
meta() {
if (!this.isNew && this.toggleDrawer) {
this.getAuditsAndComments()
}
},
toggleDrawer (td) {
toggleDrawer(td) {
if (td) {
this.getAuditsAndComments()
}
}
},
created () {
created() {
this.localState = { ...this.value }
if (!this.isNew && this.toggleDrawer) {
this.getAuditsAndComments()
}
},
methods: {
isRequired (_columnObj, rowObj) {
isRequired(_columnObj, rowObj) {
let columnObj = _columnObj
if (columnObj.bt) {
columnObj = this.meta.columns.find(c => c.cn === columnObj.bt.cn)
@ -358,14 +358,14 @@ export default {
(rowObj[columnObj._cn] === undefined || rowObj[columnObj._cn] === null) &&
!columnObj.default)
},
updateCol (_row, _cn, pid) {
updateCol(_row, _cn, pid) {
this.$set(this.localState, _cn, pid)
this.$set(this.changedColumns, _cn, true)
},
isYou (email) {
isYou(email) {
return this.$store.state.users.user && this.$store.state.users.user.email === email
},
async getAuditsAndComments () {
async getAuditsAndComments() {
this.loadingLogs = true
const data = await this.$store.dispatch('sqlMgr/ActSqlOp', [{ dbAlias: this.dbAlias }, 'xcModelRowAuditAndCommentList', {
model_id: this.meta.columns.filter(c => c.pk).map(c => this.localState[c._cn]).join('___'),
@ -374,7 +374,7 @@ export default {
this.logs = data.list
this.loadingLogs = false
},
async save () {
async save() {
try {
const id = this.meta.columns.filter(c => c.pk).map(c => this.localState[c._cn]).join('___')
@ -413,7 +413,7 @@ export default {
this.$toast.error(`Failed to update row : ${e.message}`).goAway(3000)
}
},
async reload () {
async reload() {
// const id = this.meta.columns.filter((c) => c.pk).map(c => this.localState[c._cn]).join('___');
const where = this.meta.columns.filter(c => c.pk).map(c => `(${c._cn},eq,${this.localState[c._cn]})`).join('~and')
this.$set(this, 'changedColumns', {})
@ -424,10 +424,10 @@ export default {
this.getAuditsAndComments()
}
},
calculateDiff (date) {
calculateDiff(date) {
return dayjs.utc(date).fromNow()
},
async saveComment () {
async saveComment() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [
{ dbAlias: this.dbAlias },

2
packages/nc-gui/components/project/spreadsheet/components/extras.vue

@ -75,7 +75,7 @@ export default {
data: () => ({
showCommunity: true
}),
mounted () {
mounted() {
setInterval(() => {
this.showCommunity = !this.showCommunity
}, 60000)

24
packages/nc-gui/components/project/spreadsheet/components/fieldsMenu.vue

@ -126,42 +126,42 @@ export default {
fieldsOrderLoc: []
}),
computed: {
columnMeta () {
columnMeta() {
return this.meta && this.meta.columns ? this.meta.columns.reduce((o, c) => ({ ...o, [c._cn]: c }), {}) : {}
},
isAnyFieldHidden () {
isAnyFieldHidden() {
return Object.values(this.showFields).some(v => !v)
},
showSystemFieldsLoc: {
get () {
get() {
return this.showSystemFields
},
set (v) {
set(v) {
this.$emit('update:showSystemFields', v)
}
}
},
watch: {
fieldList (f) {
fieldList(f) {
this.fieldsOrderLoc = [...f]
},
showFields: {
handler (v) {
handler(v) {
this.$emit('input', v)
},
deep: true
},
value (v) {
value(v) {
this.showFields = v || []
},
fieldsOrder (n, o) {
fieldsOrder(n, o) {
if ((n && n.join()) !== (o && o.join())) {
this.fieldsOrderLoc = n
}
},
fieldsOrderLoc: {
handler (n, o) {
handler(n, o) {
if ((n && n.join()) !== (o && o.join())) {
this.$emit('update:fieldsOrder', n)
}
@ -169,16 +169,16 @@ export default {
deep: true
}
},
created () {
created() {
this.showFields = this.value
this.fieldsOrderLoc = this.fieldsOrder
},
methods: {
showAll () {
showAll() {
// eslint-disable-next-line no-return-assign,no-sequences
this.showFields = Object.keys(this.showFields).reduce((o, k) => (o[k] = true, o), {})
},
hideAll () {
hideAll() {
// eslint-disable-next-line no-return-assign,no-sequences
this.showFields = Object.keys(this.showFields).reduce((o, k) => (o[k] = false, o), {})
}

4
packages/nc-gui/components/project/spreadsheet/components/headerCell.vue

@ -144,7 +144,7 @@ export default {
columnDeleteDialog: false
}),
methods: {
async deleteColumn () {
async deleteColumn() {
try {
const column = { ...this.column, cno: this.column.cn }
column.altered = 4
@ -164,7 +164,7 @@ export default {
console.log(e)
}
},
async setAsPrimaryValue () {
async setAsPrimaryValue() {
// todo: pass only updated fields
try {
const meta = JSON.parse(JSON.stringify(this.meta))

2
packages/nc-gui/components/project/spreadsheet/components/lockMenu.vue

@ -85,7 +85,7 @@ export default {
}),
methods: {
changeLockType (type) {
changeLockType(type) {
if (type === 'personal') {
return this.$toast.info('Coming soon').goAway(3000)
}

4
packages/nc-gui/components/project/spreadsheet/components/pagination.vue

@ -41,11 +41,11 @@ export default {
page: 1
}),
watch: {
value (v) {
value(v) {
this.page = v
}
},
mounted () {
mounted() {
this.page = this.value
}
}

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

@ -50,20 +50,20 @@ export default {
viewsList: null
}),
computed: {
origin () {
origin() {
return location.origin
}
},
created () {
created() {
this.loadSharedViewsList()
},
methods: {
async loadSharedViewsList () {
async loadSharedViewsList() {
this.viewsList = await this.$store.dispatch('sqlMgr/ActSqlOp', [{ dbAlias: this.nodes.dbAlias }, 'listSharedViewLinks', {
model_name: this.modelName
}])
},
async deleteLink (id) {
async deleteLink(id) {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{ dbAlias: this.nodes.dbAlias }, 'deleteSharedViewLink', {
id

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

@ -85,20 +85,20 @@ export default {
}),
watch: {
sortList: {
handler (v) {
handler(v) {
this.$emit('input', v)
},
deep: true
},
value (v) {
value(v) {
this.sortList = v || []
}
},
created () {
created() {
this.filters = this.value || []
},
methods: {
addSort () {
addSort() {
this.sortList.push({
field: '',
order: ''

40
packages/nc-gui/components/project/spreadsheet/components/spreadsheetNavDrawer.vue

@ -540,10 +540,10 @@ export default {
}),
computed: {
selectedViewIdLocal: {
get () {
get() {
return this.selectedViewId
},
set (id) {
set(id) {
const selectedView = this.viewsList && this.viewsList.find(v => v.id === id)
let queryParams = {}
@ -572,26 +572,26 @@ export default {
}
},
watch: {
async load (v) {
async load(v) {
if (v) {
await this.loadViews()
}
}
},
async created () {
async created() {
if (this.load) {
await this.loadViews()
}
},
methods: {
hideMiniSponsorCard () {
hideMiniSponsorCard() {
this.$store.commit('windows/MutMiniSponsorCard', Date.now())
},
openCreateViewDlg (type) {
openCreateViewDlg(type) {
this.createViewType = type
this.showCreateView = true
},
isCentrallyAligned (col) {
isCentrallyAligned(col) {
return ![
'SingleLineText',
'LongText',
@ -605,13 +605,13 @@ export default {
'LastModifiedTime'
].includes(col.uidt)
},
onPasswordProtectChange () {
onPasswordProtectChange() {
if (!this.passwordProtect) {
this.shareLink.password = null
this.saveShareLinkPassword()
}
},
async saveShareLinkPassword () {
async saveShareLinkPassword() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [
{ dbAlias: this.nodes.dbAlias },
@ -626,7 +626,7 @@ export default {
this.$toast.error(e.message).goAway(3000)
}
},
async loadViews () {
async loadViews() {
this.viewsList = await this.sqlOp(
{
dbAlias: this.nodes.dbAlias
@ -655,11 +655,11 @@ export default {
// }
// this.$emit('loadTableData');
// },
copyapiUrlToClipboard () {
copyapiUrlToClipboard() {
this.$clipboard(this.currentApiUrl)
this.clipboardSuccessHandler()
},
async updateViewName (view) {
async updateViewName(view) {
try {
await this.sqlOp({ dbAlias: this.nodes.dbAlias }, 'xcVirtualTableRename', {
id: view.id,
@ -673,7 +673,7 @@ export default {
}
await this.loadViews()
},
showRenameTextBox (view, i) {
showRenameTextBox(view, i) {
this.$set(view, 'edit', true)
this.$nextTick(() => {
const input = this.$refs[`input${i}`][0]
@ -681,7 +681,7 @@ export default {
input.setSelectionRange(0, input.value.length)
})
},
async deleteView (view) {
async deleteView(view) {
try {
await this.sqlOp({ dbAlias: this.nodes.dbAlias }, 'xcVirtualTableDelete', {
id: view.id,
@ -694,7 +694,7 @@ export default {
this.$toast.error(e.message).goAway(3000)
}
},
async genShareLink () {
async genShareLink() {
this.showShareModel = true
const sharedViewUrl = await this.$store.dispatch('sqlMgr/ActSqlOp', [
{ dbAlias: this.nodes.dbAlias },
@ -714,18 +714,18 @@ export default {
])
this.shareLink = sharedViewUrl
},
copyView (view, i) {
copyView(view, i) {
this.createViewType = view.show_as
this.showCreateView = true
this.copyViewRef = view
},
async onViewCreate (viewMeta) {
async onViewCreate(viewMeta) {
this.copyViewRef = null
await this.loadViews()
this.selectedViewIdLocal = viewMeta.id
// await this.onViewChange();
},
clipboard (str) {
clipboard(str) {
const el = document.createElement('textarea')
el.addEventListener('focusin', e => e.stopPropagation())
el.value = str
@ -734,10 +734,10 @@ export default {
document.execCommand('copy')
document.body.removeChild(el)
},
clipboardSuccessHandler () {
clipboardSuccessHandler() {
this.$toast.info('Copied to clipboard').goAway(1000)
},
copyShareUrlToClipboard () {
copyShareUrlToClipboard() {
this.clipboard(this.shareLink.url)
this.clipboardSuccessHandler()
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save