import { StoreModel } from "../../../../../clients/StoreModel"; import { Workspace as WorkspaceType } from "../../../../../platform/services/workspace/types"; import { StandardCallback, StandardErrorCallback } from "../../../../../types"; type UserInputResponseType = { choice: string; value?: string; }; type SaveWorkspaceWaterfallParams = { workspaceExists: boolean; workspaceName: string; template: any; }; export type ReorderType = { oldIndex: number; newIndex: number; }; declare let WorkspaceManagementStore: StoreModel; declare let WorkspaceManagementGlobalStore: StoreModel; declare const Actions: { autoSave: (callback: StandardCallback) => void; completeInitialize: () => void; /********************************************************************************************* * * GETTERS/SETTERS * *********************************************************************************************/ getActiveWorkspace: () => Promise; getWorkspaceBeingEdited: () => Promise; getWorkspaceList: () => Promise; getIsSwitchingWorkspaces: () => Promise; setIsSwitchingWorkspaces: (val: boolean) => import("../../../../../typedoc-types").StandardPromise; getIsPromptingUser: () => Promise; setIsPromptingUser: (val: boolean) => import("../../../../../typedoc-types").StandardPromise; /********************************************************************************************* * * Main Workspace Actions * *********************************************************************************************/ /** * Handles the complete workflow for creating a new workspace. * We make sure the user doesn't lose any unsaved work, ask them to name it, make sure that workspace doesn't already exist, then actually save the new workspace. After that, we fire off a notification to let them know that everything was a great success. */ newWorkspace: () => void; /** * Handles the workflow for removing a workspace. * As long as you are not deleting the workspace that is active, it will pop up a confirm dialog, * and if the user says "yes", it will delete the workspace. */ removeWorkspace: (data: { name: string; }, cb?: (val: any) => void) => void; /** * The `activeWorkspace` is simply a copy of something we brought out of storage. This function copies the `activeWorkspace` to back to storage. */ saveWorkspace: (cb?: StandardErrorCallback) => Promise; reorderWorkspaceList: ({ oldIndex, newIndex }: ReorderType) => Promise; renameWorkspace: ({ oldName, newName }: { oldName: string; newName: string; }) => void; showPreferences: () => void; /** * Ask the user for a name, make sure it doesn't already exist, then save. */ saveWorkspaceAs: () => void; /** * Asks the user if they'd like to save their data, then loads the requested workspace. */ switchToWorkspace: ({ name }: { name: string; }) => Promise; /********************************************************************************************* * * Workspace Management Helpers * *********************************************************************************************/ /** * General handler for `async.series` and `async.waterfall` */ onAsyncComplete(err?: Error | null): void; /** * Helper for spawning dialogs. Keeps the internals of other functions squeaky clean. * * @param {string} type "YesNoDialog" or "SingleInputDialog" * @param {object} data Optional params for the dialog call. * @param {function} responseCallback invoked when the user interacts with the dialog. */ spawnDialog(type: "YesNoDialog" | "SingleInputDialog", data: any, responseCallback: StandardErrorCallback): void; spawnSaveAsDialog: (cb: StandardCallback) => void; /** * Spawns an input field asking what the user would like to name their new workspace. */ spawnWorkspaceInputField: (cb: StandardCallback) => void; /** * Asks the user if they'd like to save their workspace if it's different from what's in storage. If the workspace is clean, we just invoke the callback. */ askIfUserWantsToSave: (callback: StandardCallback) => Promise; /** * Handles the response from the dialog asking if the user wants to save their workspace. * * @param {any} response * @param {any} callback */ handleSaveDialogResponse(response: UserInputResponseType, callback: StandardErrorCallback): void; /** * Makes sure the user has input a valid workspace name. */ validateWorkspaceInput(response: UserInputResponseType, callback: StandardErrorCallback): void; askAboutOverwrite(params: SaveWorkspaceWaterfallParams, callback: StandardErrorCallback): void; askIfUserWantsNewWorkspace(params: SaveWorkspaceWaterfallParams, callback: StandardErrorCallback): void; /** * Checks if the workspace exists. If it does, it asks the user if they're comfortable overwriting that data. */ checkIfWorkspaceAlreadyExists(response: any, callback: StandardErrorCallback): void; }; /** * Initializes the store for the Workspace Management Menu. */ declare function initialize(cb: any): void; declare let getStore: () => StoreModel; /** * This is a quick little initialization manager that Terry hacked up. * Ultimately everything in this file should be rewritten in hooks/redux pattern. */ declare class StoreManager { initialized: boolean; initializing: boolean; callbacks: Function[]; store: StoreModel | null; constructor(); initialize(): void; addInitializedListener(cb: (store: StoreModel) => void): void; removeInitializedListener(cb: Function): void; } declare const storeManager: StoreManager; export { storeManager, WorkspaceManagementGlobalStore as GlobalStore, initialize, WorkspaceManagementStore as Store, Actions, getStore, }; //# sourceMappingURL=workspaceManagementMenuStore.d.ts.map