Skip to content

Commit 6e8c641

Browse files
committed
add environments selectors
1 parent bf5e552 commit 6e8c641

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

client/packages/lowcoder/src/redux/selectors/enterpriseSelectors.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { AppState } from "../reducers";
2+
import { Environment } from "api/enterpriseApi";
23

34
export const selectEnterpriseEditionStatus = (state: AppState) =>
45
state.ui.enterprise?.enterprise?.eeActive ?? false;
@@ -25,3 +26,44 @@ export const getGlobalBrandingSetting = (state: AppState) => {
2526
export const getWorkspaceBrandingSetting = (state: AppState) => {
2627
return state.ui.enterprise?.workspaceBranding;
2728
}
29+
30+
/* ==============================================
31+
Environment selectors
32+
==============================================
33+
*/
34+
35+
// Select all environments
36+
export const selectEnvironments = (state: AppState): Environment[] =>
37+
state.ui.enterprise?.environments?.list || [];
38+
39+
// Select loading state for environments
40+
export const selectEnvironmentsLoading = (state: AppState): boolean =>
41+
state.ui.enterprise?.environments?.loading || false;
42+
43+
// Select any error that occurred while fetching environments
44+
export const selectEnvironmentsError = (state: AppState): any =>
45+
state.ui.enterprise?.environments?.error;
46+
47+
// Select the currently selected environment
48+
export const selectCurrentEnvironment = (state: AppState): Environment | null =>
49+
state.ui.enterprise?.environments?.currentEnvironment;
50+
51+
// Select a specific environment by ID
52+
export const selectEnvironmentById = (state: AppState, environmentId: string): Environment | undefined =>
53+
state.ui.enterprise?.environments?.list.find(env => env.environmentId === environmentId);
54+
55+
// Select environment creation status
56+
export const selectEnvironmentCreating = (state: AppState): boolean =>
57+
state.ui.enterprise?.environments?.creating || false;
58+
59+
// Select environment update status
60+
export const selectEnvironmentUpdating = (state: AppState): boolean =>
61+
state.ui.enterprise?.environments?.updating || false;
62+
63+
// Select environment deletion status
64+
export const selectEnvironmentDeleting = (state: AppState): boolean =>
65+
state.ui.enterprise?.environments?.deleting || false;
66+
67+
// Select API key update status
68+
export const selectApiKeyUpdating = (state: AppState): boolean =>
69+
state.ui.enterprise?.environments?.updatingApiKey || false;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy