Browse Source

refactor: disable hm option in cloud and make relation virtual

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5272/head
Pranav C 2 years ago
parent
commit
a5bfaf90ad
  1. 12
      packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue
  2. 5
      packages/nc-gui/components/webhook/Editor.vue
  3. 1
      packages/nc-gui/pages/account/index/[page].vue
  4. 12
      packages/nocodb/src/lib/controllers/plugin.ctl.ts

12
packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue

@ -10,6 +10,8 @@ const props = defineProps<{
const emit = defineEmits(['update:value'])
const { appInfo } = $(useGlobal())
const vModel = useVModel(props, 'value', emit)
const meta = $(inject(MetaInj, ref()))
@ -31,10 +33,10 @@ if (!vModel.value.childTable) vModel.value.childTable = meta?.table_name
if (!vModel.value.parentTable) vModel.value.parentTable = vModel.value.rtn || ''
if (!vModel.value.parentColumn) vModel.value.parentColumn = vModel.value.rcn || ''
if (!vModel.value.type) vModel.value.type = 'hm'
if (!vModel.value.type) vModel.value.type = appInfo.isCloud ? 'mm' : 'hm'
if (!vModel.value.onUpdate) vModel.value.onUpdate = onUpdateDeleteOptions[0]
if (!vModel.value.onDelete) vModel.value.onDelete = onUpdateDeleteOptions[0]
if (!vModel.value.virtual) vModel.value.virtual = sqlUi === SqliteUi
if (!vModel.value.virtual) vModel.value.virtual = appInfo.isCloud || sqlUi === SqliteUi
if (!vModel.value.alias) vModel.value.alias = vModel.value.column_name
const advancedOptions = $(ref(false))
@ -55,7 +57,7 @@ const filterOption = (value: string, option: { key: string }) => option.key.toLo
<div class="border-2 p-6">
<a-form-item v-bind="validateInfos.type" class="nc-ltar-relation-type">
<a-radio-group v-model:value="vModel.type" name="type" v-bind="validateInfos.type">
<a-radio value="hm">Has Many</a-radio>
<a-radio value="hm" :disabled="appInfo.isCloud">Has Many</a-radio>
<a-radio value="mm">Many To Many</a-radio>
</a-radio-group>
</a-form-item>
@ -127,7 +129,9 @@ const filterOption = (value: string, option: { key: string }) => option.key.toLo
<div class="flex flex-row">
<a-form-item>
<a-checkbox v-model:checked="vModel.virtual" name="virtual" @change="onDataTypeChange">Virtual Relation</a-checkbox>
<a-checkbox v-model:checked="vModel.virtual" :disabled="appInfo.isCloud" name="virtual" @change="onDataTypeChange"
>Virtual Relation</a-checkbox
>
</a-form-item>
</div>
</div>

5
packages/nc-gui/components/webhook/Editor.vue

@ -313,6 +313,7 @@ async function onEventChange() {
}
async function loadPluginList() {
if (appInfo.isCloud) return
try {
const plugins = (await api.plugin.list()).list!
@ -421,9 +422,7 @@ watch(
{ immediate: true },
)
onMounted(() => {
if (!appInfo.isCoud) loadPluginList()
})
onMounted(loadPluginList)
</script>
<template>

1
packages/nc-gui/pages/account/index/[page].vue

@ -1,6 +1,7 @@
<script setup lang="ts">
const { appInfo } = useGlobal()
</script>
<template>
<AccountUserManagement v-if="$route.params.page === 'users'" />
<AccountToken v-else-if="$route.params.page === 'tokens'" />

12
packages/nocodb/src/lib/controllers/plugin.ctl.ts

@ -35,35 +35,41 @@ export async function isPluginActive(req: Request, res: Response) {
);
}
const router = Router({ mergeParams: true });
router.use((_req, res, next) => {
const blockInCloudMw = (_req, res, next) => {
if (process.env.NC_CLOUD) {
res.status(403).send('Not allowed');
} else next();
});
}
const router = Router({ mergeParams: true });
router.get(
'/api/v1/db/meta/plugins',
blockInCloudMw,
metaApiMetrics,
ncMetaAclMw(pluginList, 'pluginList')
);
router.post(
'/api/v1/db/meta/plugins/test',
metaApiMetrics,
blockInCloudMw,
ncMetaAclMw(pluginTest, 'pluginTest')
);
router.get(
'/api/v1/db/meta/plugins/:pluginId',
metaApiMetrics,
blockInCloudMw,
ncMetaAclMw(pluginRead, 'pluginRead')
);
router.patch(
'/api/v1/db/meta/plugins/:pluginId',
metaApiMetrics,
blockInCloudMw,
ncMetaAclMw(pluginUpdate, 'pluginUpdate')
);
router.get(
'/api/v1/db/meta/plugins/:pluginTitle/status',
metaApiMetrics,
blockInCloudMw,
ncMetaAclMw(isPluginActive, 'isPluginActive')
);
export default router;

Loading…
Cancel
Save