diff --git a/packages/nc-gui/components/smartsheet/Row.vue b/packages/nc-gui/components/smartsheet/Row.vue
index ac65f7f354..055733b497 100644
--- a/packages/nc-gui/components/smartsheet/Row.vue
+++ b/packages/nc-gui/components/smartsheet/Row.vue
@@ -33,6 +33,10 @@ reloadHook.on(() => {
})
provide(ReloadRowDataHookInj, reloadHook)
+
+defineExpose({
+ syncLTARRefs
+})
diff --git a/packages/nc-gui/composables/useViewData.ts b/packages/nc-gui/composables/useViewData.ts
index ea9b367e34..0ccae12fcc 100644
--- a/packages/nc-gui/composables/useViewData.ts
+++ b/packages/nc-gui/composables/useViewData.ts
@@ -256,7 +256,7 @@ export function useViewData(
async function updateOrSaveRow(row: Row, property: string) {
if (row.rowMeta.new) {
- await insertRow(row.row, formattedData.value.indexOf(row))
+ return await insertRow(row.row, formattedData.value.indexOf(row))
} else {
await updateRowProperty(row, property)
}
From c7b24c4c4e1d2a158fc66eed1056fc7ac9446699 Mon Sep 17 00:00:00 2001
From: Asheer Rizvi
Date: Sun, 11 Sep 2022 14:23:24 +0530
Subject: [PATCH 30/52] feat: added a form for creating tokens
---
.../tabs/auth/ApiTokenManagement.vue | 20 +++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/packages/nc-gui/components/tabs/auth/ApiTokenManagement.vue b/packages/nc-gui/components/tabs/auth/ApiTokenManagement.vue
index 1a093a5135..6f73b9ec7b 100644
--- a/packages/nc-gui/components/tabs/auth/ApiTokenManagement.vue
+++ b/packages/nc-gui/components/tabs/auth/ApiTokenManagement.vue
@@ -106,17 +106,29 @@ onMounted(() => {
-
+
{{ $t('title.generateToken') }}
-
+
+
- {{ $t('general.generate') }}
+
-
+
From fe917975b0f32629d85943357487b693b33251cb Mon Sep 17 00:00:00 2001
From: mertmit
Date: Sun, 11 Sep 2022 16:43:10 +0300
Subject: [PATCH 31/52] fix(nocodb): use port from connection URL
Signed-off-by: mertmit
---
packages/nocodb/src/lib/utils/NcConfigFactory.ts | 2 ++
1 file changed, 2 insertions(+)
diff --git a/packages/nocodb/src/lib/utils/NcConfigFactory.ts b/packages/nocodb/src/lib/utils/NcConfigFactory.ts
index 3cfc471ca7..466be1ee19 100644
--- a/packages/nocodb/src/lib/utils/NcConfigFactory.ts
+++ b/packages/nocodb/src/lib/utils/NcConfigFactory.ts
@@ -214,6 +214,7 @@ export default class NcConfigFactory implements NcConfig {
...defaultConnectionConfig,
...parsedQuery,
host: url.hostname,
+ port: +url.port,
},
// pool: {
// min: 1,
@@ -325,6 +326,7 @@ export default class NcConfigFactory implements NcConfig {
...defaultConnectionConfig,
...parsedQuery,
host: url.hostname,
+ port: +url.port,
},
acquireConnectionTimeout: 600000,
...(url.searchParams.has('search_path')
From 9cd963d37a089bbb9c1a3e16096425861511aa57 Mon Sep 17 00:00:00 2001
From: Asheer Rizvi
Date: Sun, 11 Sep 2022 19:25:17 +0530
Subject: [PATCH 32/52] chore: changed button to a-button
---
packages/nc-gui/components/tabs/auth/ApiTokenManagement.vue | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/nc-gui/components/tabs/auth/ApiTokenManagement.vue b/packages/nc-gui/components/tabs/auth/ApiTokenManagement.vue
index 6f73b9ec7b..282ad42c54 100644
--- a/packages/nc-gui/components/tabs/auth/ApiTokenManagement.vue
+++ b/packages/nc-gui/components/tabs/auth/ApiTokenManagement.vue
@@ -124,9 +124,9 @@ onMounted(() => {
-
+
From 48a1e36fafeda45ef2cc4e1fa40f8f36dae76800 Mon Sep 17 00:00:00 2001
From: Pranav C
Date: Mon, 12 Sep 2022 11:53:11 +0530
Subject: [PATCH 33/52] chore(gui): lint
Signed-off-by: Pranav C
---
.../nc-gui/components/smartsheet/Cell.vue | 3 +-
.../nc-gui/components/smartsheet/Grid.vue | 352 +++++++++---------
packages/nc-gui/components/smartsheet/Row.vue | 2 +-
.../smartsheet/expanded-form/index.vue | 2 +-
.../nc-gui/components/tabs/Smartsheet.vue | 6 +-
.../composables/useSmartsheetRowStore.ts | 2 +-
packages/nc-gui/composables/useViewData.ts | 16 +-
.../index/[type]/[title]/[[viewTitle]].vue | 6 +-
8 files changed, 194 insertions(+), 195 deletions(-)
diff --git a/packages/nc-gui/components/smartsheet/Cell.vue b/packages/nc-gui/components/smartsheet/Cell.vue
index 6fe1f0b035..90ee5826da 100644
--- a/packages/nc-gui/components/smartsheet/Cell.vue
+++ b/packages/nc-gui/components/smartsheet/Cell.vue
@@ -15,9 +15,9 @@ import {
toRef,
useColumn,
useDebounceFn,
+ useSmartsheetRowStoreOrThrow,
useVModel,
} from '#imports'
-import { useSmartsheetRowStoreOrThrow } from '~/composables/useSmartsheetRowStore'
import { NavigateDir } from '~/lib'
interface Props {
@@ -65,7 +65,6 @@ const syncValue = useDebounceFn(function () {
emit('save')
}, 1000)
-
const isAutoSaved = $computed(() => {
return [
UITypes.SingleLineText,
diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue
index f8faa99b39..cf4dcaf6e8 100644
--- a/packages/nc-gui/components/smartsheet/Grid.vue
+++ b/packages/nc-gui/components/smartsheet/Grid.vue
@@ -248,35 +248,36 @@ const onKeyDown = async (e: KeyboardEvent) => {
e.preventDefault()
if (selected.row < data.value.length - 1) selected.row++
break
- default: {
- const rowObj = data.value[selected.row]
- const columnObj = fields.value[selected.col]
-
- if ((!editEnabled && e.metaKey) || e.ctrlKey) {
- switch (e.keyCode) {
- // copy - ctrl/cmd +c
- case 67:
- await copy(rowObj.row[columnObj.title] || '')
- break
+ default:
+ {
+ const rowObj = data.value[selected.row]
+ const columnObj = fields.value[selected.col]
+
+ if ((!editEnabled && e.metaKey) || e.ctrlKey) {
+ switch (e.keyCode) {
+ // copy - ctrl/cmd +c
+ case 67:
+ await copy(rowObj.row[columnObj.title] || '')
+ break
+ }
}
- }
-
- if (editEnabled || e.ctrlKey || e.altKey || e.metaKey) {
- return
- }
- /** on letter key press make cell editable and empty */
- if (e?.key?.length === 1) {
- if (!isPkAvail && !rowObj.rowMeta.new) {
- // Update not allowed for table which doesn't have primary Key
- return message.info(t('msg.info.updateNotAllowedWithoutPK'))
+ if (editEnabled || e.ctrlKey || e.altKey || e.metaKey) {
+ return
}
- if (makeEditable(rowObj, columnObj)) {
- rowObj.row[columnObj.title] = ''
+
+ /** on letter key press make cell editable and empty */
+ if (e?.key?.length === 1) {
+ if (!isPkAvail && !rowObj.rowMeta.new) {
+ // Update not allowed for table which doesn't have primary Key
+ return message.info(t('msg.info.updateNotAllowedWithoutPK'))
+ }
+ if (makeEditable(rowObj, columnObj)) {
+ rowObj.row[columnObj.title] = ''
+ }
+ // editEnabled = true
}
- // editEnabled = true
}
- }
break
}
}
@@ -326,16 +327,21 @@ const showContextMenu = (e: MouseEvent, target?: { row: number; col: number }) =
const rowRefs = $ref()
+/** save/update records before unmounting the component */
onBeforeUnmount(async () => {
console.log(rowRefs)
- for (const [index, currentRow] of Object.entries(data.value)) {
+ let index = -1
+ for (const currentRow of data.value) {
+ index++
+ /** if new record save row and save the LTAR cells */
if (currentRow.rowMeta.new) {
const syncLTARRefs = rowRefs[index]!.syncLTARRefs
- const savedRow = await updateOrSaveRow(currentRow, null)
+ const savedRow = await updateOrSaveRow(currentRow, '')
await syncLTARRefs(savedRow)
currentRow.rowMeta.changed = false
continue
}
+ /** if existing row check updated cell and invoke update method */
if (currentRow.rowMeta.changed) {
currentRow.rowMeta.changed = false
for (const field of meta?.value.columns ?? []) {
@@ -347,7 +353,6 @@ onBeforeUnmount(async () => {
}
}
})
-
@@ -363,88 +368,87 @@ onBeforeUnmount(async () => {
@contextmenu="showContextMenu"
>
-
-
-
-
-
-
-
- {{ rowIndex + 1 }}
-
-
-
-
+
+
+
+
+
+
+ {{ rowIndex + 1 }}
+
+
+
+
{
>
{{ row.rowMeta.commentCount }}
-
-
- |
-
- |
-
-
-
-
-
-
-
-
-
-
-
+ :row-index="rowIndex"
+ :active="selected.col === colIndex && selected.row === rowIndex"
+ @update:edit-enabled="editEnabled = false"
+ @save="updateOrSaveRow(row, columnObj.title)"
+ @navigate="onNavigate"
+ @cancel="editEnabled = false"
+ />
+
+ |
+
+
+
+
+
+
+
+
+
+
+
{{ $t('activity.addRow') }}
-
- |
-
+
+ |
+
diff --git a/packages/nc-gui/components/smartsheet/Row.vue b/packages/nc-gui/components/smartsheet/Row.vue
index 055733b497..acfbbea0c8 100644
--- a/packages/nc-gui/components/smartsheet/Row.vue
+++ b/packages/nc-gui/components/smartsheet/Row.vue
@@ -35,7 +35,7 @@ reloadHook.on(() => {
provide(ReloadRowDataHookInj, reloadHook)
defineExpose({
- syncLTARRefs
+ syncLTARRefs,
})
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/index.vue b/packages/nc-gui/components/smartsheet/expanded-form/index.vue
index 8243cfc9d9..0f4e69fc0b 100644
--- a/packages/nc-gui/components/smartsheet/expanded-form/index.vue
+++ b/packages/nc-gui/components/smartsheet/expanded-form/index.vue
@@ -6,11 +6,11 @@ import Cell from '../Cell.vue'
import VirtualCell from '../VirtualCell.vue'
import Comments from './Comments.vue'
import Header from './Header.vue'
-import { ReloadRowDataHookInj } from '~/context'
import {
FieldsInj,
IsFormInj,
MetaInj,
+ ReloadRowDataHookInj,
computedInject,
provide,
ref,
diff --git a/packages/nc-gui/components/tabs/Smartsheet.vue b/packages/nc-gui/components/tabs/Smartsheet.vue
index 4443b12bf1..cb6d4c9903 100644
--- a/packages/nc-gui/components/tabs/Smartsheet.vue
+++ b/packages/nc-gui/components/tabs/Smartsheet.vue
@@ -21,7 +21,6 @@ import {
import type { TabItem } from '~/composables'
-
const { activeTab } = defineProps<{
activeTab: TabItem
}>()
@@ -38,10 +37,7 @@ const fields = ref([])
// TabMetaInj,
// computed(() => ({} as TabItem)),
// )
-provide(
- TabMetaInj,
- ref(activeTab),
-)
+provide(TabMetaInj, ref(activeTab))
const meta = computed(() => metas.value?.[activeTab?.id as string])
const reloadEventHook = createEventHook()
diff --git a/packages/nc-gui/composables/useSmartsheetRowStore.ts b/packages/nc-gui/composables/useSmartsheetRowStore.ts
index 191f578ca2..c337d2e2d6 100644
--- a/packages/nc-gui/composables/useSmartsheetRowStore.ts
+++ b/packages/nc-gui/composables/useSmartsheetRowStore.ts
@@ -134,7 +134,7 @@ const [useProvideSmartsheetRowStore, useSmartsheetRowStore] = useInjectionState(
removeLTARRef,
syncLTARRefs,
loadRow,
- currentRow
+ currentRow,
}
}, 'smartsheet-row-store')
diff --git a/packages/nc-gui/composables/useViewData.ts b/packages/nc-gui/composables/useViewData.ts
index dc7a39aeea..c9422d59bc 100644
--- a/packages/nc-gui/composables/useViewData.ts
+++ b/packages/nc-gui/composables/useViewData.ts
@@ -166,12 +166,12 @@ export function useViewData(
if ((!project?.value?.id || !meta?.value?.id || !viewMeta?.value?.id) && !isPublic.value) return
const response = !isPublic.value
? await api.dbViewRow.list('noco', project.value.id!, meta!.value.id!, viewMeta!.value.id, {
- ...queryParams.value,
- ...params,
- ...(isUIAllowed('sortSync') ? {} : { sortArrJson: JSON.stringify(sorts.value) }),
- ...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }),
- where: where?.value,
- })
+ ...queryParams.value,
+ ...params,
+ ...(isUIAllowed('sortSync') ? {} : { sortArrJson: JSON.stringify(sorts.value) }),
+ ...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }),
+ where: where?.value,
+ })
: await fetchSharedViewData()
formattedData.value = formatData(response.list)
paginationData.value = response.pageInfo
@@ -251,11 +251,11 @@ export function useViewData(
}
}
- async function updateOrSaveRow(row: Row, property: string) {
+ async function updateOrSaveRow(row: Row, property?: string) {
if (row.rowMeta.new) {
return await insertRow(row.row, formattedData.value.indexOf(row))
} else {
- await updateRowProperty(row, property)
+ await updateRowProperty(row, property!)
}
}
diff --git a/packages/nc-gui/pages/[projectType]/[projectId]/index/index/[type]/[title]/[[viewTitle]].vue b/packages/nc-gui/pages/[projectType]/[projectId]/index/index/[type]/[title]/[[viewTitle]].vue
index ce973167a6..ee6297069c 100644
--- a/packages/nc-gui/pages/[projectType]/[projectId]/index/index/[type]/[title]/[[viewTitle]].vue
+++ b/packages/nc-gui/pages/[projectType]/[projectId]/index/index/[type]/[title]/[[viewTitle]].vue
@@ -1,6 +1,6 @@
-
+
|