Skip to content

Commit

Permalink
fix last type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mutdmour committed Jun 10, 2024
1 parent ebc1e86 commit 9ec6414
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 69 deletions.
35 changes: 2 additions & 33 deletions packages/editor-ui/src/Interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,8 @@ export type Modals = {
[key: string]: ModalState;
};

export type ModalKey = keyof Modals;

export type ModalState = {
open: boolean;
mode?: string | null;
Expand Down Expand Up @@ -1920,39 +1922,6 @@ export type EnterpriseEditionFeatureKey =
| 'WorkerView'
| 'AdvancedPermissions';

export type ModalKey =
| 'about'
| 'chatEmbed'
| 'changePassword'
| 'editCredential'
| 'selectCredential'
| 'deleteUser'
| 'inviteUser'
| 'duplicate'
| 'tagsManager'
| 'versions'
| 'settings'
| 'lmChat'
| 'workflowShare'
| 'personalization'
| 'contactPrompt'
| 'npsSurvey'
| 'activation'
| 'onboardingCallSignup'
| 'communityPackageInstall'
| 'communityPackageManageConfirm'
| 'importCurl'
| 'generateCurl'
| 'settingsLogStream'
| 'sourceControlPush'
| 'sourceControlPull'
| 'debugPaywall'
| 'mfaSetup'
| 'workflowHistoryVersionRestore'
| 'suggestedTemplatePreview'
| 'setupCredentials'
| 'externalSecretsProvider';

export type EnterpriseEditionFeatureValue = keyof Omit<IN8nUISettings['enterprise'], 'projects'>;

export interface IN8nPromptResponse {
Expand Down
62 changes: 31 additions & 31 deletions packages/editor-ui/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,37 +36,37 @@ export const QUICKSTART_NOTE_NAME = '_QUICKSTART_NOTE_';
export const MAX_TAG_NAME_LENGTH = 24;

// modals
export const ABOUT_MODAL_KEY: ModalKey = 'about';
export const CHAT_EMBED_MODAL_KEY: ModalKey = 'chatEmbed';
export const CHANGE_PASSWORD_MODAL_KEY: ModalKey = 'changePassword';
export const CREDENTIAL_EDIT_MODAL_KEY: ModalKey = 'editCredential';
export const CREDENTIAL_SELECT_MODAL_KEY: ModalKey = 'selectCredential';
export const DELETE_USER_MODAL_KEY: ModalKey = 'deleteUser';
export const INVITE_USER_MODAL_KEY: ModalKey = 'inviteUser';
export const DUPLICATE_MODAL_KEY: ModalKey = 'duplicate';
export const TAGS_MANAGER_MODAL_KEY: ModalKey = 'tagsManager';
export const VERSIONS_MODAL_KEY: ModalKey = 'versions';
export const WORKFLOW_SETTINGS_MODAL_KEY: ModalKey = 'settings';
export const WORKFLOW_LM_CHAT_MODAL_KEY: ModalKey = 'lmChat';
export const WORKFLOW_SHARE_MODAL_KEY: ModalKey = 'workflowShare';
export const PERSONALIZATION_MODAL_KEY: ModalKey = 'personalization';
export const CONTACT_PROMPT_MODAL_KEY: ModalKey = 'contactPrompt';
export const NPS_SURVEY_MODAL_KEY: ModalKey = 'npsSurvey';
export const WORKFLOW_ACTIVE_MODAL_KEY: ModalKey = 'activation';
export const ONBOARDING_CALL_SIGNUP_MODAL_KEY: ModalKey = 'onboardingCallSignup';
export const COMMUNITY_PACKAGE_INSTALL_MODAL_KEY: ModalKey = 'communityPackageInstall';
export const COMMUNITY_PACKAGE_CONFIRM_MODAL_KEY: ModalKey = 'communityPackageManageConfirm';
export const IMPORT_CURL_MODAL_KEY: ModalKey = 'importCurl';
export const GENERATE_CURL_MODAL_KEY: ModalKey = 'generateCurl';
export const LOG_STREAM_MODAL_KEY: ModalKey = 'settingsLogStream';
export const SOURCE_CONTROL_PUSH_MODAL_KEY: ModalKey = 'sourceControlPush';
export const SOURCE_CONTROL_PULL_MODAL_KEY: ModalKey = 'sourceControlPull';
export const DEBUG_PAYWALL_MODAL_KEY: ModalKey = 'debugPaywall';
export const MFA_SETUP_MODAL_KEY: ModalKey = 'mfaSetup';
export const WORKFLOW_HISTORY_VERSION_RESTORE: ModalKey = 'workflowHistoryVersionRestore';
export const SETUP_CREDENTIALS_MODAL_KEY: ModalKey = 'setupCredentials';

export const EXTERNAL_SECRETS_PROVIDER_MODAL_KEY: ModalKey = 'externalSecretsProvider';
export const ABOUT_MODAL_KEY = 'about';
export const CHAT_EMBED_MODAL_KEY = 'chatEmbed';
export const CHANGE_PASSWORD_MODAL_KEY = 'changePassword';
export const CREDENTIAL_EDIT_MODAL_KEY = 'editCredential';
export const CREDENTIAL_SELECT_MODAL_KEY = 'selectCredential';
export const DELETE_USER_MODAL_KEY = 'deleteUser';
export const INVITE_USER_MODAL_KEY = 'inviteUser';
export const DUPLICATE_MODAL_KEY = 'duplicate';
export const TAGS_MANAGER_MODAL_KEY = 'tagsManager';
export const VERSIONS_MODAL_KEY = 'versions';
export const WORKFLOW_SETTINGS_MODAL_KEY = 'settings';
export const WORKFLOW_LM_CHAT_MODAL_KEY = 'lmChat';
export const WORKFLOW_SHARE_MODAL_KEY = 'workflowShare';
export const PERSONALIZATION_MODAL_KEY = 'personalization';
export const CONTACT_PROMPT_MODAL_KEY = 'contactPrompt';
export const NPS_SURVEY_MODAL_KEY = 'npsSurvey';
export const WORKFLOW_ACTIVE_MODAL_KEY = 'activation';
export const ONBOARDING_CALL_SIGNUP_MODAL_KEY = 'onboardingCallSignup';
export const COMMUNITY_PACKAGE_INSTALL_MODAL_KEY = 'communityPackageInstall';
export const COMMUNITY_PACKAGE_CONFIRM_MODAL_KEY = 'communityPackageManageConfirm';
export const IMPORT_CURL_MODAL_KEY = 'importCurl';
export const GENERATE_CURL_MODAL_KEY = 'generateCurl';
export const LOG_STREAM_MODAL_KEY = 'settingsLogStream';
export const SOURCE_CONTROL_PUSH_MODAL_KEY = 'sourceControlPush';
export const SOURCE_CONTROL_PULL_MODAL_KEY = 'sourceControlPull';
export const DEBUG_PAYWALL_MODAL_KEY = 'debugPaywall';
export const MFA_SETUP_MODAL_KEY = 'mfaSetup';
export const WORKFLOW_HISTORY_VERSION_RESTORE = 'workflowHistoryVersionRestore';
export const SETUP_CREDENTIALS_MODAL_KEY = 'setupCredentials';

export const EXTERNAL_SECRETS_PROVIDER_MODAL_KEY = 'externalSecretsProvider';

export const COMMUNITY_PACKAGE_MANAGE_ACTIONS = {
UNINSTALL: 'uninstall',
Expand Down
11 changes: 6 additions & 5 deletions packages/editor-ui/src/stores/ui.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import type {
AppliedThemeOption,
NotificationOptions,
ModalState,
ModalKey,
} from '@/Interface';
import { defineStore } from 'pinia';
import { useRootStore } from '@/stores/n8nRoot.store';
Expand Down Expand Up @@ -278,19 +279,19 @@ export const useUIStore = defineStore(STORES.UI, {
return this.modals[VERSIONS_MODAL_KEY].open;
},
isModalOpen() {
return (name: string) => this.modals[name].open;
return (name: ModalKey) => this.modals[name].open;
},
isModalActive() {
return (name: string) => this.modalStack.length > 0 && name === this.modalStack[0];
return (name: ModalKey) => this.modalStack.length > 0 && name === this.modalStack[0];
},
getModalActiveId() {
return (name: string) => this.modals[name].activeId;
return (name: ModalKey) => this.modals[name].activeId;
},
getModalMode() {
return (name: string) => this.modals[name].mode;
return (name: ModalKey) => this.modals[name].mode;
},
getModalData() {
return (name: string) => this.modals[name].data;
return (name: ModalKey) => this.modals[name].data;
},
getFakeDoorByLocation() {
return (location: IFakeDoorLocation) =>
Expand Down

0 comments on commit 9ec6414

Please sign in to comment.