diff --git a/frontend/app/shared/components/schema-category.component.scss b/frontend/app/shared/components/schema-category.component.scss
index 45155b172..69db35af9 100644
--- a/frontend/app/shared/components/schema-category.component.scss
+++ b/frontend/app/shared/components/schema-category.component.scss
@@ -94,10 +94,6 @@ $drag-margin: -8px;
}
}
-.cdk-drag-placeholder {
- display: none;
-}
-
.cdk-drag-animating {
transition: none;
}
diff --git a/frontend/app/shared/services/schemas.service.ts b/frontend/app/shared/services/schemas.service.ts
index 35402bc56..decb75d47 100644
--- a/frontend/app/shared/services/schemas.service.ts
+++ b/frontend/app/shared/services/schemas.service.ts
@@ -345,8 +345,10 @@ export interface UpdateUIFields {
export interface CreateSchemaDto {
readonly name: string;
readonly fields?: ReadonlyArray;
- readonly properties?: SchemaPropertiesDto;
+ readonly category?: string;
readonly isSingleton?: boolean;
+ readonly isPublished?: boolean;
+ readonly properties?: SchemaPropertiesDto;
}
export interface UpdateSchemaCategoryDto {
diff --git a/frontend/app/shared/state/schemas.forms.ts b/frontend/app/shared/state/schemas.forms.ts
index 6f83b106c..8b6a81582 100644
--- a/frontend/app/shared/state/schemas.forms.ts
+++ b/frontend/app/shared/state/schemas.forms.ts
@@ -31,21 +31,22 @@ export class CreateSchemaForm extends Form {
ValidatorsEx.pattern('[a-z0-9]+(\-[a-z0-9]+)*', 'i18n:schemas.schemaNameValidationMessage')
]
],
+ initialCategory: undefined,
isSingleton: false,
importing: {}
}));
}
public transformLoad(value: CreateSchemaDto) {
- const { name, isSingleton, ...importing } = value;
+ const { name, isSingleton, category, ...importing } = value;
- return { name, isSingleton, importing };
+ return { name, isSingleton, importing, initialCategory: category };
}
public transformSubmit(value: any): CreateSchemaDto {
- const { name, isSingleton, importing } = value;
+ const { name, isSingleton, importing, initialCategory } = value;
- return { name, isSingleton, ...importing };
+ return { name, isSingleton, category: initialCategory, ...importing };
}
}
diff --git a/frontend/app/shared/state/schemas.state.ts b/frontend/app/shared/state/schemas.state.ts
index a5da0ba4b..7d82d06bc 100644
--- a/frontend/app/shared/state/schemas.state.ts
+++ b/frontend/app/shared/state/schemas.state.ts
@@ -43,7 +43,7 @@ function sameSchema(lhs: SchemaDetailsDto | null, rhs?: SchemaDetailsDto | null)
@Injectable()
export class SchemasState extends State {
- public categoriesPlain =
+ public categoryNames =
this.project(x => x.categories);
public selectedSchemaOrNull =
@@ -68,7 +68,7 @@ export class SchemasState extends State {
this.projectFrom(this.schemas, x => x.filter(s => s.isPublished));
public categories =
- this.projectFrom2(this.schemas, this.categoriesPlain, (s, c) => buildCategories(c, s));
+ this.projectFrom2(this.schemas, this.categoryNames, (s, c) => buildCategories(c, s));
public get schemaId() {
return this.snapshot.selectedSchema?.id || '';
@@ -383,8 +383,10 @@ function getField(x: SchemaDetailsDto, request: AddFieldDto, parent?: RootFieldD
}
}
+const NO_NAME = '';
+
function buildCategories(categories: ReadonlyArray, schemas: SchemasList): ReadonlyArray {
- const uniqueCategories: { [name: string]: true } = {};
+ const uniqueCategories: { [name: string]: true } = { [NO_NAME]: true };
for (const category of categories) {
uniqueCategories[category] = true;
@@ -408,7 +410,7 @@ function buildCategories(categories: ReadonlyArray, schemas: SchemasList
}
function getCategory(schema: SchemaDto) {
- return schema.category || 'Schemas';
+ return schema.category || NO_NAME;
}
export function isSameCategory(name: string, schema: SchemaDto): boolean {