Browse Source

PR fixes: geodata column layout, expanded form in shared view

pull/4749/head
flisowna 2 years ago
parent
commit
18719c0a4a
  1. 17
      packages/nc-gui/components/cell/GeoData.vue
  2. 11
      packages/nc-gui/components/smartsheet/Map.vue
  3. 3
      tests/playwright/pages/Dashboard/index.ts

17
packages/nc-gui/components/cell/GeoData.vue

@ -1,6 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { GeoLocationType } from 'nocodb-sdk' import type { GeoLocationType } from 'nocodb-sdk'
import { Modal as AModal, latLongToJoinedString, useVModel } from '#imports' import { Modal as AModal, latLongToJoinedString, useVModel } from '#imports'
import GeoDataIcon from '~icons/mdi/map-marker'
interface Props { interface Props {
modelValue?: string | null modelValue?: string | null
@ -20,10 +21,13 @@ let isExpanded = $ref(false)
let isLoading = $ref(false) let isLoading = $ref(false)
let isLocationSet = $ref(false)
const [latitude, longitude] = (vModel.value || '').split(';') const [latitude, longitude] = (vModel.value || '').split(';')
const latLongStr = computed(() => { const latLongStr = computed(() => {
const [latitude, longitude] = (vModel.value || '').split(';') const [latitude, longitude] = (vModel.value || '').split(';')
if (latitude) isLocationSet = true
return latitude && longitude ? `${latitude}; ${longitude}` : 'Set location' return latitude && longitude ? `${latitude}; ${longitude}` : 'Set location'
}) })
@ -69,7 +73,18 @@ const onClickSetCurrentLocation = () => {
<template> <template>
<a-dropdown :is="isExpanded ? AModal : 'div'" v-model:visible="isExpanded" trigger="click"> <a-dropdown :is="isExpanded ? AModal : 'div'" v-model:visible="isExpanded" trigger="click">
<a-button>{{ latLongStr }}</a-button> <div
v-if="!isLocationSet"
class="group cursor-pointer flex gap-1 items-center mx-auto max-w-32 justify-center active:(ring ring-accent ring-opacity-100) rounded border-1 p-1 shadow-sm hover:(bg-primary bg-opacity-10) dark:(!bg-slate-500)"
>
<div class="flex items-center gap-2">
<GeoDataIcon class="transform dark:(!text-white) group-hover:(!text-accent scale-120) text-gray-500 text-[0.75rem]" />
<div class="group-hover:text-primary text-gray-500 dark:text-gray-200 dark:group-hover:!text-white text-xs">
{{ latLongStr }}
</div>
</div>
</div>
<div v-else>{{ latLongStr }}</div>
<template #overlay> <template #overlay>
<a-form :model="formState" class="flex flex-col" @finish="handleFinish"> <a-form :model="formState" class="flex flex-col" @finish="handleFinish">
<a-form-item> <a-form-item>

11
packages/nc-gui/components/smartsheet/Map.vue

@ -3,7 +3,7 @@ import 'leaflet/dist/leaflet.css'
import L, { LatLng } from 'leaflet' import L, { LatLng } from 'leaflet'
import 'leaflet.markercluster' import 'leaflet.markercluster'
import { ViewTypes } from 'nocodb-sdk' import { ViewTypes } from 'nocodb-sdk'
import { OpenNewRecordFormHookInj, latLongToJoinedString, onMounted, provide, ref } from '#imports' import { OpenNewRecordFormHookInj, latLongToJoinedString, onMounted, provide, ref, IsPublicInj } from '#imports'
import type { Row as RowType } from '~/lib' import type { Row as RowType } from '~/lib'
const route = useRoute() const route = useRoute()
@ -23,6 +23,8 @@ const mapContainerRef = ref<HTMLElement>()
const myMapRef = ref<L.Map>() const myMapRef = ref<L.Map>()
const isPublic = inject(IsPublicInj, ref(false))
const meta = inject(MetaInj, ref()) const meta = inject(MetaInj, ref())
const view = inject(ActiveViewInj, ref()) const view = inject(ActiveViewInj, ref())
@ -199,7 +201,6 @@ watch(view, async (nextView) => {
}) })
const count = computed(() => paginationData.value.totalRows) const count = computed(() => paginationData.value.totalRows)
</script> </script>
<template> <template>
@ -219,8 +220,7 @@ const count = computed(() => paginationData.value.totalRows)
</a-tooltip> </a-tooltip>
</div> </div>
</div> </div>
<Suspense v-if="!isPublic">
<Suspense>
<LazySmartsheetExpandedForm <LazySmartsheetExpandedForm
v-if="expandedFormRow && expandedFormDlg" v-if="expandedFormRow && expandedFormDlg"
v-model="expandedFormDlg" v-model="expandedFormDlg"
@ -230,8 +230,7 @@ const count = computed(() => paginationData.value.totalRows)
:view="view" :view="view"
/> />
</Suspense> </Suspense>
<Suspense v-if="!isPublic">
<Suspense>
<LazySmartsheetExpandedForm <LazySmartsheetExpandedForm
v-if="expandedFormOnRowIdDlg" v-if="expandedFormOnRowIdDlg"
:key="route.query.rowId" :key="route.query.rowId"

3
tests/playwright/pages/Dashboard/index.ts

@ -10,6 +10,7 @@ import { SettingsPage } from './Settings';
import { ViewSidebarPage } from './ViewSidebar'; import { ViewSidebarPage } from './ViewSidebar';
import { GalleryPage } from './Gallery'; import { GalleryPage } from './Gallery';
import { KanbanPage } from './Kanban'; import { KanbanPage } from './Kanban';
import { MapPage } from './Map';
import { ImportAirtablePage } from './Import/Airtable'; import { ImportAirtablePage } from './Import/Airtable';
import { ImportTemplatePage } from './Import/ImportTemplate'; import { ImportTemplatePage } from './Import/ImportTemplate';
import { WebhookFormPage } from './WebhookForm'; import { WebhookFormPage } from './WebhookForm';
@ -24,6 +25,7 @@ export class DashboardPage extends BasePage {
readonly gallery: GalleryPage; readonly gallery: GalleryPage;
readonly form: FormPage; readonly form: FormPage;
readonly kanban: KanbanPage; readonly kanban: KanbanPage;
readonly map: MapPage;
readonly expandedForm: ExpandedFormPage; readonly expandedForm: ExpandedFormPage;
readonly webhookForm: WebhookFormPage; readonly webhookForm: WebhookFormPage;
readonly childList: ChildList; readonly childList: ChildList;
@ -43,6 +45,7 @@ export class DashboardPage extends BasePage {
this.gallery = new GalleryPage(this); this.gallery = new GalleryPage(this);
this.form = new FormPage(this); this.form = new FormPage(this);
this.kanban = new KanbanPage(this); this.kanban = new KanbanPage(this);
this.map = new MapPage(this);
this.expandedForm = new ExpandedFormPage(this); this.expandedForm = new ExpandedFormPage(this);
this.webhookForm = new WebhookFormPage(this); this.webhookForm = new WebhookFormPage(this);
this.childList = new ChildList(this); this.childList = new ChildList(this);

Loading…
Cancel
Save