mirror of
https://github.com/logos-storage/logos-storage-installer.git
synced 2026-01-05 23:13:06 +00:00
hooks up config menu
This commit is contained in:
parent
a1d6056974
commit
a9c94057e8
12
src/main.js
12
src/main.js
@ -22,9 +22,13 @@ import { showInfoMessage } from "./utils/messages.js";
|
||||
import { ConfigService } from "./services/configService.js";
|
||||
import { openCodexApp } from "./services/codexapp.js";
|
||||
|
||||
import { UiService } from "./services/uiservice.js";
|
||||
import { FsService } from "./services/fsService.js";
|
||||
import { MainMenu } from "./ui/mainmenu.js";
|
||||
import { InstallMenu } from "./ui/installmenu.js";
|
||||
import { UiService } from "./services/uiservice.js";
|
||||
import { ConfigMenu } from "./ui/configmenu.js";
|
||||
import { PathSelector } from "./utils/pathSelector.js";
|
||||
import { NumberSelector } from "./utils/numberSelector.js";
|
||||
|
||||
async function showNavigationMenu() {
|
||||
console.log("\n");
|
||||
@ -91,8 +95,12 @@ export async function main() {
|
||||
|
||||
const configService = new ConfigService();
|
||||
const uiService = new UiService();
|
||||
const fsService = new FsService();
|
||||
const pathSelector = new PathSelector(uiService, fsService);
|
||||
const numberSelector = new NumberSelector(uiService);
|
||||
const installMenu = new InstallMenu(uiService, configService);
|
||||
const mainMenu = new MainMenu(uiService, installMenu);
|
||||
const configMenu = new ConfigMenu(uiService, configService, pathSelector, numberSelector)
|
||||
const mainMenu = new MainMenu(uiService, installMenu, configMenu);
|
||||
|
||||
await mainMenu.show();
|
||||
return;
|
||||
|
||||
@ -21,7 +21,7 @@ export class ConfigMenu {
|
||||
action: this.editLogsDir,
|
||||
},
|
||||
{
|
||||
label: `Storage quota = ${bytesAmountToString(this.config.storageQuota)}`,
|
||||
label: `Storage quota = ${this.bytesAmountToString(this.config.storageQuota)}`,
|
||||
action: this.editStorageQuota,
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
export class MainMenu {
|
||||
constructor(uiService, installMenu) {
|
||||
constructor(uiService, installMenu, configMenu) {
|
||||
this.ui = uiService;
|
||||
this.installMenu = installMenu;
|
||||
this.configMenu = configMenu;
|
||||
this.running = true;
|
||||
}
|
||||
|
||||
@ -22,6 +23,10 @@ export class MainMenu {
|
||||
label: "Install Codex",
|
||||
action: this.installMenu.show,
|
||||
},
|
||||
{
|
||||
label: "Configure Codex",
|
||||
action: this.configMenu.show,
|
||||
},
|
||||
{
|
||||
label: "Exit",
|
||||
action: this.closeMainMenu,
|
||||
|
||||
@ -12,10 +12,14 @@ describe("mainmenu", () => {
|
||||
show: vi.fn(),
|
||||
};
|
||||
|
||||
const mockConfigMenu = {
|
||||
show: vi.fn(),
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.resetAllMocks();
|
||||
|
||||
mainmenu = new MainMenu(mockUiService, mockInstallMenu);
|
||||
mainmenu = new MainMenu(mockUiService, mockInstallMenu, mockConfigMenu);
|
||||
|
||||
// Presents test getting stuck in main loop.
|
||||
const originalPrompt = mainmenu.promptMainMenu;
|
||||
@ -36,6 +40,7 @@ describe("mainmenu", () => {
|
||||
"Select an option",
|
||||
[
|
||||
{ label: "Install Codex", action: mockInstallMenu.show },
|
||||
{ label: "Configure Codex", action: mockConfigMenu.show },
|
||||
{ label: "Exit", action: mainmenu.closeMainMenu },
|
||||
],
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user