@@ -1,28 +0,0 @@
|
||||
import { FoldersViewActionConfig } from '../../../config/schema/actions/custom/folders-view';
|
||||
import { FolderViewQuery } from '../../../view/query';
|
||||
import { CardActionsAPI } from '../../types';
|
||||
import { AdvancedCameraCardAction } from './base';
|
||||
|
||||
export class FoldersViewAction extends AdvancedCameraCardAction<FoldersViewActionConfig> {
|
||||
public async execute(api: CardActionsAPI): Promise<void> {
|
||||
await super.execute(api);
|
||||
|
||||
const folder = api.getFoldersManager().getFolder(this._action.folder);
|
||||
if (!folder) {
|
||||
return;
|
||||
}
|
||||
|
||||
const query = api.getFoldersManager().generateDefaultFolderQuery(folder);
|
||||
if (!query) {
|
||||
return;
|
||||
}
|
||||
|
||||
await api.getViewManager().setViewByParametersWithExistingQuery({
|
||||
params: {
|
||||
// Supports both 'folder' and 'folders' views.
|
||||
view: this._action.advanced_camera_card_action,
|
||||
query: new FolderViewQuery(query),
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,11 @@ export class ViewAction extends AdvancedCameraCardAction<ViewActionConfig> {
|
||||
params: {
|
||||
view: this._action.advanced_camera_card_action,
|
||||
},
|
||||
...(this._action.folder && {
|
||||
queryExecutorOptions: {
|
||||
folder: this._action.folder,
|
||||
},
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import { DefaultAction } from './actions/default';
|
||||
import { DisplayModeSelectAction } from './actions/display-mode-select';
|
||||
import { DownloadAction } from './actions/download';
|
||||
import { ExpandAction } from './actions/expand';
|
||||
import { FoldersViewAction } from './actions/folders-view';
|
||||
import { FullscreenAction } from './actions/fullscreen';
|
||||
import { InternalCallbackAction } from './actions/internal-callback';
|
||||
import { LogAction } from './actions/log';
|
||||
@@ -86,6 +85,8 @@ export class ActionFactory {
|
||||
return new DefaultAction(context, action, options?.config);
|
||||
case 'clip':
|
||||
case 'clips':
|
||||
case 'folder':
|
||||
case 'folders':
|
||||
case 'image':
|
||||
case 'live':
|
||||
case 'recording':
|
||||
@@ -151,9 +152,6 @@ export class ActionFactory {
|
||||
return new StatusBarAction(context, action, options?.config);
|
||||
case INTERNAL_CALLBACK_ACTION:
|
||||
return new InternalCallbackAction(context, action, options?.config);
|
||||
case 'folder':
|
||||
case 'folders':
|
||||
return new FoldersViewAction(context, action, options?.config);
|
||||
}
|
||||
|
||||
/* istanbul ignore next: this path cannot be reached -- @preserve */
|
||||
|
||||
Reference in New Issue
Block a user