feat: Add custom reload action to reload dashboard (#2217)
- Closes: #2215 --------- Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
This commit is contained in:
co-authored by
Felipe Santos
parent
7edaac079e
commit
1f41781a84
@@ -0,0 +1,11 @@
|
||||
import { GeneralActionConfig } from '../../../config/schema/actions/custom/general';
|
||||
import { CardActionsAPI } from '../../types';
|
||||
import { AdvancedCameraCardAction } from './base';
|
||||
|
||||
export class ReloadAction extends AdvancedCameraCardAction<GeneralActionConfig> {
|
||||
public async execute(api: CardActionsAPI): Promise<void> {
|
||||
await super.execute(api);
|
||||
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import { PTZAction } from './actions/ptz';
|
||||
import { PTZControlsAction } from './actions/ptz-controls';
|
||||
import { PTZDigitalAction } from './actions/ptz-digital';
|
||||
import { PTZMultiAction } from './actions/ptz-multi';
|
||||
import { ReloadAction } from './actions/reload';
|
||||
import { ScreenshotAction } from './actions/screenshot';
|
||||
import { SleepAction } from './actions/sleep';
|
||||
import { StatusBarAction } from './actions/status-bar';
|
||||
@@ -150,6 +151,8 @@ export class ActionFactory {
|
||||
return new LogAction(context, action, options?.config);
|
||||
case 'status_bar':
|
||||
return new StatusBarAction(context, action, options?.config);
|
||||
case 'reload':
|
||||
return new ReloadAction(context, action, options?.config);
|
||||
case INTERNAL_CALLBACK_ACTION:
|
||||
return new InternalCallbackAction(context, action, options?.config);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user