Skip to content
Snippets Groups Projects

New GUI V2 structure

Merged Mohammad Torkashvand requested to merge feature/NAT-556-gui-v2-new-structure into develop
All threads resolved!
1 file
+ 43
37
Compare changes
  • Side-by-side
  • Inline
import process from 'process';
import process from 'process';
 
import { Environment, OrchestratorConfig } from '@orchestrator-ui/orchestrator-ui-components';
import {
// Default configurations
Environment,
export const DEFAULT_GRAPHQL_CORE_ENDPOINT = 'http://localhost:8080/api/graphql';
OrchestratorConfig,
} from '@orchestrator-ui/orchestrator-ui-components';
export const DEFAULT_GRAPHQL_CORE_ENDPOINT =
'http://localhost:8080/api/graphql';
export const DEFAULT_ORCHESTRATOR_API_BASE_URL = 'http://localhost:8080/api';
export const DEFAULT_ORCHESTRATOR_API_BASE_URL = 'http://localhost:8080/api';
export const DEFAULT_ORCHESTRATOR_WEBSOCKET_URL = 'ws://localhost:8080';
export const DEFAULT_ORCHESTRATOR_WEBSOCKET_URL = 'ws://localhost:8080';
export const ENGINE_STATUS_ENDPOINT = '/settings/status';
export const ENGINE_STATUS_ENDPOINT = '/settings/status';
export const PROCESSES_ENDPOINT = '/processes';
export const PROCESSES_ENDPOINT = '/processes';
export const SUBSCRIPTION_ACTIONS_ENDPOINT = '/subscriptions/workflows';
export const SUBSCRIPTION_ACTIONS_ENDPOINT = '/subscriptions/workflows';
export const SUBSCRIPTION_PROCESSES_ENDPOINT =
export const SUBSCRIPTION_PROCESSES_ENDPOINT = '/processes/process-subscriptions-by-subscription-id';
'/processes/process-subscriptions-by-subscription-id';
export const DEFAULT_WORKFLOW_INFORMATION_LINK_URL = 'http://localhost:8080';
export const DEFAULT_WORKFLOW_INFORMATION_LINK_URL = 'http://localhost:8080';
 
interface EnvConfig {
 
ORCHESTRATOR_GRAPHQL_HOST?: string;
 
ORCHESTRATOR_GRAPHQL_PATH?: string;
 
ORCHESTRATOR_API_HOST?: string;
 
ORCHESTRATOR_API_PATH?: string;
 
ORCHESTRATOR_WEBSOCKET_URL?: string;
 
ENVIRONMENT_NAME?: string;
 
AUTH_ACTIVE?: string;
 
USE_WEB_SOCKETS?: string;
 
USE_THEME_TOGGLE?: string;
 
WORKFLOW_INFORMATION_LINK_URL?: string;
 
SHOW_WORKFLOW_INFORMATION_LINK?: string;
 
}
 
 
const getEnvValue = (envVar: string | undefined, defaultValue: string): string =>
 
envVar || defaultValue;
 
 
const getBooleanEnvValue = (envVar: string | undefined, defaultValue: boolean): boolean =>
 
envVar ? envVar.toLowerCase() === 'true' : defaultValue;
 
 
// Assemble the Orchestrator configuration from environment variables
export const getInitialOrchestratorConfig = (): OrchestratorConfig => {
export const getInitialOrchestratorConfig = (): OrchestratorConfig => {
const orchestratorGraphqlBaseUrl =
const env = process.env as unknown as EnvConfig;
process.env.ORCHESTRATOR_GRAPHQL_HOST &&
process.env.ORCHESTRATOR_GRAPHQL_PATH
// Construct URLs based on environment or defaults
? `${process.env.ORCHESTRATOR_GRAPHQL_HOST}${process.env.ORCHESTRATOR_GRAPHQL_PATH}`
const orchestratorGraphqlBaseUrl = env.ORCHESTRATOR_GRAPHQL_HOST && env.ORCHESTRATOR_GRAPHQL_PATH
: DEFAULT_GRAPHQL_CORE_ENDPOINT;
? `${env.ORCHESTRATOR_GRAPHQL_HOST}${env.ORCHESTRATOR_GRAPHQL_PATH}`
 
: DEFAULT_GRAPHQL_CORE_ENDPOINT;
const orchestratorApiBaseUrl =
const orchestratorApiBaseUrl = env.ORCHESTRATOR_API_HOST && env.ORCHESTRATOR_API_PATH
process.env.ORCHESTRATOR_API_HOST && process.env.ORCHESTRATOR_API_PATH
? `${env.ORCHESTRATOR_API_HOST}${env.ORCHESTRATOR_API_PATH}`
? `${process.env.ORCHESTRATOR_API_HOST}${process.env.ORCHESTRATOR_API_PATH}`
: DEFAULT_ORCHESTRATOR_API_BASE_URL;
: DEFAULT_ORCHESTRATOR_API_BASE_URL;
return {
return {
orchestratorApiBaseUrl,
orchestratorApiBaseUrl,
engineStatusEndpoint: orchestratorApiBaseUrl + ENGINE_STATUS_ENDPOINT,
engineStatusEndpoint: orchestratorApiBaseUrl + ENGINE_STATUS_ENDPOINT,
graphqlEndpointCore: orchestratorGraphqlBaseUrl,
graphqlEndpointCore: orchestratorGraphqlBaseUrl,
processesEndpoint: orchestratorApiBaseUrl + PROCESSES_ENDPOINT,
processesEndpoint: orchestratorApiBaseUrl + PROCESSES_ENDPOINT,
environmentName:
environmentName: getEnvValue(env.ENVIRONMENT_NAME, Environment.DEVELOPMENT),
process.env.ENVIRONMENT_NAME ?? Environment.DEVELOPMENT,
subscriptionActionsEndpoint: orchestratorApiBaseUrl + SUBSCRIPTION_ACTIONS_ENDPOINT,
subscriptionActionsEndpoint:
subscriptionProcessesEndpoint: orchestratorApiBaseUrl + SUBSCRIPTION_PROCESSES_ENDPOINT,
orchestratorApiBaseUrl + SUBSCRIPTION_ACTIONS_ENDPOINT,
orchestratorWebsocketUrl: getEnvValue(env.ORCHESTRATOR_WEBSOCKET_URL, DEFAULT_ORCHESTRATOR_WEBSOCKET_URL),
subscriptionProcessesEndpoint:
authActive: getBooleanEnvValue(env.AUTH_ACTIVE, true),
orchestratorApiBaseUrl + SUBSCRIPTION_PROCESSES_ENDPOINT,
useWebSockets: getBooleanEnvValue(env.USE_WEB_SOCKETS, false),
orchestratorWebsocketUrl:
useThemeToggle: getBooleanEnvValue(env.USE_THEME_TOGGLE, false),
process.env.ORCHESTRATOR_WEBSOCKET_URL ||
workflowInformationLinkUrl: getEnvValue(env.WORKFLOW_INFORMATION_LINK_URL, DEFAULT_WORKFLOW_INFORMATION_LINK_URL),
DEFAULT_ORCHESTRATOR_WEBSOCKET_URL,
showWorkflowInformationLink: getBooleanEnvValue(env.SHOW_WORKFLOW_INFORMATION_LINK, false),
authActive: process.env.AUTH_ACTIVE?.toLowerCase() != 'false',
useWebSockets: process.env.USE_WEB_SOCKETS?.toLowerCase() === 'true',
useThemeToggle: process.env.USE_THEME_TOGGLE?.toLowerCase() === 'true',
workflowInformationLinkUrl:
process.env.WORKFLOW_INFORMATION_LINK_URL ??
DEFAULT_WORKFLOW_INFORMATION_LINK_URL,
showWorkflowInformationLink:
process.env.SHOW_WORKFLOW_INFORMATION_LINK?.toLowerCase() ===
'true',
};
};
};
};
Loading