Browse Source

clean code

pull/4723/head
flisowna 2 years ago
parent
commit
832c4adf8b
  1. 13
      packages/nc-gui/components/cell/GeoData.vue
  2. 8
      packages/nc-gui/components/smartsheet/Map.vue
  3. 18
      packages/nc-gui/components/smartsheet/sidebar/toolbar/GeodataSwitcher.vue
  4. 3
      packages/nc-gui/composables/useMapViewDataStore.ts

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

@ -3,7 +3,6 @@ import type { GeoLocationType } from 'nocodb-sdk'
import { useVModel } from '#imports'
interface Props {
// modelValue?: GeoLocationType | null
modelValue?: string | null
}
@ -15,14 +14,8 @@ const props = defineProps<Props>()
const emits = defineEmits<Emits>()
// const editEnabled = inject(EditModeInj)
// const isForm = inject(IsFormInj, ref(false))
const vModel = useVModel(props, 'modelValue', emits)
// const localValueState = ref<string | undefined>()
let error = $ref<string | undefined>()
let isExpanded = $ref(false)
@ -36,7 +29,6 @@ const latLongStr = computed(() => {
return latitude && longitude ? `${latitude}; ${longitude}` : 'Set location'
})
const formState = reactive({
latitude,
longitude,
@ -54,7 +46,6 @@ const clear = () => {
formState.latitude = latitude
formState.longitude = longitude
console.log(`clear - formState: `, formState)
}
const onGetCurrentLocation = () => {
@ -92,8 +83,8 @@ const onGetCurrentLocation = () => {
<a-input v-model:value="formState.longitude" type="number" step="0.0000001" required :min="-180" :max="180" />
</a-form-item>
<a-form-item class="flex align-center location">
<MdiReload v-if="isLoading" :class="{ 'animate-infinite animate-spin': isLoading }" />
<a-button @click="onGetCurrentLocation">Your Location</a-button>
<MdiReload v-if="isLoading" :class="{ 'animate-infinite animate-spin text-gray-500': isLoading }" />
<a-button class="ml-2" @click="onGetCurrentLocation">Your Location</a-button>
</a-form-item>
<a-form-item class="buttons">
<a-button type="text" @click="clear">Cancel</a-button>

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

@ -135,14 +135,6 @@ onMounted(async () => {
localStorage.setItem(getMapCenterLocalStorageKey(mapMetaData?.value?.fk_view_id), JSON.stringify(myMap.getCenter()))
}
})
// myMap.on('contextmenu', async function (e) {
// // const newRow = await addEmptyRow()
// const lat = e.latlng.lat
// const lng = e.latlng.lng
// addMarker(lat, lng, newRow)
// expandForm(newRow)
// // submitForm()
// })
})
reloadViewMetaHook?.on(async () => {

18
packages/nc-gui/components/smartsheet/sidebar/toolbar/GeodataSwitcher.vue

@ -1,24 +1,7 @@
<script setup lang="ts">
import { IsGeodataActiveInj, ReadonlyInj, useGlobal } from '#imports'
// import { geodataToggleState } from ''
// const { t } = useI18n()
// const { api } = useApi()
// const { includeM2M } = useGlobal()
// const GeoDataToggleRef = ref(true)
// provide(IsGeodataActiveInj, GeoDataToggleRef)
// provide(ReadonlyInj, GeoDataToggleRef)
async function toggleGeodataFeature() {
geodataToggleState.show = !geodataToggleState.show
// console.log(GeoDataToggleRef.value)
}
// watch(FOO?.value, () => {
// console.log('FOO FOO?.value', FOO?.value)
// })
</script>
<template>
@ -26,7 +9,6 @@ async function toggleGeodataFeature() {
<template #title>
<span> Toggle GeoData </span>
</template>
<!-- <div style="{{fontSize: '5px';}}"></div> -->
<mdi-map-marker class="cursor-pointer" @click="toggleGeodataFeature" />
</a-tooltip>
</template>

3
packages/nc-gui/composables/useMapViewDataStore.ts

@ -6,8 +6,6 @@ import type { Row } from '~/lib'
export const geodataToggleState = reactive({ show: false })
// const { project, isSharedBase } = useProject()
const formatData = (list: Row[]) =>
list.map((row) => ({
row: { ...row },
@ -38,7 +36,6 @@ const [useProvideMapViewStore, useMapViewStore] = useInjectionState(
const paginationData = ref<PaginatedType>({ page: 1, pageSize: appInfoDefaultLimit })
const queryParams = computed(() => ({
// offset: ((paginationData.value.page ?? 0) - 1) * (paginationData.value.pageSize ?? appInfoDefaultLimit),
limit: paginationData.value.pageSize ?? appInfoDefaultLimit,
where: where?.value ?? '',
}))

Loading…
Cancel
Save