Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const state = reactive({
isDomainAdmin: computed(() => userStore.getters.isDomainAdmin),
isAdminMode: computed(() => appContextStore.getters.isAdminMode),
isGrantLoading: computed(() => appContextStore.getters.globalGrantLoading),
visibleAlertIcon: computed(() => globalConfigStore.state.schema.ALERT_MANAGER.uiAffects?.visibleAlertIcon),
visibleAlertIcon: computed(() => globalConfigStore.state.schema.ALERT_MANAGER?.uiAffects?.visibleAlertIcon),
tooltipTexts: computed<Record<string, string>>(() => ({
adminToggle: (state.isAdminMode ? i18n.t('COMMON.GNB.TOOLTIP.EXIT_ADMIN_MODE') : i18n.t('COMMON.GNB.TOOLTIP.ENABLE_ADMIN_MODE')) as string,
})),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export class FeatureSchemaManager {
...this.config,
...config,
};
this.createSchema();
this.setFeatureSchema();
}

createSchema() {
setFeatureSchema() {
const globalConfigStore = useGlobalConfigStore();
const schema = {} as FeatureSchemaType;

Expand All @@ -32,7 +32,6 @@ export class FeatureSchemaManager {
const currentVersion = this.config[feature]?.VERSION || 'V1';
configurator.initialize(currentVersion);
const menuConfig = configurator.getMenu(this.config);

if (configurator.uiAffect) {
configurator.uiAffect.forEach((uiAffect) => {
const targetFeature = uiAffect.feature;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/lib/config/global-config/types/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface FeatureConfiguratorType {
getRoutes: (isAdmin?: boolean) => RouteConfig|null;
getMenu: (config?: GlobalServiceConfig) => FeatureMenuConfig;
initialize: (version: FeatureVersion) => void;
uiAffect: FeatureUiAffect[];
uiAffect?: FeatureUiAffect[];
}

interface UiAffectConfig {
Expand Down
2 changes: 0 additions & 2 deletions apps/web/src/lib/site-initializer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { initDomain } from '@/lib/site-initializer/domain';
import { initDomainSettings } from '@/lib/site-initializer/domain-settings';
import { initEcharts } from '@/lib/site-initializer/echarts';
import { initErrorHandler } from '@/lib/site-initializer/error-handler';
import { initTaskManagementTemplate } from '@/lib/site-initializer/initTaskManagementTemplate';
import { mergeConfig } from '@/lib/site-initializer/merge-config';
import { initModeSetting } from '@/lib/site-initializer/mode-setting';
import { checkSsoAccessToken } from '@/lib/site-initializer/sso';
Expand Down Expand Up @@ -107,7 +106,6 @@ const init = async () => {
initRequestIdleCallback();
const results = await Promise.allSettled([
checkSsoAccessToken(),
initTaskManagementTemplate(),
]);
const errors: any[] = [];
results.forEach((result) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { pinia } from '@/store/pinia';
import { useUserStore } from '@/store/user/user-store';

import {
useTaskManagementTemplateStore,
} from '@/services/ops-flow/task-management-templates/stores/use-task-management-template-store';

export const initTaskManagementTemplate = async () => {
const userStore = useUserStore(pinia);
if (userStore.state.isSessionExpired) return;

export const initTaskManagementTemplate = async () => {
const taskManagementTemplateStore = useTaskManagementTemplateStore(pinia);
await Promise.allSettled([
taskManagementTemplateStore.setInitialTemplateId(),
Expand Down
11 changes: 9 additions & 2 deletions apps/web/src/lib/site-initializer/merge-config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import { APIError } from '@cloudforet/core-lib/space-connector/error';

import type { PublicConfigGetParameters } from '@/api-clients/config/public-config/schema/api-verbs/get';
import { PUBLIC_CONFIG_NAMES } from '@/api-clients/config/public-config/schema/constant';
import type { PublicConfigModel } from '@/api-clients/config/public-config/schema/model';

import type { GlobalServiceConfig } from '@/lib/config/global-config/types/type';

import ErrorHandler from '@/common/composables/error/errorHandler';

export const mergeConfig = async (config, domainId: string): Promise<GlobalServiceConfig> => {
const baseConfig = config.get('SERVICES') || {};

Expand All @@ -16,8 +19,12 @@ export const mergeConfig = async (config, domainId: string): Promise<GlobalServi
domain_id: domainId,
});
overrideConfig = overrideConfigData.SERVICES || {};
} catch {
console.warn('404 Not Found: Data not found. Setting default values.');
} catch (e: any) {
if (e instanceof APIError && e.status === 404) {
console.warn('404 Not Found: Service Setting Data not found. Setting default values.');
} else {
ErrorHandler.handleError(e);
}
}

Object.keys(overrideConfig).forEach((serviceName) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const state = reactive({
result[type].push({
label: i18n.t('ALERT_MANAGER.EVENT_RULE.ASSET_TYPE'),
name: 'asset_types',
value: matchAssetValue.asset_types.map((i) => storeState.cloudServiceType[i].label).join(', '),
value: matchAssetValue.asset_types.map((i) => (storeState.cloudServiceType[i] ? storeState.cloudServiceType[i].label : i)).join(', '),
});
}
if (matchAssetValue.key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const { visibleContents } = useContentsAccessibility(MENU_ID.OPS_FLOW);

/* Tabs */
const state = reactive({
visibleAlertTab: computed(() => globalConfigStore.state.schema.ALERT_MANAGER.uiAffects?.visibleAssetAlertTab),
visibleAlertTab: computed(() => globalConfigStore.state.schema.ALERT_MANAGER?.uiAffects?.visibleAssetAlertTab),
});
const singleItemTabState = reactive({
tabs: computed(() => {
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/services/auth/authenticator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { useErrorStore } from '@/store/error/error-store';
import { pinia } from '@/store/pinia';
import { useUserStore } from '@/store/user/user-store';

import { initTaskManagementTemplate } from '@/lib/site-initializer/initTaskManagementTemplate';


abstract class Authenticator {
static async signIn(credentials: Record<string, any>, authType: AuthType | 'SAML', verifyCode?: string): Promise<void> {
Expand All @@ -29,7 +27,6 @@ abstract class Authenticator {
await userWorkspaceStore.load();
displayStore.setIsSignInFailed(false);
errorStore.reset();
await initTaskManagementTemplate();
}

static async signOut(): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const budgetPageState = budgetPageStore.$state;
const state = reactive({
loading: true,
budgetData: computed<BudgetModel|null>(() => budgetPageState.budgetData),
visibleBudgetNotification: computed<boolean>(() => globalConfigStore.state.schema.ALERT_MANAGER.uiAffects?.visibleBudgetNotification ?? false),
visibleBudgetNotification: computed<boolean>(() => globalConfigStore.state.schema.ALERT_MANAGER?.uiAffects?.visibleBudgetNotification ?? false),
isWorkspaceTarget: computed<boolean>(() => (state.budgetData?.resource_group === 'WORKSPACE')),
adminModeLink: computed<Location>(() => ({
name: ADMIN_COST_EXPLORER_ROUTE.BUDGET.DETAIL._NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const router = useRouter();
const globalConfigStore = useGlobalConfigStore();

const state = reactive({
visibleUserNotification: computed<boolean>(() => globalConfigStore.state.schema.ALERT_MANAGER.uiAffects?.visibleUserNotification ?? false),
visibleUserNotification: computed<boolean>(() => globalConfigStore.state.schema.ALERT_MANAGER?.uiAffects?.visibleUserNotification ?? false),
isDataValid: false,
notificationLevel: 'LV1' as NotificationLevel,
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const props = withDefaults(defineProps<{
});
const route = useRoute();
const state = reactive({
visibleUserNotification: computed<boolean>(() => globalConfigStore.state.schema.ALERT_MANAGER.uiAffects?.visibleUserNotification ?? false),
visibleUserNotification: computed<boolean>(() => globalConfigStore.state.schema.ALERT_MANAGER?.uiAffects?.visibleUserNotification ?? false),
loading: true,
channelLoading: true,
userId: computed<string|undefined>(() => (route.params.userId ? decodeURIComponent(route.params.userId) : userStore.state.userId)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const globalConfigStore = useGlobalConfigStore();

export const useNotificationItem = <Data>(_state: NotificationItemState<Data>, emit: Emit<Data>) => {
const state = reactive({
visibleUserNotification: computed<boolean>(() => globalConfigStore.state.schema.ALERT_MANAGER.uiAffects?.visibleUserNotification ?? false),
visibleUserNotification: computed<boolean>(() => globalConfigStore.state.schema.ALERT_MANAGER?.uiAffects?.visibleUserNotification ?? false),
isEditMode: _state.isEditMode,
dataForEdit: _state.dataForEdit,
userChannelId: _state.userChannelId,
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/services/ops-flow/configurator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { RouteConfig } from 'vue-router';
import type { FeatureConfiguratorType, FeatureMenuConfig, FeatureUiAffect } from '@/lib/config/global-config/types/type';
import type { Menu } from '@/lib/menu/config';
import { MENU_ID } from '@/lib/menu/config';
import { initTaskManagementTemplate } from '@/lib/site-initializer/initTaskManagementTemplate';

import adminOpsFlowRoutes from '@/services/ops-flow/routes/admin/routes';
import opsFlowRoutes from '@/services/ops-flow/routes/routes';
Expand All @@ -22,6 +23,8 @@ class OpsFlowConfigurator implements FeatureConfiguratorType {
}

getMenu(): FeatureMenuConfig {
initTaskManagementTemplate();

const baseMenu: Menu = {
id: MENU_ID.OPS_FLOW,
needPermissionByRole: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const useTaskManagementTemplateStore = defineStore('task-management-templ
} catch (e) {
if (e instanceof APIError && e.status === 404) {
state.templateId = 'default';
console.warn('404 Not Found: Template Id Data not found.');
return;
}
ErrorHandler.handleError(e);
Expand Down Expand Up @@ -111,6 +112,7 @@ export const useTaskManagementTemplateStore = defineStore('task-management-templ
} catch (e) {
if (e instanceof APIError && e.status === 404) {
state.enableLanding = false;
console.warn('404 Not Found: Template Landing Data not found.');
return;
}
ErrorHandler.handleError(e);
Expand Down
Loading