Ver código fonte

feat(admin-ui): Implement deletion of Collections

Michael Bromley 6 anos atrás
pai
commit
1d7ab26222

+ 1 - 0
admin-ui/src/app/catalog/components/collection-list/collection-list.component.html

@@ -11,6 +11,7 @@
         [collections]="items$ | async | paginate: (paginationConfig$ | async) || {}"
         [activeCollectionId]="activeCollectionId$ | async"
         (rearrange)="onRearrange($event)"
+        (deleteCollection)="deleteCollection($event)"
     ></vdr-collection-tree>
 
     <div class="collection-contents" [class.expanded]="activeCollectionId$ | async">

+ 31 - 2
admin-ui/src/app/catalog/components/collection-list/collection-list.component.ts

@@ -1,14 +1,15 @@
 import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
 import { ActivatedRoute, Router } from '@angular/router';
 import { PaginationInstance } from 'ngx-pagination';
-import { combineLatest, Observable } from 'rxjs';
-import { distinctUntilChanged, map } from 'rxjs/operators';
+import { combineLatest, EMPTY, Observable } from 'rxjs';
+import { distinctUntilChanged, map, switchMap } from 'rxjs/operators';
 
 import { BaseListComponent } from '../../../common/base-list.component';
 import { GetCollectionList } from '../../../common/generated-types';
 import { _ } from '../../../core/providers/i18n/mark-for-extraction';
 import { NotificationService } from '../../../core/providers/notification/notification.service';
 import { DataService } from '../../../data/providers/data.service';
+import { ModalService } from '../../../shared/providers/modal/modal.service';
 import { RearrangeEvent } from '../collection-tree/collection-tree.component';
 
 @Component({
@@ -27,6 +28,7 @@ export class CollectionListComponent
     constructor(
         private dataService: DataService,
         private notificationService: NotificationService,
+        private modalService: ModalService,
         router: Router,
         route: ActivatedRoute,
     ) {
@@ -72,6 +74,33 @@ export class CollectionListComponent
         });
     }
 
+    deleteCollection(id: string) {
+        this.modalService
+            .dialog({
+                title: _('catalog.confirm-delete-collection'),
+                buttons: [
+                    { type: 'seconday', label: _('common.cancel') },
+                    { type: 'danger', label: _('common.delete'), returnValue: true },
+                ],
+            })
+            .pipe(
+                switchMap(response => (response ? this.dataService.collection.deleteCollection(id) : EMPTY)),
+            )
+            .subscribe(
+                () => {
+                    this.notificationService.success(_('common.notify-delete-success'), {
+                        entity: 'ProductVariant',
+                    });
+                    this.refresh();
+                },
+                err => {
+                    this.notificationService.error(_('common.notify-delete-error'), {
+                        entity: 'ProductVariant',
+                    });
+                },
+            );
+    }
+
     closeContents() {
         const params = { ...this.route.snapshot.params };
         delete params.contents;

+ 5 - 0
admin-ui/src/app/catalog/components/collection-tree/collection-tree-node.component.html

@@ -80,6 +80,11 @@
                         <clr-icon shape="child-arrow"></clr-icon>
                         {{ item.path }}
                     </button>
+                    <div class="dropdown-divider"></div>
+                    <button class="button" vdrDropdownItem (click)="delete(collection.id)">
+                        <clr-icon shape="trash" class="is-danger"></clr-icon>
+                        {{ 'common.delete' | translate }}
+                    </button>
                 </vdr-dropdown-menu>
             </vdr-dropdown>
         </div>

+ 4 - 0
admin-ui/src/app/catalog/components/collection-tree/collection-tree-node.component.ts

@@ -83,4 +83,8 @@ export class CollectionTreeNodeComponent implements OnInit {
     drop(event: CdkDragDrop<Collection.Fragment | RootNode<Collection.Fragment>>) {
         this.root.onDrop(event);
     }
+
+    delete(id: string) {
+        this.root.onDelete(id);
+    }
 }

+ 5 - 0
admin-ui/src/app/catalog/components/collection-tree/collection-tree.component.ts

@@ -25,6 +25,7 @@ export class CollectionTreeComponent implements OnChanges {
     @Input() collections: Collection.Fragment[];
     @Input() activeCollectionId: string;
     @Output() rearrange = new EventEmitter<RearrangeEvent>();
+    @Output() deleteCollection = new EventEmitter<string>();
     collectionTree: RootNode<Collection.Fragment>;
 
     ngOnChanges(changes: SimpleChanges) {
@@ -51,6 +52,10 @@ export class CollectionTreeComponent implements OnChanges {
         this.rearrange.emit(event);
     }
 
+    onDelete(id: string) {
+        this.deleteCollection.emit(id);
+    }
+
     private isRootNode<T extends HasParent>(node: T | RootNode<T>): node is RootNode<T> {
         return !node.hasOwnProperty('parent');
     }

+ 2 - 1
admin-ui/src/app/catalog/components/facet-list/facet-list.component.html

@@ -26,7 +26,7 @@
         <td class="left align-middle" [class.private]="facet.isPrivate">{{ facet.name }}</td>
         <td class="left align-middle" [class.private]="facet.isPrivate">
             <vdr-facet-value-chip
-                *ngFor="let value of (facet.values | slice: 0:displayLimit[facet.id] || 3)"
+                *ngFor="let value of facet.values | slice: 0:displayLimit[facet.id] || 3"
                 [facetValue]="value"
                 [removable]="false"
                 [displayFacetName]="false"
@@ -70,6 +70,7 @@
                         (click)="deleteFacet(facet.id)"
                         vdrDropdownItem
                     >
+                        <clr-icon shape="trash" class="is-danger"></clr-icon>
                         {{ 'common.delete' | translate }}
                     </button>
                 </vdr-dropdown-menu>

+ 1 - 0
admin-ui/src/app/catalog/components/product-list/product-list.component.html

@@ -82,6 +82,7 @@
                         (click)="deleteProduct(result.productId)"
                         vdrDropdownItem
                     >
+                        <clr-icon shape="trash" class="is-danger"></clr-icon>
                         {{ 'common.delete' | translate }}
                     </button>
                 </vdr-dropdown-menu>

+ 222 - 202
admin-ui/src/app/common/generated-types.ts

@@ -1545,26 +1545,44 @@ export type MoveCollectionInput = {
 
 export type Mutation = {
   __typename?: 'Mutation',
-  /** Create a new Administrator */
-  createAdministrator: Administrator,
-  /** Update an existing Administrator */
-  updateAdministrator: Administrator,
-  /** Assign a Role to an Administrator */
-  assignRoleToAdministrator: Administrator,
   /** Create a new Asset */
   createAssets: Array<Asset>,
+  login: LoginResult,
+  logout: Scalars['Boolean'],
   /** Create a new Collection */
   createCollection: Collection,
   /** Update an existing Collection */
   updateCollection: Collection,
+  /** Delete a Collection */
+  deleteCollection: DeletionResponse,
   /** Move a Collection to a different parent or index */
   moveCollection: Collection,
   /** Create a new Channel */
   createChannel: Channel,
   /** Update an existing Channel */
   updateChannel: Channel,
-  login: LoginResult,
-  logout: Scalars['Boolean'],
+  /** Create a new Administrator */
+  createAdministrator: Administrator,
+  /** Update an existing Administrator */
+  updateAdministrator: Administrator,
+  /** Assign a Role to an Administrator */
+  assignRoleToAdministrator: Administrator,
+  /** Create a new CustomerGroup */
+  createCustomerGroup: CustomerGroup,
+  /** Update an existing CustomerGroup */
+  updateCustomerGroup: CustomerGroup,
+  /** Add Customers to a CustomerGroup */
+  addCustomersToGroup: CustomerGroup,
+  /** Remove Customers from a CustomerGroup */
+  removeCustomersFromGroup: CustomerGroup,
+  /** Create a new Country */
+  createCountry: Country,
+  /** Update an existing Country */
+  updateCountry: Country,
+  /** Delete a Country */
+  deleteCountry: DeletionResponse,
+  importProducts?: Maybe<ImportInfo>,
+  updateGlobalSettings: GlobalSettings,
   /** Create a new Customer. If a password is provided, a new User will also be created an linked to the Customer. */
   createCustomer: Customer,
   /** Update an existing Customer */
@@ -1577,12 +1595,6 @@ export type Mutation = {
   updateCustomerAddress: Address,
   /** Update an existing Address */
   deleteCustomerAddress: Scalars['Boolean'],
-  /** Create a new Country */
-  createCountry: Country,
-  /** Update an existing Country */
-  updateCountry: Country,
-  /** Delete a Country */
-  deleteCountry: DeletionResponse,
   /** Create a new Facet */
   createFacet: Facet,
   /** Update an existing Facet */
@@ -1595,16 +1607,13 @@ export type Mutation = {
   updateFacetValues: Array<FacetValue>,
   /** Delete one or more FacetValues */
   deleteFacetValues: Array<DeletionResponse>,
-  /** Create a new CustomerGroup */
-  createCustomerGroup: CustomerGroup,
-  /** Update an existing CustomerGroup */
-  updateCustomerGroup: CustomerGroup,
-  /** Add Customers to a CustomerGroup */
-  addCustomersToGroup: CustomerGroup,
-  /** Remove Customers from a CustomerGroup */
-  removeCustomersFromGroup: CustomerGroup,
-  updateGlobalSettings: GlobalSettings,
-  importProducts?: Maybe<ImportInfo>,
+  settlePayment: Payment,
+  fulfillOrder: Fulfillment,
+  cancelOrder: Order,
+  refundOrder: Refund,
+  settleRefund: Refund,
+  addNoteToOrder: Order,
+  reindex: JobInfo,
   /** Update an existing PaymentMethod */
   updatePaymentMethod: PaymentMethod,
   /** Create a new ProductOptionGroup */
@@ -1615,12 +1624,6 @@ export type Mutation = {
   createProductOption: ProductOption,
   /** Create a new ProductOption within a ProductOptionGroup */
   updateProductOption: ProductOption,
-  settlePayment: Payment,
-  fulfillOrder: Fulfillment,
-  cancelOrder: Order,
-  refundOrder: Refund,
-  settleRefund: Refund,
-  addNoteToOrder: Order,
   /** Create a new Product */
   createProduct: Product,
   /** Update an existing Product */
@@ -1637,22 +1640,17 @@ export type Mutation = {
   updateProductVariants: Array<Maybe<ProductVariant>>,
   /** Delete a ProductVariant */
   deleteProductVariant: DeletionResponse,
-  createPromotion: Promotion,
-  updatePromotion: Promotion,
-  deletePromotion: DeletionResponse,
-  reindex: JobInfo,
-  /** Create a new ShippingMethod */
-  createShippingMethod: ShippingMethod,
-  /** Update an existing ShippingMethod */
-  updateShippingMethod: ShippingMethod,
-  /** Create a new TaxRate */
-  createTaxRate: TaxRate,
-  /** Update an existing TaxRate */
-  updateTaxRate: TaxRate,
   /** Create a new Role */
   createRole: Role,
   /** Update an existing Role */
   updateRole: Role,
+  /** Create a new ShippingMethod */
+  createShippingMethod: ShippingMethod,
+  /** Update an existing ShippingMethod */
+  updateShippingMethod: ShippingMethod,
+  createPromotion: Promotion,
+  updatePromotion: Promotion,
+  deletePromotion: DeletionResponse,
   /** Create a new TaxCategory */
   createTaxCategory: TaxCategory,
   /** Update an existing TaxCategory */
@@ -1667,6 +1665,10 @@ export type Mutation = {
   addMembersToZone: Zone,
   /** Remove members from a Zone */
   removeMembersFromZone: Zone,
+  /** Create a new TaxRate */
+  createTaxRate: TaxRate,
+  /** Update an existing TaxRate */
+  updateTaxRate: TaxRate,
   requestStarted: Scalars['Int'],
   requestCompleted: Scalars['Int'],
   setAsLoggedIn: UserStatus,
@@ -1675,6 +1677,48 @@ export type Mutation = {
 };
 
 
+export type MutationCreateAssetsArgs = {
+  input: Array<CreateAssetInput>
+};
+
+
+export type MutationLoginArgs = {
+  username: Scalars['String'],
+  password: Scalars['String'],
+  rememberMe?: Maybe<Scalars['Boolean']>
+};
+
+
+export type MutationCreateCollectionArgs = {
+  input: CreateCollectionInput
+};
+
+
+export type MutationUpdateCollectionArgs = {
+  input: UpdateCollectionInput
+};
+
+
+export type MutationDeleteCollectionArgs = {
+  id: Scalars['ID']
+};
+
+
+export type MutationMoveCollectionArgs = {
+  input: MoveCollectionInput
+};
+
+
+export type MutationCreateChannelArgs = {
+  input: CreateChannelInput
+};
+
+
+export type MutationUpdateChannelArgs = {
+  input: UpdateChannelInput
+};
+
+
 export type MutationCreateAdministratorArgs = {
   input: CreateAdministratorInput
 };
@@ -1691,40 +1735,50 @@ export type MutationAssignRoleToAdministratorArgs = {
 };
 
 
-export type MutationCreateAssetsArgs = {
-  input: Array<CreateAssetInput>
+export type MutationCreateCustomerGroupArgs = {
+  input: CreateCustomerGroupInput
 };
 
 
-export type MutationCreateCollectionArgs = {
-  input: CreateCollectionInput
+export type MutationUpdateCustomerGroupArgs = {
+  input: UpdateCustomerGroupInput
 };
 
 
-export type MutationUpdateCollectionArgs = {
-  input: UpdateCollectionInput
+export type MutationAddCustomersToGroupArgs = {
+  customerGroupId: Scalars['ID'],
+  customerIds: Array<Scalars['ID']>
 };
 
 
-export type MutationMoveCollectionArgs = {
-  input: MoveCollectionInput
+export type MutationRemoveCustomersFromGroupArgs = {
+  customerGroupId: Scalars['ID'],
+  customerIds: Array<Scalars['ID']>
 };
 
 
-export type MutationCreateChannelArgs = {
-  input: CreateChannelInput
+export type MutationCreateCountryArgs = {
+  input: CreateCountryInput
 };
 
 
-export type MutationUpdateChannelArgs = {
-  input: UpdateChannelInput
+export type MutationUpdateCountryArgs = {
+  input: UpdateCountryInput
 };
 
 
-export type MutationLoginArgs = {
-  username: Scalars['String'],
-  password: Scalars['String'],
-  rememberMe?: Maybe<Scalars['Boolean']>
+export type MutationDeleteCountryArgs = {
+  id: Scalars['ID']
+};
+
+
+export type MutationImportProductsArgs = {
+  csvFile: Scalars['Upload']
+};
+
+
+export type MutationUpdateGlobalSettingsArgs = {
+  input: UpdateGlobalSettingsInput
 };
 
 
@@ -1760,21 +1814,6 @@ export type MutationDeleteCustomerAddressArgs = {
 };
 
 
-export type MutationCreateCountryArgs = {
-  input: CreateCountryInput
-};
-
-
-export type MutationUpdateCountryArgs = {
-  input: UpdateCountryInput
-};
-
-
-export type MutationDeleteCountryArgs = {
-  id: Scalars['ID']
-};
-
-
 export type MutationCreateFacetArgs = {
   input: CreateFacetInput
 };
@@ -1807,35 +1846,33 @@ export type MutationDeleteFacetValuesArgs = {
 };
 
 
-export type MutationCreateCustomerGroupArgs = {
-  input: CreateCustomerGroupInput
+export type MutationSettlePaymentArgs = {
+  id: Scalars['ID']
 };
 
 
-export type MutationUpdateCustomerGroupArgs = {
-  input: UpdateCustomerGroupInput
+export type MutationFulfillOrderArgs = {
+  input: FulfillOrderInput
 };
 
 
-export type MutationAddCustomersToGroupArgs = {
-  customerGroupId: Scalars['ID'],
-  customerIds: Array<Scalars['ID']>
+export type MutationCancelOrderArgs = {
+  input: CancelOrderInput
 };
 
 
-export type MutationRemoveCustomersFromGroupArgs = {
-  customerGroupId: Scalars['ID'],
-  customerIds: Array<Scalars['ID']>
+export type MutationRefundOrderArgs = {
+  input: RefundOrderInput
 };
 
 
-export type MutationUpdateGlobalSettingsArgs = {
-  input: UpdateGlobalSettingsInput
+export type MutationSettleRefundArgs = {
+  input: SettleRefundInput
 };
 
 
-export type MutationImportProductsArgs = {
-  csvFile: Scalars['Upload']
+export type MutationAddNoteToOrderArgs = {
+  input: AddNoteToOrderInput
 };
 
 
@@ -1864,36 +1901,6 @@ export type MutationUpdateProductOptionArgs = {
 };
 
 
-export type MutationSettlePaymentArgs = {
-  id: Scalars['ID']
-};
-
-
-export type MutationFulfillOrderArgs = {
-  input: FulfillOrderInput
-};
-
-
-export type MutationCancelOrderArgs = {
-  input: CancelOrderInput
-};
-
-
-export type MutationRefundOrderArgs = {
-  input: RefundOrderInput
-};
-
-
-export type MutationSettleRefundArgs = {
-  input: SettleRefundInput
-};
-
-
-export type MutationAddNoteToOrderArgs = {
-  input: AddNoteToOrderInput
-};
-
-
 export type MutationCreateProductArgs = {
   input: CreateProductInput
 };
@@ -1936,18 +1943,13 @@ export type MutationDeleteProductVariantArgs = {
 };
 
 
-export type MutationCreatePromotionArgs = {
-  input: CreatePromotionInput
-};
-
-
-export type MutationUpdatePromotionArgs = {
-  input: UpdatePromotionInput
+export type MutationCreateRoleArgs = {
+  input: CreateRoleInput
 };
 
 
-export type MutationDeletePromotionArgs = {
-  id: Scalars['ID']
+export type MutationUpdateRoleArgs = {
+  input: UpdateRoleInput
 };
 
 
@@ -1961,23 +1963,18 @@ export type MutationUpdateShippingMethodArgs = {
 };
 
 
-export type MutationCreateTaxRateArgs = {
-  input: CreateTaxRateInput
-};
-
-
-export type MutationUpdateTaxRateArgs = {
-  input: UpdateTaxRateInput
+export type MutationCreatePromotionArgs = {
+  input: CreatePromotionInput
 };
 
 
-export type MutationCreateRoleArgs = {
-  input: CreateRoleInput
+export type MutationUpdatePromotionArgs = {
+  input: UpdatePromotionInput
 };
 
 
-export type MutationUpdateRoleArgs = {
-  input: UpdateRoleInput
+export type MutationDeletePromotionArgs = {
+  id: Scalars['ID']
 };
 
 
@@ -2018,6 +2015,16 @@ export type MutationRemoveMembersFromZoneArgs = {
 };
 
 
+export type MutationCreateTaxRateArgs = {
+  input: CreateTaxRateInput
+};
+
+
+export type MutationUpdateTaxRateArgs = {
+  input: UpdateTaxRateInput
+};
+
+
 export type MutationSetAsLoggedInArgs = {
   username: Scalars['String'],
   loginTime: Scalars['String']
@@ -2529,69 +2536,59 @@ export type PromotionSortParameter = {
 
 export type Query = {
   __typename?: 'Query',
-  administrators: AdministratorList,
-  administrator?: Maybe<Administrator>,
   assets: AssetList,
   asset?: Maybe<Asset>,
+  me?: Maybe<CurrentUser>,
   collections: CollectionList,
   collection?: Maybe<Collection>,
   collectionFilters: Array<ConfigurableOperation>,
   channels: Array<Channel>,
   channel?: Maybe<Channel>,
   activeChannel: Channel,
-  me?: Maybe<CurrentUser>,
-  customers: CustomerList,
-  customer?: Maybe<Customer>,
+  administrators: AdministratorList,
+  administrator?: Maybe<Administrator>,
+  customerGroups: Array<CustomerGroup>,
+  customerGroup?: Maybe<CustomerGroup>,
   countries: CountryList,
   country?: Maybe<Country>,
+  globalSettings: GlobalSettings,
+  customers: CustomerList,
+  customer?: Maybe<Customer>,
   facets: FacetList,
   facet?: Maybe<Facet>,
-  customerGroups: Array<CustomerGroup>,
-  customerGroup?: Maybe<CustomerGroup>,
-  globalSettings: GlobalSettings,
   job?: Maybe<JobInfo>,
   jobs: Array<JobInfo>,
+  order?: Maybe<Order>,
+  orders: OrderList,
+  search: SearchResponse,
   paymentMethods: PaymentMethodList,
   paymentMethod?: Maybe<PaymentMethod>,
   productOptionGroups: Array<ProductOptionGroup>,
   productOptionGroup?: Maybe<ProductOptionGroup>,
-  order?: Maybe<Order>,
-  orders: OrderList,
   products: ProductList,
   /** Get a Product either by id or slug. If neither id nor slug is speicified, an error will result. */
   product?: Maybe<Product>,
-  promotion?: Maybe<Promotion>,
-  promotions: PromotionList,
-  adjustmentOperations: AdjustmentOperations,
-  search: SearchResponse,
+  roles: RoleList,
+  role?: Maybe<Role>,
   shippingMethods: ShippingMethodList,
   shippingMethod?: Maybe<ShippingMethod>,
   shippingEligibilityCheckers: Array<ConfigurableOperation>,
   shippingCalculators: Array<ConfigurableOperation>,
-  taxRates: TaxRateList,
-  taxRate?: Maybe<TaxRate>,
-  roles: RoleList,
-  role?: Maybe<Role>,
+  promotion?: Maybe<Promotion>,
+  promotions: PromotionList,
+  adjustmentOperations: AdjustmentOperations,
   taxCategories: Array<TaxCategory>,
   taxCategory?: Maybe<TaxCategory>,
   zones: Array<Zone>,
   zone?: Maybe<Zone>,
+  taxRates: TaxRateList,
+  taxRate?: Maybe<TaxRate>,
   networkStatus: NetworkStatus,
   userStatus: UserStatus,
   uiState: UiState,
 };
 
 
-export type QueryAdministratorsArgs = {
-  options?: Maybe<AdministratorListOptions>
-};
-
-
-export type QueryAdministratorArgs = {
-  id: Scalars['ID']
-};
-
-
 export type QueryAssetsArgs = {
   options?: Maybe<AssetListOptions>
 };
@@ -2619,12 +2616,17 @@ export type QueryChannelArgs = {
 };
 
 
-export type QueryCustomersArgs = {
-  options?: Maybe<CustomerListOptions>
+export type QueryAdministratorsArgs = {
+  options?: Maybe<AdministratorListOptions>
 };
 
 
-export type QueryCustomerArgs = {
+export type QueryAdministratorArgs = {
+  id: Scalars['ID']
+};
+
+
+export type QueryCustomerGroupArgs = {
   id: Scalars['ID']
 };
 
@@ -2639,6 +2641,16 @@ export type QueryCountryArgs = {
 };
 
 
+export type QueryCustomersArgs = {
+  options?: Maybe<CustomerListOptions>
+};
+
+
+export type QueryCustomerArgs = {
+  id: Scalars['ID']
+};
+
+
 export type QueryFacetsArgs = {
   languageCode?: Maybe<LanguageCode>,
   options?: Maybe<FacetListOptions>
@@ -2651,11 +2663,6 @@ export type QueryFacetArgs = {
 };
 
 
-export type QueryCustomerGroupArgs = {
-  id: Scalars['ID']
-};
-
-
 export type QueryJobArgs = {
   jobId: Scalars['String']
 };
@@ -2666,6 +2673,21 @@ export type QueryJobsArgs = {
 };
 
 
+export type QueryOrderArgs = {
+  id: Scalars['ID']
+};
+
+
+export type QueryOrdersArgs = {
+  options?: Maybe<OrderListOptions>
+};
+
+
+export type QuerySearchArgs = {
+  input: SearchInput
+};
+
+
 export type QueryPaymentMethodsArgs = {
   options?: Maybe<PaymentMethodListOptions>
 };
@@ -2688,16 +2710,6 @@ export type QueryProductOptionGroupArgs = {
 };
 
 
-export type QueryOrderArgs = {
-  id: Scalars['ID']
-};
-
-
-export type QueryOrdersArgs = {
-  options?: Maybe<OrderListOptions>
-};
-
-
 export type QueryProductsArgs = {
   languageCode?: Maybe<LanguageCode>,
   options?: Maybe<ProductListOptions>
@@ -2711,18 +2723,13 @@ export type QueryProductArgs = {
 };
 
 
-export type QueryPromotionArgs = {
-  id: Scalars['ID']
-};
-
-
-export type QueryPromotionsArgs = {
-  options?: Maybe<PromotionListOptions>
+export type QueryRolesArgs = {
+  options?: Maybe<RoleListOptions>
 };
 
 
-export type QuerySearchArgs = {
-  input: SearchInput
+export type QueryRoleArgs = {
+  id: Scalars['ID']
 };
 
 
@@ -2736,32 +2743,32 @@ export type QueryShippingMethodArgs = {
 };
 
 
-export type QueryTaxRatesArgs = {
-  options?: Maybe<TaxRateListOptions>
+export type QueryPromotionArgs = {
+  id: Scalars['ID']
 };
 
 
-export type QueryTaxRateArgs = {
-  id: Scalars['ID']
+export type QueryPromotionsArgs = {
+  options?: Maybe<PromotionListOptions>
 };
 
 
-export type QueryRolesArgs = {
-  options?: Maybe<RoleListOptions>
+export type QueryTaxCategoryArgs = {
+  id: Scalars['ID']
 };
 
 
-export type QueryRoleArgs = {
+export type QueryZoneArgs = {
   id: Scalars['ID']
 };
 
 
-export type QueryTaxCategoryArgs = {
-  id: Scalars['ID']
+export type QueryTaxRatesArgs = {
+  options?: Maybe<TaxRateListOptions>
 };
 
 
-export type QueryZoneArgs = {
+export type QueryTaxRateArgs = {
   id: Scalars['ID']
 };
 
@@ -3461,6 +3468,13 @@ export type MoveCollectionMutationVariables = {
 
 export type MoveCollectionMutation = ({ __typename?: 'Mutation' } & { moveCollection: ({ __typename?: 'Collection' } & CollectionFragment) });
 
+export type DeleteCollectionMutationVariables = {
+  id: Scalars['ID']
+};
+
+
+export type DeleteCollectionMutation = ({ __typename?: 'Mutation' } & { deleteCollection: ({ __typename?: 'DeletionResponse' } & Pick<DeletionResponse, 'result' | 'message'>) });
+
 export type GetCollectionContentsQueryVariables = {
   id: Scalars['ID'],
   options?: Maybe<ProductVariantListOptions>
@@ -4277,6 +4291,12 @@ export namespace MoveCollection {
   export type MoveCollection = CollectionFragment;
 }
 
+export namespace DeleteCollection {
+  export type Variables = DeleteCollectionMutationVariables;
+  export type Mutation = DeleteCollectionMutation;
+  export type DeleteCollection = DeleteCollectionMutation['deleteCollection'];
+}
+
 export namespace GetCollectionContents {
   export type Variables = GetCollectionContentsQueryVariables;
   export type Query = GetCollectionContentsQuery;

+ 9 - 0
admin-ui/src/app/data/definitions/collection-definitions.ts

@@ -104,6 +104,15 @@ export const MOVE_COLLECTION = gql`
     ${COLLECTION_FRAGMENT}
 `;
 
+export const DELETE_COLLECTION = gql`
+    mutation DeleteCollection($id: ID!) {
+        deleteCollection(id: $id) {
+            result
+            message
+        }
+    }
+`;
+
 export const GET_COLLECTION_CONTENTS = gql`
     query GetCollectionContents($id: ID!, $options: ProductVariantListOptions) {
         collection(id: $id) {

+ 11 - 0
admin-ui/src/app/data/providers/collection-data.service.ts

@@ -6,6 +6,7 @@ import {
     CollectionFilterParameter,
     CreateCollection,
     CreateCollectionInput,
+    DeleteCollection,
     GetCollection,
     GetCollectionContents,
     GetCollectionFilters,
@@ -18,6 +19,7 @@ import {
 import { getDefaultLanguage } from '../../common/utilities/get-default-language';
 import {
     CREATE_COLLECTION,
+    DELETE_COLLECTION,
     GET_COLLECTION,
     GET_COLLECTION_CONTENTS,
     GET_COLLECTION_FILTERS,
@@ -100,6 +102,15 @@ export class CollectionDataService {
         );
     }
 
+    deleteCollection(id: string) {
+        return this.baseDataService.mutate<DeleteCollection.Mutation, DeleteCollection.Variables>(
+            DELETE_COLLECTION,
+            {
+                id,
+            },
+        );
+    }
+
     getCollectionContents(id: string, take: number = 10, skip: number = 0, filterTerm?: string) {
         const filter = filterTerm
             ? ({ name: { contains: filterTerm } } as CollectionFilterParameter)

+ 2 - 1
admin-ui/src/i18n-messages/en.json

@@ -29,6 +29,7 @@
     "add-option": "Add option",
     "assets-selected-count": "{ count } assets selected",
     "collection-contents": "Collection contents",
+    "confirm-delete-collection": "Delete collection?",
     "confirm-delete-country": "Delete country?",
     "confirm-delete-facet": "Delete facet?",
     "confirm-delete-facet-value": "Delete facet value?",
@@ -515,4 +516,4 @@
     "update": "Update",
     "zone": "Zone"
   }
-}
+}