Browse Source

Fix schema categories.

pull/372/head
Sebastian Stehle 7 years ago
parent
commit
ef1ba770d6
  1. 2
      src/Squidex/app/shared/components/schema-category.component.html
  2. 8
      src/Squidex/app/shared/components/schema-category.component.ts
  3. 2
      src/Squidex/app/shared/services/schemas.service.spec.ts
  4. 2
      src/Squidex/app/shared/services/schemas.service.ts

2
src/Squidex/app/shared/components/schema-category.component.html

@ -8,7 +8,7 @@
<h3>{{snapshot.displayName}} ({{snapshot.schemasFiltered.length}})</h3>
<button type="button" class="btn btn-sm btn-text-secondary float-right" *ngIf="snapshot.schemasForCategory.length === 0 && !forContent" (click)="emitRemove()">
<button type="button" class="btn btn-sm btn-text-secondary float-right" *ngIf="snapshot.schemasForCategory.length === 0 && snapshot.isDeletable && !forContent" (click)="emitRemove()">
<i class="icon-bin2"></i>
</button>
</div>

8
src/Squidex/app/shared/components/schema-category.component.ts

@ -24,6 +24,8 @@ interface State {
schemasFiltered: ImmutableArray<SchemaDto>;
schemasForCategory: ImmutableArray<SchemaDto>;
isDeletable: boolean;
isOpen: boolean;
}
@ -64,6 +66,7 @@ export class SchemaCategoryComponent extends StatefulComponent<State> implements
private readonly schemasState: SchemasState
) {
super(changeDetector, {
isDeletable: true,
schemasFiltered: ImmutableArray.empty(),
schemasForCategory: ImmutableArray.empty(),
isOpen: true
@ -104,12 +107,15 @@ export class SchemaCategoryComponent extends StatefulComponent<State> implements
if (changes['name']) {
let displayName = 'Schemas';
let isDeletable = true;
if (this.name && this.name.length > 0) {
displayName = this.name;
} else {
isDeletable = false;
}
this.next(s => ({ ...s, displayName }));
this.next(s => ({ ...s, isDeletable, displayName }));
}
}

2
src/Squidex/app/shared/services/schemas.service.spec.ts

@ -205,7 +205,7 @@ describe('SchemasService', () => {
const resource: Resource = {
_links: {
updateCategory: { method: 'PUT', href: '/api/apps/my-app/schemas/my-schema/category' }
['update/category']: { method: 'PUT', href: '/api/apps/my-app/schemas/my-schema/category' }
}
};

2
src/Squidex/app/shared/services/schemas.service.ts

@ -310,7 +310,7 @@ export class SchemasService {
}
public putCategory(appName: string, resource: Resource, dto: UpdateSchemaCategoryDto, version: Version): Observable<SchemaDetailsDto> {
const link = resource._links['updateCategory'];
const link = resource._links['update/category'];
const url = this.apiUrl.buildUrl(link.href);

Loading…
Cancel
Save