Browse Source

refactor/gui-v2-store-fixed-styling

pull/2798/head
Muhammed Mustafa 2 years ago
parent
commit
fe21eabf6c
  1. 45
      packages/nc-gui-v2/components/dashboard/settings/AppStore/AppInstall.vue
  2. 12
      packages/nc-gui-v2/components/dashboard/settings/AppStore/index.vue

45
packages/nc-gui-v2/components/dashboard/settings/AppStore/AppInstall.vue

@ -3,6 +3,7 @@ import { ref } from 'vue'
import { useToast } from 'vue-toastification' import { useToast } from 'vue-toastification'
import type { PluginType } from 'nocodb-sdk' import type { PluginType } from 'nocodb-sdk'
import MdiDeleteOutlineIcon from '~icons/mdi/delete-outline' import MdiDeleteOutlineIcon from '~icons/mdi/delete-outline'
import CloseIcon from '~icons/material-symbols/close-rounded'
import MdiPlusIcon from '~icons/mdi/plus' import MdiPlusIcon from '~icons/mdi/plus'
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' import { extractSdkResponseErrorMsg } from '~/utils/errorUtils'
@ -17,7 +18,7 @@ type Plugin = PluginType & {
const { id } = defineProps<Props>() const { id } = defineProps<Props>()
const emits = defineEmits(['saved']) const emits = defineEmits(['saved', 'close'])
enum Action { enum Action {
Save = 'save', Save = 'save',
@ -35,6 +36,11 @@ let pluginFormData = $ref<Record<string, any>>({})
let isLoading = $ref(true) let isLoading = $ref(true)
let loadingAction = $ref<null | Action>(null) let loadingAction = $ref<null | Action>(null)
const layout = {
labelCol: { span: 10 },
wrapperCol: { span: 16 },
}
const addSetting = () => pluginFormData.push({}) const addSetting = () => pluginFormData.push({})
const saveSettings = async () => { const saveSettings = async () => {
@ -130,6 +136,7 @@ onMounted(async () => {
<template v-else> <template v-else>
<div class="flex flex-col"> <div class="flex flex-col">
<div class="w-full relative">
<div class="flex flex-row justify-center pb-4 mb-2 border-b-1 w-full gap-x-1"> <div class="flex flex-row justify-center pb-4 mb-2 border-b-1 w-full gap-x-1">
<div <div
v-if="plugin.logo" v-if="plugin.logo"
@ -141,10 +148,19 @@ onMounted(async () => {
<span class="font-semibold text-lg">{{ plugin.formDetails.title }}</span> <span class="font-semibold text-lg">{{ plugin.formDetails.title }}</span>
</div> </div>
<div class="absolute -right-2 -top-0.5">
<a-button type="text" class="!rounded-md mr-1" @click="emits('close')">
<template #icon>
<CloseIcon class="flex mx-auto" />
</template>
</a-button>
</div>
</div>
<a-form ref="formRef" :model="pluginFormData" class="mx-auto mt-2"> <a-form ref="formRef" v-bind="plugin?.formDetails.array ? {} : layout" :model="pluginFormData" class="mx-4 mt-3">
<!-- Form with multiple entry --> <!-- Form with multiple entry -->
<table v-if="plugin.formDetails.array" class="form-table"> <div v-if="plugin.formDetails.array" class="flex flex-row justify-center">
<table class="form-table">
<thead> <thead>
<tr> <tr>
<th v-for="(columnData, columnIndex) in plugin.formDetails.items" :key="columnIndex"> <th v-for="(columnData, columnIndex) in plugin.formDetails.items" :key="columnIndex">
@ -158,6 +174,7 @@ onMounted(async () => {
<tr v-for="(itemRow, itemIndex) in plugin.parsedInput" :key="itemIndex"> <tr v-for="(itemRow, itemIndex) in plugin.parsedInput" :key="itemIndex">
<td v-for="(columnData, columnIndex) in plugin.formDetails.items" :key="columnIndex" class="px-2"> <td v-for="(columnData, columnIndex) in plugin.formDetails.items" :key="columnIndex" class="px-2">
<a-form-item <a-form-item
class="relative mb-3"
:name="[`${itemIndex}`, columnData.key]" :name="[`${itemIndex}`, columnData.key]"
:rules="[{ required: columnData.required, message: `${columnData.label} is required` }]" :rules="[{ required: columnData.required, message: `${columnData.label} is required` }]"
> >
@ -177,17 +194,20 @@ onMounted(async () => {
:placeholder="columnData.placeholder" :placeholder="columnData.placeholder"
/> />
<a-input v-else v-model:value="itemRow[columnData.key]" :placeholder="columnData.placeholder" /> <a-input v-else v-model:value="itemRow[columnData.key]" :placeholder="columnData.placeholder" />
</a-form-item> <div
</td> v-if="itemIndex !== 0 && columnIndex === plugin.formDetails.items.length - 1"
<td v-if="itemIndex !== 0" class="pb-4"> class="absolute flex flex-col justify-start mt-2 -right-6 top-0"
>
<MdiDeleteOutlineIcon class="hover:text-red-400 cursor-pointer" @click="deleteFormRow(itemIndex)" /> <MdiDeleteOutlineIcon class="hover:text-red-400 cursor-pointer" @click="deleteFormRow(itemIndex)" />
</div>
</a-form-item>
</td> </td>
</tr> </tr>
</tbody> </tbody>
<tr> <tr>
<td :colspan="plugin.formDetails.items.length" class="text-center"> <td :colspan="plugin.formDetails.items.length" class="text-center">
<a-button type="default" class="!bg-gray-100 rounded-md border-none" @click="addSetting"> <a-button type="default" class="!bg-gray-100 rounded-md border-none mr-1" @click="addSetting">
<template #icon> <template #icon>
<MdiPlusIcon class="flex mx-auto" /> <MdiPlusIcon class="flex mx-auto" />
</template> </template>
@ -195,6 +215,7 @@ onMounted(async () => {
</td> </td>
</tr> </tr>
</table> </table>
</div>
<!-- Form with only one entry --> <!-- Form with only one entry -->
<div v-else> <div v-else>
@ -240,12 +261,4 @@ onMounted(async () => {
</template> </template>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss"></style>
.form-table {
@apply border-none min-w-[400px];
}
tbody tr:nth-of-type(odd) {
@apply bg-transparent;
}
</style>

12
packages/nc-gui-v2/components/dashboard/settings/AppStore/index.vue

@ -70,7 +70,7 @@ onMounted(async () => {
</script> </script>
<template> <template>
<a-modal v-model:visible="showPluginInstallModal" min-width="400px" max-width="700px" min-height="300" :footer="null"> <a-modal v-model:visible="showPluginInstallModal" :closable="false" centered min-height="300" :footer="null">
<AppInstall <AppInstall
v-if="pluginApp && showPluginInstallModal" v-if="pluginApp && showPluginInstallModal"
:id="pluginApp.id" :id="pluginApp.id"
@ -91,16 +91,6 @@ onMounted(async () => {
</div> </div>
</a-modal> </a-modal>
<v-dialog min-width="400px" max-width="700px" min-height="300">
<v-card v-if="pluginApp">
<v-card-text> Please confirm to reset {{ pluginApp.title }} </v-card-text>
<v-card-actions>
<v-btn color="primary" @click="resetPlugin"> Yes </v-btn>
<v-btn @click="showPluginUninstallModal = false"> No </v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<div class="h-full overflow-y-scroll grid grid-cols-2 gap-x-2 gap-y-4"> <div class="h-full overflow-y-scroll grid grid-cols-2 gap-x-2 gap-y-4">
<a-card <a-card
v-for="(app, i) in apps" v-for="(app, i) in apps"

Loading…
Cancel
Save