mirror of https://github.com/nocodb/nocodb
Browse Source
* feat: allow partial column update (GUI) * feat: allow partial column update (backend) * refactor: swagger schema description correction * feat: allow edit from multi field editor * fix: allow meta update in api level * fix: add tooltip and docs link * fix: multi field editor corrections * fix: allow table meta update * fix: allow table meta update * fix: allow column validation update * fix: block adding new option directly from cell * fix: add tooltip for column menu options * refactor: tooltips * test: replace index with count as parameter * fix: corrections * refactor: hint text updatepull/8822/head
Pranav C
5 months ago
committed by
GitHub
38 changed files with 586 additions and 296 deletions
@ -0,0 +1,64 @@ |
|||||||
|
<script setup lang="ts"> |
||||||
|
const props = defineProps<{ |
||||||
|
allowMetaWrite: boolean |
||||||
|
allowDataWrite: boolean |
||||||
|
}>() |
||||||
|
|
||||||
|
const emits = defineEmits(['update:allowMetaWrite', 'update:allowDataWrite']) |
||||||
|
|
||||||
|
const dataWrite = useVModel(props, 'allowDataWrite', emits) |
||||||
|
const metaWrite = useVModel(props, 'allowMetaWrite', emits) |
||||||
|
</script> |
||||||
|
|
||||||
|
<template> |
||||||
|
<a-form-item> |
||||||
|
<template #help> |
||||||
|
<span class="text-small"> |
||||||
|
{{ $t('tooltip.allowDataWrite') }} |
||||||
|
</span> |
||||||
|
</template> |
||||||
|
<template #label> |
||||||
|
<div class="flex gap-1 justify-end"> |
||||||
|
<span> |
||||||
|
{{ $t('labels.allowDataWrite') }} |
||||||
|
</span> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
<div class="flex justify-start"> |
||||||
|
<NcTooltip :disabled="!metaWrite" placement="topLeft"> |
||||||
|
<template #title> |
||||||
|
{{ $t('tooltip.dataWriteOptionDisabled') }} |
||||||
|
</template> |
||||||
|
<a-switch v-model:checked="dataWrite" :disabled="metaWrite" data-testid="nc-allow-data-write" size="small"></a-switch> |
||||||
|
</NcTooltip> |
||||||
|
</div> |
||||||
|
</a-form-item> |
||||||
|
<a-form-item> |
||||||
|
<template #help> |
||||||
|
<span class="text-small"> |
||||||
|
<span class="font-weight-medium" :class="{ 'nc-allow-meta-write-help': metaWrite }"> |
||||||
|
{{ $t('labels.notRecommended') }}: |
||||||
|
</span> |
||||||
|
{{ $t('tooltip.allowMetaWrite') }} |
||||||
|
</span> |
||||||
|
</template> |
||||||
|
<template #label> |
||||||
|
<div class="flex gap-1 justify-end"> |
||||||
|
<span> |
||||||
|
{{ $t('labels.allowMetaWrite') }} |
||||||
|
</span> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
<a-switch v-model:checked="metaWrite" data-testid="nc-allow-meta-write" class="nc-allow-meta-write" size="small"></a-switch> |
||||||
|
</a-form-item> |
||||||
|
</template> |
||||||
|
|
||||||
|
<style scoped> |
||||||
|
.nc-allow-meta-write.ant-switch-checked { |
||||||
|
background: #b33870; |
||||||
|
} |
||||||
|
|
||||||
|
.nc-allow-meta-write-help { |
||||||
|
color: #b33870; |
||||||
|
} |
||||||
|
</style> |
@ -0,0 +1,39 @@ |
|||||||
|
<script setup lang="ts"> |
||||||
|
import type { TooltipPlacement } from 'ant-design-vue/es/tooltip' |
||||||
|
import type { CSSProperties } from '@vue/runtime-dom' |
||||||
|
|
||||||
|
defineProps<{ |
||||||
|
tooltipStyle?: CSSProperties |
||||||
|
overlayInnerStyle?: CSSProperties |
||||||
|
mouseLeaveDelay?: number |
||||||
|
placement?: TooltipPlacement |
||||||
|
trigger?: 'hover' | 'click' |
||||||
|
message?: string |
||||||
|
enabled?: boolean |
||||||
|
}>() |
||||||
|
</script> |
||||||
|
|
||||||
|
<template> |
||||||
|
<NcTooltip |
||||||
|
:disabled="!enabled" |
||||||
|
:tooltip-style="{ 'min-width': 'max-content' }" |
||||||
|
:overlay-inner-style="{ 'min-width': 'max-content' }" |
||||||
|
:mouse-leave-delay="0.3" |
||||||
|
placement="left" |
||||||
|
trigger="hover" |
||||||
|
> |
||||||
|
<template #title> |
||||||
|
{{ $t('tooltip.schemaChangeDisabled') }} <br /> |
||||||
|
{{ message }} |
||||||
|
<br v-if="message" /> |
||||||
|
<a |
||||||
|
class="!text-current" |
||||||
|
href="https://docs.nocodb.com/data-sources/connect-to-data-source#configuring-permissions" |
||||||
|
target="_blank" |
||||||
|
> |
||||||
|
Learn more |
||||||
|
</a> |
||||||
|
</template> |
||||||
|
<slot /> |
||||||
|
</NcTooltip> |
||||||
|
</template> |
@ -0,0 +1,92 @@ |
|||||||
|
// based on source restriction decide the icon color
|
||||||
|
import type { SourceType } from 'nocodb-sdk' |
||||||
|
import { clientTypes } from '~/utils/baseCreateUtils' |
||||||
|
|
||||||
|
export const getSourceIconColor = (source: SourceType) => { |
||||||
|
if (source.is_schema_readonly && source.is_data_readonly) { |
||||||
|
return '#278bff' |
||||||
|
} |
||||||
|
if (source.is_schema_readonly) { |
||||||
|
return '#df830f' |
||||||
|
} |
||||||
|
return '#de0062' |
||||||
|
} |
||||||
|
|
||||||
|
// based on source restriction decide the tooltip message with docs link
|
||||||
|
export const getSourceTooltip = (source: SourceType) => { |
||||||
|
const dbLabel = `Connection type is ${clientTypes.find((c) => c.value === source.type)?.text || source.type?.toUpperCase()}.` |
||||||
|
|
||||||
|
if (source.is_schema_readonly && source.is_data_readonly) { |
||||||
|
return h( |
||||||
|
'div', |
||||||
|
{ |
||||||
|
className: 'w-max', |
||||||
|
}, |
||||||
|
[ |
||||||
|
dbLabel, |
||||||
|
h('br'), |
||||||
|
'Both data and schema editing are disabled.', |
||||||
|
h('br'), |
||||||
|
'These settings are ideal for read-only use cases of your data.', |
||||||
|
h('br'), |
||||||
|
h( |
||||||
|
'a', |
||||||
|
{ |
||||||
|
className: '!text-current', |
||||||
|
href: 'https://docs.nocodb.com/data-sources/connect-to-data-source#configuring-permissions', |
||||||
|
target: '_blank', |
||||||
|
}, |
||||||
|
'Learn more', |
||||||
|
), |
||||||
|
], |
||||||
|
) |
||||||
|
} |
||||||
|
if (source.is_schema_readonly) { |
||||||
|
return h( |
||||||
|
'div', |
||||||
|
{ |
||||||
|
className: 'max-w-90', |
||||||
|
}, |
||||||
|
[ |
||||||
|
dbLabel, |
||||||
|
h('br'), |
||||||
|
'Data editing is allowed and Schema edit is not allowed.', |
||||||
|
h('br'), |
||||||
|
'An ideal settings for administrative users who need to change data directly on database.', |
||||||
|
h('br'), |
||||||
|
h( |
||||||
|
'a', |
||||||
|
{ |
||||||
|
className: '!text-current', |
||||||
|
href: 'https://docs.nocodb.com/data-sources/connect-to-data-source#configuring-permissions', |
||||||
|
target: '_blank', |
||||||
|
}, |
||||||
|
'Learn more', |
||||||
|
), |
||||||
|
], |
||||||
|
) |
||||||
|
} |
||||||
|
return h( |
||||||
|
'div', |
||||||
|
{ |
||||||
|
className: 'max-w-90', |
||||||
|
}, |
||||||
|
[ |
||||||
|
dbLabel, |
||||||
|
h('br'), |
||||||
|
'Both Data and Schema Editing are enabled.', |
||||||
|
h('br'), |
||||||
|
'We highly recommend ', |
||||||
|
h( |
||||||
|
'a', |
||||||
|
{ |
||||||
|
className: '!text-current', |
||||||
|
href: 'https://docs.nocodb.com/data-sources/connect-to-data-source#configuring-permissions', |
||||||
|
target: '_blank', |
||||||
|
}, |
||||||
|
'disabling schema editing', |
||||||
|
), |
||||||
|
' to maintain data integrity and avoid potential issues.', |
||||||
|
], |
||||||
|
) |
||||||
|
} |
Loading…
Reference in new issue