Skip to content

Commit

Permalink
Make StatusWidget tools extendable
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaucau committed Dec 7, 2021
1 parent 7bab6ed commit 9b47c90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions js/dist-typings/admin/components/StatusWidget.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default class StatusWidget extends DashboardWidget {
items(): ItemList<any>;
toolsItems(): ItemList<any>;
handleClearCache(e: any): void;
}
import DashboardWidget from "./DashboardWidget";
Expand Down
13 changes: 12 additions & 1 deletion js/src/admin/components/StatusWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class StatusWidget extends DashboardWidget {
buttonClassName="Button"
menuClassName="Dropdown-menu--right"
>
<Button onclick={this.handleClearCache.bind(this)}>{app.translator.trans('core.admin.dashboard.clear_cache_button')}</Button>
{this.toolsItems().toArray()}
</Dropdown>
);

Expand All @@ -37,6 +37,17 @@ export default class StatusWidget extends DashboardWidget {
return items;
}

toolsItems() {
const items = new ItemList();

items.add(
'clearCache',
<Button onclick={this.handleClearCache.bind(this)}>{app.translator.trans('core.admin.dashboard.clear_cache_button')}</Button>
);

return items;
}

handleClearCache(e) {
app.modal.show(LoadingModal);

Expand Down

0 comments on commit 9b47c90

Please sign in to comment.