Browse Source

feat: generic button

pull/6336/head
sreehari jayaraj 1 year ago
parent
commit
53ec221c5a
  1. 54
      packages/nc-gui/components/dashboard/settings/data-sources/EditBase.vue

54
packages/nc-gui/components/dashboard/settings/data-sources/EditBase.vue

@ -234,6 +234,8 @@ const editBase = async () => {
} }
} }
const isConnSuccess = ref(false)
const testConnection = async () => { const testConnection = async () => {
try { try {
await validate() await validate()
@ -261,17 +263,7 @@ const testConnection = async () => {
if (result.code === 0) { if (result.code === 0) {
testSuccess.value = true testSuccess.value = true
isConnSuccess.value = true
Modal.confirm({
title: t('msg.info.dbConnected'),
icon: null,
type: 'success',
okText: 'Ok & Edit Base',
okType: 'primary',
cancelText: t('general.cancel'),
onOk: editBase,
style: 'top: 30%!important',
})
} else { } else {
testSuccess.value = false testSuccess.value = false
@ -472,9 +464,9 @@ onMounted(async () => {
</a-form-item> </a-form-item>
<!-- Use Connection URL --> <!-- Use Connection URL -->
<div class="flex justify-end gap-2"> <div class="flex justify-end gap-2">
<a-button type="primary" class="nc-extdb-btn-import-url !rounded-md" @click.stop="importURLDlg = true"> <NcButton size="small" type="primary" class="nc-extdb-btn-import-url !rounded-md" @click.stop="importURLDlg = true">
{{ $t('activity.useConnectionUrl') }} {{ $t('activity.useConnectionUrl') }}
</a-button> </NcButton>
</div> </div>
<a-collapse ghost expand-icon-position="right" class="!mt-6"> <a-collapse ghost expand-icon-position="right" class="!mt-6">
<a-collapse-panel key="1"> <a-collapse-panel key="1">
@ -578,10 +570,10 @@ onMounted(async () => {
</a-form-item> </a-form-item>
<div class="flex justify-end"> <div class="flex justify-end">
<a-button type="primary" class="!rounded-md" @click="handleEditJSON()"> <NcButton size="small" type="primary" class="!rounded-md" @click="handleEditJSON()">
<!-- Edit connection JSON --> <!-- Edit connection JSON -->
{{ $t('activity.editConnJson') }} {{ $t('activity.editConnJson') }}
</a-button> </NcButton>
</div> </div>
</a-collapse-panel> </a-collapse-panel>
</a-collapse> </a-collapse>
@ -590,13 +582,19 @@ onMounted(async () => {
<a-form-item class="flex justify-end !mt-5"> <a-form-item class="flex justify-end !mt-5">
<div class="flex justify-end gap-2"> <div class="flex justify-end gap-2">
<a-button type="secondary" class="nc-extdb-btn-test-connection !rounded-md" @click="testConnection"> <NcButton type="secondary" size="small" class="nc-extdb-btn-test-connection !rounded-md" @click="testConnection">
{{ $t('activity.testDbConn') }} {{ $t('activity.testDbConn') }}
</a-button> </NcButton>
<a-button type="primary" :disabled="!testSuccess" class="nc-extdb-btn-submit !rounded-md" @click="editBase"> <NcButton
size="small"
type="primary"
:disabled="!testSuccess"
class="nc-extdb-btn-submit !rounded-md"
@click="editBase"
>
{{ $t('general.submit') }} {{ $t('general.submit') }}
</a-button> </NcButton>
</div> </div>
</a-form-item> </a-form-item>
<div class="w-full flex items-center mt-2 text-[#e65100]"> <div class="w-full flex items-center mt-2 text-[#e65100]">
@ -629,16 +627,16 @@ onMounted(async () => {
</a-modal> </a-modal>
</div> </div>
<!-- connection succesfull modal --> <!-- connection succesfull modal -->
<GeneralModal v-model:visible="isConnSuccess" class="!w-[25rem]"> <GeneralModal v-model:visible="isConnSuccess" class="!w-[25rem]">
<div class="flex flex-col h-full p-8"> <div class="flex flex-col h-full p-8">
<div class="text-lg font-semibold self-start mb-4">{{ t('msg.info.dbConnected') }}</div> <div class="text-lg font-semibold self-start mb-4">{{ t('msg.info.dbConnected') }}</div>
<div class="flex gap-x-2 mt-5 ml-7 pt-2.5 justify-end"> <div class="flex gap-x-2 mt-5 ml-7 pt-2.5 justify-end">
<NcButton key="back" type="secondary" @click="isConnSuccess = false">{{ $t('general.cancel') }}</NcButton> <NcButton key="back" type="secondary" @click="isConnSuccess = false">{{ $t('general.cancel') }}</NcButton>
<NcButton key="submit" type="primary" @click="createBase">Ok & Add Base</NcButton> <NcButton key="submit" type="primary" @click="editBase">Ok & Edit Base</NcButton>
</div>
</div> </div>
</GeneralModal> </div>
</GeneralModal>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

Loading…
Cancel
Save