@internetarchive/collection-browser 2.7.6-alpha1 → 2.7.6-alpha2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,10 +23,6 @@ export declare class ManageBar extends LitElement {
23
23
  * Array of items that have been selected for management
24
24
  */
25
25
  selectedItems: Array<ManageableItem>;
26
- /**
27
- * Item removal failure message, if any
28
- */
29
- itemRemovalFailed: string;
30
26
  /**
31
27
  * Whether to show the "Select All" button (default false)
32
28
  */
@@ -35,6 +31,10 @@ export declare class ManageBar extends LitElement {
35
31
  * Whether to show the "Unselect All" button (default false)
36
32
  */
37
33
  showUnselectAll: boolean;
34
+ /**
35
+ * Item removal failure message, if any
36
+ */
37
+ isItemDeleted: boolean;
38
38
  /**
39
39
  * Whether to show "Item Manager the items" button (default false)
40
40
  */
@@ -17,10 +17,6 @@ let ManageBar = class ManageBar extends LitElement {
17
17
  * Array of items that have been selected for management
18
18
  */
19
19
  this.selectedItems = [];
20
- /**
21
- * Item removal failure message, if any
22
- */
23
- this.itemRemovalFailed = '';
24
20
  /**
25
21
  * Whether to show the "Select All" button (default false)
26
22
  */
@@ -29,6 +25,10 @@ let ManageBar = class ManageBar extends LitElement {
29
25
  * Whether to show the "Unselect All" button (default false)
30
26
  */
31
27
  this.showUnselectAll = false;
28
+ /**
29
+ * Item removal failure message, if any
30
+ */
31
+ this.isItemDeleted = true;
32
32
  /**
33
33
  * Whether to show "Item Manager the items" button (default false)
34
34
  */
@@ -39,8 +39,16 @@ let ManageBar = class ManageBar extends LitElement {
39
39
  this.removeAllowed = false;
40
40
  }
41
41
  updated(changed) {
42
- if (changed.has('itemRemovalFailed') && this.itemRemovalFailed !== '') {
43
- this.showRemoveItemsErrorModal();
42
+ var _a, _b;
43
+ if (changed.has('isItemDeleted')) {
44
+ console.log(this.isItemDeleted);
45
+ if (this.isItemDeleted === false) {
46
+ this.showRemoveItemsErrorModal();
47
+ }
48
+ else {
49
+ (_a = this.modalManager) === null || _a === void 0 ? void 0 : _a.closeModal();
50
+ (_b = this.modalManager) === null || _b === void 0 ? void 0 : _b.classList.remove('remove-items');
51
+ }
44
52
  }
45
53
  }
46
54
  render() {
@@ -174,7 +182,7 @@ let ManageBar = class ManageBar extends LitElement {
174
182
  showHeaderLogo: false,
175
183
  closeOnBackdropClick: true,
176
184
  title: html `${msg('Error: unable to remove items')}`,
177
- message: html `${msg(this.itemRemovalFailed)}`,
185
+ message: html `${msg('An error occurred while removing items. Please try again in a few minutes.')}`,
178
186
  });
179
187
  (_a = this.modalManager) === null || _a === void 0 ? void 0 : _a.classList.add('remove-items');
180
188
  (_b = this.modalManager) === null || _b === void 0 ? void 0 : _b.showModal({
@@ -235,15 +243,15 @@ __decorate([
235
243
  __decorate([
236
244
  property({ type: Object })
237
245
  ], ManageBar.prototype, "selectedItems", void 0);
238
- __decorate([
239
- property({ type: String })
240
- ], ManageBar.prototype, "itemRemovalFailed", void 0);
241
246
  __decorate([
242
247
  property({ type: Boolean })
243
248
  ], ManageBar.prototype, "showSelectAll", void 0);
244
249
  __decorate([
245
250
  property({ type: Boolean })
246
251
  ], ManageBar.prototype, "showUnselectAll", void 0);
252
+ __decorate([
253
+ property({ type: Boolean })
254
+ ], ManageBar.prototype, "isItemDeleted", void 0);
247
255
  __decorate([
248
256
  property({ type: Boolean })
249
257
  ], ManageBar.prototype, "showManageButton", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"manage-bar.js","sourceRoot":"","sources":["../../../src/manage/manage-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EACL,UAAU,EACV,IAAI,EACJ,GAAG,GAIJ,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EACL,WAAW,GAEZ,MAAM,gCAAgC,C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Aa,CAAC,YAAY,CAAC;GACf,SAAS,CA2PrB;SA3PY,SAAS","sourcesContent":["import { msg } from '@lit/localize';\nimport {\n LitElement,\n html,\n css,\n TemplateResult,\n CSSResultGroup,\n PropertyValues,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { when } from 'lit/directives/when.js';\nimport {\n ModalConfig,\n type ModalManagerInterface,\n} from '@internetarchive/modal-manager';\nimport iaButtonStyle from '../styles/ia-button';\nimport './remove-items-modal-content';\n\nexport interface ManageableItem {\n identifier: string;\n title?: string;\n dateStr?: string;\n}\n\n@customElement('manage-bar')\nexport class ManageBar extends LitElement {\n /**\n * The label displayed in front of the management buttons\n */\n @property({ type: String }) label = msg('Select items to remove');\n\n /**\n * Specifies the context in which the collection browser is being used\n */\n @property({ type: String }) activeTabId?: string;\n\n /**\n * The shared modal manager component for displaying modal dialogs on this page\n */\n @property({ type: Object }) modalManager?: ModalManagerInterface;\n\n /**\n * Array of items that have been selected for management\n */\n @property({ type: Object }) selectedItems: Array<ManageableItem> = [];\n\n /**\n * Item removal failure message, if any\n */\n @property({ type: String }) itemRemovalFailed = '';\n\n /**\n * Whether to show the \"Select All\" button (default false)\n */\n @property({ type: Boolean }) showSelectAll = false;\n\n /**\n * Whether to show the \"Unselect All\" button (default false)\n */\n @property({ type: Boolean }) showUnselectAll = false;\n\n /**\n * Whether to show \"Item Manager the items\" button (default false)\n */\n @property({ type: Boolean }) showManageButton = false;\n\n /**\n * Whether to active delete button for selectable items\n */\n @property({ type: Boolean }) removeAllowed = false;\n\n updated(changed: PropertyValues): void {\n if (changed.has('itemRemovalFailed') && this.itemRemovalFailed !== '') {\n this.showRemoveItemsErrorModal();\n }\n }\n\n render(): TemplateResult {\n return html`\n <div class=\"manage-container\">\n <span class=\"manage-label\">${this.label}</span>\n <div class=\"manage-buttons\">\n <button class=\"ia-button dark\" @click=${this.cancelClicked}>\n ${msg('Cancel')}\n </button>\n <button\n class=\"ia-button danger\"\n ?disabled=${!this.removeAllowed}\n @click=${this.showRemoveItemsModal}\n >\n ${msg('Remove selected items')}\n </button>\n ${when(\n this.showManageButton,\n () => html` <button\n class=\"ia-button warning\"\n ?disabled=${!this.removeAllowed}\n @click=${this.manageItemsClicked}\n >\n ${msg('Item Manager the items')}\n </button>`\n )}\n <div class=\"selection-buttons\">\n ${when(\n this.showSelectAll,\n () => html` <button\n class=\"ia-button link select-all-btn\"\n @click=${this.selectAllClicked}\n >\n ${msg('Select all')}\n </button>`\n )}\n ${when(\n this.showUnselectAll,\n () => html` <button\n class=\"ia-button link unselect-all-btn\"\n @click=${this.unselectAllClicked}\n >\n ${msg('Unselect all')}\n </button>`\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n private cancelClicked(): void {\n this.dispatchEvent(new CustomEvent('cancel'));\n }\n\n /**\n * Shows a modal dialog confirming the list of items to be removed\n * @param items Which items to list in the modal\n */\n private removeItemsClicked(): void {\n this.showRemoveItemsProcessingModal();\n this.dispatchEvent(new CustomEvent('removeItems'));\n }\n\n private manageItemsClicked(): void {\n this.dispatchEvent(new CustomEvent('manageItems'));\n }\n\n private selectAllClicked(): void {\n this.dispatchEvent(new CustomEvent('selectAll'));\n }\n\n private unselectAllClicked(): void {\n this.dispatchEvent(new CustomEvent('unselectAll'));\n }\n\n /**\n * Shows a modal dialog confirming the list of items to be removed\n * @param items Which items to list in the modal\n */\n private showRemoveItemsModal(): void {\n const delayMessage =\n this.activeTabId === 'uploads'\n ? msg(\n 'Note: it may take a few minutes for these items to stop appearing in your uploads list.'\n )\n : undefined;\n\n const customModalContent = html`\n <remove-items-modal-content\n .items=${this.selectedItems}\n .message=${delayMessage}\n @confirm=${() => this.removeItemsClicked()}\n ></remove-items-modal-content>\n `;\n\n const config = new ModalConfig({\n showProcessingIndicator: false,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#194880',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Are you sure you want to remove these items?')}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n customModalContent,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n /**\n * Shows a modal dialog indicating that item removal is being processed\n */\n private showRemoveItemsProcessingModal(): void {\n const config = new ModalConfig({\n showProcessingIndicator: true,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#194880',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Removing selected items...')}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n /**\n * Shows a modal dialog indicating that an error occurred while removing items\n */\n private showRemoveItemsErrorModal(): void {\n const config = new ModalConfig({\n showProcessingIndicator: false,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#691916',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Error: unable to remove items')}`,\n message: html`${msg(this.itemRemovalFailed)}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n static get styles(): CSSResultGroup {\n return css`\n ${iaButtonStyle}\n .manage-container {\n display: flex;\n align-items: center;\n column-gap: 5px;\n padding: 20px 0 20px;\n flex-wrap: wrap;\n }\n\n .manage-label {\n display: inline-block;\n font-weight: bold;\n font-size: 1.8rem;\n padding-right: 10px;\n }\n\n .manage-buttons {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n column-gap: 5px;\n }\n\n .selection-buttons {\n display: inherit;\n }\n\n .ia-button,\n button {\n padding: 6px 12px;\n font-size: 1.4rem;\n margin: 3px 0;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"manage-bar.js","sourceRoot":"","sources":["../../../src/manage/manage-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;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,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA2C;AAKzC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAuB;AAKtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAyB;AAKxB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAsB;AAKrB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAA0B;AAKzB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAuB;AA5CxC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAmQrB;SAnQY,SAAS","sourcesContent":["import { msg } from '@lit/localize';\nimport {\n LitElement,\n html,\n css,\n TemplateResult,\n CSSResultGroup,\n PropertyValues,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { when } from 'lit/directives/when.js';\nimport {\n ModalConfig,\n type ModalManagerInterface,\n} from '@internetarchive/modal-manager';\nimport iaButtonStyle from '../styles/ia-button';\nimport './remove-items-modal-content';\n\nexport interface ManageableItem {\n identifier: string;\n title?: string;\n dateStr?: string;\n}\n\n@customElement('manage-bar')\nexport class ManageBar extends LitElement {\n /**\n * The label displayed in front of the management buttons\n */\n @property({ type: String }) label = msg('Select items to remove');\n\n /**\n * Specifies the context in which the collection browser is being used\n */\n @property({ type: String }) activeTabId?: string;\n\n /**\n * The shared modal manager component for displaying modal dialogs on this page\n */\n @property({ type: Object }) modalManager?: ModalManagerInterface;\n\n /**\n * Array of items that have been selected for management\n */\n @property({ type: Object }) selectedItems: Array<ManageableItem> = [];\n\n /**\n * Whether to show the \"Select All\" button (default false)\n */\n @property({ type: Boolean }) showSelectAll = false;\n\n /**\n * Whether to show the \"Unselect All\" button (default false)\n */\n @property({ type: Boolean }) showUnselectAll = false;\n\n /**\n * Item removal failure message, if any\n */\n @property({ type: Boolean }) isItemDeleted = true;\n\n /**\n * Whether to show \"Item Manager the items\" button (default false)\n */\n @property({ type: Boolean }) showManageButton = false;\n\n /**\n * Whether to active delete button for selectable items\n */\n @property({ type: Boolean }) removeAllowed = false;\n\n updated(changed: PropertyValues): void {\n if (changed.has('isItemDeleted')) {\n console.log(this.isItemDeleted)\n if (this.isItemDeleted === false) {\n this.showRemoveItemsErrorModal();\n } else {\n this.modalManager?.closeModal();\n this.modalManager?.classList.remove('remove-items');\n }\n }\n }\n\n render(): TemplateResult {\n return html`\n <div class=\"manage-container\">\n <span class=\"manage-label\">${this.label}</span>\n <div class=\"manage-buttons\">\n <button class=\"ia-button dark\" @click=${this.cancelClicked}>\n ${msg('Cancel')}\n </button>\n <button\n class=\"ia-button danger\"\n ?disabled=${!this.removeAllowed}\n @click=${this.showRemoveItemsModal}\n >\n ${msg('Remove selected items')}\n </button>\n ${when(\n this.showManageButton,\n () => html` <button\n class=\"ia-button warning\"\n ?disabled=${!this.removeAllowed}\n @click=${this.manageItemsClicked}\n >\n ${msg('Item Manager the items')}\n </button>`\n )}\n <div class=\"selection-buttons\">\n ${when(\n this.showSelectAll,\n () => html` <button\n class=\"ia-button link select-all-btn\"\n @click=${this.selectAllClicked}\n >\n ${msg('Select all')}\n </button>`\n )}\n ${when(\n this.showUnselectAll,\n () => html` <button\n class=\"ia-button link unselect-all-btn\"\n @click=${this.unselectAllClicked}\n >\n ${msg('Unselect all')}\n </button>`\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n private cancelClicked(): void {\n this.dispatchEvent(new CustomEvent('cancel'));\n }\n\n /**\n * Shows a modal dialog confirming the list of items to be removed\n * @param items Which items to list in the modal\n */\n private removeItemsClicked(): void {\n this.showRemoveItemsProcessingModal();\n this.dispatchEvent(new CustomEvent('removeItems'));\n }\n\n private manageItemsClicked(): void {\n this.dispatchEvent(new CustomEvent('manageItems'));\n }\n\n private selectAllClicked(): void {\n this.dispatchEvent(new CustomEvent('selectAll'));\n }\n\n private unselectAllClicked(): void {\n this.dispatchEvent(new CustomEvent('unselectAll'));\n }\n\n /**\n * Shows a modal dialog confirming the list of items to be removed\n * @param items Which items to list in the modal\n */\n private showRemoveItemsModal(): void {\n const delayMessage =\n this.activeTabId === 'uploads'\n ? msg(\n 'Note: it may take a few minutes for these items to stop appearing in your uploads list.'\n )\n : undefined;\n\n const customModalContent = html`\n <remove-items-modal-content\n .items=${this.selectedItems}\n .message=${delayMessage}\n @confirm=${() => this.removeItemsClicked()}\n ></remove-items-modal-content>\n `;\n\n const config = new ModalConfig({\n showProcessingIndicator: false,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#194880',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Are you sure you want to remove these items?')}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n customModalContent,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n /**\n * Shows a modal dialog indicating that item removal is being processed\n */\n private showRemoveItemsProcessingModal(): void {\n const config = new ModalConfig({\n showProcessingIndicator: true,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#194880',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Removing selected items...')}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n /**\n * Shows a modal dialog indicating that an error occurred while removing items\n */\n private showRemoveItemsErrorModal(): void {\n const config = new ModalConfig({\n showProcessingIndicator: false,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#691916',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Error: unable to remove items')}`,\n message: html`${msg(\n 'An error occurred while removing items. Please try again in a few minutes.',\n )}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n static get styles(): CSSResultGroup {\n return css`\n ${iaButtonStyle}\n .manage-container {\n display: flex;\n align-items: center;\n column-gap: 5px;\n padding: 20px 0 20px;\n flex-wrap: wrap;\n }\n\n .manage-label {\n display: inline-block;\n font-weight: bold;\n font-size: 1.8rem;\n padding-right: 10px;\n }\n\n .manage-buttons {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n column-gap: 5px;\n }\n\n .selection-buttons {\n display: inherit;\n }\n\n .ia-button,\n button {\n padding: 6px 12px;\n font-size: 1.4rem;\n margin: 3px 0;\n }\n `;\n }\n}\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The Internet Archive Collection Browser.",
4
4
  "license": "AGPL-3.0-only",
5
5
  "author": "Internet Archive",
6
- "version": "2.7.6-alpha1",
6
+ "version": "2.7.6-alpha2",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
package/src/app-root.ts CHANGED
@@ -50,8 +50,6 @@ export class AppRoot extends LitElement {
50
50
 
51
51
  @state() private searchType: SearchType = SearchType.METADATA;
52
52
 
53
- @state() private itemRemovalError: String = '';
54
-
55
53
  @property({ type: Object, reflect: false }) latestAction?: AnalyticsEvent;
56
54
 
57
55
  @query('#base-query-field') private baseQueryField!: HTMLInputElement;
@@ -488,15 +486,15 @@ export class AppRoot extends LitElement {
488
486
  .analyticsHandler=${this.analyticsHandler}
489
487
  .pageContext=${'search'}
490
488
  .activeTabId=${'uploads'}
491
- .itemRemovalFailed=${''}
492
489
  @visiblePageChanged=${this.visiblePageChanged}
493
490
  @baseQueryChanged=${this.baseQueryChanged}
494
491
  @searchTypeChanged=${this.searchTypeChanged}
495
492
  @manageModeChanged=${this.manageModeChanged}
496
493
  @itemRemovalRequested=${(e: CustomEvent) => {
497
- console.log('itemRemovalRequested: ', e.detail.items);
498
494
  setTimeout(() => {
499
- this.itemRemovalError = 'something has changed!';
495
+ console.log('itemRemovalRequested: ', e.detail.items);
496
+ this.collectionBrowser.isItemDeleted = false;
497
+ this.collectionBrowser.isManageView = false;
500
498
  }, 1200);
501
499
  }}
502
500
  @itemManagerRequested=${(e: CustomEvent) =>
@@ -723,7 +721,7 @@ export class AppRoot extends LitElement {
723
721
  this.collectionBrowser.isManageView = target.checked;
724
722
  this.collectionBrowser.manageViewLabel =
725
723
  'Select items to remove (customizable texts)';
726
- this.itemRemovalError = '';
724
+ this.collectionBrowser.isItemDeleted = true;
727
725
  }
728
726
 
729
727
  /**
@@ -246,6 +246,8 @@ export class CollectionBrowser
246
246
  */
247
247
  @property({ type: Boolean }) isManageView = true;
248
248
 
249
+ @property({ type: Boolean }) isItemDeleted = true;
250
+
249
251
  @property({ type: String }) manageViewLabel = 'Select items to remove';
250
252
 
251
253
  /** Whether to replace the default sort options with a slot for customization (default: false) */
@@ -264,8 +266,6 @@ export class CollectionBrowser
264
266
  @property({ type: Object }) dataSource: CollectionBrowserDataSourceInterface =
265
267
  new CollectionBrowserDataSource(this, this.pageSize);
266
268
 
267
- @property({ type: String }) itemRemovalFailed = '';
268
-
269
269
  /**
270
270
  * The page that the consumer wants to load.
271
271
  */
@@ -782,9 +782,9 @@ export class CollectionBrowser
782
782
  .label=${this.manageViewLabel}
783
783
  .modalManager=${this.modalManager}
784
784
  .selectedItems=${this.dataSource.checkedTileModels}
785
- .itemRemovalFailed=${this.itemRemovalFailed}
786
785
  showSelectAll
787
786
  showUnselectAll
787
+ ?isItemDeleted=${this.isItemDeleted}
788
788
  ?showManageButton=${this.pageContext === 'search'}
789
789
  ?removeAllowed=${this.dataSource.checkedTileModels.length !== 0}
790
790
  @removeItems=${this.handleRemoveItems}
@@ -44,11 +44,6 @@ export class ManageBar extends LitElement {
44
44
  */
45
45
  @property({ type: Object }) selectedItems: Array<ManageableItem> = [];
46
46
 
47
- /**
48
- * Item removal failure message, if any
49
- */
50
- @property({ type: String }) itemRemovalFailed = '';
51
-
52
47
  /**
53
48
  * Whether to show the "Select All" button (default false)
54
49
  */
@@ -59,6 +54,11 @@ export class ManageBar extends LitElement {
59
54
  */
60
55
  @property({ type: Boolean }) showUnselectAll = false;
61
56
 
57
+ /**
58
+ * Item removal failure message, if any
59
+ */
60
+ @property({ type: Boolean }) isItemDeleted = true;
61
+
62
62
  /**
63
63
  * Whether to show "Item Manager the items" button (default false)
64
64
  */
@@ -70,8 +70,14 @@ export class ManageBar extends LitElement {
70
70
  @property({ type: Boolean }) removeAllowed = false;
71
71
 
72
72
  updated(changed: PropertyValues): void {
73
- if (changed.has('itemRemovalFailed') && this.itemRemovalFailed !== '') {
74
- this.showRemoveItemsErrorModal();
73
+ if (changed.has('isItemDeleted')) {
74
+ console.log(this.isItemDeleted)
75
+ if (this.isItemDeleted === false) {
76
+ this.showRemoveItemsErrorModal();
77
+ } else {
78
+ this.modalManager?.closeModal();
79
+ this.modalManager?.classList.remove('remove-items');
80
+ }
75
81
  }
76
82
  }
77
83
 
@@ -225,7 +231,9 @@ export class ManageBar extends LitElement {
225
231
  showHeaderLogo: false,
226
232
  closeOnBackdropClick: true,
227
233
  title: html`${msg('Error: unable to remove items')}`,
228
- message: html`${msg(this.itemRemovalFailed)}`,
234
+ message: html`${msg(
235
+ 'An error occurred while removing items. Please try again in a few minutes.',
236
+ )}`,
229
237
  });
230
238
 
231
239
  this.modalManager?.classList.add('remove-items');