Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fd04c772ec | |||
| d430a4f44e | |||
| 8bc3d74659 |
+2
@@ -12,6 +12,8 @@ export const COMMAND_MENU_ITEM_FRAGMENT = gql`
|
||||
}
|
||||
label
|
||||
icon
|
||||
shortLabel
|
||||
position
|
||||
isPinned
|
||||
conditionalAvailabilityExpression
|
||||
availabilityType
|
||||
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
import { type MigrationInterface, type QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddShortLabelPositionScopeToCommandMenuItem1772643950000
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'AddShortLabelPositionScopeToCommandMenuItem1772643950000';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ADD "shortLabel" character varying`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ADD "position" double precision NOT NULL DEFAULT '0'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ALTER COLUMN "availabilityType" DROP DEFAULT`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ALTER COLUMN "availabilityType" TYPE character varying`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`UPDATE "core"."commandMenuItem" SET "availabilityType" = CASE WHEN "availabilityType" IN ('SINGLE_RECORD', 'BULK_RECORDS') THEN 'RECORD_SELECTION' ELSE 'GLOBAL' END`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "core"."commandMenuItem_availabilitytype_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "core"."commandMenuItem_availabilitytype_enum" AS ENUM('GLOBAL', 'RECORD_SELECTION')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ALTER COLUMN "availabilityType" TYPE "core"."commandMenuItem_availabilitytype_enum" USING "availabilityType"::"core"."commandMenuItem_availabilitytype_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ALTER COLUMN "availabilityType" SET DEFAULT 'GLOBAL'`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ALTER COLUMN "availabilityType" DROP DEFAULT`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ALTER COLUMN "availabilityType" TYPE character varying`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`UPDATE "core"."commandMenuItem" SET "availabilityType" = CASE WHEN "availabilityType" = 'RECORD_SELECTION' THEN 'SINGLE_RECORD' ELSE 'GLOBAL' END`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "core"."commandMenuItem_availabilitytype_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "core"."commandMenuItem_availabilitytype_enum" AS ENUM('GLOBAL', 'SINGLE_RECORD', 'BULK_RECORDS')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ALTER COLUMN "availabilityType" TYPE "core"."commandMenuItem_availabilitytype_enum" USING "availabilityType"::"core"."commandMenuItem_availabilitytype_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ALTER COLUMN "availabilityType" SET DEFAULT 'GLOBAL'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" DROP COLUMN "position"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" DROP COLUMN "shortLabel"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
+11
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
Field,
|
||||
Float,
|
||||
HideField,
|
||||
ObjectType,
|
||||
registerEnumType,
|
||||
@@ -10,6 +11,7 @@ import {
|
||||
IsDateString,
|
||||
IsEnum,
|
||||
IsNotEmpty,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
@@ -53,6 +55,15 @@ export class CommandMenuItemDTO {
|
||||
@Field({ nullable: true })
|
||||
icon?: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
shortLabel?: string;
|
||||
|
||||
@IsNumber()
|
||||
@Field(() => Float)
|
||||
position: number;
|
||||
|
||||
@IsBoolean()
|
||||
@Field()
|
||||
isPinned: boolean;
|
||||
|
||||
+12
-1
@@ -1,9 +1,10 @@
|
||||
import { Field, InputType } from '@nestjs/graphql';
|
||||
import { Field, Float, InputType } from '@nestjs/graphql';
|
||||
|
||||
import {
|
||||
IsBoolean,
|
||||
IsEnum,
|
||||
IsNotEmpty,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
@@ -34,6 +35,16 @@ export class CreateCommandMenuItemInput {
|
||||
@Field({ nullable: true })
|
||||
icon?: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
shortLabel?: string;
|
||||
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
@Field(() => Float, { nullable: true })
|
||||
position?: number;
|
||||
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
|
||||
+12
-1
@@ -1,9 +1,10 @@
|
||||
import { Field, InputType } from '@nestjs/graphql';
|
||||
import { Field, Float, InputType } from '@nestjs/graphql';
|
||||
|
||||
import {
|
||||
IsBoolean,
|
||||
IsEnum,
|
||||
IsNotEmpty,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
@@ -29,6 +30,16 @@ export class UpdateCommandMenuItemInput {
|
||||
@Field({ nullable: true })
|
||||
icon?: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
shortLabel?: string;
|
||||
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
@Field(() => Float, { nullable: true })
|
||||
position?: number;
|
||||
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
|
||||
+7
-2
@@ -17,8 +17,7 @@ import { SyncableEntity } from 'src/engine/workspace-manager/types/syncable-enti
|
||||
|
||||
export enum CommandMenuItemAvailabilityType {
|
||||
GLOBAL = 'GLOBAL',
|
||||
SINGLE_RECORD = 'SINGLE_RECORD',
|
||||
BULK_RECORDS = 'BULK_RECORDS',
|
||||
RECORD_SELECTION = 'RECORD_SELECTION',
|
||||
}
|
||||
|
||||
@Entity({ name: 'commandMenuItem', schema: 'core' })
|
||||
@@ -63,6 +62,12 @@ export class CommandMenuItemEntity
|
||||
@Column({ nullable: true, type: 'varchar' })
|
||||
icon: string | null;
|
||||
|
||||
@Column({ nullable: true, type: 'varchar' })
|
||||
shortLabel: string | null;
|
||||
|
||||
@Column({ nullable: false, type: 'double precision', default: 0 })
|
||||
position: number;
|
||||
|
||||
@Column({ default: false })
|
||||
isPinned: boolean;
|
||||
|
||||
|
||||
+2
@@ -3,6 +3,8 @@ import { type MetadataEntityPropertyName } from 'src/engine/metadata-modules/fla
|
||||
export const FLAT_COMMAND_MENU_ITEM_EDITABLE_PROPERTIES = [
|
||||
'label',
|
||||
'icon',
|
||||
'shortLabel',
|
||||
'position',
|
||||
'isPinned',
|
||||
'availabilityType',
|
||||
'availabilityObjectMetadataId',
|
||||
|
||||
+2
@@ -63,6 +63,8 @@ export const fromCommandMenuItemEntityToFlatCommandMenuItem = ({
|
||||
frontComponentId: commandMenuItemEntity.frontComponentId,
|
||||
label: commandMenuItemEntity.label,
|
||||
icon: commandMenuItemEntity.icon,
|
||||
shortLabel: commandMenuItemEntity.shortLabel,
|
||||
position: commandMenuItemEntity.position,
|
||||
isPinned: commandMenuItemEntity.isPinned,
|
||||
availabilityType: commandMenuItemEntity.availabilityType,
|
||||
availabilityObjectMetadataId:
|
||||
|
||||
+2
@@ -64,6 +64,8 @@ export const fromCreateCommandMenuItemInputToFlatCommandMenuItemToCreate = ({
|
||||
frontComponentUniversalIdentifier,
|
||||
label: createCommandMenuItemInput.label,
|
||||
icon: createCommandMenuItemInput.icon ?? null,
|
||||
shortLabel: createCommandMenuItemInput.shortLabel ?? null,
|
||||
position: createCommandMenuItemInput.position ?? 0,
|
||||
isPinned: createCommandMenuItemInput.isPinned ?? false,
|
||||
availabilityType:
|
||||
createCommandMenuItemInput.availabilityType ??
|
||||
|
||||
+4
@@ -9,8 +9,12 @@ export const fromFlatCommandMenuItemToCommandMenuItemDto = (
|
||||
frontComponentId: flatCommandMenuItem.frontComponentId ?? undefined,
|
||||
label: flatCommandMenuItem.label,
|
||||
icon: flatCommandMenuItem.icon ?? undefined,
|
||||
shortLabel: flatCommandMenuItem.shortLabel ?? undefined,
|
||||
position: flatCommandMenuItem.position,
|
||||
isPinned: flatCommandMenuItem.isPinned,
|
||||
availabilityType: flatCommandMenuItem.availabilityType,
|
||||
conditionalAvailabilityExpression:
|
||||
flatCommandMenuItem.conditionalAvailabilityExpression ?? undefined,
|
||||
availabilityObjectMetadataId:
|
||||
flatCommandMenuItem.availabilityObjectMetadataId ?? undefined,
|
||||
workspaceId: flatCommandMenuItem.workspaceId,
|
||||
|
||||
+2
@@ -24,6 +24,8 @@ exports[`ALL_UNIVERSAL_FLAT_ENTITY_PROPERTIES_TO_COMPARE_AND_STRINGIFY should ma
|
||||
"propertiesToCompare": [
|
||||
"label",
|
||||
"icon",
|
||||
"shortLabel",
|
||||
"position",
|
||||
"isPinned",
|
||||
"availabilityType",
|
||||
"conditionalAvailabilityExpression",
|
||||
|
||||
+10
@@ -970,6 +970,16 @@ export const ALL_ENTITY_PROPERTIES_CONFIGURATION_BY_METADATA_NAME = {
|
||||
universalProperty: undefined,
|
||||
},
|
||||
icon: { toCompare: true, toStringify: false, universalProperty: undefined },
|
||||
shortLabel: {
|
||||
toCompare: true,
|
||||
toStringify: false,
|
||||
universalProperty: undefined,
|
||||
},
|
||||
position: {
|
||||
toCompare: true,
|
||||
toStringify: false,
|
||||
universalProperty: undefined,
|
||||
},
|
||||
isPinned: {
|
||||
toCompare: true,
|
||||
toStringify: false,
|
||||
|
||||
Reference in New Issue
Block a user