Browse Source

fix: cross workspace snapshot restore

pull/9879/head
DarkPhoenix2704 1 month ago
parent
commit
283542d45f
  1. 3
      packages/nc-gui/components/general/WorkspaceIcon.vue
  2. 4
      packages/nocodb/src/interface/Jobs.ts
  3. 7
      packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.processor.ts
  4. 2
      packages/nocodb/src/schema/swagger.json
  5. 1
      packages/nocodb/src/services/bases.service.ts

3
packages/nc-gui/components/general/WorkspaceIcon.vue

@ -11,7 +11,7 @@ const props = defineProps<{
iconType: WorkspaceIconType | string
}
hideLabel?: boolean
size?: 'small' | 'medium' | 'large' | 'xlarge'
size?: 'small' | 'medium' | 'large' | 'xlarge' | 'middle'
isRounded?: boolean
}>()
@ -74,6 +74,7 @@ const size = computed(() => props.size || 'medium')
:class="{
'min-w-4 w-4 h-4 rounded': size === 'small',
'min-w-6 w-6 h-6 rounded-md': size === 'medium',
'min-w-8 w-6 h-8 rounded-md': size === 'middle',
'min-w-10 w-10 h-10 rounded-lg !text-base': size === 'large',
'min-w-16 w-16 h-16 rounded-lg !text-4xl': size === 'xlarge',
'!rounded-[50%]': props.isRounded,

4
packages/nocodb/src/interface/Jobs.ts

@ -180,6 +180,10 @@ export interface CreateSnapshotJobData extends JobData {
export interface RestoreSnapshotJobData extends JobData {
sourceId: string;
targetBaseId: string;
targetContext: {
workspace_id: string;
base_id: string;
}
snapshot: SnapshotType;
req: NcRequest;
}

7
packages/nocodb/src/modules/jobs/jobs/export-import/duplicate.processor.ts

@ -44,14 +44,15 @@ export class DuplicateProcessor {
req,
context,
options,
operation
operation,
targetContext: _targetContext
}: {
sourceBase: Base; // Base to duplicate
targetBase: Base; // Base to duplicate to
dataSource: Source; // Data source to duplicate from
req: NcRequest;
context: NcContext // Context of the base to duplicate
targetContext?: NcContext // Context of the base to duplicate to
options: {
excludeData?: boolean;
excludeHooks?: boolean;
@ -62,7 +63,7 @@ export class DuplicateProcessor {
}) {
const hrTime = initTime();
const targetContext = {
const targetContext = _targetContext ?? {
workspace_id: targetBase.fk_workspace_id,
base_id: targetBase.id,
}

2
packages/nocodb/src/schema/swagger.json

@ -24470,7 +24470,7 @@
"title": {
"description": "Base Title",
"example": "My Base",
"maxLength": 128,
"maxLength": 50,
"minLength": 1,
"type": "string"
},

1
packages/nocodb/src/services/bases.service.ts

@ -262,6 +262,7 @@ export class BasesService {
}
if (baseBody?.title.length > 50) {
// Limited for consistent behaviour across identifier names for table, view, columns
NcError.badRequest('Base title exceeds 50 characters');
}

Loading…
Cancel
Save