feature: add toolbar refresher component (#1088)
This commit is contained in:
1 parent
75ef323e6d
commit
68a269efac
4 files changed
+36
-4
No files matched your search
@@ -95,6 +95,9 @@ export default class RelativeDatetimeLiveComponent extends Component {
|
||||
* @type {string}
|
||||
*/
|
||||
get formatted() {
|
||||
return this.intl.formatRelative(this.scaledDelta, { unit: this.unit });
|
||||
return this.intl.formatRelative(this.scaledDelta, {
|
||||
unit: this.unit,
|
||||
numeric: 'auto',
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{{#if this.lastRefreshed}}
|
||||
<Rose::Toolbar::Info>
|
||||
<RelativeDatetimeLive @date={{this.lastRefreshed}} />
|
||||
</Rose::Toolbar::Info>
|
||||
{{/if}}
|
||||
|
||||
<LoadingButton @onClick={{this.onClick}}>
|
||||
{{t 'actions.refresh'}}
|
||||
</LoadingButton>
|
||||
@@ -0,0 +1,20 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { action } from '@ember/object';
|
||||
|
||||
export default class ToolbarRefresherComponent extends Component {
|
||||
// =properties
|
||||
|
||||
@tracked lastRefreshed = null;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Executes the click handler argument and trackes the time it completed.
|
||||
*/
|
||||
@action
|
||||
async onClick() {
|
||||
await this.args.onClick();
|
||||
this.lastRefreshed = new Date();
|
||||
}
|
||||
}
|
||||
@@ -112,9 +112,9 @@
|
||||
>{{t 'actions.clear-all-filters'}}
|
||||
</Rose::Button>
|
||||
{{/if}}
|
||||
<LoadingButton @onClick={{route-action 'refreshSessions'}}>
|
||||
{{t 'actions.refresh'}}
|
||||
</LoadingButton>
|
||||
|
||||
<ToolbarRefresher @onClick={{route-action 'refreshSessions'}} />
|
||||
|
||||
</Rose::Form>
|
||||
</Rose::Toolbar>
|
||||
{{/if}}
|
||||
|
||||
Reference in new issue
Block a user