From 174ae68f56da0c47b210e245bc4d008b6dd29912 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 25 Aug 2022 12:53:14 +0530 Subject: [PATCH] chore(gui-v2): group imports and rename arg Signed-off-by: Pranav C --- .../composables/useExpandedFormStore.ts | 2 +- packages/nc-gui-v2/composables/useViewData.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/nc-gui-v2/composables/useExpandedFormStore.ts b/packages/nc-gui-v2/composables/useExpandedFormStore.ts index 76437ef8e7..6f0cb3f829 100644 --- a/packages/nc-gui-v2/composables/useExpandedFormStore.ts +++ b/packages/nc-gui-v2/composables/useExpandedFormStore.ts @@ -7,6 +7,7 @@ import { NOCO, extractPkFromRow, extractSdkResponseErrorMsg, + getHTMLEncodedText, useApi, useInjectionState, useNuxtApp, @@ -14,7 +15,6 @@ import { useProvideSmartsheetRowStore, } from '#imports' import type { Row } from '~/composables' -import { getHTMLEncodedText } from '~/utils' const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((meta: Ref, row: Ref) => { const { $e, $state, $api } = useNuxtApp() diff --git a/packages/nc-gui-v2/composables/useViewData.ts b/packages/nc-gui-v2/composables/useViewData.ts index dd444abc5c..96caec58f3 100644 --- a/packages/nc-gui-v2/composables/useViewData.ts +++ b/packages/nc-gui-v2/composables/useViewData.ts @@ -7,10 +7,10 @@ import { NOCO, extractPkFromRow, extractSdkResponseErrorMsg, + getHTMLEncodedText, useProject, useUIPermission, } from '#imports' -import { getHTMLEncodedText } from '~/utils' const formatData = (list: Record[]) => list.map((row) => ({ @@ -165,11 +165,11 @@ export function useViewData( } } - const updateRowProperty = async (row: Row, property: string) => { + const updateRowProperty = async (toUpdate: Row, property: string) => { try { const id = meta?.value?.columns ?.filter((c) => c.pk) - .map((c) => row.row[c.title as string]) + .map((c) => toUpdate.row[c.title as string]) .join('___') as string const updatedRowData = await $api.dbViewRow.update( @@ -179,7 +179,7 @@ export function useViewData( viewMeta?.value?.id as string, id, { - [property]: row.row[property], + [property]: toUpdate.row[property], }, // todo: // { @@ -192,14 +192,14 @@ export function useViewData( fk_model_id: meta?.value.id as string, column_name: property, row_id: id, - value: getHTMLEncodedText(row.row[property]), - prev_value: getHTMLEncodedText(row.oldRow[property]), + value: getHTMLEncodedText(toUpdate.row[property]), + prev_value: getHTMLEncodedText(toUpdate.oldRow[property]), }) .catch(() => {}) /** update row data(to sync formula and other related columns) */ - Object.assign(row.row, updatedRowData) - Object.assign(row.oldRow, updatedRowData) + Object.assign(toUpdate.row, updatedRowData) + Object.assign(toUpdate.oldRow, updatedRowData) } catch (e: any) { message.error(`Row update failed ${await extractSdkResponseErrorMsg(e)}`) }