Skip to content

Commit

Permalink
Merge pull request #105 from center-for-threat-informed-defense/AF-17…
Browse files Browse the repository at this point in the history
…9-splash-bugs

AF-179 Fix splash screen bugs
  • Loading branch information
mikecarenzo committed Aug 25, 2023
2 parents 6f5bb26 + 654a443 commit aee44e9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { AppCommand } from "../AppCommand";
import { ApplicationStore } from "@/store/StoreTypes";

export class GroupCommand extends AppCommand {

/**
* The list of commands in order of application.
*/
public readonly commands: ReadonlyArray<AppCommand>;

/**
* Executes a series of page commands.
* @param context
* The application context.
*/
constructor(context: ApplicationStore) {
super(context);
this.commands = [];
}

/**
* Adds a command to the group.
* @param command
* The command.
*/
public add(command: AppCommand) {
(this.commands as AppCommand[]).push(command);
}

/**
* Applies the set of commands.
*/
public execute(): void {
for(const command of this.commands) {
command.execute();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from "./ClearPageRecoveryBank";
export * from "./CopySelectedChildren";
export * from "./GroupCommand";
export * from "./HideSplashMenu";
export * from "./LoadFile";
export * from "./LoadSettings";
Expand Down
14 changes: 12 additions & 2 deletions src/attack_flow_builder/src/store/Stores/ContextMenuStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,23 @@ export default {
{
text: "New File",
type: MenuType.Item,
data: () => App.LoadFile.fromNew(ctx),
data: async () => {
const cmd = new App.GroupCommand(ctx);
cmd.add(await App.LoadFile.fromNew(ctx));
cmd.add(new App.HideSplashMenu(ctx));
return cmd;
},
shortcut: file.new_file,
},
{
text: `Open File...`,
type: MenuType.Item,
data: () => App.LoadFile.fromFileSystem(ctx),
data: async () => {
const cmd = new App.GroupCommand(ctx);
cmd.add(await App.LoadFile.fromFileSystem(ctx));
cmd.add(new App.HideSplashMenu(ctx));
return cmd;
},
shortcut: file.open_file,
}
],
Expand Down

0 comments on commit aee44e9

Please sign in to comment.