diff --git a/apps/web/src/api-clients/_common/constants/api-doc-constant.ts b/apps/web/src/api-clients/_common/constants/api-doc-constant.ts
index 163634c799..88f14c4551 100644
--- a/apps/web/src/api-clients/_common/constants/api-doc-constant.ts
+++ b/apps/web/src/api-clients/_common/constants/api-doc-constant.ts
@@ -25,6 +25,101 @@
*/
export const API_DOC = {
+ 'alert-manager': {
+ alert: [
+ 'create',
+ 'delete',
+ 'get',
+ 'history',
+ 'list',
+ 'update',
+ ],
+ 'escalation-policy': [
+ 'create',
+ 'delete',
+ 'get',
+ 'list',
+ 'update',
+ ],
+ event: [
+ 'create',
+ ],
+ 'event-rule': [
+ 'change-order',
+ 'create',
+ 'delete',
+ 'get',
+ 'list',
+ 'update',
+ ],
+ note: [
+ 'create',
+ 'delete',
+ 'get',
+ 'list',
+ 'update',
+ ],
+ 'notification-protocol': [
+ 'create',
+ 'delete',
+ 'disable',
+ 'enable',
+ 'get',
+ 'list',
+ 'update-plugin',
+ 'update',
+ 'verify-plugin',
+ ],
+ service: [
+ 'change-members',
+ 'create',
+ 'delete',
+ 'get',
+ 'list',
+ 'update',
+ ],
+ 'service-channel': [
+ 'create-forward-channel',
+ 'create',
+ 'delete',
+ 'disable',
+ 'enable',
+ 'get',
+ 'list',
+ 'update',
+ ],
+ 'user-channel': [
+ 'create',
+ 'delete',
+ 'disable',
+ 'enable',
+ 'get',
+ 'list',
+ 'update',
+ ],
+ 'user-group-channel': [
+ 'create',
+ 'delete',
+ 'disable',
+ 'enable',
+ 'get',
+ 'list',
+ 'update',
+ ],
+ webhook: [
+ 'create',
+ 'delete',
+ 'disable',
+ 'enable',
+ 'get',
+ 'list-errors',
+ 'list',
+ 'update-message-format',
+ 'update-plugin',
+ 'update',
+ 'verify-plugin',
+ ],
+ },
config: {
'domain-config': [
'create',
@@ -397,6 +492,79 @@ export const API_DOC = {
'analyze',
],
},
+ monitoring: {
+ alert: [
+ 'assign-user',
+ 'create',
+ 'delete',
+ 'get',
+ 'list',
+ 'update-state',
+ 'update',
+ ],
+ 'data-source': [
+ 'list',
+ ],
+ 'escalation-policy': [
+ 'create',
+ 'delete',
+ 'get',
+ 'list',
+ 'set-default',
+ 'update',
+ ],
+ event: [
+ 'list',
+ ],
+ 'event-rule': [
+ 'change-order',
+ 'create',
+ 'delete',
+ 'get',
+ 'list',
+ 'update',
+ ],
+ log: [
+ 'list',
+ ],
+ note: [
+ 'create',
+ 'delete',
+ 'get',
+ 'list',
+ 'update',
+ ],
+ 'project-alert-config': [
+ 'create',
+ 'delete',
+ 'get',
+ 'list',
+ 'update',
+ ],
+ webhook: [
+ 'create',
+ 'delete',
+ 'disable',
+ 'enable',
+ 'get',
+ 'list',
+ 'update-plugin',
+ 'update',
+ 'verify-plugin',
+ ],
+ },
+ notification: {
+ protocol: [
+ 'create',
+ 'delete',
+ 'disable',
+ 'enable',
+ 'get',
+ 'list',
+ 'update-plugin',
+ 'update',
+ ],
+ },
opsflow: {
comment: [
'create',
diff --git a/apps/web/src/api-clients/alert-manager/alert/composables/use-alert-api.ts b/apps/web/src/api-clients/alert-manager/alert/composables/use-alert-api.ts
new file mode 100644
index 0000000000..d5aa525557
--- /dev/null
+++ b/apps/web/src/api-clients/alert-manager/alert/composables/use-alert-api.ts
@@ -0,0 +1,26 @@
+import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+
+import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { AlertCreateParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/create';
+import type { AlertDeleteParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/delete';
+import type { AlertGetParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/get';
+import type { AlertHistoryParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/history';
+import type { AlertListParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/list';
+import type { AlertUpdateParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/update';
+import type { AlertHistoryModel, AlertModel } from '@/api-clients/alert-manager/alert/schema/model';
+
+export const useAlertApi = () => {
+ const actions = {
+ create: SpaceConnector.clientV2.alertManager.alert.create,
+ delete: SpaceConnector.clientV2.alertManager.alert.delete,
+ get: SpaceConnector.clientV2.alertManager.alert.get,
+ history: SpaceConnector.clientV2.alertManager.alert.history>,
+ list: SpaceConnector.clientV2.alertManager.alert.list>,
+ update: SpaceConnector.clientV2.alertManager.alert.update,
+ };
+
+ return {
+ alertAPI: actions,
+ };
+};
+
diff --git a/apps/web/src/schema/alert-manager/alert/api-verbs/create.ts b/apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/create.ts
similarity index 85%
rename from apps/web/src/schema/alert-manager/alert/api-verbs/create.ts
rename to apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/create.ts
index 1ca43abb2b..6074e7775f 100644
--- a/apps/web/src/schema/alert-manager/alert/api-verbs/create.ts
+++ b/apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/create.ts
@@ -1,4 +1,4 @@
-import type { AlertResourcesType, AlertSeverityType, AlertUrgencyType } from '@/schema/alert-manager/alert/type';
+import type { AlertResourcesType, AlertSeverityType, AlertUrgencyType } from '@/api-clients/alert-manager/alert/schema/type';
export interface AlertCreateParameters {
title: string;
diff --git a/apps/web/src/schema/alert-manager/alert/api-verbs/delete.ts b/apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/alert/api-verbs/delete.ts
rename to apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/alert-manager/alert/api-verbs/get.ts b/apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/alert/api-verbs/get.ts
rename to apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/alert-manager/alert/api-verbs/history.ts b/apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/history.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/alert/api-verbs/history.ts
rename to apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/history.ts
diff --git a/apps/web/src/schema/alert-manager/alert/api-verbs/list.ts b/apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/list.ts
similarity index 91%
rename from apps/web/src/schema/alert-manager/alert/api-verbs/list.ts
rename to apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/list.ts
index 2e9688c080..b5d9aa122f 100644
--- a/apps/web/src/schema/alert-manager/alert/api-verbs/list.ts
+++ b/apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/list.ts
@@ -5,7 +5,7 @@ import type {
AlertSeverityType,
AlertStatusType, AlertTriggeredType,
AlertUrgencyType,
-} from '@/schema/alert-manager/alert/type';
+} from '@/api-clients/alert-manager/alert/schema/type';
export interface AlertListParameters {
query?: Query;
diff --git a/apps/web/src/schema/alert-manager/alert/api-verbs/update.ts b/apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/update.ts
similarity index 62%
rename from apps/web/src/schema/alert-manager/alert/api-verbs/update.ts
rename to apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/update.ts
index 7a3cb2a177..c67905fd95 100644
--- a/apps/web/src/schema/alert-manager/alert/api-verbs/update.ts
+++ b/apps/web/src/api-clients/alert-manager/alert/schema/api-verbs/update.ts
@@ -1,4 +1,4 @@
-import type { AlertUrgencyType, AlertStatusType } from '@/schema/alert-manager/alert/type';
+import type { AlertUrgencyType, AlertStatusType } from '@/api-clients/alert-manager/alert/schema/type';
export interface AlertUpdateParameters {
alert_id: string;
diff --git a/apps/web/src/schema/alert-manager/alert/constants.ts b/apps/web/src/api-clients/alert-manager/alert/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/alert/constants.ts
rename to apps/web/src/api-clients/alert-manager/alert/schema/constants.ts
diff --git a/apps/web/src/schema/alert-manager/alert/model.ts b/apps/web/src/api-clients/alert-manager/alert/schema/model.ts
similarity index 95%
rename from apps/web/src/schema/alert-manager/alert/model.ts
rename to apps/web/src/api-clients/alert-manager/alert/schema/model.ts
index cba934c392..c8b1e79a42 100644
--- a/apps/web/src/schema/alert-manager/alert/model.ts
+++ b/apps/web/src/api-clients/alert-manager/alert/schema/model.ts
@@ -5,7 +5,7 @@ import type {
AlertUrgencyType,
AlertHistoryActionType,
AlertHistoryNotificationInfoType,
-} from '@/schema/alert-manager/alert/type';
+} from '@/api-clients/alert-manager/alert/schema/type';
export interface AlertModel {
alert_id: string;
diff --git a/apps/web/src/schema/alert-manager/alert/type.ts b/apps/web/src/api-clients/alert-manager/alert/schema/type.ts
similarity index 95%
rename from apps/web/src/schema/alert-manager/alert/type.ts
rename to apps/web/src/api-clients/alert-manager/alert/schema/type.ts
index 5ffa4ecf5e..7f99c8c449 100644
--- a/apps/web/src/schema/alert-manager/alert/type.ts
+++ b/apps/web/src/api-clients/alert-manager/alert/schema/type.ts
@@ -2,7 +2,7 @@ import type {
ALERT_SEVERITY, ALERT_STATUS, ALERT_TRIGGERED_TYPE, ALERT_URGENCY,
ALERT_HISTORY_ACTION,
ALERT_HISTORY_NOTIFICATION_STATE,
-} from '@/schema/alert-manager/alert/constants';
+} from '@/api-clients/alert-manager/alert/schema/constants';
export type AlertStatusType = typeof ALERT_STATUS[keyof typeof ALERT_STATUS];
export type AlertUrgencyType = typeof ALERT_URGENCY[keyof typeof ALERT_URGENCY];
diff --git a/apps/web/src/api-clients/alert-manager/escalation-policy/composables/use-escalation-policy-api.ts b/apps/web/src/api-clients/alert-manager/escalation-policy/composables/use-escalation-policy-api.ts
new file mode 100644
index 0000000000..7f361c35c2
--- /dev/null
+++ b/apps/web/src/api-clients/alert-manager/escalation-policy/composables/use-escalation-policy-api.ts
@@ -0,0 +1,24 @@
+import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+
+import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { EscalationPolicyCreateParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/create';
+import type { EscalationPolicyDeleteParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/delete';
+import type { EscalationPolicyGetParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/get';
+import type { EscalationPolicyListParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/list';
+import type { EscalationPolicyUpdateParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/update';
+import type { EscalationPolicyModel } from '@/api-clients/alert-manager/escalation-policy/schema/model';
+
+export const useEscalationPolicyApi = () => {
+ const actions = {
+ create: SpaceConnector.clientV2.alertManager.escalationPolicy.create,
+ delete: SpaceConnector.clientV2.alertManager.escalationPolicy.delete,
+ get: SpaceConnector.clientV2.alertManager.escalationPolicy.get,
+ list: SpaceConnector.clientV2.alertManager.escalationPolicy.list>,
+ update: SpaceConnector.clientV2.alertManager.escalationPolicy.update,
+ };
+
+ return {
+ escalationPolicyAPI: actions,
+ };
+};
+
diff --git a/apps/web/src/schema/alert-manager/escalation-policy/api-verbs/create.ts b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/create.ts
similarity index 86%
rename from apps/web/src/schema/alert-manager/escalation-policy/api-verbs/create.ts
rename to apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/create.ts
index d4ae69a1b3..6e985463db 100644
--- a/apps/web/src/schema/alert-manager/escalation-policy/api-verbs/create.ts
+++ b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/create.ts
@@ -3,7 +3,7 @@ import type {
EscalationPolicyFinishConditionType,
EscalationPolicyRepeatType,
EscalationPolicyRulesType,
-} from '@/schema/alert-manager/escalation-policy/type';
+} from '@/api-clients/alert-manager/escalation-policy/schema/type';
export interface EscalationPolicyCreateParameters {
name: string;
diff --git a/apps/web/src/schema/alert-manager/escalation-policy/api-verbs/delete.ts b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/escalation-policy/api-verbs/delete.ts
rename to apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/alert-manager/escalation-policy/api-verbs/get.ts b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/escalation-policy/api-verbs/get.ts
rename to apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/alert-manager/escalation-policy/api-verbs/list.ts b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/list.ts
similarity index 70%
rename from apps/web/src/schema/alert-manager/escalation-policy/api-verbs/list.ts
rename to apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/list.ts
index 8cab61a71b..7dc1b6bf89 100644
--- a/apps/web/src/schema/alert-manager/escalation-policy/api-verbs/list.ts
+++ b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/list.ts
@@ -1,6 +1,6 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';
-import type { EscalationPolicyFinishConditionType } from '@/schema/alert-manager/escalation-policy/type';
+import type { EscalationPolicyFinishConditionType } from '@/api-clients/alert-manager/escalation-policy/schema/type';
export interface EscalationPolicyListParameters {
query?: Query;
diff --git a/apps/web/src/schema/alert-manager/escalation-policy/api-verbs/update.ts b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/update.ts
similarity index 86%
rename from apps/web/src/schema/alert-manager/escalation-policy/api-verbs/update.ts
rename to apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/update.ts
index 933f30a875..68b8abd555 100644
--- a/apps/web/src/schema/alert-manager/escalation-policy/api-verbs/update.ts
+++ b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/api-verbs/update.ts
@@ -3,7 +3,7 @@ import type {
EscalationPolicyFinishConditionType,
EscalationPolicyRepeatType,
EscalationPolicyRulesType,
-} from '@/schema/alert-manager/escalation-policy/type';
+} from '@/api-clients/alert-manager/escalation-policy/schema/type';
export interface EscalationPolicyUpdateParameters {
escalation_policy_id: string;
diff --git a/apps/web/src/schema/alert-manager/escalation-policy/constants.ts b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/escalation-policy/constants.ts
rename to apps/web/src/api-clients/alert-manager/escalation-policy/schema/constants.ts
diff --git a/apps/web/src/schema/alert-manager/escalation-policy/model.ts b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/model.ts
similarity index 89%
rename from apps/web/src/schema/alert-manager/escalation-policy/model.ts
rename to apps/web/src/api-clients/alert-manager/escalation-policy/schema/model.ts
index 0293026271..eddce58ba8 100644
--- a/apps/web/src/schema/alert-manager/escalation-policy/model.ts
+++ b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/model.ts
@@ -3,7 +3,7 @@ import type {
EscalationPolicyFinishConditionType,
EscalationPolicyRepeatType,
EscalationPolicyRulesType,
-} from '@/schema/alert-manager/escalation-policy/type';
+} from '@/api-clients/alert-manager/escalation-policy/schema/type';
export interface EscalationPolicyModel {
escalation_policy_id: string;
diff --git a/apps/web/src/schema/alert-manager/escalation-policy/type.ts b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/type.ts
similarity index 88%
rename from apps/web/src/schema/alert-manager/escalation-policy/type.ts
rename to apps/web/src/api-clients/alert-manager/escalation-policy/schema/type.ts
index 8ea1fdb9cc..7ce746ea13 100644
--- a/apps/web/src/schema/alert-manager/escalation-policy/type.ts
+++ b/apps/web/src/api-clients/alert-manager/escalation-policy/schema/type.ts
@@ -1,7 +1,7 @@
import type {
ESCALATION_POLICY_FINISH_CONDITION,
ESCALATION_POLICY_STATE,
-} from '@/schema/alert-manager/escalation-policy/constants';
+} from '@/api-clients/alert-manager/escalation-policy/schema/constants';
export type EscalationPolicyStateType = typeof ESCALATION_POLICY_STATE[keyof typeof ESCALATION_POLICY_STATE];
export type EscalationPolicyFinishConditionType = typeof ESCALATION_POLICY_FINISH_CONDITION[keyof typeof ESCALATION_POLICY_FINISH_CONDITION];
diff --git a/apps/web/src/api-clients/alert-manager/event-rule/composables/use-event-rule-api.ts b/apps/web/src/api-clients/alert-manager/event-rule/composables/use-event-rule-api.ts
new file mode 100644
index 0000000000..aa054cadb8
--- /dev/null
+++ b/apps/web/src/api-clients/alert-manager/event-rule/composables/use-event-rule-api.ts
@@ -0,0 +1,26 @@
+import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+
+import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { EventRuleChangeOrderParameters } from '@/api-clients/alert-manager/event-rule/schema/api-verbs/change-order';
+import type { EventRuleCreateParameters } from '@/api-clients/alert-manager/event-rule/schema/api-verbs/create';
+import type { EventRuleDeleteParameters } from '@/api-clients/alert-manager/event-rule/schema/api-verbs/delete';
+import type { EventRuleGetParameters } from '@/api-clients/alert-manager/event-rule/schema/api-verbs/get';
+import type { EventRuleListParameters } from '@/api-clients/alert-manager/event-rule/schema/api-verbs/list';
+import type { EventRuleUpdateParameters } from '@/api-clients/alert-manager/event-rule/schema/api-verbs/update';
+import type { EventRuleModel } from '@/api-clients/alert-manager/event-rule/schema/model';
+
+export const useEventRuleApi = () => {
+ const actions = {
+ changeOrder: SpaceConnector.clientV2.alertManager.eventRule.changeOrder,
+ create: SpaceConnector.clientV2.alertManager.eventRule.create,
+ delete: SpaceConnector.clientV2.alertManager.eventRule.delete,
+ get: SpaceConnector.clientV2.alertManager.eventRule.get,
+ list: SpaceConnector.clientV2.alertManager.eventRule.list>,
+ update: SpaceConnector.clientV2.alertManager.eventRule.update,
+ };
+
+ return {
+ eventRuleAPI: actions,
+ };
+};
+
diff --git a/apps/web/src/schema/alert-manager/event-rule/api-verbs/change-order.ts b/apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/change-order.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/event-rule/api-verbs/change-order.ts
rename to apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/change-order.ts
diff --git a/apps/web/src/schema/alert-manager/event-rule/api-verbs/create.ts b/apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/create.ts
similarity index 89%
rename from apps/web/src/schema/alert-manager/event-rule/api-verbs/create.ts
rename to apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/create.ts
index ddda29c748..e0ec40ca8c 100644
--- a/apps/web/src/schema/alert-manager/event-rule/api-verbs/create.ts
+++ b/apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/create.ts
@@ -4,7 +4,7 @@ import type {
EventRuleConditionsPolicyType,
EventRuleConditionsType, EventRuleOptions,
EventRuleScopeType,
-} from '@/schema/alert-manager/event-rule/type';
+} from '@/api-clients/alert-manager/event-rule/schema/type';
export interface EventRuleCreateParameters {
name?: string;
diff --git a/apps/web/src/schema/alert-manager/event-rule/api-verbs/delete.ts b/apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/event-rule/api-verbs/delete.ts
rename to apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/alert-manager/event-rule/api-verbs/get.ts b/apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/event-rule/api-verbs/get.ts
rename to apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/alert-manager/event-rule/api-verbs/list.ts b/apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/list.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/event-rule/api-verbs/list.ts
rename to apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/list.ts
diff --git a/apps/web/src/schema/alert-manager/event-rule/api-verbs/update.ts b/apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/update.ts
similarity index 88%
rename from apps/web/src/schema/alert-manager/event-rule/api-verbs/update.ts
rename to apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/update.ts
index dbe47c84e1..23b6fe77e5 100644
--- a/apps/web/src/schema/alert-manager/event-rule/api-verbs/update.ts
+++ b/apps/web/src/api-clients/alert-manager/event-rule/schema/api-verbs/update.ts
@@ -3,7 +3,7 @@ import type {
EventRuleActionsType,
EventRuleConditionsPolicyType,
EventRuleConditionsType, EventRuleOptions,
-} from '@/schema/alert-manager/event-rule/type';
+} from '@/api-clients/alert-manager/event-rule/schema/type';
export interface EventRuleUpdateParameters {
event_rule_id: string;
diff --git a/apps/web/src/schema/alert-manager/event-rule/constant.ts b/apps/web/src/api-clients/alert-manager/event-rule/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/event-rule/constant.ts
rename to apps/web/src/api-clients/alert-manager/event-rule/schema/constants.ts
diff --git a/apps/web/src/schema/alert-manager/event-rule/model.ts b/apps/web/src/api-clients/alert-manager/event-rule/schema/model.ts
similarity index 91%
rename from apps/web/src/schema/alert-manager/event-rule/model.ts
rename to apps/web/src/api-clients/alert-manager/event-rule/schema/model.ts
index 539eef9b03..60d08f2016 100644
--- a/apps/web/src/schema/alert-manager/event-rule/model.ts
+++ b/apps/web/src/api-clients/alert-manager/event-rule/schema/model.ts
@@ -5,7 +5,7 @@ import type {
EventRuleConditionsType,
EventRuleOptions,
EventRuleScopeType,
-} from '@/schema/alert-manager/event-rule/type';
+} from '@/api-clients/alert-manager/event-rule/schema/type';
export interface EventRuleModel {
event_rule_id: string;
diff --git a/apps/web/src/schema/alert-manager/event-rule/type.ts b/apps/web/src/api-clients/alert-manager/event-rule/schema/type.ts
similarity index 89%
rename from apps/web/src/schema/alert-manager/event-rule/type.ts
rename to apps/web/src/api-clients/alert-manager/event-rule/schema/type.ts
index 52004cdf13..3f7e7ba828 100644
--- a/apps/web/src/schema/alert-manager/event-rule/type.ts
+++ b/apps/web/src/api-clients/alert-manager/event-rule/schema/type.ts
@@ -1,5 +1,5 @@
-import type { AlertStatusType } from '@/schema/alert-manager/alert/type';
-import type { EVENT_RULE_CONDITIONS_POLICY, EVENT_RULE_URGENCY, EVENT_RULE_SCOPE } from '@/schema/alert-manager/event-rule/constant';
+import type { AlertStatusType } from '@/api-clients/alert-manager/alert/schema/type';
+import type { EVENT_RULE_CONDITIONS_POLICY, EVENT_RULE_URGENCY, EVENT_RULE_SCOPE } from '@/api-clients/alert-manager/event-rule/schema/constants';
export type EventRuleConditionsPolicyType = typeof EVENT_RULE_CONDITIONS_POLICY[keyof typeof EVENT_RULE_CONDITIONS_POLICY];
export type EventRuleUrgencyType = typeof EVENT_RULE_URGENCY[keyof typeof EVENT_RULE_URGENCY];
diff --git a/apps/web/src/api-clients/alert-manager/event/composables/use-event-api.ts b/apps/web/src/api-clients/alert-manager/event/composables/use-event-api.ts
new file mode 100644
index 0000000000..5cc0d196b3
--- /dev/null
+++ b/apps/web/src/api-clients/alert-manager/event/composables/use-event-api.ts
@@ -0,0 +1,15 @@
+import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+
+import type { EventCreateParameters } from '@/api-clients/alert-manager/event/schema/api-verbs/create';
+import type { EventModel } from '@/api-clients/alert-manager/event/schema/model';
+
+export const useEventApi = () => {
+ const actions = {
+ create: SpaceConnector.clientV2.alertManager.event.create,
+ };
+
+ return {
+ eventAPI: actions,
+ };
+};
+
diff --git a/apps/web/src/schema/alert-manager/event/api-verbs/create.ts b/apps/web/src/api-clients/alert-manager/event/schema/api-verbs/create.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/event/api-verbs/create.ts
rename to apps/web/src/api-clients/alert-manager/event/schema/api-verbs/create.ts
diff --git a/apps/web/src/schema/alert-manager/event/constants.ts b/apps/web/src/api-clients/alert-manager/event/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/event/constants.ts
rename to apps/web/src/api-clients/alert-manager/event/schema/constants.ts
diff --git a/apps/web/src/schema/alert-manager/event/model.ts b/apps/web/src/api-clients/alert-manager/event/schema/model.ts
similarity index 84%
rename from apps/web/src/schema/alert-manager/event/model.ts
rename to apps/web/src/api-clients/alert-manager/event/schema/model.ts
index b41a6f0e6f..2a6b9c56aa 100644
--- a/apps/web/src/schema/alert-manager/event/model.ts
+++ b/apps/web/src/api-clients/alert-manager/event/schema/model.ts
@@ -1,4 +1,4 @@
-import type { EventSeverityType, EventType } from '@/schema/alert-manager/event/type';
+import type { EventSeverityType, EventType } from '@/api-clients/alert-manager/event/schema/type';
export interface EventModel {
event_id: string;
diff --git a/apps/web/src/schema/alert-manager/event/type.ts b/apps/web/src/api-clients/alert-manager/event/schema/type.ts
similarity index 60%
rename from apps/web/src/schema/alert-manager/event/type.ts
rename to apps/web/src/api-clients/alert-manager/event/schema/type.ts
index a33245a307..e2ab56d74e 100644
--- a/apps/web/src/schema/alert-manager/event/type.ts
+++ b/apps/web/src/api-clients/alert-manager/event/schema/type.ts
@@ -1,4 +1,4 @@
-import type { EVENT_SEVERITY, EVENT_TYPE } from '@/schema/alert-manager/event/constants';
+import type { EVENT_SEVERITY, EVENT_TYPE } from '@/api-clients/alert-manager/event/schema/constants';
export type EventSeverityType = typeof EVENT_SEVERITY[keyof typeof EVENT_SEVERITY];
export type EventType = typeof EVENT_TYPE[keyof typeof EVENT_TYPE];
diff --git a/apps/web/src/api-clients/alert-manager/note/composables/use-note-api.ts b/apps/web/src/api-clients/alert-manager/note/composables/use-note-api.ts
new file mode 100644
index 0000000000..ed09f3c827
--- /dev/null
+++ b/apps/web/src/api-clients/alert-manager/note/composables/use-note-api.ts
@@ -0,0 +1,24 @@
+import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+
+import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { NoteCreateParameters } from '@/api-clients/alert-manager/note/schema/api-verbs/create';
+import type { NoteDeleteParameters } from '@/api-clients/alert-manager/note/schema/api-verbs/delete';
+import type { NoteGetParameters } from '@/api-clients/alert-manager/note/schema/api-verbs/get';
+import type { NoteListParameters } from '@/api-clients/alert-manager/note/schema/api-verbs/list';
+import type { NoteUpdateParameters } from '@/api-clients/alert-manager/note/schema/api-verbs/update';
+import type { NoteModel } from '@/api-clients/alert-manager/note/schema/model';
+
+export const useNoteApi = () => {
+ const actions = {
+ create: SpaceConnector.clientV2.alertManager.note.create,
+ delete: SpaceConnector.clientV2.alertManager.note.delete,
+ get: SpaceConnector.clientV2.alertManager.note.get,
+ list: SpaceConnector.clientV2.alertManager.note.list>,
+ update: SpaceConnector.clientV2.alertManager.note.update,
+ };
+
+ return {
+ noteAPI: actions,
+ };
+};
+
diff --git a/apps/web/src/schema/alert-manager/note/api-verbs/create.ts b/apps/web/src/api-clients/alert-manager/note/schema/api-verbs/create.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/note/api-verbs/create.ts
rename to apps/web/src/api-clients/alert-manager/note/schema/api-verbs/create.ts
diff --git a/apps/web/src/schema/alert-manager/note/api-verbs/delete.ts b/apps/web/src/api-clients/alert-manager/note/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/note/api-verbs/delete.ts
rename to apps/web/src/api-clients/alert-manager/note/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/alert-manager/note/api-verbs/get.ts b/apps/web/src/api-clients/alert-manager/note/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/note/api-verbs/get.ts
rename to apps/web/src/api-clients/alert-manager/note/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/alert-manager/note/api-verbs/list.ts b/apps/web/src/api-clients/alert-manager/note/schema/api-verbs/list.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/note/api-verbs/list.ts
rename to apps/web/src/api-clients/alert-manager/note/schema/api-verbs/list.ts
diff --git a/apps/web/src/schema/alert-manager/note/api-verbs/update.ts b/apps/web/src/api-clients/alert-manager/note/schema/api-verbs/update.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/note/api-verbs/update.ts
rename to apps/web/src/api-clients/alert-manager/note/schema/api-verbs/update.ts
diff --git a/apps/web/src/schema/alert-manager/note/model.ts b/apps/web/src/api-clients/alert-manager/note/schema/model.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/note/model.ts
rename to apps/web/src/api-clients/alert-manager/note/schema/model.ts
diff --git a/apps/web/src/api-clients/alert-manager/notification-protocol/composables/use-notification-protocol-api.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/composables/use-notification-protocol-api.ts
new file mode 100644
index 0000000000..cbff5e8e06
--- /dev/null
+++ b/apps/web/src/api-clients/alert-manager/notification-protocol/composables/use-notification-protocol-api.ts
@@ -0,0 +1,32 @@
+import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+
+import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { NotificationProtocolCreateParameters } from '@/api-clients/alert-manager/notification-protocol/schema/api-verbs/create';
+import type { NotificationProtocolDeleteParameters } from '@/api-clients/alert-manager/notification-protocol/schema/api-verbs/delete';
+import type { NotificationProtocolDisableParameters } from '@/api-clients/alert-manager/notification-protocol/schema/api-verbs/disable';
+import type { NotificationProtocolEnableParameters } from '@/api-clients/alert-manager/notification-protocol/schema/api-verbs/enable';
+import type { NotificationProtocolGetParameters } from '@/api-clients/alert-manager/notification-protocol/schema/api-verbs/get';
+import type { NotificationProtocolListParameters } from '@/api-clients/alert-manager/notification-protocol/schema/api-verbs/list';
+import type { NotificationProtocolUpdateParameters } from '@/api-clients/alert-manager/notification-protocol/schema/api-verbs/update';
+import type { NotificationProtocolUpdatePluginParameters } from '@/api-clients/alert-manager/notification-protocol/schema/api-verbs/update-plugin';
+import type { NotificationProtocolVerifyPluginParameters } from '@/api-clients/alert-manager/notification-protocol/schema/api-verbs/verify-plugin';
+import type { NotificationProtocolModel } from '@/api-clients/alert-manager/notification-protocol/schema/model';
+
+export const useNotificationProtocolApi = () => {
+ const actions = {
+ create: SpaceConnector.clientV2.alertManager.notificationProtocol.create,
+ delete: SpaceConnector.clientV2.alertManager.notificationProtocol.delete,
+ disable: SpaceConnector.clientV2.alertManager.notificationProtocol.disable,
+ enable: SpaceConnector.clientV2.alertManager.notificationProtocol.enable,
+ get: SpaceConnector.clientV2.alertManager.notificationProtocol.get,
+ list: SpaceConnector.clientV2.alertManager.notificationProtocol.list>,
+ updatePlugin: SpaceConnector.clientV2.alertManager.notificationProtocol.updatePlugin,
+ update: SpaceConnector.clientV2.alertManager.notificationProtocol.update,
+ verifyPlugin: SpaceConnector.clientV2.alertManager.notificationProtocol.verifyPlugin,
+ };
+
+ return {
+ notificationProtocolAPI: actions,
+ };
+};
+
diff --git a/apps/web/src/schema/alert-manager/notification-protocol/api-verbs/create.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/create.ts
similarity index 81%
rename from apps/web/src/schema/alert-manager/notification-protocol/api-verbs/create.ts
rename to apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/create.ts
index 260e2f04eb..5177becb1e 100644
--- a/apps/web/src/schema/alert-manager/notification-protocol/api-verbs/create.ts
+++ b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/create.ts
@@ -1,6 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { NotificationProtocolPluginInfoRequestType } from '@/schema/alert-manager/notification-protocol/type';
-
+import type { NotificationProtocolPluginInfoRequestType } from '@/api-clients/alert-manager/notification-protocol/schema/type';
export interface NotificationProtocolCreateParameters {
name: string;
diff --git a/apps/web/src/schema/alert-manager/notification-protocol/api-verbs/delete.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/notification-protocol/api-verbs/delete.ts
rename to apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/alert-manager/notification-protocol/api-verbs/disable.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/disable.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/notification-protocol/api-verbs/disable.ts
rename to apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/disable.ts
diff --git a/apps/web/src/schema/alert-manager/notification-protocol/api-verbs/enable.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/enable.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/notification-protocol/api-verbs/enable.ts
rename to apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/enable.ts
diff --git a/apps/web/src/schema/alert-manager/notification-protocol/api-verbs/get.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/notification-protocol/api-verbs/get.ts
rename to apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/alert-manager/notification-protocol/api-verbs/list.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/list.ts
similarity index 67%
rename from apps/web/src/schema/alert-manager/notification-protocol/api-verbs/list.ts
rename to apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/list.ts
index 173a7aa9fc..d6b3abc1a2 100644
--- a/apps/web/src/schema/alert-manager/notification-protocol/api-verbs/list.ts
+++ b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/list.ts
@@ -1,6 +1,6 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';
-import type { NotificationProtocolStateType } from '@/schema/alert-manager/notification-protocol/type';
+import type { NotificationProtocolStateType } from '@/api-clients/alert-manager/notification-protocol/schema/type';
export interface NotificationProtocolListParameters {
query?: Query;
diff --git a/apps/web/src/schema/alert-manager/notification-protocol/api-verbs/update-plugin.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/update-plugin.ts
similarity index 81%
rename from apps/web/src/schema/alert-manager/notification-protocol/api-verbs/update-plugin.ts
rename to apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/update-plugin.ts
index 422a7f6d71..a0ebf66977 100644
--- a/apps/web/src/schema/alert-manager/notification-protocol/api-verbs/update-plugin.ts
+++ b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/update-plugin.ts
@@ -1,4 +1,4 @@
-import type { NotificationProtocolPluginUpgradeModeType } from '@/schema/alert-manager/notification-protocol/type';
+import type { NotificationProtocolPluginUpgradeModeType } from '@/api-clients/alert-manager/notification-protocol/schema/type';
export interface NotificationProtocolUpdatePluginParameters {
protocol_id: string;
diff --git a/apps/web/src/schema/alert-manager/notification-protocol/api-verbs/update.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/update.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/notification-protocol/api-verbs/update.ts
rename to apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/update.ts
diff --git a/apps/web/src/schema/alert-manager/notification-protocol/api-verbs/verify-plugin.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/verify-plugin.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/notification-protocol/api-verbs/verify-plugin.ts
rename to apps/web/src/api-clients/alert-manager/notification-protocol/schema/api-verbs/verify-plugin.ts
diff --git a/apps/web/src/schema/alert-manager/notification-protocol/constants.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/notification-protocol/constants.ts
rename to apps/web/src/api-clients/alert-manager/notification-protocol/schema/constants.ts
diff --git a/apps/web/src/schema/alert-manager/notification-protocol/model.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/model.ts
similarity index 86%
rename from apps/web/src/schema/alert-manager/notification-protocol/model.ts
rename to apps/web/src/api-clients/alert-manager/notification-protocol/schema/model.ts
index 09858280e6..4d8e4e4fbe 100644
--- a/apps/web/src/schema/alert-manager/notification-protocol/model.ts
+++ b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/model.ts
@@ -4,7 +4,7 @@ import type { Tags } from '@/api-clients/_common/schema/model';
import type {
NotificationProtocolPluginInfoType,
NotificationProtocolStateType,
-} from '@/schema/alert-manager/notification-protocol/type';
+} from '@/api-clients/alert-manager/notification-protocol/schema/type';
export interface NotificationProtocolModel {
protocol_id: string;
diff --git a/apps/web/src/schema/alert-manager/notification-protocol/type.ts b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/type.ts
similarity index 92%
rename from apps/web/src/schema/alert-manager/notification-protocol/type.ts
rename to apps/web/src/api-clients/alert-manager/notification-protocol/schema/type.ts
index 093b9d778d..4ac5864484 100644
--- a/apps/web/src/schema/alert-manager/notification-protocol/type.ts
+++ b/apps/web/src/api-clients/alert-manager/notification-protocol/schema/type.ts
@@ -1,6 +1,6 @@
import type { JsonSchema } from '@cloudforet/mirinae/types/controls/forms/json-schema-form/type';
-import type { NOTIFICATION_PROTOCOL_STATE, NOTIFICATION_PROTOCOL_PLUGIN_UPGRADE_MODE } from '@/schema/alert-manager/notification-protocol/constants';
+import type { NOTIFICATION_PROTOCOL_STATE, NOTIFICATION_PROTOCOL_PLUGIN_UPGRADE_MODE } from '@/api-clients/alert-manager/notification-protocol/schema/constants';
export type NotificationProtocolStateType = typeof NOTIFICATION_PROTOCOL_STATE[keyof typeof NOTIFICATION_PROTOCOL_STATE];
diff --git a/apps/web/src/api-clients/alert-manager/service-channel/composables/use-service-channel-api.ts b/apps/web/src/api-clients/alert-manager/service-channel/composables/use-service-channel-api.ts
new file mode 100644
index 0000000000..f25d52ec78
--- /dev/null
+++ b/apps/web/src/api-clients/alert-manager/service-channel/composables/use-service-channel-api.ts
@@ -0,0 +1,30 @@
+import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+
+import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { ServiceChannelCreateParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/create';
+import type { ServiceChannelCreateForwardChannelParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/create-forward-channel';
+import type { ServiceChannelDeleteParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/delete';
+import type { ServiceChannelDisableParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/disable';
+import type { ServiceChannelEnableParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/enable';
+import type { ServiceChannelGetParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/get';
+import type { ServiceChannelListParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/list';
+import type { ServiceChannelUpdateParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/update';
+import type { ServiceChannelModel } from '@/api-clients/alert-manager/service-channel/schema/model';
+
+export const useServiceChannelApi = () => {
+ const actions = {
+ createForwardChannel: SpaceConnector.clientV2.alertManager.serviceChannel.createForwardChannel,
+ create: SpaceConnector.clientV2.alertManager.serviceChannel.create,
+ delete: SpaceConnector.clientV2.alertManager.serviceChannel.delete,
+ disable: SpaceConnector.clientV2.alertManager.serviceChannel.disable,
+ enable: SpaceConnector.clientV2.alertManager.serviceChannel.enable,
+ get: SpaceConnector.clientV2.alertManager.serviceChannel.get,
+ list: SpaceConnector.clientV2.alertManager.serviceChannel.list>,
+ update: SpaceConnector.clientV2.alertManager.serviceChannel.update,
+ };
+
+ return {
+ serviceChannelAPI: actions,
+ };
+};
+
diff --git a/apps/web/src/schema/alert-manager/service-channel/api-verbs/create-forward-channel.ts b/apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/create-forward-channel.ts
similarity index 82%
rename from apps/web/src/schema/alert-manager/service-channel/api-verbs/create-forward-channel.ts
rename to apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/create-forward-channel.ts
index 9cc120c911..ec8613bb5c 100644
--- a/apps/web/src/schema/alert-manager/service-channel/api-verbs/create-forward-channel.ts
+++ b/apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/create-forward-channel.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { ServiceChannelDataType, ServiceChannelScheduleInfoType } from '@/schema/alert-manager/service-channel/type';
+import type { ServiceChannelDataType, ServiceChannelScheduleInfoType } from '@/api-clients/alert-manager/service-channel/schema/type';
export interface ServiceChannelCreateForwardChannelParameters {
name: string;
diff --git a/apps/web/src/schema/alert-manager/service-channel/api-verbs/create.ts b/apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/create.ts
similarity index 83%
rename from apps/web/src/schema/alert-manager/service-channel/api-verbs/create.ts
rename to apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/create.ts
index 7a9cb76cdc..37e9b0d926 100644
--- a/apps/web/src/schema/alert-manager/service-channel/api-verbs/create.ts
+++ b/apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/create.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { ServiceChannelDataType, ServiceChannelScheduleInfoType } from '@/schema/alert-manager/service-channel/type';
+import type { ServiceChannelDataType, ServiceChannelScheduleInfoType } from '@/api-clients/alert-manager/service-channel/schema/type';
export interface ServiceChannelCreateParameters {
protocol_id: string;
diff --git a/apps/web/src/schema/alert-manager/service-channel/api-verbs/delete.ts b/apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/service-channel/api-verbs/delete.ts
rename to apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/alert-manager/service-channel/api-verbs/disable.ts b/apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/disable.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/service-channel/api-verbs/disable.ts
rename to apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/disable.ts
diff --git a/apps/web/src/schema/alert-manager/service-channel/api-verbs/enable.ts b/apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/enable.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/service-channel/api-verbs/enable.ts
rename to apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/enable.ts
diff --git a/apps/web/src/schema/alert-manager/service-channel/api-verbs/get.ts b/apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/service-channel/api-verbs/get.ts
rename to apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/alert-manager/service-channel/api-verbs/list.ts b/apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/list.ts
similarity index 86%
rename from apps/web/src/schema/alert-manager/service-channel/api-verbs/list.ts
rename to apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/list.ts
index c7283b3582..fe2f8b25ce 100644
--- a/apps/web/src/schema/alert-manager/service-channel/api-verbs/list.ts
+++ b/apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/list.ts
@@ -3,7 +3,7 @@ import type { Query } from '@cloudforet/core-lib/space-connector/type';
import type {
ServiceChannelStateType,
ServiceChannelType,
-} from '@/schema/alert-manager/service-channel/type';
+} from '@/api-clients/alert-manager/service-channel/schema/type';
export interface ServiceChannelListParameters {
query?: Query;
diff --git a/apps/web/src/schema/alert-manager/service-channel/api-verbs/update.ts b/apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/update.ts
similarity index 81%
rename from apps/web/src/schema/alert-manager/service-channel/api-verbs/update.ts
rename to apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/update.ts
index 51dc4c2801..68221986b6 100644
--- a/apps/web/src/schema/alert-manager/service-channel/api-verbs/update.ts
+++ b/apps/web/src/api-clients/alert-manager/service-channel/schema/api-verbs/update.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { ServiceChannelDataType, ServiceChannelScheduleInfoType } from '@/schema/alert-manager/service-channel/type';
+import type { ServiceChannelDataType, ServiceChannelScheduleInfoType } from '@/api-clients/alert-manager/service-channel/schema/type';
export interface ServiceChannelUpdateParameters {
channel_id: string;
diff --git a/apps/web/src/schema/alert-manager/service-channel/constants.ts b/apps/web/src/api-clients/alert-manager/service-channel/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/service-channel/constants.ts
rename to apps/web/src/api-clients/alert-manager/service-channel/schema/constants.ts
diff --git a/apps/web/src/schema/alert-manager/service-channel/model.ts b/apps/web/src/api-clients/alert-manager/service-channel/schema/model.ts
similarity index 80%
rename from apps/web/src/schema/alert-manager/service-channel/model.ts
rename to apps/web/src/api-clients/alert-manager/service-channel/schema/model.ts
index 0d8bea6974..0b1f852dfe 100644
--- a/apps/web/src/schema/alert-manager/service-channel/model.ts
+++ b/apps/web/src/api-clients/alert-manager/service-channel/schema/model.ts
@@ -1,9 +1,10 @@
import type { Tags } from '@/api-clients/_common/schema/model';
import type {
ServiceChannelDataType,
+ ServiceChannelScheduleInfoType,
ServiceChannelStateType,
- ServiceChannelType, ServiceChannelScheduleInfoType,
-} from '@/schema/alert-manager/service-channel/type';
+ ServiceChannelType,
+} from '@/api-clients/alert-manager/service-channel/schema/type';
export interface ServiceChannelModel {
channel_id: string;
diff --git a/apps/web/src/schema/alert-manager/service-channel/type.ts b/apps/web/src/api-clients/alert-manager/service-channel/schema/type.ts
similarity index 94%
rename from apps/web/src/schema/alert-manager/service-channel/type.ts
rename to apps/web/src/api-clients/alert-manager/service-channel/schema/type.ts
index b349dd71f4..96809817e4 100644
--- a/apps/web/src/schema/alert-manager/service-channel/type.ts
+++ b/apps/web/src/api-clients/alert-manager/service-channel/schema/type.ts
@@ -3,7 +3,7 @@ import type {
SERVICE_CHANNEL_STATE,
SERVICE_CHANNEL_TYPE,
SERVICE_CHANNEL_SCHEDULE_TYPE,
-} from '@/schema/alert-manager/service-channel/constants';
+} from '@/api-clients/alert-manager/service-channel/schema/constants';
export type ServiceChannelStateType = typeof SERVICE_CHANNEL_STATE[keyof typeof SERVICE_CHANNEL_STATE];
export type ServiceChannelType = typeof SERVICE_CHANNEL_TYPE[keyof typeof SERVICE_CHANNEL_TYPE];
diff --git a/apps/web/src/api-clients/alert-manager/service/composables/use-service-api.ts b/apps/web/src/api-clients/alert-manager/service/composables/use-service-api.ts
new file mode 100644
index 0000000000..f1006031cb
--- /dev/null
+++ b/apps/web/src/api-clients/alert-manager/service/composables/use-service-api.ts
@@ -0,0 +1,26 @@
+import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+
+import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { ServiceChangeMembersParameters } from '@/api-clients/alert-manager/service/schema/api-verbs/change-members';
+import type { ServiceCreateParameters } from '@/api-clients/alert-manager/service/schema/api-verbs/create';
+import type { ServiceDeleteParameters } from '@/api-clients/alert-manager/service/schema/api-verbs/delete';
+import type { ServiceGetParameters } from '@/api-clients/alert-manager/service/schema/api-verbs/get';
+import type { ServiceListParameters } from '@/api-clients/alert-manager/service/schema/api-verbs/list';
+import type { ServiceUpdateParameters } from '@/api-clients/alert-manager/service/schema/api-verbs/update';
+import type { ServiceModel } from '@/api-clients/alert-manager/service/schema/model';
+
+export const useServiceApi = () => {
+ const actions = {
+ changeMembers: SpaceConnector.clientV2.alertManager.service.changeMembers,
+ create: SpaceConnector.clientV2.alertManager.service.create,
+ delete: SpaceConnector.clientV2.alertManager.service.delete,
+ get: SpaceConnector.clientV2.alertManager.service.get,
+ list: SpaceConnector.clientV2.alertManager.service.list>,
+ update: SpaceConnector.clientV2.alertManager.service.update,
+ };
+
+ return {
+ serviceAPI: actions,
+ };
+};
+
diff --git a/apps/web/src/schema/alert-manager/service/api-verbs/chagne-members.ts b/apps/web/src/api-clients/alert-manager/service/schema/api-verbs/change-members.ts
similarity index 59%
rename from apps/web/src/schema/alert-manager/service/api-verbs/chagne-members.ts
rename to apps/web/src/api-clients/alert-manager/service/schema/api-verbs/change-members.ts
index ebdd311bd8..9c6eb4dc90 100644
--- a/apps/web/src/schema/alert-manager/service/api-verbs/chagne-members.ts
+++ b/apps/web/src/api-clients/alert-manager/service/schema/api-verbs/change-members.ts
@@ -1,4 +1,4 @@
-import type { MembersType } from '@/schema/alert-manager/service/type';
+import type { MembersType } from '@/api-clients/alert-manager/service/schema/type';
export interface ServiceChangeMembersParameters {
service_id: string;
diff --git a/apps/web/src/schema/alert-manager/service/api-verbs/create.ts b/apps/web/src/api-clients/alert-manager/service/schema/api-verbs/create.ts
similarity index 72%
rename from apps/web/src/schema/alert-manager/service/api-verbs/create.ts
rename to apps/web/src/api-clients/alert-manager/service/schema/api-verbs/create.ts
index 21a95bb002..7710aa8519 100644
--- a/apps/web/src/schema/alert-manager/service/api-verbs/create.ts
+++ b/apps/web/src/api-clients/alert-manager/service/schema/api-verbs/create.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { MembersType, ServiceOptionsType } from '@/schema/alert-manager/service/type';
+import type { MembersType, ServiceOptionsType } from '@/api-clients/alert-manager/service/schema/type';
export interface ServiceCreateParameters {
name: string;
diff --git a/apps/web/src/schema/alert-manager/service/api-verbs/delete.ts b/apps/web/src/api-clients/alert-manager/service/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/service/api-verbs/delete.ts
rename to apps/web/src/api-clients/alert-manager/service/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/alert-manager/service/api-verbs/get.ts b/apps/web/src/api-clients/alert-manager/service/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/service/api-verbs/get.ts
rename to apps/web/src/api-clients/alert-manager/service/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/alert-manager/service/api-verbs/list.ts b/apps/web/src/api-clients/alert-manager/service/schema/api-verbs/list.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/service/api-verbs/list.ts
rename to apps/web/src/api-clients/alert-manager/service/schema/api-verbs/list.ts
diff --git a/apps/web/src/schema/alert-manager/service/api-verbs/update.ts b/apps/web/src/api-clients/alert-manager/service/schema/api-verbs/update.ts
similarity index 74%
rename from apps/web/src/schema/alert-manager/service/api-verbs/update.ts
rename to apps/web/src/api-clients/alert-manager/service/schema/api-verbs/update.ts
index bcfb7b6917..77486e249b 100644
--- a/apps/web/src/schema/alert-manager/service/api-verbs/update.ts
+++ b/apps/web/src/api-clients/alert-manager/service/schema/api-verbs/update.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { ServiceOptionsType } from '@/schema/alert-manager/service/type';
+import type { ServiceOptionsType } from '@/api-clients/alert-manager/service/schema/type';
export interface ServiceUpdateParameters {
service_id: string;
diff --git a/apps/web/src/schema/alert-manager/service/constants.ts b/apps/web/src/api-clients/alert-manager/service/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/service/constants.ts
rename to apps/web/src/api-clients/alert-manager/service/schema/constants.ts
diff --git a/apps/web/src/schema/alert-manager/service/model.ts b/apps/web/src/api-clients/alert-manager/service/schema/model.ts
similarity index 91%
rename from apps/web/src/schema/alert-manager/service/model.ts
rename to apps/web/src/api-clients/alert-manager/service/schema/model.ts
index bad20bc731..27c9ccca2c 100644
--- a/apps/web/src/schema/alert-manager/service/model.ts
+++ b/apps/web/src/api-clients/alert-manager/service/schema/model.ts
@@ -1,7 +1,7 @@
import type { Tags } from '@/api-clients/_common/schema/model';
import type {
AlertsInfoType, AlertsType, HealthyType, MembersType, ServiceOptionsType,
-} from '@/schema/alert-manager/service/type';
+} from '@/api-clients/alert-manager/service/schema/type';
export interface ServiceModel {
service_id: string;
diff --git a/apps/web/src/schema/alert-manager/service/type.ts b/apps/web/src/api-clients/alert-manager/service/schema/type.ts
similarity index 92%
rename from apps/web/src/schema/alert-manager/service/type.ts
rename to apps/web/src/api-clients/alert-manager/service/schema/type.ts
index 67cc5867ec..dec52b4ad4 100644
--- a/apps/web/src/schema/alert-manager/service/type.ts
+++ b/apps/web/src/api-clients/alert-manager/service/schema/type.ts
@@ -1,7 +1,7 @@
import type {
NOTIFICATION_URGENCY, RECOVERY_MODE, MEMBERS_TYPE, SERVICE_ALERTS_TYPE,
SERVICE_HEALTHY_TYPE,
-} from '@/schema/alert-manager/service/constants';
+} from '@/api-clients/alert-manager/service/schema/constants';
export type NotificationUrgencyType = typeof NOTIFICATION_URGENCY[keyof typeof NOTIFICATION_URGENCY];
export type RecoveryModeType = typeof RECOVERY_MODE[keyof typeof RECOVERY_MODE];
diff --git a/apps/web/src/api-clients/alert-manager/user-channel/composables/use-user-channel-api.ts b/apps/web/src/api-clients/alert-manager/user-channel/composables/use-user-channel-api.ts
new file mode 100644
index 0000000000..6da3118a1c
--- /dev/null
+++ b/apps/web/src/api-clients/alert-manager/user-channel/composables/use-user-channel-api.ts
@@ -0,0 +1,28 @@
+import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+
+import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { UserChannelCreateParameters } from '@/api-clients/alert-manager/user-channel/schema/api-verbs/create';
+import type { UserChannelDeleteParameters } from '@/api-clients/alert-manager/user-channel/schema/api-verbs/delete';
+import type { UserChannelDisableParameters } from '@/api-clients/alert-manager/user-channel/schema/api-verbs/disable';
+import type { UserChannelEnableParameters } from '@/api-clients/alert-manager/user-channel/schema/api-verbs/enable';
+import type { UserChannelGetParameters } from '@/api-clients/alert-manager/user-channel/schema/api-verbs/get';
+import type { UserChannelListParameters } from '@/api-clients/alert-manager/user-channel/schema/api-verbs/list';
+import type { UserChannelUpdateParameters } from '@/api-clients/alert-manager/user-channel/schema/api-verbs/update';
+import type { UserChannelModel } from '@/api-clients/alert-manager/user-channel/schema/model';
+
+export const useUserChannelApi = () => {
+ const actions = {
+ create: SpaceConnector.clientV2.alertManager.userChannel.create,
+ delete: SpaceConnector.clientV2.alertManager.userChannel.delete,
+ disable: SpaceConnector.clientV2.alertManager.userChannel.disable,
+ enable: SpaceConnector.clientV2.alertManager.userChannel.enable,
+ get: SpaceConnector.clientV2.alertManager.userChannel.get,
+ list: SpaceConnector.clientV2.alertManager.userChannel.list>,
+ update: SpaceConnector.clientV2.alertManager.userChannel.update,
+ };
+
+ return {
+ userChannelAPI: actions,
+ };
+};
+
diff --git a/apps/web/src/schema/alert-manager/user-channel/api-verbs/create.ts b/apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/create.ts
similarity index 67%
rename from apps/web/src/schema/alert-manager/user-channel/api-verbs/create.ts
rename to apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/create.ts
index 1ba874cf52..9ffeb0383b 100644
--- a/apps/web/src/schema/alert-manager/user-channel/api-verbs/create.ts
+++ b/apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/create.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { UserChannelScheduleInfoType } from '@/schema/alert-manager/user-channel/type';
+import type { UserChannelScheduleInfoType } from '@/api-clients/alert-manager/user-channel/schema/type';
export interface UserChannelCreateParameters {
protocol_id: string;
diff --git a/apps/web/src/schema/alert-manager/user-channel/api-verbs/delete.ts b/apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/user-channel/api-verbs/delete.ts
rename to apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/alert-manager/user-channel/api-verbs/disable.ts b/apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/disable.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/user-channel/api-verbs/disable.ts
rename to apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/disable.ts
diff --git a/apps/web/src/schema/alert-manager/user-channel/api-verbs/enable.ts b/apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/enable.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/user-channel/api-verbs/enable.ts
rename to apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/enable.ts
diff --git a/apps/web/src/schema/alert-manager/user-channel/api-verbs/get.ts b/apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/user-channel/api-verbs/get.ts
rename to apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/alert-manager/user-channel/api-verbs/list.ts b/apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/list.ts
similarity index 71%
rename from apps/web/src/schema/alert-manager/user-channel/api-verbs/list.ts
rename to apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/list.ts
index d746592400..6da2293dce 100644
--- a/apps/web/src/schema/alert-manager/user-channel/api-verbs/list.ts
+++ b/apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/list.ts
@@ -1,6 +1,6 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';
-import type { UserChannelStateType } from '@/schema/alert-manager/user-channel/type';
+import type { UserChannelStateType } from '@/api-clients/alert-manager/user-channel/schema/type';
export interface UserChannelListParameters {
query?: Query;
diff --git a/apps/web/src/schema/alert-manager/user-channel/api-verbs/update.ts b/apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/update.ts
similarity index 70%
rename from apps/web/src/schema/alert-manager/user-channel/api-verbs/update.ts
rename to apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/update.ts
index b6a8cbe81c..2aeec64aa1 100644
--- a/apps/web/src/schema/alert-manager/user-channel/api-verbs/update.ts
+++ b/apps/web/src/api-clients/alert-manager/user-channel/schema/api-verbs/update.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { UserChannelScheduleInfoType } from '@/schema/alert-manager/user-channel/type';
+import type { UserChannelScheduleInfoType } from '@/api-clients/alert-manager/user-channel/schema/type';
export interface UserChannelUpdateParameters {
channel_id: string;
diff --git a/apps/web/src/schema/alert-manager/user-channel/constants.ts b/apps/web/src/api-clients/alert-manager/user-channel/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/user-channel/constants.ts
rename to apps/web/src/api-clients/alert-manager/user-channel/schema/constants.ts
diff --git a/apps/web/src/schema/alert-manager/user-channel/model.ts b/apps/web/src/api-clients/alert-manager/user-channel/schema/model.ts
similarity index 86%
rename from apps/web/src/schema/alert-manager/user-channel/model.ts
rename to apps/web/src/api-clients/alert-manager/user-channel/schema/model.ts
index bc046d561b..7b801b2ce2 100644
--- a/apps/web/src/schema/alert-manager/user-channel/model.ts
+++ b/apps/web/src/api-clients/alert-manager/user-channel/schema/model.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { UserChannelScheduleInfoType, UserChannelStateType } from '@/schema/alert-manager/user-channel/type';
+import type { UserChannelScheduleInfoType, UserChannelStateType } from '@/api-clients/alert-manager/user-channel/schema/type';
export interface UserChannelModel {
channel_id: string;
diff --git a/apps/web/src/schema/alert-manager/user-channel/type.ts b/apps/web/src/api-clients/alert-manager/user-channel/schema/type.ts
similarity index 92%
rename from apps/web/src/schema/alert-manager/user-channel/type.ts
rename to apps/web/src/api-clients/alert-manager/user-channel/schema/type.ts
index 4336b248f8..654d022915 100644
--- a/apps/web/src/schema/alert-manager/user-channel/type.ts
+++ b/apps/web/src/api-clients/alert-manager/user-channel/schema/type.ts
@@ -1,4 +1,4 @@
-import type { USER_CHANNEL_SCHEDULE_TYPE, USER_CHANNEL_STATE } from '@/schema/alert-manager/user-channel/constants';
+import type { USER_CHANNEL_SCHEDULE_TYPE, USER_CHANNEL_STATE } from '@/api-clients/alert-manager/user-channel/schema/constants';
export type UserChannelStateType = typeof USER_CHANNEL_STATE[keyof typeof USER_CHANNEL_STATE];
export type UserChannelScheduleType = typeof USER_CHANNEL_SCHEDULE_TYPE[keyof typeof USER_CHANNEL_SCHEDULE_TYPE];
diff --git a/apps/web/src/api-clients/alert-manager/user-group-channel/composables/use-user-group-channel-api.ts b/apps/web/src/api-clients/alert-manager/user-group-channel/composables/use-user-group-channel-api.ts
new file mode 100644
index 0000000000..cb664ab266
--- /dev/null
+++ b/apps/web/src/api-clients/alert-manager/user-group-channel/composables/use-user-group-channel-api.ts
@@ -0,0 +1,28 @@
+import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+
+import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { UserGroupChannelCreateParameters } from '@/api-clients/alert-manager/user-group-channel/schema/api-verbs/create';
+import type { UserGroupChannelDeleteParameters } from '@/api-clients/alert-manager/user-group-channel/schema/api-verbs/delete';
+import type { UserGroupChannelDisableParameters } from '@/api-clients/alert-manager/user-group-channel/schema/api-verbs/disable';
+import type { UserGroupChannelEnableParameters } from '@/api-clients/alert-manager/user-group-channel/schema/api-verbs/enable';
+import type { UserGroupChannelGetParameters } from '@/api-clients/alert-manager/user-group-channel/schema/api-verbs/get';
+import type { UserGroupChannelListParameters } from '@/api-clients/alert-manager/user-group-channel/schema/api-verbs/list';
+import type { UserGroupChannelUpdateParameters } from '@/api-clients/alert-manager/user-group-channel/schema/api-verbs/update';
+import type { UserGroupChannelModel } from '@/api-clients/alert-manager/user-group-channel/schema/model';
+
+export const useUserGroupChannelApi = () => {
+ const actions = {
+ create: SpaceConnector.clientV2.alertManager.userGroupChannel.create,
+ delete: SpaceConnector.clientV2.alertManager.userGroupChannel.delete,
+ disable: SpaceConnector.clientV2.alertManager.userGroupChannel.disable,
+ enable: SpaceConnector.clientV2.alertManager.userGroupChannel.enable,
+ get: SpaceConnector.clientV2.alertManager.userGroupChannel.get,
+ list: SpaceConnector.clientV2.alertManager.userGroupChannel.list>,
+ update: SpaceConnector.clientV2.alertManager.userGroupChannel.update,
+ };
+
+ return {
+ userGroupChannelAPI: actions,
+ };
+};
+
diff --git a/apps/web/src/schema/alert-manager/user-group-channel/api-verbs/create.ts b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/create.ts
similarity index 83%
rename from apps/web/src/schema/alert-manager/user-group-channel/api-verbs/create.ts
rename to apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/create.ts
index 0b3172b938..92f3f9dcc4 100644
--- a/apps/web/src/schema/alert-manager/user-group-channel/api-verbs/create.ts
+++ b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/create.ts
@@ -1,7 +1,7 @@
import type { Tags } from '@/api-clients/_common/schema/model';
import type {
UserGroupChannelScheduleInfoType,
-} from '@/schema/alert-manager/user-group-channel/type';
+} from '@/api-clients/alert-manager/user-group-channel/schema/type';
export interface UserGroupChannelCreateParameters {
protocol_id: string;
diff --git a/apps/web/src/schema/alert-manager/user-group-channel/api-verbs/delete.ts b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/user-group-channel/api-verbs/delete.ts
rename to apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/alert-manager/user-group-channel/api-verbs/disable.ts b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/disable.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/user-group-channel/api-verbs/disable.ts
rename to apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/disable.ts
diff --git a/apps/web/src/schema/alert-manager/user-group-channel/api-verbs/enable.ts b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/enable.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/user-group-channel/api-verbs/enable.ts
rename to apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/enable.ts
diff --git a/apps/web/src/schema/alert-manager/user-group-channel/api-verbs/get.ts b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/user-group-channel/api-verbs/get.ts
rename to apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/alert-manager/user-group-channel/api-verbs/list.ts b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/list.ts
similarity index 73%
rename from apps/web/src/schema/alert-manager/user-group-channel/api-verbs/list.ts
rename to apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/list.ts
index bc96d55c14..cb57908681 100644
--- a/apps/web/src/schema/alert-manager/user-group-channel/api-verbs/list.ts
+++ b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/list.ts
@@ -1,6 +1,6 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';
-import type { UserGroupChannelStateType } from '@/schema/alert-manager/user-group-channel/type';
+import type { UserGroupChannelStateType } from '@/api-clients/alert-manager/user-group-channel/schema/type';
export interface UserGroupChannelListParameters {
query?: Query;
diff --git a/apps/web/src/schema/alert-manager/user-group-channel/api-verbs/update.ts b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/update.ts
similarity index 69%
rename from apps/web/src/schema/alert-manager/user-group-channel/api-verbs/update.ts
rename to apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/update.ts
index 63d204af10..26ec28a318 100644
--- a/apps/web/src/schema/alert-manager/user-group-channel/api-verbs/update.ts
+++ b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/api-verbs/update.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { UserGroupChannelScheduleInfoType } from '@/schema/alert-manager/user-group-channel/type';
+import type { UserGroupChannelScheduleInfoType } from '@/api-clients/alert-manager/user-group-channel/schema/type';
export interface UserGroupChannelUpdateParameters {
channel_id: string;
diff --git a/apps/web/src/schema/alert-manager/user-group-channel/constants.ts b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/user-group-channel/constants.ts
rename to apps/web/src/api-clients/alert-manager/user-group-channel/schema/constants.ts
diff --git a/apps/web/src/schema/alert-manager/user-group-channel/model.ts b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/model.ts
similarity index 88%
rename from apps/web/src/schema/alert-manager/user-group-channel/model.ts
rename to apps/web/src/api-clients/alert-manager/user-group-channel/schema/model.ts
index 2c86789ad5..a6a339a88d 100644
--- a/apps/web/src/schema/alert-manager/user-group-channel/model.ts
+++ b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/model.ts
@@ -3,7 +3,7 @@ import type { Tags } from '@/api-clients/_common/schema/model';
import type {
UserGroupChannelStateType,
UserGroupChannelScheduleInfoType,
-} from '@/schema/alert-manager/user-group-channel/type';
+} from '@/api-clients/alert-manager/user-group-channel/schema/type';
export interface UserGroupChannelModel {
channel_id: string;
diff --git a/apps/web/src/schema/alert-manager/user-group-channel/type.ts b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/type.ts
similarity index 92%
rename from apps/web/src/schema/alert-manager/user-group-channel/type.ts
rename to apps/web/src/api-clients/alert-manager/user-group-channel/schema/type.ts
index 8850cfbbad..21541e0b73 100644
--- a/apps/web/src/schema/alert-manager/user-group-channel/type.ts
+++ b/apps/web/src/api-clients/alert-manager/user-group-channel/schema/type.ts
@@ -1,7 +1,7 @@
import type {
USER_GROUP_CHANNEL_SCHEDULE_TYPE,
USER_GROUP_CHANNEL_STATE,
-} from '@/schema/alert-manager/user-group-channel/constants';
+} from '@/api-clients/alert-manager/user-group-channel/schema/constants';
export type UserGroupChannelStateType = typeof USER_GROUP_CHANNEL_STATE[keyof typeof USER_GROUP_CHANNEL_STATE];
export type UserGroupChannelScheduleType = typeof USER_GROUP_CHANNEL_SCHEDULE_TYPE[keyof typeof USER_GROUP_CHANNEL_SCHEDULE_TYPE];
diff --git a/apps/web/src/api-clients/alert-manager/webhook/composables/use-webhook-api.ts b/apps/web/src/api-clients/alert-manager/webhook/composables/use-webhook-api.ts
new file mode 100644
index 0000000000..6d7b725828
--- /dev/null
+++ b/apps/web/src/api-clients/alert-manager/webhook/composables/use-webhook-api.ts
@@ -0,0 +1,36 @@
+import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+
+import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { WebhookCreateParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/create';
+import type { WebhookDeleteParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/delete';
+import type { WebhookDisableParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/disable';
+import type { WebhookEnableParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/enable';
+import type { WebhookGetParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/get';
+import type { WebhookListParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/list';
+import type { WebhookListErrorsParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/list-errors';
+import type { WebhookUpdateParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/update';
+import type { WebhookUpdateMessageFormatParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/update-message-format';
+import type { WebhookUpdatePluginParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/update-plugin';
+import type { WebhookVerifyPluginParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/verify-plugin';
+import type { WebhookListErrorsModel, WebhookModel } from '@/api-clients/alert-manager/webhook/schema/model';
+
+export const useWebhookApi = () => {
+ const actions = {
+ create: SpaceConnector.clientV2.alertManager.webhook.create,
+ delete: SpaceConnector.clientV2.alertManager.webhook.delete,
+ disable: SpaceConnector.clientV2.alertManager.webhook.disable,
+ enable: SpaceConnector.clientV2.alertManager.webhook.enable,
+ get: SpaceConnector.clientV2.alertManager.webhook.get,
+ listErrors: SpaceConnector.clientV2.alertManager.webhook.listErrors>,
+ list: SpaceConnector.clientV2.alertManager.webhook.list>,
+ updateMessageFormat: SpaceConnector.clientV2.alertManager.webhook.updateMessageFormat,
+ updatePlugin: SpaceConnector.clientV2.alertManager.webhook.updatePlugin,
+ update: SpaceConnector.clientV2.alertManager.webhook.update,
+ verifyPlugin: SpaceConnector.clientV2.alertManager.webhook.verifyPlugin,
+ };
+
+ return {
+ webhookAPI: actions,
+ };
+};
+
diff --git a/apps/web/src/schema/alert-manager/webhook/api-verbs/create.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/create.ts
similarity index 68%
rename from apps/web/src/schema/alert-manager/webhook/api-verbs/create.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/create.ts
index 0242ea89c0..feec006c04 100644
--- a/apps/web/src/schema/alert-manager/webhook/api-verbs/create.ts
+++ b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/create.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { WebhookPluginInfoType } from '@/schema/alert-manager/webhook/type';
+import type { WebhookPluginInfoType } from '@/api-clients/alert-manager/webhook/schema/type';
export interface WebhookCreateParameters {
name: string;
diff --git a/apps/web/src/schema/alert-manager/webhook/api-verbs/delete.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/webhook/api-verbs/delete.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/alert-manager/webhook/api-verbs/disable.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/disable.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/webhook/api-verbs/disable.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/disable.ts
diff --git a/apps/web/src/schema/alert-manager/webhook/api-verbs/enable.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/enable.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/webhook/api-verbs/enable.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/enable.ts
diff --git a/apps/web/src/schema/alert-manager/webhook/api-verbs/get.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/webhook/api-verbs/get.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/alert-manager/webhook/api-verbs/list-errors.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/list-errors.ts
similarity index 75%
rename from apps/web/src/schema/alert-manager/webhook/api-verbs/list-errors.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/list-errors.ts
index e0c55dfb20..5a8d9db5de 100644
--- a/apps/web/src/schema/alert-manager/webhook/api-verbs/list-errors.ts
+++ b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/list-errors.ts
@@ -1,6 +1,6 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';
-export interface WebhookListErrorSParameters {
+export interface WebhookListErrorsParameters {
query?: Query;
webhook_id: string;
error_id?: string;
diff --git a/apps/web/src/schema/alert-manager/webhook/api-verbs/list.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/list.ts
similarity index 76%
rename from apps/web/src/schema/alert-manager/webhook/api-verbs/list.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/list.ts
index d33ccc8621..4d1125df00 100644
--- a/apps/web/src/schema/alert-manager/webhook/api-verbs/list.ts
+++ b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/list.ts
@@ -1,6 +1,6 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';
-import type { WebhookStateType } from '@/schema/alert-manager/webhook/type';
+import type { WebhookStateType } from '@/api-clients/alert-manager/webhook/schema/type';
export interface WebhookListParameters {
query?: Query;
diff --git a/apps/web/src/schema/alert-manager/webhook/api-verbs/update-message-format.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/update-message-format.ts
similarity index 58%
rename from apps/web/src/schema/alert-manager/webhook/api-verbs/update-message-format.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/update-message-format.ts
index 20ddd80fd0..2bd6a6d426 100644
--- a/apps/web/src/schema/alert-manager/webhook/api-verbs/update-message-format.ts
+++ b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/update-message-format.ts
@@ -1,4 +1,4 @@
-import type { WebhookMessageFormatType } from '@/schema/alert-manager/webhook/type';
+import type { WebhookMessageFormatType } from '@/api-clients/alert-manager/webhook/schema/type';
export interface WebhookUpdateMessageFormatParameters {
webhook_id: string;
diff --git a/apps/web/src/schema/alert-manager/webhook/api-verbs/update-plugin.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/update-plugin.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/webhook/api-verbs/update-plugin.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/update-plugin.ts
diff --git a/apps/web/src/schema/alert-manager/webhook/api-verbs/update.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/update.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/webhook/api-verbs/update.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/update.ts
diff --git a/apps/web/src/schema/alert-manager/webhook/api-verbs/verify-plugin.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/verify-plugin.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/webhook/api-verbs/verify-plugin.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/api-verbs/verify-plugin.ts
diff --git a/apps/web/src/schema/alert-manager/webhook/constants.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/alert-manager/webhook/constants.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/constants.ts
diff --git a/apps/web/src/schema/alert-manager/webhook/model.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/model.ts
similarity index 93%
rename from apps/web/src/schema/alert-manager/webhook/model.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/model.ts
index 35017a43c0..58d2ef1dbd 100644
--- a/apps/web/src/schema/alert-manager/webhook/model.ts
+++ b/apps/web/src/api-clients/alert-manager/webhook/schema/model.ts
@@ -1,7 +1,7 @@
import type { Tags } from '@/api-clients/_common/schema/model';
import type {
WebhookPluginInfoType, WebhookRequestType, WebhookStateType, WebhookMessageFormatType,
-} from '@/schema/alert-manager/webhook/type';
+} from '@/api-clients/alert-manager/webhook/schema/type';
export interface WebhookModel {
webhook_id: string;
diff --git a/apps/web/src/schema/alert-manager/webhook/type.ts b/apps/web/src/api-clients/alert-manager/webhook/schema/type.ts
similarity index 82%
rename from apps/web/src/schema/alert-manager/webhook/type.ts
rename to apps/web/src/api-clients/alert-manager/webhook/schema/type.ts
index 2621883d09..5e51504f8c 100644
--- a/apps/web/src/schema/alert-manager/webhook/type.ts
+++ b/apps/web/src/api-clients/alert-manager/webhook/schema/type.ts
@@ -1,4 +1,4 @@
-import type { WEBHOOK_STATE } from '@/schema/alert-manager/webhook/constants';
+import type { WEBHOOK_STATE } from '@/api-clients/alert-manager/webhook/schema/constants';
export type WebhookStateType = typeof WEBHOOK_STATE[keyof typeof WEBHOOK_STATE];
diff --git a/apps/web/src/api-clients/identity/user-group/schema/model.ts b/apps/web/src/api-clients/identity/user-group/schema/model.ts
index 9c617c1d1d..4be86f694a 100644
--- a/apps/web/src/api-clients/identity/user-group/schema/model.ts
+++ b/apps/web/src/api-clients/identity/user-group/schema/model.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { UserGroupChannelModel } from '@/schema/alert-manager/user-group-channel/model';
+import type { UserGroupChannelModel } from '@/api-clients/alert-manager/user-group-channel/schema/model';
export interface UserGroupModel {
user_group_id: string;
diff --git a/apps/web/src/schema/monitoring/alert/api-verbs/assign-user.ts b/apps/web/src/api-clients/monitoring/alert/schema/api-verbs/assign-user.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/alert/api-verbs/assign-user.ts
rename to apps/web/src/api-clients/monitoring/alert/schema/api-verbs/assign-user.ts
diff --git a/apps/web/src/schema/monitoring/alert/api-verbs/create.ts b/apps/web/src/api-clients/monitoring/alert/schema/api-verbs/create.ts
similarity index 67%
rename from apps/web/src/schema/monitoring/alert/api-verbs/create.ts
rename to apps/web/src/api-clients/monitoring/alert/schema/api-verbs/create.ts
index d345e5a207..6963faa0f5 100644
--- a/apps/web/src/schema/monitoring/alert/api-verbs/create.ts
+++ b/apps/web/src/api-clients/monitoring/alert/schema/api-verbs/create.ts
@@ -1,4 +1,4 @@
-import type { AlertUrgency } from '@/schema/monitoring/alert/type';
+import type { AlertUrgency } from '@/api-clients/monitoring/alert/schema/type';
export interface AlertCreateParameters {
title: string;
diff --git a/apps/web/src/schema/monitoring/alert/api-verbs/delete.ts b/apps/web/src/api-clients/monitoring/alert/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/alert/api-verbs/delete.ts
rename to apps/web/src/api-clients/monitoring/alert/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/monitoring/alert/api-verbs/get.ts b/apps/web/src/api-clients/monitoring/alert/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/alert/api-verbs/get.ts
rename to apps/web/src/api-clients/monitoring/alert/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/monitoring/alert/api-verbs/list.ts b/apps/web/src/api-clients/monitoring/alert/schema/api-verbs/list.ts
similarity index 67%
rename from apps/web/src/schema/monitoring/alert/api-verbs/list.ts
rename to apps/web/src/api-clients/monitoring/alert/schema/api-verbs/list.ts
index eee33ababe..b12b957f6c 100644
--- a/apps/web/src/schema/monitoring/alert/api-verbs/list.ts
+++ b/apps/web/src/api-clients/monitoring/alert/schema/api-verbs/list.ts
@@ -1,19 +1,19 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { AlertModel } from '@/schema/alert-manager/alert/model';
+import type { AlertModel } from '@/api-clients/alert-manager/alert/schema/model';
import type {
- AlertSeverity, AlertState, AlertUrgency,
-} from '@/schema/monitoring/alert/type';
+ AlertSeverityType, AlertUrgencyType, AlertStatusType,
+} from '@/api-clients/alert-manager/alert/schema/type';
export interface AlertListParameters {
alert_number?: number;
alert_id?: string;
title?: string;
- state?: AlertState;
+ state?: AlertStatusType;
assignee?: string;
- urgency?: AlertUrgency;
- severity?: AlertSeverity;
+ urgency?: AlertUrgencyType;
+ severity?: AlertSeverityType;
resource_id?: string;
provider?: string;
account?: string;
diff --git a/apps/web/src/schema/monitoring/alert/api-verbs/update-state.ts b/apps/web/src/api-clients/monitoring/alert/schema/api-verbs/update-state.ts
similarity index 60%
rename from apps/web/src/schema/monitoring/alert/api-verbs/update-state.ts
rename to apps/web/src/api-clients/monitoring/alert/schema/api-verbs/update-state.ts
index 55a5291c90..d9ccc8aba4 100644
--- a/apps/web/src/schema/monitoring/alert/api-verbs/update-state.ts
+++ b/apps/web/src/api-clients/monitoring/alert/schema/api-verbs/update-state.ts
@@ -1,4 +1,4 @@
-import type { AlertState } from '@/schema/monitoring/alert/type';
+import type { AlertState } from '@/api-clients/monitoring/alert/schema/type';
export interface AlertUpdateStateParameters {
alert_id: string;
diff --git a/apps/web/src/schema/monitoring/alert/api-verbs/update.ts b/apps/web/src/api-clients/monitoring/alert/schema/api-verbs/update.ts
similarity index 67%
rename from apps/web/src/schema/monitoring/alert/api-verbs/update.ts
rename to apps/web/src/api-clients/monitoring/alert/schema/api-verbs/update.ts
index b3646360c9..ca22c9cb4a 100644
--- a/apps/web/src/schema/monitoring/alert/api-verbs/update.ts
+++ b/apps/web/src/api-clients/monitoring/alert/schema/api-verbs/update.ts
@@ -1,4 +1,4 @@
-import type { AlertState, AlertUrgency } from '@/schema/monitoring/alert/type';
+import type { AlertState, AlertUrgency } from '@/api-clients/monitoring/alert/schema/type';
export interface AlertUpdateParameters {
alert_id: string;
diff --git a/apps/web/src/schema/monitoring/alert/constants.ts b/apps/web/src/api-clients/monitoring/alert/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/alert/constants.ts
rename to apps/web/src/api-clients/monitoring/alert/schema/constants.ts
diff --git a/apps/web/src/schema/monitoring/alert/model.ts b/apps/web/src/api-clients/monitoring/alert/schema/model.ts
similarity index 94%
rename from apps/web/src/schema/monitoring/alert/model.ts
rename to apps/web/src/api-clients/monitoring/alert/schema/model.ts
index 119fad4a5e..3a27286e61 100644
--- a/apps/web/src/schema/monitoring/alert/model.ts
+++ b/apps/web/src/api-clients/monitoring/alert/schema/model.ts
@@ -1,6 +1,6 @@
import type {
AlertResource, AlertSeverity, AlertState, AlertUrgency,
-} from '@/schema/monitoring/alert/type';
+} from '@/api-clients/monitoring/alert/schema/type';
export interface AlertModelV1 {
alert_number: number;
diff --git a/apps/web/src/schema/monitoring/alert/type.ts b/apps/web/src/api-clients/monitoring/alert/schema/type.ts
similarity index 78%
rename from apps/web/src/schema/monitoring/alert/type.ts
rename to apps/web/src/api-clients/monitoring/alert/schema/type.ts
index 9b418dcac5..2221384c81 100644
--- a/apps/web/src/schema/monitoring/alert/type.ts
+++ b/apps/web/src/api-clients/monitoring/alert/schema/type.ts
@@ -1,4 +1,4 @@
-import type { ALERT_STATE, ALERT_URGENCY } from '@/schema/monitoring/alert/constants';
+import type { ALERT_STATE, ALERT_URGENCY } from '@/api-clients/monitoring/alert/schema/constants';
export interface AlertResource {
resource_id?: string;
diff --git a/apps/web/src/schema/monitoring/data-source/api-verbs/list.ts b/apps/web/src/api-clients/monitoring/data-source/schema/api-verbs/list.ts
similarity index 77%
rename from apps/web/src/schema/monitoring/data-source/api-verbs/list.ts
rename to apps/web/src/api-clients/monitoring/data-source/schema/api-verbs/list.ts
index 3e8741fd6f..3bc34588be 100644
--- a/apps/web/src/schema/monitoring/data-source/api-verbs/list.ts
+++ b/apps/web/src/api-clients/monitoring/data-source/schema/api-verbs/list.ts
@@ -1,6 +1,6 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';
-import type { MonitoringType } from '@/schema/monitoring/data-source/type';
+import type { MonitoringType } from '@/api-clients/monitoring/data-source/schema/type';
export interface DataSourceListParameters {
query?: Query;
diff --git a/apps/web/src/schema/monitoring/data-source/constant.ts b/apps/web/src/api-clients/monitoring/data-source/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/data-source/constant.ts
rename to apps/web/src/api-clients/monitoring/data-source/schema/constants.ts
diff --git a/apps/web/src/schema/monitoring/data-source/model.ts b/apps/web/src/api-clients/monitoring/data-source/schema/model.ts
similarity index 92%
rename from apps/web/src/schema/monitoring/data-source/model.ts
rename to apps/web/src/api-clients/monitoring/data-source/schema/model.ts
index 0630522018..3b4f439159 100644
--- a/apps/web/src/schema/monitoring/data-source/model.ts
+++ b/apps/web/src/api-clients/monitoring/data-source/schema/model.ts
@@ -1,7 +1,7 @@
import type { DynamicLayout } from '@cloudforet/mirinae/types/data-display/dynamic/dynamic-layout/type/layout-schema';
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { MonitoringType } from '@/schema/monitoring/data-source/type';
+import type { MonitoringType } from '@/api-clients/monitoring/data-source/schema/type';
interface DataSourcePluginModel {
diff --git a/apps/web/src/api-clients/monitoring/data-source/schema/type.ts b/apps/web/src/api-clients/monitoring/data-source/schema/type.ts
new file mode 100644
index 0000000000..aa1b8310ff
--- /dev/null
+++ b/apps/web/src/api-clients/monitoring/data-source/schema/type.ts
@@ -0,0 +1,3 @@
+import type { MONITORING_TYPE } from '@/api-clients/monitoring/data-source/schema/constants';
+
+export type MonitoringType = typeof MONITORING_TYPE[keyof typeof MONITORING_TYPE];
diff --git a/apps/web/src/schema/monitoring/escalation-policy/api-verbs/create.ts b/apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/create.ts
similarity index 66%
rename from apps/web/src/schema/monitoring/escalation-policy/api-verbs/create.ts
rename to apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/create.ts
index e06869f302..c8125fd92b 100644
--- a/apps/web/src/schema/monitoring/escalation-policy/api-verbs/create.ts
+++ b/apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/create.ts
@@ -1,5 +1,5 @@
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
-import type { EscalationPolicyRule, EscalationPolicyFinishCondition } from '@/schema/monitoring/escalation-policy/type';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
+import type { EscalationPolicyRule, EscalationPolicyFinishCondition } from '@/api-clients/monitoring/escalation-policy/schema/type';
export interface EscalationPolicyCreateParameters {
name: string;
diff --git a/apps/web/src/schema/monitoring/escalation-policy/api-verbs/delete.ts b/apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/escalation-policy/api-verbs/delete.ts
rename to apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/monitoring/escalation-policy/api-verbs/get.ts b/apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/escalation-policy/api-verbs/get.ts
rename to apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/monitoring/escalation-policy/api-verbs/list.ts b/apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/list.ts
similarity index 71%
rename from apps/web/src/schema/monitoring/escalation-policy/api-verbs/list.ts
rename to apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/list.ts
index bb90d61493..8a99216225 100644
--- a/apps/web/src/schema/monitoring/escalation-policy/api-verbs/list.ts
+++ b/apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/list.ts
@@ -1,8 +1,8 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
-import type { EscalationPolicyFinishCondition } from '@/schema/monitoring/escalation-policy/type';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
+import type { EscalationPolicyFinishCondition } from '@/api-clients/monitoring/escalation-policy/schema/type';
export interface EscalationPolicyListParameters {
query?: Query;
diff --git a/apps/web/src/schema/monitoring/escalation-policy/api-verbs/set-default.ts b/apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/set-default.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/escalation-policy/api-verbs/set-default.ts
rename to apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/set-default.ts
diff --git a/apps/web/src/schema/monitoring/escalation-policy/api-verbs/update.ts b/apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/update.ts
similarity index 84%
rename from apps/web/src/schema/monitoring/escalation-policy/api-verbs/update.ts
rename to apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/update.ts
index a8a7d0c8a4..aa397f735a 100644
--- a/apps/web/src/schema/monitoring/escalation-policy/api-verbs/update.ts
+++ b/apps/web/src/api-clients/monitoring/escalation-policy/schema/api-verbs/update.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { EscalationPolicyRule, EscalationPolicyFinishCondition } from '@/schema/monitoring/escalation-policy/type';
+import type { EscalationPolicyRule, EscalationPolicyFinishCondition } from '@/api-clients/monitoring/escalation-policy/schema/type';
export interface EscalationPolicyUpdateParameters {
escalation_policy_id: string;
diff --git a/apps/web/src/schema/monitoring/escalation-policy/constant.ts b/apps/web/src/api-clients/monitoring/escalation-policy/schema/constants.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/escalation-policy/constant.ts
rename to apps/web/src/api-clients/monitoring/escalation-policy/schema/constants.ts
diff --git a/apps/web/src/schema/monitoring/escalation-policy/model.ts b/apps/web/src/api-clients/monitoring/escalation-policy/schema/model.ts
similarity index 90%
rename from apps/web/src/schema/monitoring/escalation-policy/model.ts
rename to apps/web/src/api-clients/monitoring/escalation-policy/schema/model.ts
index 7f19cc1290..8e9b9208bf 100644
--- a/apps/web/src/schema/monitoring/escalation-policy/model.ts
+++ b/apps/web/src/api-clients/monitoring/escalation-policy/schema/model.ts
@@ -1,6 +1,6 @@
import type { Tags } from '@/api-clients/_common/schema/model';
import type { ResourceGroupType } from '@/api-clients/_common/schema/type';
-import type { EscalationPolicyRule, EscalationPolicyFinishCondition } from '@/schema/monitoring/escalation-policy/type';
+import type { EscalationPolicyRule, EscalationPolicyFinishCondition } from '@/api-clients/monitoring/escalation-policy/schema/type';
export interface EscalationPolicyModel {
escalation_policy_id: string;
diff --git a/apps/web/src/schema/monitoring/escalation-policy/type.ts b/apps/web/src/api-clients/monitoring/escalation-policy/schema/type.ts
similarity index 69%
rename from apps/web/src/schema/monitoring/escalation-policy/type.ts
rename to apps/web/src/api-clients/monitoring/escalation-policy/schema/type.ts
index 1f876abf81..b39c939b14 100644
--- a/apps/web/src/schema/monitoring/escalation-policy/type.ts
+++ b/apps/web/src/api-clients/monitoring/escalation-policy/schema/type.ts
@@ -1,4 +1,4 @@
-import type { ESCALATION_POLICY_FINISH_CONDITION } from '@/schema/monitoring/escalation-policy/constant';
+import type { ESCALATION_POLICY_FINISH_CONDITION } from '@/api-clients/alert-manager/escalation-policy/schema/constants';
export interface EscalationPolicyRule {
notification_level: 'ALL'|'LV1'|'LV2'|'LV3'|'LV4'|'LV5';
diff --git a/apps/web/src/schema/monitoring/event-rule/api-verbs/change-order.ts b/apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/change-order.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/event-rule/api-verbs/change-order.ts
rename to apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/change-order.ts
diff --git a/apps/web/src/schema/monitoring/event-rule/api-verbs/create.ts b/apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/create.ts
similarity index 76%
rename from apps/web/src/schema/monitoring/event-rule/api-verbs/create.ts
rename to apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/create.ts
index e977caefd1..4048d0be22 100644
--- a/apps/web/src/schema/monitoring/event-rule/api-verbs/create.ts
+++ b/apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/create.ts
@@ -1,9 +1,9 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { EventRuleModel } from '@/schema/monitoring/event-rule/model';
+import type { EventRuleModel } from '@/api-clients/monitoring/event-rule/schema/model';
import type {
EventRuleActions, EventRuleCondition,
EventRuleConditionsPolicy, EventRuleOptions,
-} from '@/schema/monitoring/event-rule/type';
+} from '@/api-clients/monitoring/event-rule/schema/type';
export interface EventRuleCreateParameters {
conditions: EventRuleCondition[];
diff --git a/apps/web/src/schema/monitoring/event-rule/api-verbs/delete.ts b/apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/event-rule/api-verbs/delete.ts
rename to apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/monitoring/event-rule/api-verbs/get.ts b/apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/event-rule/api-verbs/get.ts
rename to apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/monitoring/event-rule/api-verbs/list.ts b/apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/list.ts
similarity index 76%
rename from apps/web/src/schema/monitoring/event-rule/api-verbs/list.ts
rename to apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/list.ts
index 23a091ae08..cfbbba44e0 100644
--- a/apps/web/src/schema/monitoring/event-rule/api-verbs/list.ts
+++ b/apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/list.ts
@@ -1,6 +1,6 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';
-import type { EventRuleModel } from '@/schema/monitoring/event-rule/model';
+import type { EventRuleModel } from '@/api-clients/monitoring/event-rule/schema/model';
export interface EventRuleListParameters {
event_rule_id?: string;
diff --git a/apps/web/src/schema/monitoring/event-rule/api-verbs/update.ts b/apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/update.ts
similarity index 88%
rename from apps/web/src/schema/monitoring/event-rule/api-verbs/update.ts
rename to apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/update.ts
index 5a09d6e157..92c72f2b59 100644
--- a/apps/web/src/schema/monitoring/event-rule/api-verbs/update.ts
+++ b/apps/web/src/api-clients/monitoring/event-rule/schema/api-verbs/update.ts
@@ -2,7 +2,7 @@ import type { Tags } from '@/api-clients/_common/schema/model';
import type {
EventRuleActions, EventRuleCondition,
EventRuleConditionsPolicy, EventRuleOptions,
-} from '@/schema/monitoring/event-rule/type';
+} from '@/api-clients/monitoring/event-rule/schema/type';
export interface EventRuleUpdateParameters {
event_rule_id: string;
diff --git a/apps/web/src/schema/monitoring/event-rule/model.ts b/apps/web/src/api-clients/monitoring/event-rule/schema/model.ts
similarity index 92%
rename from apps/web/src/schema/monitoring/event-rule/model.ts
rename to apps/web/src/api-clients/monitoring/event-rule/schema/model.ts
index 4df071cbc8..bae0ab87cf 100644
--- a/apps/web/src/schema/monitoring/event-rule/model.ts
+++ b/apps/web/src/api-clients/monitoring/event-rule/schema/model.ts
@@ -2,7 +2,7 @@ import type { Tags } from '@/api-clients/_common/schema/model';
import type { ResourceGroupType } from '@/api-clients/_common/schema/type';
import type {
EventRuleCondition, EventRuleActions, EventRuleConditionsPolicy, EventRuleOptions,
-} from '@/schema/monitoring/event-rule/type';
+} from '@/api-clients/monitoring/event-rule/schema/type';
export interface EventRuleModel {
event_rule_id: string;
diff --git a/apps/web/src/schema/monitoring/event-rule/type.ts b/apps/web/src/api-clients/monitoring/event-rule/schema/type.ts
similarity index 91%
rename from apps/web/src/schema/monitoring/event-rule/type.ts
rename to apps/web/src/api-clients/monitoring/event-rule/schema/type.ts
index e00f6698f5..6fe178b24c 100644
--- a/apps/web/src/schema/monitoring/event-rule/type.ts
+++ b/apps/web/src/api-clients/monitoring/event-rule/schema/type.ts
@@ -1,4 +1,4 @@
-import type { AlertUrgency } from '@/schema/monitoring/alert/type';
+import type { AlertUrgency } from '@/api-clients/monitoring/alert/schema/type';
export type EventRuleConditionKey =
|'title'
diff --git a/apps/web/src/schema/monitoring/event/api-verbs/list.ts b/apps/web/src/api-clients/monitoring/event/schema/api-verbs/list.ts
similarity index 83%
rename from apps/web/src/schema/monitoring/event/api-verbs/list.ts
rename to apps/web/src/api-clients/monitoring/event/schema/api-verbs/list.ts
index 38f734d4c8..871c991329 100644
--- a/apps/web/src/schema/monitoring/event/api-verbs/list.ts
+++ b/apps/web/src/api-clients/monitoring/event/schema/api-verbs/list.ts
@@ -1,6 +1,6 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';
-import type { AlertSeverity } from '@/schema/monitoring/alert/type';
+import type { AlertSeverity } from '@/api-clients/monitoring/alert/schema/type';
export interface EventListParameters {
event_id?: string;
diff --git a/apps/web/src/schema/monitoring/event/model.ts b/apps/web/src/api-clients/monitoring/event/schema/model.ts
similarity index 75%
rename from apps/web/src/schema/monitoring/event/model.ts
rename to apps/web/src/api-clients/monitoring/event/schema/model.ts
index a864aa9829..2db91c0ef5 100644
--- a/apps/web/src/schema/monitoring/event/model.ts
+++ b/apps/web/src/api-clients/monitoring/event/schema/model.ts
@@ -1,5 +1,5 @@
-import type { AlertSeverity, AlertResource } from '@/schema/monitoring/alert/type';
-import type { EventType } from '@/schema/monitoring/event/type';
+import type { AlertSeverity, AlertResource } from '@/api-clients/monitoring/alert/schema/type';
+import type { EventType } from '@/api-clients/monitoring/event/schema/type';
export interface EventModel {
event_id: string;
diff --git a/apps/web/src/schema/monitoring/event/type.ts b/apps/web/src/api-clients/monitoring/event/schema/type.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/event/type.ts
rename to apps/web/src/api-clients/monitoring/event/schema/type.ts
diff --git a/apps/web/src/schema/monitoring/log/api-verbs/list.ts b/apps/web/src/api-clients/monitoring/log/schema/api-verbs/list.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/log/api-verbs/list.ts
rename to apps/web/src/api-clients/monitoring/log/schema/api-verbs/list.ts
diff --git a/apps/web/src/schema/monitoring/log/model.ts b/apps/web/src/api-clients/monitoring/log/schema/model.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/log/model.ts
rename to apps/web/src/api-clients/monitoring/log/schema/model.ts
diff --git a/apps/web/src/schema/monitoring/note/api-verbs/create.ts b/apps/web/src/api-clients/monitoring/note/schema/api-verbs/create.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/note/api-verbs/create.ts
rename to apps/web/src/api-clients/monitoring/note/schema/api-verbs/create.ts
diff --git a/apps/web/src/schema/monitoring/note/api-verbs/delete.ts b/apps/web/src/api-clients/monitoring/note/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/note/api-verbs/delete.ts
rename to apps/web/src/api-clients/monitoring/note/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/monitoring/note/api-verbs/get.ts b/apps/web/src/api-clients/monitoring/note/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/note/api-verbs/get.ts
rename to apps/web/src/api-clients/monitoring/note/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/monitoring/note/api-verbs/list.ts b/apps/web/src/api-clients/monitoring/note/schema/api-verbs/list.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/note/api-verbs/list.ts
rename to apps/web/src/api-clients/monitoring/note/schema/api-verbs/list.ts
diff --git a/apps/web/src/schema/monitoring/note/api-verbs/update.ts b/apps/web/src/api-clients/monitoring/note/schema/api-verbs/update.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/note/api-verbs/update.ts
rename to apps/web/src/api-clients/monitoring/note/schema/api-verbs/update.ts
diff --git a/apps/web/src/schema/monitoring/note/model.ts b/apps/web/src/api-clients/monitoring/note/schema/model.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/note/model.ts
rename to apps/web/src/api-clients/monitoring/note/schema/model.ts
diff --git a/apps/web/src/schema/monitoring/project-alert-config/api-verbs/create.ts b/apps/web/src/api-clients/monitoring/project-alert-config/schema/api-verbs/create.ts
similarity index 59%
rename from apps/web/src/schema/monitoring/project-alert-config/api-verbs/create.ts
rename to apps/web/src/api-clients/monitoring/project-alert-config/schema/api-verbs/create.ts
index bb653bf9ea..57a2adb6a5 100644
--- a/apps/web/src/schema/monitoring/project-alert-config/api-verbs/create.ts
+++ b/apps/web/src/api-clients/monitoring/project-alert-config/schema/api-verbs/create.ts
@@ -1,4 +1,4 @@
-import type { ProjectAlertConfigOptions } from '@/schema/monitoring/project-alert-config/type';
+import type { ProjectAlertConfigOptions } from '@/api-clients/monitoring/project-alert-config/schema/type';
export interface ProjectAlertConfigCreateParameters {
project_id: string;
diff --git a/apps/web/src/schema/monitoring/project-alert-config/api-verbs/delete.ts b/apps/web/src/api-clients/monitoring/project-alert-config/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/project-alert-config/api-verbs/delete.ts
rename to apps/web/src/api-clients/monitoring/project-alert-config/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/monitoring/project-alert-config/api-verbs/get.ts b/apps/web/src/api-clients/monitoring/project-alert-config/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/project-alert-config/api-verbs/get.ts
rename to apps/web/src/api-clients/monitoring/project-alert-config/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/monitoring/project-alert-config/api-verbs/list.ts b/apps/web/src/api-clients/monitoring/project-alert-config/schema/api-verbs/list.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/project-alert-config/api-verbs/list.ts
rename to apps/web/src/api-clients/monitoring/project-alert-config/schema/api-verbs/list.ts
diff --git a/apps/web/src/schema/monitoring/project-alert-config/api-verbs/update.ts b/apps/web/src/api-clients/monitoring/project-alert-config/schema/api-verbs/update.ts
similarity index 60%
rename from apps/web/src/schema/monitoring/project-alert-config/api-verbs/update.ts
rename to apps/web/src/api-clients/monitoring/project-alert-config/schema/api-verbs/update.ts
index e837f41895..2c491240b0 100644
--- a/apps/web/src/schema/monitoring/project-alert-config/api-verbs/update.ts
+++ b/apps/web/src/api-clients/monitoring/project-alert-config/schema/api-verbs/update.ts
@@ -1,4 +1,4 @@
-import type { ProjectAlertConfigOptions } from '@/schema/monitoring/project-alert-config/type';
+import type { ProjectAlertConfigOptions } from '@/api-clients/monitoring/project-alert-config/schema/type';
export interface ProjectAlertConfigUpdateParameters {
project_id: string;
diff --git a/apps/web/src/schema/monitoring/project-alert-config/model.ts b/apps/web/src/api-clients/monitoring/project-alert-config/schema/model.ts
similarity index 68%
rename from apps/web/src/schema/monitoring/project-alert-config/model.ts
rename to apps/web/src/api-clients/monitoring/project-alert-config/schema/model.ts
index b27aca1831..7d6a859bbf 100644
--- a/apps/web/src/schema/monitoring/project-alert-config/model.ts
+++ b/apps/web/src/api-clients/monitoring/project-alert-config/schema/model.ts
@@ -1,4 +1,4 @@
-import type { ProjectAlertConfigOptions } from '@/schema/monitoring/project-alert-config/type';
+import type { ProjectAlertConfigOptions } from '@/api-clients/monitoring/project-alert-config/schema/type';
export interface ProjectAlertConfigModel {
project_id: string;
diff --git a/apps/web/src/schema/monitoring/project-alert-config/type.ts b/apps/web/src/api-clients/monitoring/project-alert-config/schema/type.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/project-alert-config/type.ts
rename to apps/web/src/api-clients/monitoring/project-alert-config/schema/type.ts
diff --git a/apps/web/src/schema/monitoring/webhook/api-verbs/create.ts b/apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/create.ts
similarity index 70%
rename from apps/web/src/schema/monitoring/webhook/api-verbs/create.ts
rename to apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/create.ts
index 13f3deaaff..22b50c5670 100644
--- a/apps/web/src/schema/monitoring/webhook/api-verbs/create.ts
+++ b/apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/create.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { WebhookPluginInfo } from '@/schema/monitoring/webhook/type';
+import type { WebhookPluginInfo } from '@/api-clients/monitoring/webhook/schema/type';
export interface WebhookCreateParameters {
name: string;
diff --git a/apps/web/src/schema/monitoring/webhook/api-verbs/delete.ts b/apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/delete.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/webhook/api-verbs/delete.ts
rename to apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/delete.ts
diff --git a/apps/web/src/schema/monitoring/webhook/api-verbs/disable.ts b/apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/disable.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/webhook/api-verbs/disable.ts
rename to apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/disable.ts
diff --git a/apps/web/src/schema/monitoring/webhook/api-verbs/enable.ts b/apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/enable.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/webhook/api-verbs/enable.ts
rename to apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/enable.ts
diff --git a/apps/web/src/schema/monitoring/webhook/api-verbs/get.ts b/apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/get.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/webhook/api-verbs/get.ts
rename to apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/get.ts
diff --git a/apps/web/src/schema/monitoring/webhook/api-verbs/list.ts b/apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/list.ts
similarity index 77%
rename from apps/web/src/schema/monitoring/webhook/api-verbs/list.ts
rename to apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/list.ts
index 1b9a02878c..e2b5c3b359 100644
--- a/apps/web/src/schema/monitoring/webhook/api-verbs/list.ts
+++ b/apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/list.ts
@@ -1,6 +1,6 @@
import type { Query } from '@cloudforet/core-lib/space-connector/type';
-import type { WebhookState } from '@/schema/monitoring/webhook/type';
+import type { WebhookState } from '@/api-clients/monitoring/webhook/schema/type';
export interface WebhookListParameters {
webhook_id?: string;
diff --git a/apps/web/src/schema/monitoring/webhook/api-verbs/update-plugin.ts b/apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/update-plugin.ts
similarity index 68%
rename from apps/web/src/schema/monitoring/webhook/api-verbs/update-plugin.ts
rename to apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/update-plugin.ts
index 22eb24630d..22d550d10a 100644
--- a/apps/web/src/schema/monitoring/webhook/api-verbs/update-plugin.ts
+++ b/apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/update-plugin.ts
@@ -1,4 +1,4 @@
-import type { WebhookPluginInfo } from '@/schema/monitoring/webhook/type';
+import type { WebhookPluginInfo } from '@/api-clients/monitoring/webhook/schema/type';
export interface WebhookUpdatePluginParameters {
webhook_id: string;
diff --git a/apps/web/src/schema/monitoring/webhook/api-verbs/update.ts b/apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/update.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/webhook/api-verbs/update.ts
rename to apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/update.ts
diff --git a/apps/web/src/schema/monitoring/webhook/api-verbs/verify-plugin.ts b/apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/verify-plugin.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/webhook/api-verbs/verify-plugin.ts
rename to apps/web/src/api-clients/monitoring/webhook/schema/api-verbs/verify-plugin.ts
diff --git a/apps/web/src/schema/monitoring/webhook/model.ts b/apps/web/src/api-clients/monitoring/webhook/schema/model.ts
similarity index 83%
rename from apps/web/src/schema/monitoring/webhook/model.ts
rename to apps/web/src/api-clients/monitoring/webhook/schema/model.ts
index e0b1484a94..af35cfc546 100644
--- a/apps/web/src/schema/monitoring/webhook/model.ts
+++ b/apps/web/src/api-clients/monitoring/webhook/schema/model.ts
@@ -1,5 +1,5 @@
import type { Tags } from '@/api-clients/_common/schema/model';
-import type { WebhookPluginInfo, WebhookState } from '@/schema/monitoring/webhook/type';
+import type { WebhookPluginInfo, WebhookState } from '@/api-clients/monitoring/webhook/schema/type';
type WebhookRequestsType = {
total: number;
diff --git a/apps/web/src/schema/monitoring/webhook/type.ts b/apps/web/src/api-clients/monitoring/webhook/schema/type.ts
similarity index 100%
rename from apps/web/src/schema/monitoring/webhook/type.ts
rename to apps/web/src/api-clients/monitoring/webhook/schema/type.ts
diff --git a/apps/web/src/api-clients/notification/protocol/composables/use-protocol-api.ts b/apps/web/src/api-clients/notification/protocol/composables/use-protocol-api.ts
new file mode 100644
index 0000000000..2d34561697
--- /dev/null
+++ b/apps/web/src/api-clients/notification/protocol/composables/use-protocol-api.ts
@@ -0,0 +1,30 @@
+import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+
+import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { ProtocolCreateParameters } from '@/api-clients/notification/protocol/schema/api-verbs/create';
+import type { ProtocolDeleteParameters } from '@/api-clients/notification/protocol/schema/api-verbs/delete';
+import type { ProtocolDisableParameters } from '@/api-clients/notification/protocol/schema/api-verbs/disable';
+import type { ProtocolEnableParameters } from '@/api-clients/notification/protocol/schema/api-verbs/enable';
+import type { ProtocolGetParameters } from '@/api-clients/notification/protocol/schema/api-verbs/get';
+import type { ProtocolListParameters } from '@/api-clients/notification/protocol/schema/api-verbs/list';
+import type { ProtocolUpdateParameters } from '@/api-clients/notification/protocol/schema/api-verbs/update';
+import type { ProtocolUpdatePluginParameters } from '@/api-clients/notification/protocol/schema/api-verbs/update-plugin';
+import type { ProtocolModel } from '@/api-clients/notification/protocol/schema/model';
+
+export const useProtocolApi = () => {
+ const actions = {
+ create: SpaceConnector.clientV2.notification.protocol.create,
+ delete: SpaceConnector.clientV2.notification.protocol.delete,
+ disable: SpaceConnector.clientV2.notification.protocol.disable,
+ enable: SpaceConnector.clientV2.notification.protocol.enable,
+ get: SpaceConnector.clientV2.notification.protocol.get,
+ list: SpaceConnector.clientV2.notification.protocol.list>,
+ updatePlugin: SpaceConnector.clientV2.notification.protocol.updatePlugin,
+ update: SpaceConnector.clientV2.notification.protocol.update,
+ };
+
+ return {
+ protocolAPI: actions,
+ };
+};
+
diff --git a/apps/web/src/api-clients/notification/protocol/schema/api-verbs/create.ts b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/create.ts
new file mode 100644
index 0000000000..f3b8ecd5fb
--- /dev/null
+++ b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/create.ts
@@ -0,0 +1,8 @@
+import type { Tags } from '@/api-clients/_common/schema/model';
+import type { ProtocolPluginInfo } from '@/schema/notification/protocol/type';
+
+export interface ProtocolCreateParameters {
+ name: string;
+ plugin_info: ProtocolPluginInfo;
+ tags?: Tags;
+}
diff --git a/apps/web/src/api-clients/notification/protocol/schema/api-verbs/delete.ts b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/delete.ts
new file mode 100644
index 0000000000..92cdfae168
--- /dev/null
+++ b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/delete.ts
@@ -0,0 +1,3 @@
+export interface ProtocolDeleteParameters {
+ protocol_id: string;
+}
diff --git a/apps/web/src/api-clients/notification/protocol/schema/api-verbs/disable.ts b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/disable.ts
new file mode 100644
index 0000000000..7abf88a0c0
--- /dev/null
+++ b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/disable.ts
@@ -0,0 +1,3 @@
+export interface ProtocolDisableParameters {
+ protocol_id: string;
+}
diff --git a/apps/web/src/api-clients/notification/protocol/schema/api-verbs/enable.ts b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/enable.ts
new file mode 100644
index 0000000000..e765974ba4
--- /dev/null
+++ b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/enable.ts
@@ -0,0 +1,3 @@
+export interface ProtocolEnableParameters {
+ protocol_id: string;
+}
diff --git a/apps/web/src/api-clients/notification/protocol/schema/api-verbs/get.ts b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/get.ts
new file mode 100644
index 0000000000..9c9a0cb9dc
--- /dev/null
+++ b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/get.ts
@@ -0,0 +1,3 @@
+export interface ProtocolGetParameters {
+ protocol_id: string;
+}
diff --git a/apps/web/src/api-clients/notification/protocol/schema/api-verbs/list.ts b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/list.ts
new file mode 100644
index 0000000000..f5fe5e8139
--- /dev/null
+++ b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/list.ts
@@ -0,0 +1,11 @@
+import type { Query } from '@cloudforet/core-lib/space-connector/type';
+
+import type { ProtocolState } from '@/schema/notification/protocol/type';
+
+export interface ProtocolListParameters {
+ protocol_id?: string;
+ name?: string;
+ state?: ProtocolState;
+ protocol_type?: string;
+ query?: Query;
+}
diff --git a/apps/web/src/api-clients/notification/protocol/schema/api-verbs/update-plugin.ts b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/update-plugin.ts
new file mode 100644
index 0000000000..1d6f7b0032
--- /dev/null
+++ b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/update-plugin.ts
@@ -0,0 +1,5 @@
+export interface ProtocolUpdatePluginParameters {
+ protocol_id: string;
+ version?: string;
+ options?: Record;
+}
diff --git a/apps/web/src/api-clients/notification/protocol/schema/api-verbs/update.ts b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/update.ts
new file mode 100644
index 0000000000..0bf2f45666
--- /dev/null
+++ b/apps/web/src/api-clients/notification/protocol/schema/api-verbs/update.ts
@@ -0,0 +1,7 @@
+import type { Tags } from '@/api-clients/_common/schema/model';
+
+export interface ProtocolUpdateParameters {
+ protocol_id: string;
+ name?: string;
+ tags?: Tags;
+}
diff --git a/apps/web/src/api-clients/notification/protocol/schema/model.ts b/apps/web/src/api-clients/notification/protocol/schema/model.ts
new file mode 100644
index 0000000000..04ec782de6
--- /dev/null
+++ b/apps/web/src/api-clients/notification/protocol/schema/model.ts
@@ -0,0 +1,15 @@
+import type { Tags } from '@/api-clients/_common/schema/model';
+import type { ProtocolCapability, ProtocolPluginInfo, ProtocolState } from '@/schema/notification/protocol/type';
+
+export interface ProtocolModel {
+ protocol_id: string;
+ name: string;
+ state: ProtocolState;
+ protocol_type: string;
+ resource_type: string;
+ capability: ProtocolCapability;
+ plugin_info: ProtocolPluginInfo;
+ tags: Tags;
+ domain_id: string;
+ created_at: string;
+}
diff --git a/apps/web/src/api-clients/notification/protocol/schema/type.ts b/apps/web/src/api-clients/notification/protocol/schema/type.ts
new file mode 100644
index 0000000000..75d6b7fbf1
--- /dev/null
+++ b/apps/web/src/api-clients/notification/protocol/schema/type.ts
@@ -0,0 +1,24 @@
+import type { JsonSchema } from '@cloudforet/mirinae/types/controls/forms/json-schema-form/type';
+
+export type ProtocolState = 'ENABLED'|'DISABLED';
+
+export interface ProtocolCapability {
+ supported_schema: string[];
+}
+
+type ProtocolPluginMetadata = {
+ data_type: 'PLAIN_TEXT'|'SECRET';
+ data: {
+ schema: JsonSchema;
+ }
+} | Record;
+
+type ProtocolPluginUpgradeMode = 'AUTO'|'MANUAL';
+
+export interface ProtocolPluginInfo {
+ plugin_id: string;
+ version: string;
+ options: Record;
+ metadata: ProtocolPluginMetadata;
+ upgrade_mode: ProtocolPluginUpgradeMode;
+}
diff --git a/apps/web/src/common/components/schedule-setting-form/ScheduleSettingForm.vue b/apps/web/src/common/components/schedule-setting-form/ScheduleSettingForm.vue
index d77d64cb52..ec9a09123c 100644
--- a/apps/web/src/common/components/schedule-setting-form/ScheduleSettingForm.vue
+++ b/apps/web/src/common/components/schedule-setting-form/ScheduleSettingForm.vue
@@ -10,7 +10,7 @@ import {
} from '@cloudforet/mirinae';
import type { SelectDropdownMenuItem } from '@cloudforet/mirinae/types/controls/dropdown/select-dropdown/type';
-import type { ServiceChannelScheduleType } from '@/schema/alert-manager/service-channel/type';
+import type { ServiceChannelScheduleType } from '@/api-clients/alert-manager/service-channel/schema/type';
import { i18n } from '@/translations';
import { timezoneList } from '@/store/user/constant';
diff --git a/apps/web/src/common/modules/monitoring/Monitoring.vue b/apps/web/src/common/modules/monitoring/Monitoring.vue
index 63df55e5d0..8478ff4313 100644
--- a/apps/web/src/common/modules/monitoring/Monitoring.vue
+++ b/apps/web/src/common/modules/monitoring/Monitoring.vue
@@ -121,7 +121,7 @@ import {
} from '@cloudforet/mirinae';
-import { MONITORING_TYPE } from '@/schema/monitoring/data-source/constant';
+import { MONITORING_TYPE } from '@/api-clients/monitoring/data-source/schema/constants';
import { useReferenceRouter } from '@/router/composables/use-reference-router';
diff --git a/apps/web/src/common/modules/user/UserSelectDropdown.vue b/apps/web/src/common/modules/user/UserSelectDropdown.vue
index 0abee8f4d3..f4b2477605 100644
--- a/apps/web/src/common/modules/user/UserSelectDropdown.vue
+++ b/apps/web/src/common/modules/user/UserSelectDropdown.vue
@@ -13,7 +13,7 @@ import type {
SelectDropdownMenuItem,
} from '@cloudforet/mirinae/types/controls/dropdown/select-dropdown/type';
-import type { MembersType } from '@/schema/alert-manager/service/type';
+import type { MembersType } from '@/api-clients/alert-manager/service/schema/type';
import { i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
diff --git a/apps/web/src/common/pages/AlertPublicDetailPage.vue b/apps/web/src/common/pages/AlertPublicDetailPage.vue
index 330af0aebc..2f1e076185 100644
--- a/apps/web/src/common/pages/AlertPublicDetailPage.vue
+++ b/apps/web/src/common/pages/AlertPublicDetailPage.vue
@@ -13,9 +13,9 @@ import {
import type { TabItem } from '@cloudforet/mirinae/types/navigation/tabs/tab/type';
import { iso8601Formatter } from '@cloudforet/utils';
-import type { AlertModel } from '@/schema/alert-manager/alert/model';
-import { ALERT_STATE, ALERT_URGENCY } from '@/schema/monitoring/alert/constants';
-import type { AlertModelV1 } from '@/schema/monitoring/alert/model';
+import type { AlertModel } from '@/api-clients/alert-manager/alert/schema/model';
+import { ALERT_STATE, ALERT_URGENCY } from '@/api-clients/monitoring/alert/schema/constants';
+import type { AlertModelV1 } from '@/api-clients/monitoring/alert/schema/model';
import { i18n, setI18nLocale } from '@/translations';
import { ERROR_ROUTE } from '@/router/constant';
diff --git a/apps/web/src/lib/variable-models/managed-model/resource-model/service-variable-model.ts b/apps/web/src/lib/variable-models/managed-model/resource-model/service-variable-model.ts
index acfee1cd0c..27ccc31421 100644
--- a/apps/web/src/lib/variable-models/managed-model/resource-model/service-variable-model.ts
+++ b/apps/web/src/lib/variable-models/managed-model/resource-model/service-variable-model.ts
@@ -1,4 +1,4 @@
-import type { ServiceModel } from '@/schema/alert-manager/service/model';
+import type { ServiceModel } from '@/api-clients/alert-manager/service/schema/model';
import ResourceVariableModel from '@/lib/variable-models/_base/resource-variable-model';
import type { VariableModelConstructorConfig } from '@/lib/variable-models/_base/types';
diff --git a/apps/web/src/lib/variable-models/managed-model/resource-model/webhook-variable-model.ts b/apps/web/src/lib/variable-models/managed-model/resource-model/webhook-variable-model.ts
index 1c00886ea7..559eb3c354 100644
--- a/apps/web/src/lib/variable-models/managed-model/resource-model/webhook-variable-model.ts
+++ b/apps/web/src/lib/variable-models/managed-model/resource-model/webhook-variable-model.ts
@@ -1,4 +1,4 @@
-import type { WebhookModel } from '@/schema/monitoring/webhook/model';
+import type { WebhookModel } from '@/api-clients/monitoring/webhook/schema/model';
import ResourceVariableModel from '@/lib/variable-models/_base/resource-variable-model';
import type { VariableModelConstructorConfig } from '@/lib/variable-models/_base/types';
diff --git a/apps/web/src/query/pagination/use-scoped-pagination-query.ts b/apps/web/src/query/pagination/use-scoped-pagination-query.ts
index a1f20731e2..6cf27a19d4 100644
--- a/apps/web/src/query/pagination/use-scoped-pagination-query.ts
+++ b/apps/web/src/query/pagination/use-scoped-pagination-query.ts
@@ -4,7 +4,7 @@ import {
} from 'vue';
import type { InfiniteData } from '@tanstack/vue-query';
-import { type UseInfiniteQueryOptions } from '@tanstack/vue-query';
+import { useQueryClient, type UseInfiniteQueryOptions } from '@tanstack/vue-query';
import type { GrantScope } from '@/api-clients/identity/token/schema/type';
import { useScopedInfiniteQuery } from '@/query/composables/use-scoped-infinite-query';
@@ -32,7 +32,7 @@ import type { QueryKeyArray } from '@/query/query-key/_types/query-key-type';
* @param pageOptions - Pagination control:
* - thisPage: current page number (1-based)
* - pageSize: number of items per page
- * - verb: one of 'list' | 'stat' | 'analyze' | 'load' (used to insert page info in correct param structure)
+ * - verb: one of 'list' | 'load' (used to insert page info in correct param structure)
*
* @param requiredScopes - A list of **required grant scopes** to determine if the query should execute.
*
@@ -53,8 +53,9 @@ type PaginatableBaseData = {
type UsePaginationQueryOptions = Omit<
UseInfiniteQueryOptions, TPageData, QueryKeyArray, number>,
- 'initialPageParam' | 'queryFn' | 'getNextPageParam'
+ 'initialPageParam' | 'queryFn' | 'getNextPageParam' | 'select'
> & {
+ queryKey: ComputedRef
queryFn: (params: TParams) => Promise;
params: ComputedRef;
initialPageParam?: number;
@@ -63,7 +64,7 @@ type UsePaginationQueryOptions = Omit
interface UsePaginationQueryPageOptions {
thisPage: ComputedRef;
pageSize: ComputedRef;
- verb: 'list' | 'stat' | 'analyze' | 'load';
+ verb: 'list' | 'load';
}
export const useScopedPaginationQuery = (
@@ -71,6 +72,7 @@ export const useScopedPaginationQuery = {
+ const queryClient = useQueryClient();
const { thisPage, pageSize, verb } = pageOptions;
const {
queryFn, params, initialPageParam = 1, ...restOptions
@@ -103,12 +105,27 @@ export const useScopedPaginationQuery = {
- const currentLength = query.data.value?.pages?.length ?? 0;
- if (val > currentLength && !query.isFetchingNextPage.value) {
- const calls = Array.from({ length: val - currentLength });
- await Promise.all(calls.map(() => query.fetchNextPage()));
+ const fetchUntilPageLoaded = (targetPage: number) => {
+ const current = query.data.value?.pages?.length ?? 0;
+
+ if (current >= targetPage) return;
+
+ if (!query.isFetchingNextPage.value) {
+ query.fetchNextPage().then(() => {
+ setTimeout(() => fetchUntilPageLoaded(targetPage), 0);
+ });
+ } else {
+ setTimeout(() => fetchUntilPageLoaded(targetPage), 50);
}
+ };
+
+ watch(thisPage, (val) => {
+ fetchUntilPageLoaded(val);
+ });
+
+ // Clear cached pages when page size changes to avoid inconsistent pagination data
+ watch(pageSize, () => {
+ queryClient.resetQueries({ queryKey: options.queryKey.value });
});
return {
diff --git a/apps/web/src/schema/monitoring/data-source/type.ts b/apps/web/src/schema/monitoring/data-source/type.ts
deleted file mode 100644
index ac8679ecd0..0000000000
--- a/apps/web/src/schema/monitoring/data-source/type.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import type { MONITORING_TYPE } from '@/schema/monitoring/data-source/constant';
-
-export type MonitoringType = typeof MONITORING_TYPE[keyof typeof MONITORING_TYPE];
diff --git a/apps/web/src/schema/repository/plugin/constant.ts b/apps/web/src/schema/repository/plugin/constants.ts
similarity index 100%
rename from apps/web/src/schema/repository/plugin/constant.ts
rename to apps/web/src/schema/repository/plugin/constants.ts
diff --git a/apps/web/src/schema/repository/plugin/type.ts b/apps/web/src/schema/repository/plugin/type.ts
index 535da95d76..543e0f2732 100644
--- a/apps/web/src/schema/repository/plugin/type.ts
+++ b/apps/web/src/schema/repository/plugin/type.ts
@@ -1,7 +1,5 @@
-import type { MonitoringType } from '@/schema/monitoring/data-source/type';
-import type { PLUGIN_STATE, REGISTRY_TYPE } from '@/schema/repository/plugin/constant';
-
-
+import type { MonitoringType } from '@/api-clients/monitoring/data-source/schema/type';
+import type { PLUGIN_STATE, REGISTRY_TYPE } from '@/schema/repository/plugin/constants';
export type PluginState = typeof PLUGIN_STATE[keyof typeof PLUGIN_STATE];
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertDashboardAlertStateWidget.vue b/apps/web/src/services/alert-manager/v1/components/AlertDashboardAlertStateWidget.vue
index e37341b751..32d9a7ad27 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertDashboardAlertStateWidget.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertDashboardAlertStateWidget.vue
@@ -15,9 +15,9 @@ import {
import { numberFormatter } from '@cloudforet/utils';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { AlertListParameters } from '@/schema/monitoring/alert/api-verbs/list';
-import { ALERT_STATE } from '@/schema/monitoring/alert/constants';
-import type { AlertModelV1 } from '@/schema/monitoring/alert/model';
+import type { AlertListParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/list';
+import { ALERT_STATE } from '@/api-clients/monitoring/alert/schema/constants';
+import type { AlertModelV1 } from '@/api-clients/monitoring/alert/schema/model';
import { i18n } from '@/translations';
import { useUserWorkspaceStore } from '@/store/app-context/workspace/user-workspace-store';
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertDashboardProjectSearchWidgetAlertList.vue b/apps/web/src/services/alert-manager/v1/components/AlertDashboardProjectSearchWidgetAlertList.vue
index d366352a55..b7a56deb15 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertDashboardProjectSearchWidgetAlertList.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertDashboardProjectSearchWidgetAlertList.vue
@@ -11,9 +11,9 @@ import {
} from '@cloudforet/mirinae';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { AlertListParameters } from '@/schema/monitoring/alert/api-verbs/list';
-import { ALERT_STATE } from '@/schema/monitoring/alert/constants';
-import type { AlertModelV1 } from '@/schema/monitoring/alert/model';
+import type { AlertListParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/list';
+import { ALERT_STATE } from '@/api-clients/monitoring/alert/schema/constants';
+import type { AlertModelV1 } from '@/api-clients/monitoring/alert/schema/model';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
import type { UserReferenceMap } from '@/store/reference/user-reference-store';
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertDashboardTop5ProjectActivityWidgetTooltip.vue b/apps/web/src/services/alert-manager/v1/components/AlertDashboardTop5ProjectActivityWidgetTooltip.vue
index 47359dfcd1..af4daa6e95 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertDashboardTop5ProjectActivityWidgetTooltip.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertDashboardTop5ProjectActivityWidgetTooltip.vue
@@ -13,8 +13,8 @@ import {
} from '@cloudforet/mirinae';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { AlertListParameters } from '@/schema/monitoring/alert/api-verbs/list';
-import type { AlertModelV1 } from '@/schema/monitoring/alert/model';
+import type { AlertListParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/list';
+import type { AlertModelV1 } from '@/api-clients/monitoring/alert/schema/model';
import { useUserStore } from '@/store/user/user-store';
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertDetailInfoTable.vue b/apps/web/src/services/alert-manager/v1/components/AlertDetailInfoTable.vue
index 2feced1be7..22f9701552 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertDetailInfoTable.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertDetailInfoTable.vue
@@ -7,9 +7,9 @@ import {
} from '@cloudforet/mirinae';
import { iso8601Formatter } from '@cloudforet/utils';
-import type { AlertModel } from '@/schema/alert-manager/alert/model';
-import type { EscalationPolicyGetParameters } from '@/schema/monitoring/escalation-policy/api-verbs/get';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
+import type { AlertModel } from '@/api-clients/alert-manager/alert/schema/model';
+import type { EscalationPolicyGetParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/get';
+import type { EscalationPolicyModel } from '@/api-clients/alert-manager/escalation-policy/schema/model';
import { i18n } from '@/translations';
import { useUserWorkspaceStore } from '@/store/app-context/workspace/user-workspace-store';
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertDetailNote.vue b/apps/web/src/services/alert-manager/v1/components/AlertDetailNote.vue
index 92806f337a..ed6bf2c49d 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertDetailNote.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertDetailNote.vue
@@ -10,10 +10,10 @@ import {
import { iso8601Formatter } from '@cloudforet/utils';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { NoteCreateParameters } from '@/schema/monitoring/note/api-verbs/create';
-import type { NoteDeleteParameters } from '@/schema/monitoring/note/api-verbs/delete';
-import type { NoteListParameters } from '@/schema/monitoring/note/api-verbs/list';
-import type { NoteModel } from '@/schema/monitoring/note/model';
+import type { NoteCreateParameters } from '@/api-clients/monitoring/note/schema/api-verbs/create';
+import type { NoteDeleteParameters } from '@/api-clients/monitoring/note/schema/api-verbs/delete';
+import type { NoteListParameters } from '@/api-clients/monitoring/note/schema/api-verbs/list';
+import type { NoteModel } from '@/api-clients/monitoring/note/schema/model';
import { i18n } from '@/translations';
import { useUserStore } from '@/store/user/user-store';
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertDetailResponder.vue b/apps/web/src/services/alert-manager/v1/components/AlertDetailResponder.vue
index 8d28f8ab84..373d232dfd 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertDetailResponder.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertDetailResponder.vue
@@ -12,10 +12,10 @@ import {
} from '@cloudforet/mirinae';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { AlertModelV1 } from '@/schema/monitoring/alert/model';
-import type { EscalationPolicyGetParameters } from '@/schema/monitoring/escalation-policy/api-verbs/get';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
-import type { EscalationPolicyRule } from '@/schema/monitoring/escalation-policy/type';
+import type { AlertModelV1 } from '@/api-clients/monitoring/alert/schema/model';
+import type { EscalationPolicyGetParameters } from '@/api-clients/monitoring/escalation-policy/schema/api-verbs/get';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
+import type { EscalationPolicyRule } from '@/api-clients/monitoring/escalation-policy/schema/type';
import type { ProjectChannelListParameters } from '@/schema/notification/project-channel/api-verbs/list';
import type { ProjectChannelModel } from '@/schema/notification/project-channel/model';
import { i18n } from '@/translations';
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertDetailSummary.vue b/apps/web/src/services/alert-manager/v1/components/AlertDetailSummary.vue
index 78d5f20eed..eea9e77fb4 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertDetailSummary.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertDetailSummary.vue
@@ -8,8 +8,8 @@ import {
} from '@cloudforet/mirinae';
import { iso8601Formatter } from '@cloudforet/utils';
-import { ALERT_STATE, ALERT_URGENCY } from '@/schema/monitoring/alert/constants';
-import type { AlertState, AlertUrgency } from '@/schema/monitoring/alert/type';
+import { ALERT_STATE, ALERT_URGENCY } from '@/api-clients/monitoring/alert/schema/constants';
+import type { AlertState, AlertUrgency } from '@/api-clients/monitoring/alert/schema/type';
import { i18n } from '@/translations';
import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertDetailTabsPushedEvent.vue b/apps/web/src/services/alert-manager/v1/components/AlertDetailTabsPushedEvent.vue
index 090579f6a2..a124e9853f 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertDetailTabsPushedEvent.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertDetailTabsPushedEvent.vue
@@ -12,8 +12,8 @@ import {
} from '@cloudforet/mirinae';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { EventListParameters } from '@/schema/monitoring/event/api-verbs/list';
-import type { EventModel } from '@/schema/monitoring/event/model';
+import type { EventListParameters } from '@/api-clients/monitoring/event/schema/api-verbs/list';
+import type { EventModel } from '@/api-clients/monitoring/event/schema/model';
import { useUserStore } from '@/store/user/user-store';
@@ -23,7 +23,6 @@ import AlertDetailTabsPushedEventVerticalTimeline
from '@/services/alert-manager/v1/components/AlertDetailTabsPushedEventVerticalTimeline.vue';
-
const PAGE_SIZE = 10;
const props = defineProps<{
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertListItem.vue b/apps/web/src/services/alert-manager/v1/components/AlertListItem.vue
index f266673716..81197dc615 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertListItem.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertListItem.vue
@@ -10,7 +10,7 @@ import {
} from '@cloudforet/mirinae';
-import { ALERT_STATE } from '@/schema/monitoring/alert/constants';
+import { ALERT_STATE } from '@/api-clients/monitoring/alert/schema/constants';
import { useReferenceRouter } from '@/router/composables/use-reference-router';
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertMainAcknowledgeModal.vue b/apps/web/src/services/alert-manager/v1/components/AlertMainAcknowledgeModal.vue
index ee9a5e6dea..91dd953108 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertMainAcknowledgeModal.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertMainAcknowledgeModal.vue
@@ -5,7 +5,7 @@ import {
import { PButtonModal, PCheckbox } from '@cloudforet/mirinae';
-import type { AlertModelV1 } from '@/schema/monitoring/alert/model';
+import type { AlertModelV1 } from '@/api-clients/monitoring/alert/schema/model';
import { i18n } from '@/translations';
import { useUserStore } from '@/store/user/user-store';
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertMainAlertCreateModal.vue b/apps/web/src/services/alert-manager/v1/components/AlertMainAlertCreateModal.vue
index 2038e5a3ed..8f95296612 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertMainAlertCreateModal.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertMainAlertCreateModal.vue
@@ -10,11 +10,11 @@ import {
} from '@cloudforet/mirinae';
-import type { AlertCreateParameters } from '@/schema/monitoring/alert/api-verbs/create';
-import { ALERT_URGENCY } from '@/schema/monitoring/alert/constants';
-import type { ProjectAlertConfigCreateParameters } from '@/schema/monitoring/project-alert-config/api-verbs/create';
-import type { ProjectAlertConfigGetParameters } from '@/schema/monitoring/project-alert-config/api-verbs/get';
-import type { ProjectAlertConfigModel } from '@/schema/monitoring/project-alert-config/model';
+import type { AlertCreateParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/create';
+import { ALERT_URGENCY } from '@/api-clients/monitoring/alert/schema/constants';
+import type { ProjectAlertConfigCreateParameters } from '@/api-clients/monitoring/project-alert-config/schema/api-verbs/create';
+import type { ProjectAlertConfigGetParameters } from '@/api-clients/monitoring/project-alert-config/schema/api-verbs/get';
+import type { ProjectAlertConfigModel } from '@/api-clients/monitoring/project-alert-config/schema/model';
import { i18n } from '@/translations';
import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
@@ -25,6 +25,7 @@ import type { ProjectTreeNodeData } from '@/common/modules/project/project-tree-
import ProjectSelectDropdown from '@/common/modules/project/ProjectSelectDropdown.vue';
+
const props = defineProps<{
visible: boolean;
projectId?: string;
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertMainDataTable.vue b/apps/web/src/services/alert-manager/v1/components/AlertMainDataTable.vue
index 61e8eb16b7..a29f52faa6 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertMainDataTable.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertMainDataTable.vue
@@ -18,9 +18,9 @@ import type { ToolboxOptions } from '@cloudforet/mirinae/types/controls/toolbox/
import type { DataTableFieldType } from '@cloudforet/mirinae/types/data-display/tables/data-table/type';
import { durationFormatter, iso8601Formatter } from '@cloudforet/utils';
-import type { AlertModel } from '@/schema/alert-manager/alert/model';
-import type { AlertListParameters, AlertListResponse } from '@/schema/monitoring/alert/api-verbs/list';
-import { ALERT_STATE, ALERT_URGENCY } from '@/schema/monitoring/alert/constants';
+import type { AlertModel } from '@/api-clients/alert-manager/alert/schema/model';
+import type { AlertListParameters, AlertListResponse } from '@/api-clients/monitoring/alert/schema/api-verbs/list';
+import { ALERT_STATE, ALERT_URGENCY } from '@/api-clients/monitoring/alert/schema/constants';
import { useReferenceRouter } from '@/router/composables/use-reference-router';
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertMainDataTableActions.vue b/apps/web/src/services/alert-manager/v1/components/AlertMainDataTableActions.vue
index 9fa826a6de..4cb7763406 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertMainDataTableActions.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertMainDataTableActions.vue
@@ -11,9 +11,9 @@ import {
} from '@cloudforet/mirinae';
import { durationFormatter, iso8601Formatter } from '@cloudforet/utils';
-import type { AlertDeleteParameters } from '@/schema/monitoring/alert/api-verbs/delete';
-import { ALERT_STATE, ALERT_URGENCY } from '@/schema/monitoring/alert/constants';
-import type { AlertModelV1 } from '@/schema/monitoring/alert/model';
+import type { AlertDeleteParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/delete';
+import { ALERT_STATE, ALERT_URGENCY } from '@/api-clients/monitoring/alert/schema/constants';
+import type { AlertModelV1 } from '@/api-clients/monitoring/alert/schema/model';
import { i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
diff --git a/apps/web/src/services/alert-manager/v1/components/AlertMainResolveModal.vue b/apps/web/src/services/alert-manager/v1/components/AlertMainResolveModal.vue
index 470c9eb78b..938bfbd7a4 100644
--- a/apps/web/src/services/alert-manager/v1/components/AlertMainResolveModal.vue
+++ b/apps/web/src/services/alert-manager/v1/components/AlertMainResolveModal.vue
@@ -7,11 +7,11 @@ import {
} from '@cloudforet/mirinae';
-import type { AlertUpdateParameters } from '@/schema/monitoring/alert/api-verbs/update';
-import { ALERT_STATE } from '@/schema/monitoring/alert/constants';
-import type { AlertModelV1 } from '@/schema/monitoring/alert/model';
-import type { NoteCreateParameters } from '@/schema/monitoring/note/api-verbs/create';
-import type { NoteModel } from '@/schema/monitoring/note/model';
+import type { AlertUpdateParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/update';
+import { ALERT_STATE } from '@/api-clients/monitoring/alert/schema/constants';
+import type { AlertModelV1 } from '@/api-clients/monitoring/alert/schema/model';
+import type { NoteCreateParameters } from '@/api-clients/monitoring/note/schema/api-verbs/create';
+import type { NoteModel } from '@/api-clients/monitoring/note/schema/model';
import { i18n } from '@/translations';
import { showErrorMessage, showSuccessMessage } from '@/lib/helper/notice-alert-helper';
diff --git a/apps/web/src/services/alert-manager/v1/components/EscalationPolicyDataTable.vue b/apps/web/src/services/alert-manager/v1/components/EscalationPolicyDataTable.vue
index 9348cbbe2b..dea51ffa25 100644
--- a/apps/web/src/services/alert-manager/v1/components/EscalationPolicyDataTable.vue
+++ b/apps/web/src/services/alert-manager/v1/components/EscalationPolicyDataTable.vue
@@ -7,11 +7,11 @@ import {
} from '@cloudforet/mirinae';
import type { DataTableField } from '@cloudforet/mirinae/types/data-display/tables/data-table/type';
-import { ALERT_STATE } from '@/schema/monitoring/alert/constants';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
+import { ALERT_STATE } from '@/api-clients/monitoring/alert/schema/constants';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
import type {
EscalationPolicyFinishCondition,
-} from '@/schema/monitoring/escalation-policy/type';
+} from '@/api-clients/monitoring/escalation-policy/schema/type';
import { i18n } from '@/translations';
import { useReferenceRouter } from '@/router/composables/use-reference-router';
diff --git a/apps/web/src/services/alert-manager/v1/components/EscalationPolicyForm.vue b/apps/web/src/services/alert-manager/v1/components/EscalationPolicyForm.vue
index 2ccf19a949..dffcc8a7bb 100644
--- a/apps/web/src/services/alert-manager/v1/components/EscalationPolicyForm.vue
+++ b/apps/web/src/services/alert-manager/v1/components/EscalationPolicyForm.vue
@@ -10,9 +10,9 @@ import {
import { ROLE_TYPE } from '@/api-clients/identity/role/constant';
-import { ESCALATION_POLICY_FINISH_CONDITION } from '@/schema/monitoring/escalation-policy/constant';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
-import type { EscalationPolicyFinishCondition } from '@/schema/monitoring/escalation-policy/type';
+import { ESCALATION_POLICY_FINISH_CONDITION } from '@/api-clients/monitoring/escalation-policy/schema/constants';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
+import type { EscalationPolicyFinishCondition } from '@/api-clients/monitoring/escalation-policy/schema/type';
import { i18n } from '@/translations';
import { useReferenceRouter } from '@/router/composables/use-reference-router';
diff --git a/apps/web/src/services/alert-manager/v1/components/EscalationPolicyFormModal.vue b/apps/web/src/services/alert-manager/v1/components/EscalationPolicyFormModal.vue
index 12829705bd..14f35b67d9 100644
--- a/apps/web/src/services/alert-manager/v1/components/EscalationPolicyFormModal.vue
+++ b/apps/web/src/services/alert-manager/v1/components/EscalationPolicyFormModal.vue
@@ -5,9 +5,9 @@ import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import { PButtonModal } from '@cloudforet/mirinae';
-import type { EscalationPolicyCreateParameters } from '@/schema/monitoring/escalation-policy/api-verbs/create';
-import type { EscalationPolicyUpdateParameters } from '@/schema/monitoring/escalation-policy/api-verbs/update';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
+import type { EscalationPolicyCreateParameters } from '@/api-clients/monitoring/escalation-policy/schema/api-verbs/create';
+import type { EscalationPolicyUpdateParameters } from '@/api-clients/monitoring/escalation-policy/schema/api-verbs/update';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
import { i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
diff --git a/apps/web/src/services/alert-manager/v1/components/EscalationPolicyFormRulesInput.vue b/apps/web/src/services/alert-manager/v1/components/EscalationPolicyFormRulesInput.vue
index 6025380137..b6145d41ec 100644
--- a/apps/web/src/services/alert-manager/v1/components/EscalationPolicyFormRulesInput.vue
+++ b/apps/web/src/services/alert-manager/v1/components/EscalationPolicyFormRulesInput.vue
@@ -14,7 +14,7 @@ import {
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import { RESOURCE_GROUP } from '@/api-clients/_common/schema/constant';
-import type { EscalationPolicyRule } from '@/schema/monitoring/escalation-policy/type';
+import type { EscalationPolicyRule } from '@/api-clients/monitoring/escalation-policy/schema/type';
import type { ProjectChannelListParameters } from '@/schema/notification/project-channel/api-verbs/list';
import type { ProjectChannelModel } from '@/schema/notification/project-channel/model';
diff --git a/apps/web/src/services/alert-manager/v1/composables/alert-info.ts b/apps/web/src/services/alert-manager/v1/composables/alert-info.ts
index d0f21cb902..939af7f038 100644
--- a/apps/web/src/services/alert-manager/v1/composables/alert-info.ts
+++ b/apps/web/src/services/alert-manager/v1/composables/alert-info.ts
@@ -2,7 +2,7 @@ import { reactive } from 'vue';
import { cloneDeep } from 'lodash';
-import type { AlertUpdateParameters } from '@/schema/monitoring/alert/api-verbs/update';
+import type { AlertUpdateParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/update';
import { i18n } from '@/translations';
import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
diff --git a/apps/web/src/services/alert-manager/v1/composables/alert-state-i18n.ts b/apps/web/src/services/alert-manager/v1/composables/alert-state-i18n.ts
index 5d65b710e4..62141964a5 100644
--- a/apps/web/src/services/alert-manager/v1/composables/alert-state-i18n.ts
+++ b/apps/web/src/services/alert-manager/v1/composables/alert-state-i18n.ts
@@ -2,7 +2,7 @@ import type { ComputedRef } from 'vue';
import { computed } from 'vue';
import type { TranslateResult } from 'vue-i18n';
-import type { AlertState } from '@/schema/monitoring/alert/type';
+import type { AlertState } from '@/api-clients/monitoring/alert/schema/type';
import { i18n } from '@/translations';
diff --git a/apps/web/src/services/alert-manager/v1/composables/alert-urgency-i18n.ts b/apps/web/src/services/alert-manager/v1/composables/alert-urgency-i18n.ts
index f2a2d89174..47365a4528 100644
--- a/apps/web/src/services/alert-manager/v1/composables/alert-urgency-i18n.ts
+++ b/apps/web/src/services/alert-manager/v1/composables/alert-urgency-i18n.ts
@@ -2,7 +2,7 @@ import type { ComputedRef } from 'vue';
import { computed } from 'vue';
import type { TranslateResult } from 'vue-i18n';
-import type { AlertUrgency } from '@/schema/monitoring/alert/type';
+import type { AlertUrgency } from '@/api-clients/monitoring/alert/schema/type';
import { i18n } from '@/translations';
diff --git a/apps/web/src/services/alert-manager/v1/constants/alert-constant.ts b/apps/web/src/services/alert-manager/v1/constants/alert-constant.ts
index 15d48026b4..88dc26350c 100644
--- a/apps/web/src/services/alert-manager/v1/constants/alert-constant.ts
+++ b/apps/web/src/services/alert-manager/v1/constants/alert-constant.ts
@@ -1,5 +1,5 @@
-import { ALERT_STATE, ALERT_URGENCY } from '@/schema/monitoring/alert/constants';
-import type { AlertSeverity } from '@/schema/monitoring/alert/type';
+import { ALERT_STATE, ALERT_URGENCY } from '@/api-clients/monitoring/alert/schema/constants';
+import type { AlertSeverity } from '@/api-clients/monitoring/alert/schema/type';
import {
blue, coral, gray, red, violet, yellow,
diff --git a/apps/web/src/services/alert-manager/v1/helpers/alert-badge-helper.ts b/apps/web/src/services/alert-manager/v1/helpers/alert-badge-helper.ts
index 80f00f3cdb..2fa288097d 100644
--- a/apps/web/src/services/alert-manager/v1/helpers/alert-badge-helper.ts
+++ b/apps/web/src/services/alert-manager/v1/helpers/alert-badge-helper.ts
@@ -1,6 +1,6 @@
import { RESOURCE_GROUP } from '@/api-clients/_common/schema/constant';
-import { ALERT_STATE } from '@/schema/monitoring/alert/constants';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
+import { ALERT_STATE } from '@/api-clients/monitoring/alert/schema/constants';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
diff --git a/apps/web/src/services/alert-manager/v1/pages/AlertDashboardPage.vue b/apps/web/src/services/alert-manager/v1/pages/AlertDashboardPage.vue
index cdebd8d775..428a000acf 100644
--- a/apps/web/src/services/alert-manager/v1/pages/AlertDashboardPage.vue
+++ b/apps/web/src/services/alert-manager/v1/pages/AlertDashboardPage.vue
@@ -6,8 +6,8 @@ import { PHeading } from '@cloudforet/mirinae';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { ProjectAlertConfigListParameters } from '@/schema/monitoring/project-alert-config/api-verbs/list';
-import type { ProjectAlertConfigModel } from '@/schema/monitoring/project-alert-config/model';
+import type { ProjectAlertConfigListParameters } from '@/api-clients/monitoring/project-alert-config/schema/api-verbs/list';
+import type { ProjectAlertConfigModel } from '@/api-clients/monitoring/project-alert-config/schema/model';
import ErrorHandler from '@/common/composables/error/errorHandler';
diff --git a/apps/web/src/services/alert-manager/v1/pages/AlertDetailPage.vue b/apps/web/src/services/alert-manager/v1/pages/AlertDetailPage.vue
index 4d16e2a07e..bcc1899c75 100644
--- a/apps/web/src/services/alert-manager/v1/pages/AlertDetailPage.vue
+++ b/apps/web/src/services/alert-manager/v1/pages/AlertDetailPage.vue
@@ -6,7 +6,7 @@ import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import { PIconButton, PHeading } from '@cloudforet/mirinae';
-import type { AlertDeleteParameters } from '@/schema/monitoring/alert/api-verbs/delete';
+import type { AlertDeleteParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/delete';
import { i18n } from '@/translations';
import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
diff --git a/apps/web/src/services/alert-manager/v1/pages/EscalationPolicyPage.vue b/apps/web/src/services/alert-manager/v1/pages/EscalationPolicyPage.vue
index ca16381f8b..2cba673f44 100644
--- a/apps/web/src/services/alert-manager/v1/pages/EscalationPolicyPage.vue
+++ b/apps/web/src/services/alert-manager/v1/pages/EscalationPolicyPage.vue
@@ -17,17 +17,17 @@ import type { ToolboxOptions } from '@cloudforet/mirinae/types/controls/toolbox/
import { iso8601Formatter } from '@cloudforet/utils';
import { RESOURCE_GROUP } from '@/api-clients/_common/schema/constant';
-import type { EscalationPolicyDeleteParameters } from '@/schema/monitoring/escalation-policy/api-verbs/delete';
+import type { EscalationPolicyDeleteParameters } from '@/api-clients/monitoring/escalation-policy/schema/api-verbs/delete';
import type {
EscalationPolicyListParameters,
EscalationPolicyListResponse,
-} from '@/schema/monitoring/escalation-policy/api-verbs/list';
-import type { EscalationPolicySetDefaultParameters } from '@/schema/monitoring/escalation-policy/api-verbs/set-default';
+} from '@/api-clients/monitoring/escalation-policy/schema/api-verbs/list';
+import type { EscalationPolicySetDefaultParameters } from '@/api-clients/monitoring/escalation-policy/schema/api-verbs/set-default';
import {
ESCALATION_POLICY_FINISH_CONDITION,
ESCALATION_POLICY_RESOURCE_GROUP,
-} from '@/schema/monitoring/escalation-policy/constant';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
+} from '@/api-clients/monitoring/escalation-policy/schema/constants';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
import { i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
@@ -46,6 +46,7 @@ import EscalationPolicyFormModal from '@/services/alert-manager/v1/components/Es
import { ACTION } from '@/services/alert-manager/v1/constants/alert-constant';
import type { ActionMode } from '@/services/alert-manager/v1/types/alert-type';
+
interface Item extends Omit {
name: {
label: string;
diff --git a/apps/web/src/services/alert-manager/v1/stores/alert-assign-user-store.ts b/apps/web/src/services/alert-manager/v1/stores/alert-assign-user-store.ts
index 14c419ec12..d0c97b4d05 100644
--- a/apps/web/src/services/alert-manager/v1/stores/alert-assign-user-store.ts
+++ b/apps/web/src/services/alert-manager/v1/stores/alert-assign-user-store.ts
@@ -8,10 +8,10 @@ import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { WorkspaceUserListParameters } from '@/api-clients/identity/workspace-user/schema/api-verbs/list';
import type { WorkspaceUserModel } from '@/api-clients/identity/workspace-user/schema/model';
-import type { AlertModel } from '@/schema/alert-manager/alert/model';
-import type { AlertAssignUserParameters } from '@/schema/monitoring/alert/api-verbs/assign-user';
-import type { AlertUpdateParameters } from '@/schema/monitoring/alert/api-verbs/update';
-import { ALERT_STATE } from '@/schema/monitoring/alert/constants';
+import type { AlertAssignUserParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/assign-user';
+import type { AlertUpdateParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/update';
+import { ALERT_STATE } from '@/api-clients/monitoring/alert/schema/constants';
+import type { AlertModelV1 } from '@/api-clients/monitoring/alert/schema/model';
import ErrorHandler from '@/common/composables/error/errorHandler';
@@ -42,9 +42,9 @@ export const useAlertAssignUserStore = defineStore('alert-user-assign-store', ()
throw new Error(alertId);
}
},
- async assignUserToAlert(alertId: string, assignee: string): Promise {
+ async assignUserToAlert(alertId: string, assignee: string): Promise {
try {
- const alertData = await SpaceConnector.clientV2.monitoring.alert.assignUser({
+ const alertData = await SpaceConnector.clientV2.monitoring.alert.assignUser({
alert_id: alertId,
assignee,
});
diff --git a/apps/web/src/services/alert-manager/v1/stores/alert-page-store.ts b/apps/web/src/services/alert-manager/v1/stores/alert-page-store.ts
index b926615b9d..3df287e563 100644
--- a/apps/web/src/services/alert-manager/v1/stores/alert-page-store.ts
+++ b/apps/web/src/services/alert-manager/v1/stores/alert-page-store.ts
@@ -4,13 +4,12 @@ import { defineStore } from 'pinia';
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
-import type { AlertModel } from '@/schema/alert-manager/alert/model';
-import type { AlertGetParameters } from '@/schema/monitoring/alert/api-verbs/get';
-import type { AlertUpdateParameters } from '@/schema/monitoring/alert/api-verbs/update';
+import type { AlertGetParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/get';
+import type { AlertUpdateParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/update';
+import type { AlertModelV1 } from '@/api-clients/monitoring/alert/schema/model';
import ErrorHandler from '@/common/composables/error/errorHandler';
-
interface UpdateAlertPayload {
alertId: string;
updateParams: Omit;
@@ -18,12 +17,12 @@ interface UpdateAlertPayload {
export const useAlertPageStore = defineStore('page-alert', () => {
const state = reactive({
- alertData: null as Partial|null,
+ alertData: null as Partial|null,
});
const actions = {
async getAlertData(alertId: string): Promise {
try {
- state.alertData = await SpaceConnector.clientV2.monitoring.alert.get({
+ state.alertData = await SpaceConnector.clientV2.monitoring.alert.get({
alert_id: alertId,
});
} catch (e: any) {
@@ -33,7 +32,7 @@ export const useAlertPageStore = defineStore('page-alert', () => {
},
async updateAlertData({ alertId, updateParams }: UpdateAlertPayload): Promise {
try {
- state.alertData = await SpaceConnector.clientV2.monitoring.alert.update({
+ state.alertData = await SpaceConnector.clientV2.monitoring.alert.update({
...updateParams,
alert_id: alertId,
});
@@ -42,7 +41,7 @@ export const useAlertPageStore = defineStore('page-alert', () => {
throw e;
}
},
- async setAlertData(alertData: AlertModel): Promise {
+ async setAlertData(alertData: AlertModelV1): Promise {
state.alertData = alertData;
},
diff --git a/apps/web/src/services/alert-manager/v1/stores/escalation-policy-form-store.ts b/apps/web/src/services/alert-manager/v1/stores/escalation-policy-form-store.ts
index 5f49b211fb..af8ec16d17 100644
--- a/apps/web/src/services/alert-manager/v1/stores/escalation-policy-form-store.ts
+++ b/apps/web/src/services/alert-manager/v1/stores/escalation-policy-form-store.ts
@@ -1,9 +1,10 @@
import type { _GettersTree } from 'pinia';
import { defineStore } from 'pinia';
-import { ESCALATION_POLICY_FINISH_CONDITION } from '@/schema/monitoring/escalation-policy/constant';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
-import type { EscalationPolicyFinishCondition, EscalationPolicyRule } from '@/schema/monitoring/escalation-policy/type';
+import { ESCALATION_POLICY_FINISH_CONDITION } from '@/api-clients/monitoring/escalation-policy/schema/constants';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
+import type { EscalationPolicyFinishCondition, EscalationPolicyRule } from '@/api-clients/monitoring/escalation-policy/schema/type';
+
interface EscalationPolicyFormState {
escalationPolicyData?: EscalationPolicyModel|undefined;
diff --git a/apps/web/src/services/alert-manager/v1/types/alert-type.ts b/apps/web/src/services/alert-manager/v1/types/alert-type.ts
index 218a106197..7949127f5e 100644
--- a/apps/web/src/services/alert-manager/v1/types/alert-type.ts
+++ b/apps/web/src/services/alert-manager/v1/types/alert-type.ts
@@ -1,6 +1,6 @@
import type { ConsoleFilter } from '@cloudforet/core-lib/query/type';
-import type { AlertState } from '@/schema/monitoring/alert/type';
+import type { AlertState } from '@/api-clients/monitoring/alert/schema/type';
import type { RouteQueryString } from '@/lib/router-query-string';
diff --git a/apps/web/src/services/alert-manager/v2/AlertContainer.vue b/apps/web/src/services/alert-manager/v2/AlertContainer.vue
index 6456d68231..3d5f8e0f73 100644
--- a/apps/web/src/services/alert-manager/v2/AlertContainer.vue
+++ b/apps/web/src/services/alert-manager/v2/AlertContainer.vue
@@ -6,7 +6,6 @@ import { useAlertPageStore } from '@/services/alert-manager/v2/stores/alert-page
const alertPageStore = useAlertPageStore();
onUnmounted(() => {
- alertPageStore.init();
alertPageStore.$dispose();
});
diff --git a/apps/web/src/services/alert-manager/v2/components/AlertCreateModal.vue b/apps/web/src/services/alert-manager/v2/components/AlertCreateModal.vue
index 3939e4ed6d..596a31ee79 100644
--- a/apps/web/src/services/alert-manager/v2/components/AlertCreateModal.vue
+++ b/apps/web/src/services/alert-manager/v2/components/AlertCreateModal.vue
@@ -2,16 +2,16 @@
import { computed, reactive } from 'vue';
import { useRoute } from 'vue-router/composables';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
-import type { Query } from '@cloudforet/core-lib/space-connector/type';
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
+
import {
PButtonModal, PFieldGroup, PTextInput, PTextarea, PSelectDropdown, PRadioGroup, PRadio,
} from '@cloudforet/mirinae';
import type { SelectDropdownMenuItem } from '@cloudforet/mirinae/types/controls/dropdown/select-dropdown/type';
-import type { AlertCreateParameters } from '@/schema/alert-manager/alert/api-verbs/create';
-import { ALERT_URGENCY } from '@/schema/alert-manager/alert/constants';
-import type { AlertModel } from '@/schema/alert-manager/alert/model';
+import { useAlertApi } from '@/api-clients/alert-manager/alert/composables/use-alert-api';
+import { ALERT_URGENCY } from '@/api-clients/alert-manager/alert/schema/constants';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import { i18n } from '@/translations';
import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
@@ -35,19 +35,20 @@ const props = withDefaults(defineProps(), {
});
const alertPageStore = useAlertPageStore();
-const alertPageState = alertPageStore.state;
const alertPageGetters = alertPageStore.getters;
const emit = defineEmits<{(e: 'update:visible'): void; }>();
const route = useRoute();
+const queryClient = useQueryClient();
+const { alertAPI } = useAlertApi();
+const { key: alertListQueryKey } = useServiceQueryKey('alert-manager', 'alert', 'list');
+
const storeState = reactive({
serviceDropdownList: computed(() => alertPageGetters.serviceDropdownList),
- alertListQuery: computed(() => alertPageState.alertListQuery),
});
const state = reactive({
- loading: false,
proxyVisible: useProxyValue('visible', props, emit),
isServicePage: route.name === ALERT_MANAGER_ROUTE.SERVICE.DETAIL._NAME,
@@ -64,6 +65,7 @@ const state = reactive({
]),
selectedRadioIdx: 0,
});
+
const {
forms: {
name,
@@ -82,28 +84,30 @@ const {
},
});
+const { mutate: createAlert, isPending } = useMutation({
+ mutationFn: alertAPI.create,
+ onSuccess: () => {
+ showSuccessMessage(i18n.t('ALERT_MANAGER.ALERTS.ALT_S_CREATE'), '');
+ queryClient.invalidateQueries({ queryKey: alertListQueryKey.value });
+ },
+ onError: (error) => {
+ ErrorHandler.handleError(error, true);
+ },
+ onSettled: () => {
+ handleClose();
+ },
+});
+
const handleClose = () => {
state.proxyVisible = false;
};
const handleConfirm = async () => {
- state.loading = true;
- try {
- await SpaceConnector.clientV2.alertManager.alert.create({
- title: name.value,
- description: description.value,
- service_id: state.selectedServiceId,
- urgency: state.radioMenuList[state.selectedRadioIdx].name,
- });
- showSuccessMessage(i18n.t('ALERT_MANAGER.ALERTS.ALT_S_CREATE'), '');
- await alertPageStore.fetchAlertsList({
- query: storeState.alertListQuery,
- });
- } catch (e) {
- ErrorHandler.handleError(e, true);
- } finally {
- state.loading = false;
- handleClose();
- }
+ createAlert({
+ title: name.value,
+ description: description.value,
+ service_id: state.selectedServiceId,
+ urgency: state.radioMenuList[state.selectedRadioIdx].name,
+ });
};
@@ -115,7 +119,7 @@ const handleConfirm = async () => {
:backdrop="true"
:visible="state.proxyVisible"
:disabled="!isAllValid || !state.selectedServiceId"
- :loading="state.loading"
+ :loading="isPending"
@confirm="handleConfirm"
@cancel="handleClose"
@close="handleClose"
diff --git a/apps/web/src/services/alert-manager/v2/components/AlertDetailDeleteModal.vue b/apps/web/src/services/alert-manager/v2/components/AlertDetailDeleteModal.vue
index df59b25bba..85d00b4fff 100644
--- a/apps/web/src/services/alert-manager/v2/components/AlertDetailDeleteModal.vue
+++ b/apps/web/src/services/alert-manager/v2/components/AlertDetailDeleteModal.vue
@@ -1,12 +1,13 @@
@@ -75,7 +79,7 @@ const handleConfirm = async () => {
:fade="true"
:backdrop="true"
:visible="state.proxyVisible"
- :loading="state.loading"
+ :loading="alertDeleteLoading"
@confirm="handleConfirm"
@cancel="handleClose"
@close="handleClose"
diff --git a/apps/web/src/services/alert-manager/v2/components/AlertDetailEditModal.vue b/apps/web/src/services/alert-manager/v2/components/AlertDetailEditModal.vue
index 7bfd25393a..c752ad3920 100644
--- a/apps/web/src/services/alert-manager/v2/components/AlertDetailEditModal.vue
+++ b/apps/web/src/services/alert-manager/v2/components/AlertDetailEditModal.vue
@@ -1,33 +1,29 @@
@@ -72,7 +68,7 @@ const handleConfirm = async () => {
:backdrop="true"
:visible="state.proxyVisible"
:disabled="!isAllValid"
- :loading="state.loading"
+ :loading="isPending"
@confirm="handleConfirm"
@cancel="handleClose"
@close="handleClose"
diff --git a/apps/web/src/services/alert-manager/v2/components/AlertDetailInfoTable.vue b/apps/web/src/services/alert-manager/v2/components/AlertDetailInfoTable.vue
index fb675195b8..6f1bb7cfe0 100644
--- a/apps/web/src/services/alert-manager/v2/components/AlertDetailInfoTable.vue
+++ b/apps/web/src/services/alert-manager/v2/components/AlertDetailInfoTable.vue
@@ -1,6 +1,6 @@
diff --git a/apps/web/src/services/alert-manager/v2/components/AlertDetailSummary.vue b/apps/web/src/services/alert-manager/v2/components/AlertDetailSummary.vue
index 301ef8ee44..109447dd74 100644
--- a/apps/web/src/services/alert-manager/v2/components/AlertDetailSummary.vue
+++ b/apps/web/src/services/alert-manager/v2/components/AlertDetailSummary.vue
@@ -1,50 +1,52 @@
@@ -134,18 +139,18 @@ watch(() => alertDetailPageState.alertInfo, (alertInfo) => {
{{ $t('ALERT_MANAGER.ESCALATION_POLICY.TITLE') }}
-
import { computed, reactive } from 'vue';
+import { useRoute } from 'vue-router/composables';
import { map } from 'lodash';
import { PDefinitionTable, PHeading, PHeadingLayout } from '@cloudforet/mirinae';
import type { DefinitionField } from '@cloudforet/mirinae/types/data-display/tables/definition-table/type';
-import type { AlertModel } from '@/schema/alert-manager/alert/model';
+import { useAlertGetQuery } from '@/services/alert-manager/v2/composables/use-alert-get-query';
-import { useAlertDetailPageStore } from '@/services/alert-manager/v2/stores/alert-detail-page-store';
+const route = useRoute();
+const { alertData } = useAlertGetQuery(route.params.alertId as string);
-const alertDetailPageStore = useAlertDetailPageStore();
-const alertDetailPageState = alertDetailPageStore.state;
-
-const storeState = reactive({
- alertInfo: computed(() => alertDetailPageState.alertInfo),
-});
const state = reactive({
- data: computed>(() => storeState.alertInfo?.additional_info) || {},
+ data: computed>(() => alertData.value?.additional_info || {}),
fields: computed(() => map(state.data, (d, k) => ({ name: k, label: k })).sort((a, b) => a.label.localeCompare(b.label))),
});
diff --git a/apps/web/src/services/alert-manager/v2/components/AlertDetailTabsTimeline.vue b/apps/web/src/services/alert-manager/v2/components/AlertDetailTabsTimeline.vue
index bbfee9667f..cd3397d526 100644
--- a/apps/web/src/services/alert-manager/v2/components/AlertDetailTabsTimeline.vue
+++ b/apps/web/src/services/alert-manager/v2/components/AlertDetailTabsTimeline.vue
@@ -1,31 +1,34 @@
@@ -161,12 +161,12 @@ watch(() => storeState.alertInfo, async (alertInfo) => {
{{ $t('ALERT_MANAGER.ALERTS.TYPE') }}
@@ -183,7 +183,7 @@ watch(() => storeState.alertInfo, async (alertInfo) => {
{{ item.label }}
-
@@ -226,12 +226,12 @@ watch(() => storeState.alertInfo, async (alertInfo) => {
10
+ && (alertHistoryData?.length || 0) > state.slicedHistoryList.length"
icon-right="ic_chevron-down"
size="sm"
style-type="secondary"
- :loading="state.loading"
+ :loading="alertHistoryLoading"
@click="handleClickShowMore"
>
{{ $t('ALERT_MANAGER.SHOW_MORE') }}
@@ -241,6 +241,7 @@ watch(() => storeState.alertInfo, async (alertInfo) => {
:visible.sync="state.modalVisible"
:type="state.modalType"
:history="state.selectedItem"
+ :service-id="alertData?.service_id || ''"
/>
diff --git a/apps/web/src/services/alert-manager/v2/components/AlertDetailTabsTimelineModal.vue b/apps/web/src/services/alert-manager/v2/components/AlertDetailTabsTimelineModal.vue
index 6f2bb29fec..5216a96787 100644
--- a/apps/web/src/services/alert-manager/v2/components/AlertDetailTabsTimelineModal.vue
+++ b/apps/web/src/services/alert-manager/v2/components/AlertDetailTabsTimelineModal.vue
@@ -10,9 +10,9 @@ import type { SelectDropdownMenuItem } from '@cloudforet/mirinae/types/controls/
import {
ALERT_HISTORY_ACTION,
ALERT_HISTORY_NOTIFICATION_STATE,
-} from '@/schema/alert-manager/alert/constants';
-import type { AlertHistoryModel, AlertModel } from '@/schema/alert-manager/alert/model';
-import type { AlertHistoryActionType, AlertHistoryNotificationInfoType, AlertHistoryNotificationChannelInfoType } from '@/schema/alert-manager/alert/type';
+} from '@/api-clients/alert-manager/alert/schema/constants';
+import type { AlertHistoryModel } from '@/api-clients/alert-manager/alert/schema/model';
+import type { AlertHistoryActionType, AlertHistoryNotificationInfoType, AlertHistoryNotificationChannelInfoType } from '@/api-clients/alert-manager/alert/schema/type';
import { i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
@@ -30,19 +30,20 @@ import { useProxyValue } from '@/common/composables/proxy-state';
import { green, red } from '@/styles/colors';
import { ALERT_CHANNEL_TABLE_FIELDS } from '@/services/alert-manager/v2/constants/alert-table-constant';
-import { useAlertDetailPageStore } from '@/services/alert-manager/v2/stores/alert-detail-page-store';
import type { AlertHistoryNotificationItemType } from '@/services/alert-manager/v2/types/alert-manager-type';
interface Props {
visible: boolean;
type: AlertHistoryActionType;
history?: AlertHistoryModel;
+ serviceId?: string;
}
const props = withDefaults(defineProps(), {
visible: false,
type: ALERT_HISTORY_ACTION.EVENT_PUSHED,
history: undefined,
+ serviceId: '',
});
const TYPE = {
@@ -53,8 +54,6 @@ const TYPE = {
const allReferenceStore = useAllReferenceStore();
const allReferenceGetters = allReferenceStore.getters;
-const alertDetailPageStore = useAlertDetailPageStore();
-const alertDetailPageState = alertDetailPageStore.state;
const emit = defineEmits<{(event: 'update:visible', visible: boolean): void;
}>();
@@ -64,7 +63,6 @@ const storeState = reactive({
service: computed(() => allReferenceGetters.service),
userGroup: computed(() => allReferenceGetters.user_group),
user: computed(() => allReferenceGetters.user),
- alertInfo: computed(() => alertDetailPageState.alertInfo),
});
const state = reactive({
proxyVisible: useProxyValue('visible', props, emit),
@@ -89,9 +87,9 @@ const state = reactive({
const refinedData = channelTypes.flatMap((type) => Object.entries(data[type] || {}).map(([name, channelInfo]) => {
const info = channelInfo as AlertHistoryNotificationChannelInfoType;
- let target = '';
+ let target: string | undefined = '';
if (type === TYPE.SERVICE) {
- target = storeState.service[storeState.alertInfo.service_id]?.label || storeState.alertInfo.service_id;
+ target = storeState.service[props.serviceId]?.label || props.serviceId;
} else if (type === TYPE.USER_GROUP) {
target = storeState.userGroup[info.user_group_id || '']?.label || info.user_group_id;
} else if (type === TYPE.USER) {
diff --git a/apps/web/src/services/alert-manager/v2/components/AlertsDetailHeader.vue b/apps/web/src/services/alert-manager/v2/components/AlertsDetailHeader.vue
index 6fe48327b1..d283519001 100644
--- a/apps/web/src/services/alert-manager/v2/components/AlertsDetailHeader.vue
+++ b/apps/web/src/services/alert-manager/v2/components/AlertsDetailHeader.vue
@@ -5,34 +5,30 @@ import { useRoute, useRouter } from 'vue-router/composables';
import { PHeadingLayout, PHeading, PSelectDropdown } from '@cloudforet/mirinae';
import type { MenuItem } from '@cloudforet/mirinae/types/controls/context-menu/type';
-import type { AlertModel } from '@/schema/alert-manager/alert/model';
import { i18n } from '@/translations';
import { usePageEditableStatus } from '@/common/composables/page-editable-status';
import AlertDetailDeleteModal from '@/services/alert-manager/v2/components/AlertDetailDeleteModal.vue';
import AlertDetailEditModal from '@/services/alert-manager/v2/components/AlertDetailEditModal.vue';
+import { useAlertGetQuery } from '@/services/alert-manager/v2/composables/use-alert-get-query';
import { ALERT_PERIOD_DROPDOWN_MENU } from '@/services/alert-manager/v2/constants/alert-table-constant';
import { ALERT_MANAGER_ROUTE } from '@/services/alert-manager/v2/routes/route-constant';
-import { useAlertDetailPageStore } from '@/services/alert-manager/v2/stores/alert-detail-page-store';
import { useAlertPageStore } from '@/services/alert-manager/v2/stores/alert-page-store';
import type { Period } from '@/services/alert-manager/v2/types/alert-manager-type';
-
type ModalType = 'edit' | 'delete';
const alertPageStore = useAlertPageStore();
const alertPageState = alertPageStore.state;
-const alertDetailPageStore = useAlertDetailPageStore();
-const alertDetailPageState = alertDetailPageStore.state;
const router = useRouter();
const route = useRoute();
const { hasReadWriteAccess } = usePageEditableStatus();
+const { alertData } = useAlertGetQuery(route.params.alertId as string);
const storeState = reactive({
- alertInfo: computed(() => alertDetailPageState.alertInfo),
selectedServiceId: computed(() => alertPageState.selectedServiceId),
selectedStatus: computed(() => alertPageState.selectedStatus),
selectedUrgency: computed(() => alertPageState.selectedUrgency),
@@ -88,7 +84,7 @@ const handleSelectDropdownMenu = (type: ModalType) => {
-
@@ -109,9 +105,12 @@ const handleSelectDropdownMenu = (type: ModalType) => {
diff --git a/apps/web/src/services/alert-manager/v2/components/AlertsManagementTable.vue b/apps/web/src/services/alert-manager/v2/components/AlertsManagementTable.vue
index d83505ccdf..d3dac47cae 100644
--- a/apps/web/src/services/alert-manager/v2/components/AlertsManagementTable.vue
+++ b/apps/web/src/services/alert-manager/v2/components/AlertsManagementTable.vue
@@ -1,6 +1,6 @@
@@ -483,16 +495,18 @@ watch(() => storeState.serviceId, async (serviceId) => {
:class="{'is-service-page': state.isServicePage}"
:sort-desc="true"
:query-tags="queryTags"
- :loading="state.loading"
- :total-count="storeState.totalCount"
+ :this-page.sync="paginationState.thisPage"
+ :page-size.sync="paginationState.pageSize"
+ :loading="alertListLoading"
+ :total-count="alertListTotalCount"
:fields="state.fields"
- :items="state.refinedAlertList"
+ :items="alertListData"
:key-item-sets="ALERT_MANAGEMENT_TABLE_HANDLER.keyItemSets"
:value-handler-map="state.tableHandler"
settings-visible
@change="handleChange"
@click-settings="handleClickSettings"
- @refresh="fetchAlertsList"
+ @refresh="refreshAlertList"
@export="handleExportToExcel"
>
storeState.serviceId, async (serviceId) => {
use-fixed-menu-style
:selected="storeState.selectedUrgency"
class="service-dropdown"
- @update:selected="handleSelectFilter('urgency', $event)"
+ @update:selected="handleSelectUrgency"
>
storeState.serviceId, async (serviceId) => {
:selected="storeState.selectedStatus"
:value="item.name"
class="status"
- @change="handleSelectFilter('status', item.name)"
+ @change="handleSelectStatus(item.name)"
>
{{ item.label }}
@@ -667,7 +681,7 @@ watch(() => storeState.serviceId, async (serviceId) => {
:resource-type="state.isServicePage ? 'service.alert' : 'alertManager.alert'"
:default-field="state.defaultFields"
@update:visible="handleVisibleCustomFieldModal"
- @complete="fetchAlertsList"
+ @complete="refreshAlertList"
@custom-field-loaded="handleCustomFieldUpdate"
/>
(() => userState.language),
- plugins: computed(() => allReferenceGetters.plugin),
createdServiceMembers: computed>(() => serviceCreateFormState.createdService.members),
selectedProtocolType: computed(() => serviceCreateFormState.selectedProtocol),
- protocolList: computed(() => serviceCreateFormState.protocolList),
});
const state = reactive({
isMobileSize: computed(() => width.value < screens.mobile.max),
@@ -63,7 +59,7 @@ const state = reactive({
selectedRadioIdx: 0,
selectedMemberIds: [] as string[],
selectedMemberItems: {} as Record,
- notificationChannelList: computed(() => storeState.protocolList.map((i) => ({
+ notificationChannelList: computed(() => notificationProtocolListData.value.map((i) => ({
name: i.protocol_id,
label: i.name,
}))),
@@ -102,9 +98,9 @@ const {
});
const getPluginIcon = (id: string): string => {
- const item = storeState.protocolList.find((i) => i.protocol_id === id);
+ const item = notificationProtocolListData.value.find((i) => i.protocol_id === id);
if (!item) return '';
- return storeState.plugins[item.plugin_info.plugin_id]?.icon || '';
+ return item?.icon || '';
};
const handleFormattedSelectedIds = (value: Record) => {
state.selectedMemberItems = value;
diff --git a/apps/web/src/services/alert-manager/v2/components/NotificationsCreateTypeSelector.vue b/apps/web/src/services/alert-manager/v2/components/NotificationsCreateTypeSelector.vue
index 820a0c2e57..f8f1dc6909 100644
--- a/apps/web/src/services/alert-manager/v2/components/NotificationsCreateTypeSelector.vue
+++ b/apps/web/src/services/alert-manager/v2/components/NotificationsCreateTypeSelector.vue
@@ -1,37 +1,26 @@
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceCreateStep1.vue b/apps/web/src/services/alert-manager/v2/components/ServiceCreateStep1.vue
index 26969432f8..9060e6a1a8 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceCreateStep1.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceCreateStep1.vue
@@ -3,14 +3,16 @@ import {
computed, reactive, watch,
} from 'vue';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
+
import {
PFieldGroup, PTextInput, PTooltip, PI,
} from '@cloudforet/mirinae';
-import type { ServiceCreateParameters } from '@/schema/alert-manager/service/api-verbs/create';
-import type { ServiceModel } from '@/schema/alert-manager/service/model';
-import type { MembersType } from '@/schema/alert-manager/service/type';
+import { useServiceApi } from '@/api-clients/alert-manager/service/composables/use-service-api';
+import type { ServiceCreateParameters } from '@/api-clients/alert-manager/service/schema/api-verbs/create';
+import type { MembersType } from '@/api-clients/alert-manager/service/schema/type';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import { i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
@@ -36,7 +38,6 @@ const storeState = reactive({
serviceListMap: computed(() => allReferenceGetters.service),
});
const state = reactive({
- loading: false,
isFocusedKey: false,
});
@@ -81,6 +82,22 @@ const {
},
});
+const queryClient = useQueryClient();
+const { serviceAPI } = useServiceApi();
+const { key: serviceListBaseQueryKey } = useServiceQueryKey('alert-manager', 'service', 'list');
+const { mutate: createService, isPending: createServiceLoading } = useMutation({
+ mutationFn: (params: ServiceCreateParameters) => serviceAPI.create(params),
+ onSuccess: (data) => {
+ queryClient.invalidateQueries({ queryKey: serviceListBaseQueryKey.value });
+ showSuccessMessage(i18n.t('ALERT_MANAGER.SERVICE.ALT_S_CREATE_SERVICE'), '');
+ serviceCreateFormStore.setCreatedService(data);
+ serviceCreateFormStore.setCurrentStep(2);
+ },
+ onError: (error) => {
+ ErrorHandler.handleError(error, true);
+ },
+});
+
const handleFormattedSelectedIds = (value: Record) => {
dropdownState.selectedMemberItems = value;
};
@@ -98,25 +115,15 @@ const handleChangeInput = (label: 'name'|'key'|'description', value?: string) =>
};
const handleCreateService = async () => {
- state.loading = true;
- try {
- const createdServiceInfo = await SpaceConnector.clientV2.alertManager.service.create({
- name: name.value,
- service_key: key.value,
- members: {
- USER: dropdownState.selectedMemberItems.USER,
- USER_GROUP: dropdownState.selectedMemberItems.USER_GROUP,
- },
- description: description.value,
- });
- showSuccessMessage(i18n.t('ALERT_MANAGER.SERVICE.ALT_S_CREATE_SERVICE'), '');
- serviceCreateFormStore.setCreatedService(createdServiceInfo);
- serviceCreateFormStore.setCurrentStep(2);
- } catch (e) {
- ErrorHandler.handleError(e, true);
- } finally {
- state.loading = false;
- }
+ createService({
+ name: name.value,
+ service_key: key.value,
+ members: {
+ USER: dropdownState.selectedMemberItems.USER,
+ USER_GROUP: dropdownState.selectedMemberItems.USER_GROUP,
+ },
+ description: description.value,
+ });
};
watch(() => state.isFocusedKey, (isFocusedKey) => {
@@ -129,7 +136,7 @@ watch(() => state.isFocusedKey, (isFocusedKey) => {
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceCreateStep2.vue b/apps/web/src/services/alert-manager/v2/components/ServiceCreateStep2.vue
index e741180c27..8017281255 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceCreateStep2.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceCreateStep2.vue
@@ -1,16 +1,8 @@
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsAlert.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsAlert.vue
index f4181746b2..f63d1db417 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsAlert.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsAlert.vue
@@ -2,6 +2,7 @@
import {
reactive, computed,
} from 'vue';
+import { useRoute } from 'vue-router/composables';
import {
PHeading,
@@ -13,17 +14,13 @@ import { usePageEditableStatus } from '@/common/composables/page-editable-status
import AlertCreateModal from '@/services/alert-manager/v2/components/AlertCreateModal.vue';
import AlertsManagementTable from '@/services/alert-manager/v2/components/AlertsManagementTable.vue';
-import { useServiceDetailPageStore } from '@/services/alert-manager/v2/stores/service-detail-page-store';
+const route = useRoute();
-const serviceDetailPageStore = useServiceDetailPageStore();
-const serviceDetailPageState = serviceDetailPageStore.state;
+const serviceId = computed(() => route.params.serviceId as string);
const { hasReadWriteAccess } = usePageEditableStatus();
-const storeState = reactive({
- serviceId: computed(() => serviceDetailPageState.serviceInfo?.service_id),
-});
const state = reactive({
modalVisible: false,
});
@@ -53,7 +50,7 @@ const handleCreateAlertModal = () => {
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotifications.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotifications.vue
index 48324091be..a5fd26423a 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotifications.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotifications.vue
@@ -1,11 +1,12 @@
{
height="1rem"
/>
- {{ getProtocolInfo(value, state.notificationProtocolList, item.data).name }}
+ {{ getProtocolInfo(value, notificationProtocolListData, item.data).name }}
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotificationsDetail.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotificationsDetail.vue
index a04687a0aa..c7f5853795 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotificationsDetail.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotificationsDetail.vue
@@ -1,21 +1,22 @@
@@ -212,12 +194,12 @@ watch(() => storeState.selectedNotificationId, async (selectedId) => {
height="1rem"
/>
- {{ getProtocolInfo(value).name }}
+ {{ getProtocolInfo(value, notificationProtocolListData).name }}
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotificationsTableModal.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotificationsTableModal.vue
index 936ed591cb..9c90b3ddfe 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotificationsTableModal.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotificationsTableModal.vue
@@ -2,16 +2,18 @@
import { computed, reactive } from 'vue';
import type { TranslateResult } from 'vue-i18n';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
+
import {
PTableCheckModal, PLazyImg, PStatus, PI,
} from '@cloudforet/mirinae';
-import type { ServiceChannelDisableParameters } from '@/schema/alert-manager/service-channel/api-verbs/disable';
-import type { ServiceChannelEnableParameters } from '@/schema/alert-manager/service-channel/api-verbs/enable';
-import { SERVICE_CHANNEL_FORWARD_TYPE } from '@/schema/alert-manager/service-channel/constants';
-import type { ServiceChannelModel } from '@/schema/alert-manager/service-channel/model';
-import { WEBHOOK_STATE } from '@/schema/alert-manager/webhook/constants';
+import { useServiceChannelApi } from '@/api-clients/alert-manager/service-channel/composables/use-service-channel-api';
+import type { ServiceChannelDisableParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/disable';
+import type { ServiceChannelEnableParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/enable';
+import type { ServiceChannelModel } from '@/api-clients/alert-manager/service-channel/schema/model';
+import { WEBHOOK_STATE } from '@/api-clients/alert-manager/webhook/schema/constants';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import { i18n } from '@/translations';
import { assetUrlConverter } from '@/lib/helper/asset-helper';
@@ -20,10 +22,9 @@ import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
import ErrorHandler from '@/common/composables/error/errorHandler';
import { useProxyValue } from '@/common/composables/proxy-state';
-import { alertManagerStateFormatter } from '@/services/alert-manager/v2/composables/refined-table-data';
+import { alertManagerStateFormatter, getProtocolInfo } from '@/services/alert-manager/v2/composables/refined-table-data';
+import { useNotificationProtocolListQuery } from '@/services/alert-manager/v2/composables/use-notification-protocol-list-query';
import { NOTIFICATION_MANAGEMENT_TABLE_FIELDS } from '@/services/alert-manager/v2/constants/notification-table-constant';
-import { useServiceDetailPageStore } from '@/services/alert-manager/v2/stores/service-detail-page-store';
-import type { ProtocolInfo, ProtocolCardItemType } from '@/services/alert-manager/v2/types/alert-manager-type';
interface Props {
selectedItem?: ServiceChannelModel;
@@ -34,19 +35,17 @@ const props = withDefaults(defineProps(), {
visible: false,
});
-const serviceDetailPageStore = useServiceDetailPageStore();
-const serviceDetailPageGetters = serviceDetailPageStore.getters;
+const queryClient = useQueryClient();
+const { notificationProtocolListData } = useNotificationProtocolListQuery();
+const { serviceChannelAPI } = useServiceChannelApi();
-const storeState = reactive({
- notificationProtocolList: computed(() => serviceDetailPageGetters.notificationProtocolList),
-});
+const { key: serviceChannelListBaseQueryKey } = useServiceQueryKey('alert-manager', 'service-channel', 'list');
const emit = defineEmits<{(e: 'close'): void;
(e: 'update:visible'): void
}>();
const state = reactive({
- loading: false,
headerTitle: computed(() => {
if (props.selectedItem?.state === WEBHOOK_STATE.ENABLED) {
return i18n.t('ALERT_MANAGER.NOTIFICATIONS.MODAL_DISABLE_TITLE');
@@ -56,46 +55,32 @@ const state = reactive({
proxyVisible: useProxyValue('visible', props, emit),
});
-const getProtocolInfo = (id: string): ProtocolInfo => {
- if (id === 'forward') {
- if (props.selectedItem?.data?.FORWARD_TYPE === SERVICE_CHANNEL_FORWARD_TYPE.ALL_MEMBER) {
- return { name: i18n.t('ALERT_MANAGER.NOTIFICATIONS.NOTIFY_TO_ALL_MEMBER') };
- }
- if (props.selectedItem?.data?.FORWARD_TYPE === SERVICE_CHANNEL_FORWARD_TYPE.USER_GROUP) {
- return { name: i18n.t('ALERT_MANAGER.NOTIFICATIONS.NOTIFY_TO_USER_GROUP') };
- }
- if (props.selectedItem?.data?.FORWARD_TYPE === SERVICE_CHANNEL_FORWARD_TYPE.USER) {
- return { name: i18n.t('ALERT_MANAGER.NOTIFICATIONS.NOTIFY_TO_USER') };
+const { mutate: serviceChannelChangeStatusMutate, isPending: changeStatusLoading } = useMutation({
+ mutationFn: (params: ServiceChannelDisableParameters | ServiceChannelEnableParameters) => {
+ if (props.selectedItem?.state === WEBHOOK_STATE.ENABLED) {
+ return serviceChannelAPI.disable(params);
}
- return { name: i18n.t('ALERT_MANAGER.NOTIFICATIONS.ASSOCIATED_MEMBER') };
- }
- const protocol = storeState.notificationProtocolList.find((item) => item.protocol_id === id);
- return {
- name: protocol?.name || '',
- icon: protocol?.icon || '',
- };
-};
-const handleConfirm = async () => {
- state.loading = true;
- try {
+ return serviceChannelAPI.enable(params);
+ },
+ onSuccess: () => {
if (props.selectedItem?.state === WEBHOOK_STATE.ENABLED) {
- await SpaceConnector.clientV2.alertManager.serviceChannel.disable({
- channel_id: props.selectedItem?.channel_id || '',
- });
showSuccessMessage(i18n.t('ALERT_MANAGER.NOTIFICATIONS.ALT_S_DISABLED'), '');
} else {
- await SpaceConnector.clientV2.alertManager.serviceChannel.enable({
- channel_id: props.selectedItem?.channel_id || '',
- });
showSuccessMessage(i18n.t('ALERT_MANAGER.NOTIFICATIONS.ALT_S_ENABLED'), '');
}
+ queryClient.invalidateQueries({ queryKey: serviceChannelListBaseQueryKey.value });
state.proxyVisible = false;
emit('close');
- } catch (e) {
- ErrorHandler.handleError(e, true);
- } finally {
- state.loading = false;
- }
+ },
+ onError: (error) => {
+ ErrorHandler.handleError(error, true);
+ },
+});
+
+const handleConfirm = () => {
+ serviceChannelChangeStatusMutate({
+ channel_id: props.selectedItem?.channel_id || '',
+ });
};
@@ -104,7 +89,7 @@ const handleConfirm = async () => {
:header-title="state.headerTitle"
:theme-color="props.selectedItem?.state === WEBHOOK_STATE.ENABLED ? 'alert' : 'primary'"
:fields="NOTIFICATION_MANAGEMENT_TABLE_FIELDS"
- :loading="state.loading"
+ :loading="changeStatusLoading"
:items="[props.selectedItem]"
modal-size="md"
@confirm="handleConfirm"
@@ -123,11 +108,11 @@ const handleConfirm = async () => {
height="1rem"
/>
- {{ getProtocolInfo(value).name }}
+ {{ getProtocolInfo(value, notificationProtocolListData).name }}
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotificationsUpdateModal.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotificationsUpdateModal.vue
index 6e784d9895..5d343a9450 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotificationsUpdateModal.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsNotificationsUpdateModal.vue
@@ -2,20 +2,23 @@
import {
computed, reactive, watch,
} from 'vue';
+import { useRoute } from 'vue-router/composables';
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
import { mapValues } from 'lodash';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import {
PButtonModal, PFieldGroup, PTextInput, PRadio, PRadioGroup, PPaneLayout, PLazyImg, PJsonSchemaForm, PI, PSelectDropdown, PTag,
} from '@cloudforet/mirinae';
import type { SelectDropdownMenuItem } from '@cloudforet/mirinae/types/controls/dropdown/select-dropdown/type';
import type { JsonSchema } from '@cloudforet/mirinae/types/controls/forms/json-schema-form/type';
-import type { ServiceChannelUpdateParameters } from '@/schema/alert-manager/service-channel/api-verbs/update';
-import { SERVICE_CHANNEL_FORWARD_TYPE, SERVICE_CHANNEL_TYPE } from '@/schema/alert-manager/service-channel/constants';
-import type { ServiceChannelModel } from '@/schema/alert-manager/service-channel/model';
-import type { MembersType } from '@/schema/alert-manager/service/type';
+import { useServiceChannelApi } from '@/api-clients/alert-manager/service-channel/composables/use-service-channel-api';
+import type { ServiceChannelUpdateParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/update';
+import { SERVICE_CHANNEL_FORWARD_TYPE, SERVICE_CHANNEL_TYPE } from '@/api-clients/alert-manager/service-channel/schema/constants';
+import type { ServiceChannelModel } from '@/api-clients/alert-manager/service-channel/schema/model';
+import type { MembersType } from '@/api-clients/alert-manager/service/schema/type';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import { i18n } from '@/translations';
import { assetUrlConverter } from '@/lib/helper/asset-helper';
@@ -28,8 +31,10 @@ import { useFormValidator } from '@/common/composables/form-validator';
import { useProxyValue } from '@/common/composables/proxy-state';
import UserSelectDropdown from '@/common/modules/user/UserSelectDropdown.vue';
+import { useNotificationProtocolListQuery } from '@/services/alert-manager/v2/composables/use-notification-protocol-list-query';
+import { useServiceGetQuery } from '@/services/alert-manager/v2/composables/use-service-get-query';
import { useServiceDetailPageStore } from '@/services/alert-manager/v2/stores/service-detail-page-store';
-import type { UserRadioType, ProtocolInfo, ProtocolCardItemType } from '@/services/alert-manager/v2/types/alert-manager-type';
+import type { UserRadioType, ProtocolInfo } from '@/services/alert-manager/v2/types/alert-manager-type';
interface Props {
selectedItem?: ServiceChannelModel;
@@ -40,20 +45,28 @@ const props = withDefaults(defineProps(), {
visible: false,
});
+const queryClient = useQueryClient();
const serviceDetailPageStore = useServiceDetailPageStore();
const serviceDetailPageGetters = serviceDetailPageStore.getters;
+const route = useRoute();
+const serviceId = computed(() => route.params.serviceId as string);
+
+const { notificationProtocolListData } = useNotificationProtocolListQuery();
+const { serviceChannelAPI } = useServiceChannelApi();
+const { serviceData } = useServiceGetQuery(serviceId);
+
+const { key: serviceChannelListBaseQueryKey } = useServiceQueryKey('alert-manager', 'service-channel', 'list');
+
const emit = defineEmits<{(e: 'close'): void;
(e: 'update:visible'): void
}>();
const storeState = reactive({
- serviceMember: computed>(() => serviceDetailPageGetters.serviceInfo?.members || []),
- notificationProtocolList: computed(() => serviceDetailPageGetters.notificationProtocolList),
+ serviceMember: computed|undefined>(() => serviceData.value?.members || undefined),
language: computed(() => serviceDetailPageGetters.language),
});
const state = reactive({
- loading: false,
proxyVisible: useProxyValue('visible', props, emit),
isForwardTypeProtocol: computed(() => props.selectedItem?.protocol_id?.toLowerCase().includes('forward') || false),
@@ -89,13 +102,26 @@ const state = reactive({
if (!name.value) return false;
return isAllValid && (state.isForwardTypeProtocol ? state.isMemberDataValid : true);
}),
- notificationChannelList: computed(() => storeState.notificationProtocolList.map((i) => ({
+ notificationChannelList: computed(() => notificationProtocolListData.value.map((i) => ({
name: i.protocol_id || '',
label: i.name,
}))),
selectedNotificationChannelIds: [],
});
+const { mutate: serviceChannelUpdateMutate, isPending: updateLoading } = useMutation({
+ mutationFn: (params: ServiceChannelUpdateParameters) => serviceChannelAPI.update(params),
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: serviceChannelListBaseQueryKey.value });
+ showSuccessMessage(i18n.t('ALERT_MANAGER.SERVICE.ALT_S_UPDATE_SERVICE'), '');
+ state.proxyVisible = false;
+ emit('close');
+ },
+ onError: (error) => {
+ ErrorHandler.handleError(error, true);
+ },
+});
+
const {
forms: {
name,
@@ -112,7 +138,8 @@ const {
},
});
-const getProtocolInfo = (id: string): ProtocolInfo => {
+const getProtocolInfo = (id?: string): ProtocolInfo => {
+ if (!id) return { name: '', icon: '' };
if (id === 'forward') {
if (props.selectedItem?.data?.FORWARD_TYPE === SERVICE_CHANNEL_FORWARD_TYPE.ALL_MEMBER) {
return { name: i18n.t('ALERT_MANAGER.NOTIFICATIONS.NOTIFY_TO_ALL_MEMBER') };
@@ -125,7 +152,7 @@ const getProtocolInfo = (id: string): ProtocolInfo => {
}
return { name: i18n.t('ALERT_MANAGER.NOTIFICATIONS.ASSOCIATED_MEMBER') };
}
- const protocol = storeState.notificationProtocolList.find((item) => item.protocol_id === id);
+ const protocol = notificationProtocolListData.value.find((item) => item.protocol_id === id);
const schema = protocol?.plugin_info?.metadata.data.schema || {};
const disabledProperties: Record = mapValues(schema.properties, (property) => ({
...property,
@@ -146,7 +173,8 @@ const handleTagDelete = (idx: number) => {
const handleFormattedSelectedIds = (value: Record) => {
state.selectedMemberItems = value;
};
-const handleChangeRadio = () => {
+const handleChangeRadio = (idx: number) => {
+ state.selectedRadioIdx = idx;
state.defaultMemberItems = [];
state.selectedMemberItems = {} as Record;
};
@@ -154,28 +182,18 @@ const handleScheduleForm = (form: ScheduleSettingFormType) => {
state.scheduleForm = form;
};
-const handleConfirm = async () => {
- state.loading = true;
- try {
- await SpaceConnector.clientV2.alertManager.serviceChannel.update({
- channel_id: props.selectedItem?.channel_id || '',
- name: name.value,
- schedule: state.scheduleForm,
- data: !state.isForwardTypeProtocol ? state.schemaForm : {
- FORWARD_TYPE: state.radioMenuList[state.selectedRadioIdx].name,
- USER_GROUP: state.selectedRadioIdx === 1 ? state.selectedMemberItems.USER_GROUP : undefined,
- USER: state.selectedRadioIdx === 2 ? state.selectedMemberItems.USER : undefined,
- PROTOCOL: state.selectedNotificationChannelIds?.map((item) => item.name),
- },
- });
- showSuccessMessage(i18n.t('ALERT_MANAGER.SERVICE.ALT_S_UPDATE_SERVICE'), '');
- state.proxyVisible = false;
- emit('close');
- } catch (e) {
- ErrorHandler.handleError(e, true);
- } finally {
- state.loading = false;
- }
+const handleConfirm = () => {
+ serviceChannelUpdateMutate({
+ channel_id: props.selectedItem?.channel_id || '',
+ name: name.value,
+ schedule: state.scheduleForm,
+ data: !state.isForwardTypeProtocol ? state.schemaForm : {
+ FORWARD_TYPE: state.radioMenuList[state.selectedRadioIdx].name,
+ USER_GROUP: state.selectedRadioIdx === 1 ? state.selectedMemberItems.USER_GROUP : undefined,
+ USER: state.selectedRadioIdx === 2 ? state.selectedMemberItems.USER : undefined,
+ PROTOCOL: state.selectedNotificationChannelIds?.map((item) => item.name),
+ },
+ });
};
watch(() => props.selectedItem, (selectedItem) => {
@@ -189,7 +207,7 @@ watch(() => props.selectedItem, (selectedItem) => {
}
state.selectedNotificationChannelIds = (props.selectedItem?.data.PROTOCOL || []).map((i) => ({
name: i,
- label: storeState.notificationProtocolList.find((item) => item.protocol_id === i)?.name || '',
+ label: notificationProtocolListData.value.find((item) => item.protocol_id === i)?.name || '',
}));
}
}, { immediate: true });
@@ -199,7 +217,7 @@ watch(() => props.selectedItem, (selectedItem) => {
@@ -210,17 +228,17 @@ watch(() => props.selectedItem, (selectedItem) => {
{{ $t('ALERT_MANAGER.NOTIFICATIONS.BASE_INFO_TITLE') }}
-
-
{{ getProtocolInfo(props.selectedItem.protocol_id).name }}
+
{{ getProtocolInfo(props.selectedItem?.protocol_id).name }}
props.selectedItem, (selectedItem) => {
@@ -285,7 +303,7 @@ watch(() => props.selectedItem, (selectedItem) => {
>
-
@@ -301,7 +319,7 @@ watch(() => props.selectedItem, (selectedItem) => {
@delete="handleTagDelete(idx)"
>
-
@@ -316,7 +334,7 @@ watch(() => props.selectedItem, (selectedItem) => {
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsOverviewEscalationPolicy.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsOverviewEscalationPolicy.vue
index 804b1ceea0..914c27d4ab 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsOverviewEscalationPolicy.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsOverviewEscalationPolicy.vue
@@ -1,24 +1,24 @@
@@ -86,13 +85,13 @@ watch(() => storeState.escalationPolicyId, (escalationPolicyId) => {
size="lg"
font-weight="regular"
/>
-
- {{ state.item.name }}
+ {{ escalationPolicyData?.name }}
import { useElementSize } from '@vueuse/core/index';
import {
- computed, reactive, ref, watch,
+ computed, reactive, ref,
} from 'vue';
+import { useRoute } from 'vue-router/composables';
import {
PFieldTitle, PIconButton, PLazyImg, PDivider, PTextButton, PDataLoader, PI,
} from '@cloudforet/mirinae';
-import { SERVICE_CHANNEL_TYPE } from '@/schema/alert-manager/service-channel/constants';
-import type { ServiceChannelModel } from '@/schema/alert-manager/service-channel/model';
+import { SERVICE_CHANNEL_TYPE } from '@/api-clients/alert-manager/service-channel/schema/constants';
import { assetUrlConverter } from '@/lib/helper/asset-helper';
-import ErrorHandler from '@/common/composables/error/errorHandler';
-
+import { getProtocolInfo } from '@/services/alert-manager/v2/composables/refined-table-data';
+import { useNotificationProtocolListQuery } from '@/services/alert-manager/v2/composables/use-notification-protocol-list-query';
+import { useServiceChannelListQuery } from '@/services/alert-manager/v2/composables/use-service-channel-list-query';
import { SERVICE_DETAIL_TABS } from '@/services/alert-manager/v2/constants/common-constant';
import { useServiceDetailPageStore } from '@/services/alert-manager/v2/stores/service-detail-page-store';
-import type { ProtocolCardItemType } from '@/services/alert-manager/v2/types/alert-manager-type';
const ITEM_DEFAULT_WIDTH = 120 + 8;
const DEFAULT_LEFT_PADDING = 16;
@@ -26,23 +26,23 @@ const rowItemsWrapperRef = ref
(null);
const itemEl = ref(null);
const serviceDetailPageStore = useServiceDetailPageStore();
-const serviceDetailPageState = serviceDetailPageStore.state;
-const serviceDetailPageGetters = serviceDetailPageStore.getters;
+
+const route = useRoute();
+const serviceId = computed(() => route.params.serviceId as string);
const { width: rowItemsWrapperWidth } = useElementSize(rowItemsWrapperRef);
-const storeState = reactive({
- serviceId: computed(() => serviceDetailPageGetters.serviceInfo.service_id),
- notificationProtocolList: computed(() => serviceDetailPageGetters.notificationProtocolList),
- serviceChannelList: computed(() => serviceDetailPageState.serviceChannelList.slice(0, 15)),
-});
+const { notificationProtocolListData } = useNotificationProtocolListQuery();
+
const state = reactive({
loading: true,
pageStart: 0,
visibleCount: computed(() => Math.floor((rowItemsWrapperWidth.value - DEFAULT_LEFT_PADDING) / ITEM_DEFAULT_WIDTH)),
- pageMax: computed(() => Math.max(storeState.serviceChannelList.length - state.visibleCount, 0)),
+ pageMax: computed(() => Math.max(serviceChannelListData.value.length - state.visibleCount, 0)),
});
+const { serviceChannelListData, serviceChannelListFetching } = useServiceChannelListQuery(serviceId);
+
const handleClickArrowButton = (increment: number) => {
const element = {
el: itemEl.value,
@@ -55,32 +55,10 @@ const handleClickArrowButton = (increment: number) => {
const marginLeft = increment * state.pageStart * element.defaultWidth;
element.el.style.marginLeft = increment === 1 ? `-${marginLeft}px` : `${marginLeft}px`;
};
-const getPluginIcon = (protocolId: string): string => {
- const notificationProtocol = storeState.notificationProtocolList.find((item) => item.protocol_id === protocolId);
- if (!notificationProtocol) return '';
-
- return assetUrlConverter(notificationProtocol?.icon || '');
-};
const handleRouteDetail = () => (
serviceDetailPageStore.setCurrentTab(SERVICE_DETAIL_TABS.NOTIFICATIONS)
);
-
-const fetchServiceChannelList = async (serviceId: string) => {
- state.loading = true;
- try {
- await serviceDetailPageStore.fetchServiceChannelList(serviceId);
- } catch (e) {
- ErrorHandler.handleError(e);
- } finally {
- state.loading = false;
- }
-};
-
-watch(() => storeState.serviceId, (serviceId) => {
- if (!serviceId) return;
- fetchServiceChannelList(serviceId);
-}, { immediate: true });
@@ -90,10 +68,10 @@ watch(() => storeState.serviceId, (serviceId) => {
size="lg"
font-weight="regular"
/>
-
storeState.serviceId, (serviceId) => {
-
@@ -112,7 +90,7 @@ watch(() => storeState.serviceId, (serviceId) => {
height="1.25rem"
/>
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsOverviewStatusTable.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsOverviewStatusTable.vue
index 450696c4bd..d7cab8437d 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsOverviewStatusTable.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsOverviewStatusTable.vue
@@ -1,9 +1,10 @@
@@ -233,17 +220,17 @@ watch(() => storeState.serviceInfo.service_id, (service_id) => {
import { useElementSize } from '@vueuse/core/index';
import {
- computed, reactive, ref, watch,
+ computed, reactive, ref,
} from 'vue';
+import { useRoute } from 'vue-router/composables';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import {
PFieldTitle, PIconButton, PLazyImg, PDivider, PTextButton, PDataLoader,
} from '@cloudforet/mirinae';
-import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { WebhookListParameters } from '@/schema/alert-manager/webhook/api-verbs/list';
-import type { WebhookModel } from '@/schema/alert-manager/webhook/model';
+import type { WebhookModel } from '@/api-clients/alert-manager/webhook/schema/model';
import type { PluginReferenceMap } from '@/store/reference/plugin-reference-store';
-import ErrorHandler from '@/common/composables/error/errorHandler';
-
+import { useWebhookListQuery } from '@/services/alert-manager/v2/composables/use-webhook-list-query';
import { SERVICE_DETAIL_TABS } from '@/services/alert-manager/v2/constants/common-constant';
import { useServiceDetailPageStore } from '@/services/alert-manager/v2/stores/service-detail-page-store';
@@ -29,16 +26,17 @@ const itemEl = ref(null);
const serviceDetailPageStore = useServiceDetailPageStore();
const serviceDetailPageGetters = serviceDetailPageStore.getters;
+const route = useRoute();
+const serviceId = computed(() => route.params.serviceId as string);
+
const { width: rowItemsWrapperWidth } = useElementSize(rowItemsWrapperRef);
const storeState = reactive({
plugins: computed(() => serviceDetailPageGetters.pluginsReferenceMap),
- serviceId: computed(() => serviceDetailPageGetters.serviceInfo.service_id),
});
const state = reactive({
- loading: true,
pageStart: 0,
- items: [] as WebhookModel[],
+ items: computed(() => webhookListData.value.slice(0, 15)),
visibleCount: computed(() => Math.floor((rowItemsWrapperWidth.value - DEFAULT_LEFT_PADDING) / ITEM_DEFAULT_WIDTH)),
pageMax: computed(() => Math.max(state.items.length - state.visibleCount, 0)),
});
@@ -63,28 +61,7 @@ const handleClickWebhookItem = (id: string) => {
serviceDetailPageStore.setSelectedWebhookId(id);
};
-const fetchWebhookList = async () => {
- state.loading = true;
- try {
- const { results } = await SpaceConnector.clientV2.alertManager.webhook.list>({
- service_id: storeState.serviceId,
- query: {
- sort: [{ key: 'created_at', desc: true }],
- },
- });
- state.items = (results || []).slice(0, 15);
- } catch (e) {
- ErrorHandler.handleError(e);
- state.items = [];
- } finally {
- state.loading = false;
- }
-};
-
-watch(() => storeState.serviceId, (serviceId) => {
- if (!serviceId) return;
- fetchWebhookList();
-}, { immediate: true });
+const { webhookListData, webhookListFetching } = useWebhookListQuery(serviceId);
@@ -98,7 +75,7 @@ watch(() => storeState.serviceId, (serviceId) => {
class="row-items-wrapper"
:class="{'empty': !state.items.length}"
>
-
(() => route.params.serviceId as string);
+
+const { eventRuleListData } = useEventRuleListQuery(serviceId);
+const { serviceData } = useServiceGetQuery(serviceId);
-const storeState = reactive({
- serviceInfo: computed(() => serviceDetailPageGetters.serviceInfo),
-});
const state = reactive({
selectModalVisible: false,
modalType: undefined as ServiceDetailSettingCardType|undefined,
@@ -63,8 +65,8 @@ const state = reactive({
type: SERVICE_SETTING_CARD.EVENT_RULE,
},
]),
- notificationPolicy: computed(() => storeState.serviceInfo.options.notification_urgency),
- autoRecovery: computed(() => storeState.serviceInfo.options.recovery_mode),
+ notificationPolicy: computed(() => serviceData.value?.options?.notification_urgency || NOTIFICATION_URGENCY.ALL),
+ autoRecovery: computed(() => serviceData.value?.options?.recovery_mode || RECOVERY_MODE.MANUAL),
});
const getCardValueInfo = (type: ServiceDetailSettingCardType): CardValueInfoType|undefined => {
@@ -155,7 +157,7 @@ onMounted(() => {
height="1rem"
width="1rem"
/>
- {{ storeState.serviceInfo.rules }}
+ {{ eventRuleListData?.length ?? 0 }}
{{ getCardValueInfo(item.type).text }}
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsContainer.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsContainer.vue
index e2ff3ce8eb..75073044bf 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsContainer.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsContainer.vue
@@ -1,6 +1,6 @@
@@ -55,7 +64,7 @@ const handleConfirm = async () => {
(() => route.params.serviceId as string);
+
const emit = defineEmits<{(event: 'update:selected-ids', value: string[]): void;
}>();
-const serviceDetailPageStore = useServiceDetailPageStore();
-const serviceDetailPageGetters = serviceDetailPageStore.getters;
+const { notificationProtocolListData } = useNotificationProtocolListQuery();
+const { serviceChannelListData } = useServiceChannelListQuery(serviceId);
-const storeState = reactive({
- serviceId: computed(() => serviceDetailPageGetters.serviceInfo.service_id),
- notificationProtocolList: computed(() => serviceDetailPageGetters.notificationProtocolList),
-});
const state = reactive({
loading: false,
- serviceChannelList: [] as ServiceChannelModel[],
- serviceChannelDropdownList: computed(() => state.serviceChannelList.map((item) => ({
+ serviceChannelDropdownList: computed(() => serviceChannelListData.value.map((item) => ({
name: item.channel_id,
label: item.name,
})).sort((a, b) => a.label.localeCompare(b.label))),
@@ -59,17 +47,17 @@ const state = reactive({
});
const getProtocolInfo = (id: string): ProtocolInfo => {
- const channel = state.serviceChannelList.find((item) => item.channel_id === id);
- const protocol = storeState.notificationProtocolList.find((item) => item.protocol_id === channel.protocol_id);
+ const channel = serviceChannelListData.value.find((item) => item.channel_id === id);
+ const protocol = notificationProtocolListData.value.find((item) => item.protocol_id === channel?.protocol_id);
return {
name: channel?.name || '',
- icon: channel.channel_type === SERVICE_CHANNEL_TYPE.FORWARD ? '' : protocol?.icon || '',
+ icon: channel?.channel_type === SERVICE_CHANNEL_TYPE.FORWARD ? '' : protocol?.icon || '',
};
};
const menuItemsHandler = (): AutocompleteHandler => async (keyword: string, pageStart = 1, pageLimit = 10) => {
const _totalCount = pageStart - 1 + pageLimit;
- const filterItems = (items: DropdownItem[]): DropdownItem[] => items.filter((item) => getTextHighlightRegex(keyword).test(item.name)).slice(pageStart - 1, _totalCount);
+ const filterItems = (items: SelectDropdownMenuItem[]): SelectDropdownMenuItem[] => items.filter((item) => getTextHighlightRegex(keyword).test(item.name)).slice(pageStart - 1, _totalCount);
const _slicedItems = filterItems(state.serviceChannelDropdownList);
return {
@@ -80,9 +68,9 @@ const menuItemsHandler = (): AutocompleteHandler => async (keyword: string, page
const currentChannelIds = computed(() => state.selectedItems.map((item) => item.name));
-const handleUpdateSelectedUserItems = (selectedUsers: SelectDropdownMenuItem[]) => {
- if (isEqual(selectedUsers, state.selectedItems)) return;
- state.selectedItems = selectedUsers;
+const handleUpdateSelectedUserItems = (selected: SelectDropdownMenuItem[]) => {
+ if (isEqual(selected, state.selectedItems)) return;
+ state.selectedItems = selected;
if (isEqual(currentChannelIds.value, props.selectedIds)) return;
emit('update:selected-ids', currentChannelIds.value);
};
@@ -93,35 +81,19 @@ const handleTagDelete = (idx: number) => {
const initMultipleType = (_channelIds?: string[]) => {
if (!Array.isArray(_channelIds)) return;
state.selectedItems = _channelIds.map((channelId) => {
- const channel = state.serviceChannelList.find((item) => item.name === channelId);
+ const channel = serviceChannelListData.value.find((item) => item.name === channelId);
return {
name: channelId,
- label: channel?.label ?? channelId,
+ label: channel?.name || channelId,
};
});
};
-const fetchServiceChannelList = async () => {
- try {
- const { results } = await SpaceConnector.clientV2.alertManager.serviceChannel.list>({
- service_id: storeState.serviceId,
- });
- state.serviceChannelList = results || [];
- } catch (e) {
- ErrorHandler.handleError(e);
- state.serviceChannelList = [];
- }
-};
-
-watch([() => props.selectedIds, () => state.serviceChannelList], async ([selectedIds, serviceChannelList]) => {
+watch([() => props.selectedIds, () => serviceChannelListData.value], async ([selectedIds, serviceChannelList]) => {
if (serviceChannelList.length > 0 && selectedIds) {
await initMultipleType(selectedIds);
}
}, { immediate: true });
-watch(() => storeState.serviceId, async (serviceId) => {
- if (!serviceId) return;
- await fetchServiceChannelList();
-}, { immediate: true });
@@ -130,7 +102,7 @@ watch(() => storeState.serviceId, async (serviceId) => {
:selected="state.selectedItems"
:handler="menuItemsHandler()"
is-filterable
- page-size="10"
+ :page-size="10"
use-fixed-menu-style
show-delete-all-button
multi-selectable
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEscalationPolicyFormModal.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEscalationPolicyFormModal.vue
index e0532cdc1c..4673aef932 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEscalationPolicyFormModal.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEscalationPolicyFormModal.vue
@@ -3,18 +3,22 @@ import {
computed, reactive, watch,
} from 'vue';
import type { TranslateResult } from 'vue-i18n';
+import { useRoute } from 'vue-router/composables';
+
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import {
PButtonModal, PTextInput, PRadio, PFieldGroup, PRadioGroup, PTextButton,
} from '@cloudforet/mirinae';
-import { ALERT_STATUS } from '@/schema/alert-manager/alert/constants';
-import type { EscalationPolicyCreateParameters } from '@/schema/alert-manager/escalation-policy/api-verbs/create';
-import type { EscalationPolicyUpdateParameters } from '@/schema/alert-manager/escalation-policy/api-verbs/update';
-import { ESCALATION_POLICY_STATE } from '@/schema/alert-manager/escalation-policy/constants';
-import type { EscalationPolicyModel } from '@/schema/alert-manager/escalation-policy/model';
-import type { EscalationPolicyRulesType } from '@/schema/alert-manager/escalation-policy/type';
+import { ALERT_STATUS } from '@/api-clients/alert-manager/alert/schema/constants';
+import { useEscalationPolicyApi } from '@/api-clients/alert-manager/escalation-policy/composables/use-escalation-policy-api';
+import type { EscalationPolicyCreateParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/create';
+import type { EscalationPolicyUpdateParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/update';
+import { ESCALATION_POLICY_STATE } from '@/api-clients/alert-manager/escalation-policy/schema/constants';
+import type { EscalationPolicyModel } from '@/api-clients/alert-manager/escalation-policy/schema/model';
+import type { EscalationPolicyRulesType } from '@/api-clients/alert-manager/escalation-policy/schema/type';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import { i18n } from '@/translations';
import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
@@ -41,17 +45,15 @@ const props = withDefaults(defineProps(), {
});
const serviceDetailPageStore = useServiceDetailPageStore();
-const serviceDetailPageGetters = serviceDetailPageStore.getters;
+
+const route = useRoute();
+const serviceId = computed(() => route.params.serviceId as string);
const emit = defineEmits<{(e: 'update:visible'): void;
(e: 'close'): void;
}>();
-const storeState = reactive({
- serviceId: computed(() => serviceDetailPageGetters.serviceInfo.service_id),
-});
const state = reactive({
- loading: false,
proxyVisible: useProxyValue('visible', props, emit),
headerTitle: computed(() => {
if (props.type === 'CREATE') return i18n.t('ALERT_MANAGER.ESCALATION_POLICY.MODAL_CREATE_TITLE');
@@ -93,6 +95,32 @@ const {
},
});
+const queryClient = useQueryClient();
+const { escalationPolicyAPI } = useEscalationPolicyApi();
+const { key: escalationPolicyLisBaseQueryKey } = useServiceQueryKey('alert-manager', 'escalation-policy', 'list');
+
+const { mutate: escalationPolicyMutation, isPending: escalationPolicyMutationPending } = useMutation({
+ mutationFn: (params: Partial) => {
+ if (props.type === 'CREATE') {
+ return escalationPolicyAPI.create(params as EscalationPolicyCreateParameters);
+ }
+ return escalationPolicyAPI.update(params as EscalationPolicyUpdateParameters);
+ },
+ onSuccess: async () => {
+ queryClient.invalidateQueries({ queryKey: escalationPolicyLisBaseQueryKey.value });
+ if (props.type === 'CREATE') {
+ showSuccessMessage(i18n.t('ALERT_MANAGER.ESCALATION_POLICY.ALT_S_CREATE_POLICY'), '');
+ } else {
+ showSuccessMessage(i18n.t('ALERT_MANAGER.ESCALATION_POLICY.ALT_S_UPDATE_POLICY'), '');
+ }
+ handleClose();
+ emit('close');
+ },
+ onError: (error) => {
+ ErrorHandler.handleError(error, true);
+ },
+});
+
const handleClose = () => {
state.proxyVisible = false;
};
@@ -100,38 +128,24 @@ const handleRouteDetail = () => {
serviceDetailPageStore.setCurrentTab(SERVICE_DETAIL_TABS.NOTIFICATIONS);
handleClose();
};
+
const handleClickConfirm = async () => {
- state.loading = true;
- try {
- const params = {
- name: name.value,
- rules: state.rules,
- repeat: {
- state: ESCALATION_POLICY_STATE.DISABLED,
- count: state.repeatCount,
- },
- finish_condition: state.radioMenuList[state.selectedRadioIdx].name,
- };
- if (props.type === 'CREATE') {
- await SpaceConnector.clientV2.alertManager.escalationPolicy.create({
- service_id: storeState.serviceId,
- ...params,
- });
- showSuccessMessage(i18n.t('ALERT_MANAGER.ESCALATION_POLICY.ALT_S_CREATE_POLICY'), '');
- } else {
- await SpaceConnector.clientV2.alertManager.escalationPolicy.update({
- escalation_policy_id: props.selectedItem?.escalation_policy_id || '',
- ...params,
- });
- showSuccessMessage(i18n.t('ALERT_MANAGER.ESCALATION_POLICY.ALT_S_UPDATE_POLICY'), '');
- }
- handleClose();
- emit('close');
- } catch (e) {
- ErrorHandler.handleError(e, true);
- } finally {
- state.loading = false;
+ const params: Partial = {
+ name: name.value,
+ rules: state.rules,
+ repeat: {
+ state: ESCALATION_POLICY_STATE.DISABLED,
+ count: state.repeatCount,
+ },
+ finish_condition: state.radioMenuList[state.selectedRadioIdx].name,
+ };
+ if (props.type === 'CREATE') {
+ params.service_id = serviceId.value;
+ } else {
+ params.escalation_policy_id = props.selectedItem?.escalation_policy_id || '';
}
+
+ escalationPolicyMutation(params);
};
watch(() => props.type, (type) => {
@@ -148,7 +162,7 @@ watch(() => props.type, (type) => {
:header-title="state.headerTitle"
:fade="true"
:backdrop="true"
- :loading="state.loading"
+ :loading="escalationPolicyMutationPending"
:visible.sync="state.proxyVisible"
:disabled="!state.isModalValid"
@confirm="handleClickConfirm"
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEscalationPolicyStateModal.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEscalationPolicyStateModal.vue
index 34b31e14b7..4cd5086069 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEscalationPolicyStateModal.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEscalationPolicyStateModal.vue
@@ -2,24 +2,19 @@
import {
computed, reactive,
} from 'vue';
+import { useRoute } from 'vue-router/composables';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import {
PButtonModal, PDefinitionTable,
} from '@cloudforet/mirinae';
import { iso8601Formatter } from '@cloudforet/utils';
-import type { EscalationPolicyModel } from '@/schema/alert-manager/escalation-policy/model';
-import type { EscalationPolicyRulesType } from '@/schema/alert-manager/escalation-policy/type';
-import type { ServiceUpdateParameters } from '@/schema/alert-manager/service/api-verbs/update';
-import type { ServiceModel } from '@/schema/alert-manager/service/model';
-import { i18n } from '@/translations';
+import type { EscalationPolicyModel } from '@/api-clients/alert-manager/escalation-policy/schema/model';
+import type { EscalationPolicyRulesType } from '@/api-clients/alert-manager/escalation-policy/schema/type';
-import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
-
-import ErrorHandler from '@/common/composables/error/errorHandler';
import { useProxyValue } from '@/common/composables/proxy-state';
+import { useServiceUpdateMutation } from '@/services/alert-manager/v2/composables/use-service-update-mutation';
import {
ESCALATION_POLICY_MANAGEMENT_TABLE_FIELDS,
} from '@/services/alert-manager/v2/constants/escalation-policy-table-constant';
@@ -35,42 +30,40 @@ const props = withDefaults(defineProps(), {
});
const serviceDetailPageStore = useServiceDetailPageStore();
-const serviceDetailPageState = serviceDetailPageStore.state;
const serviceDetailPageGetters = serviceDetailPageStore.getters;
+const route = useRoute();
+const serviceId = computed(() => route.params.serviceId as string);
+
const emit = defineEmits<{(e: 'update:visible'): void;
(e: 'close'): void;
}>();
const storeState = reactive({
timezone: computed(() => serviceDetailPageGetters.timezone),
- serviceId: computed(() => serviceDetailPageState.serviceInfo.service_id),
});
const state = reactive({
- loading: false,
proxyVisible: useProxyValue('visible', props, emit),
});
+
+const { mutate: updateService, isPending: updateServiceLoading } = useServiceUpdateMutation({
+ onSuccess: async () => {
+ state.proxyVisible = false;
+ emit('close');
+ },
+});
+
const getConnectChannelCount = (rules: EscalationPolicyRulesType[]): number => {
const allChannels = rules.flatMap((item) => item.channels);
const uniqueChannels = new Set(allChannels);
return uniqueChannels.size;
};
+
const handleConfirm = async () => {
- state.loading = true;
- try {
- await SpaceConnector.clientV2.alertManager.service.update({
- escalation_policy_id: props.selectedItem.escalation_policy_id,
- service_id: storeState.serviceId,
- });
- showSuccessMessage(i18n.t('ALERT_MANAGER.SERVICE.ALT_S_UPDATE_SERVICE'), '');
- await serviceDetailPageStore.fetchServiceDetailData(storeState.serviceId);
- state.proxyVisible = false;
- emit('close');
- } catch (e) {
- ErrorHandler.handleError(e, true);
- } finally {
- state.loading = false;
- }
+ updateService({
+ escalation_policy_id: props.selectedItem.escalation_policy_id,
+ service_id: serviceId.value,
+ });
};
@@ -78,7 +71,7 @@ const handleConfirm = async () => {
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRule.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRule.vue
index af44c5f31e..ebedd73b98 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRule.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRule.vue
@@ -1,13 +1,13 @@
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionAsset.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionAsset.vue
index 0f3b04cc15..eb866eb182 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionAsset.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionAsset.vue
@@ -14,10 +14,9 @@ import {
PButton,
} from '@cloudforet/mirinae';
-import type { EventRuleModel } from '@/schema/alert-manager/event-rule/model';
import type {
EventRuleActionsType,
-} from '@/schema/alert-manager/event-rule/type';
+} from '@/api-clients/alert-manager/event-rule/schema/type';
import { i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
@@ -29,6 +28,7 @@ import type { DataSelectorItem } from '@/common/components/select/type';
import { gray } from '@/styles/colors';
+import { useEventRuleGetQuery } from '@/services/alert-manager/v2/composables/use-event-rule-get-query';
import { useServiceDetailPageStore } from '@/services/alert-manager/v2/stores/service-detail-page-store';
import type {
EventRuleActionsToggleType,
@@ -44,11 +44,12 @@ const { width } = useWindowSize();
const emit = defineEmits<{(e: 'change-form', form: EventRuleActionsType): void}>();
+const { eventRuleData } = useEventRuleGetQuery();
+
const storeState = reactive({
cloudServiceType: computed(() => allReferenceGetters.cloudServiceType),
provider: computed(() => allReferenceGetters.provider),
isEventRuleEditMode: computed(() => serviceDetailPageState.isEventRuleEditMode),
- eventRuleInfo: computed(() => serviceDetailPageState.eventRuleInfo),
});
const state = reactive({
isMobileSize: computed(() => width.value < screens.mobile.max),
@@ -96,7 +97,7 @@ const state = reactive({
});
const updateStateFromEventRuleInfo = (): void => {
- const actions = storeState.eventRuleInfo.actions;
+ const actions = eventRuleData.value?.actions;
if (!actions) return;
if (actions.match_asset) {
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionForm.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionForm.vue
index 92016eafae..fe0957695c 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionForm.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionForm.vue
@@ -3,7 +3,7 @@ import { reactive, watch } from 'vue';
import { isUndefined, omitBy } from 'lodash';
-import type { EventRuleActionsType } from '@/schema/alert-manager/event-rule/type';
+import type { EventRuleActionsType } from '@/api-clients/alert-manager/event-rule/schema/type';
import ServiceDetailTabsSettingsEventRuleActionAlert
from '@/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionAlert.vue';
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionService.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionService.vue
index e3336a9605..0ab535c04a 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionService.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsSettingsEventRuleActionService.vue
@@ -1,6 +1,7 @@
@@ -126,7 +115,7 @@ watch(() => props.type, (type) => {
:fade="true"
:backdrop="true"
:visible.sync="state.proxyVisible"
- :loading="state.loading"
+ :loading="updateServiceLoading"
@confirm="handleConfirm"
>
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhook.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhook.vue
index 2c6dd91674..85daa1136a 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhook.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhook.vue
@@ -2,10 +2,11 @@
import {
reactive, computed, watch, onUnmounted,
} from 'vue';
-import { useRouter } from 'vue-router/composables';
+import { useRoute, useRouter } from 'vue-router/composables';
+
+import { useQueryClient } from '@tanstack/vue-query';
import { makeDistinctValueHandler, makeEnumValueHandler } from '@cloudforet/core-lib/component-util/query-search';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import { ApiQueryHelper } from '@cloudforet/core-lib/space-connector/helper';
import {
PToolboxTable,
@@ -19,10 +20,9 @@ import {
import type { MenuItem } from '@cloudforet/mirinae/types/controls/context-menu/type';
import type { ValueHandlerMap } from '@cloudforet/mirinae/types/controls/search/query-search/type';
-import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { WebhookListParameters } from '@/schema/alert-manager/webhook/api-verbs/list';
-import { WEBHOOK_STATE } from '@/schema/alert-manager/webhook/constants';
-import type { WebhookModel } from '@/schema/alert-manager/webhook/model';
+import type { WebhookListParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/list';
+import { WEBHOOK_STATE } from '@/api-clients/alert-manager/webhook/schema/constants';
+import type { WebhookModel } from '@/api-clients/alert-manager/webhook/schema/model';
import { i18n as _i18n } from '@/translations';
import type { PluginReferenceMap } from '@/store/reference/plugin-reference-store';
@@ -30,7 +30,6 @@ import type { PluginReferenceMap } from '@/store/reference/plugin-reference-stor
import { FILE_NAME_PREFIX } from '@/lib/excel-export/constant';
import { downloadExcel } from '@/lib/helper/file-download-helper';
-import ErrorHandler from '@/common/composables/error/errorHandler';
import { usePageEditableStatus } from '@/common/composables/page-editable-status';
import { useQueryTags } from '@/common/composables/query-tags';
@@ -41,6 +40,8 @@ import ServiceDetailTabsWebhookTableModal
import ServiceDetailTabsWebhookUpdateModal
from '@/services/alert-manager/v2/components/ServiceDetailTabsWebhookUpdateModal.vue';
import { alertManagerStateFormatter } from '@/services/alert-manager/v2/composables/refined-table-data';
+import { useWebhookListPaginationQuery } from '@/services/alert-manager/v2/composables/use-webhook-list-pagination-query';
+import { useWebhookListQuery } from '@/services/alert-manager/v2/composables/use-webhook-list-query';
import { SERVICE_TAB_HEIGHT } from '@/services/alert-manager/v2/constants/common-constant';
import {
ALERT_EXCEL_FIELDS,
@@ -64,6 +65,8 @@ const serviceDetailPageState = serviceDetailPageStore.state;
const serviceDetailPageGetters = serviceDetailPageStore.getters;
const router = useRouter();
+const route = useRoute();
+const serviceId = computed(() => route.params.serviceId as string);
const { hasReadWriteAccess } = usePageEditableStatus();
@@ -97,41 +100,47 @@ const tableState = reactive({
])),
fields: WEBHOOK_MANAGEMENT_TABLE_FIELDS,
valueHandlerMap: computed(() => ({
- name: makeDistinctValueHandler('alert_manager.Webhook', 'name', 'string', [{ k: 'service_id', v: storeState.serviceId, o: 'eq' }]),
+ name: makeDistinctValueHandler('alert_manager.Webhook', 'name', 'string', [{ k: 'service_id', v: serviceId.value, o: 'eq' }]),
state: makeEnumValueHandler(WEBHOOK_STATE),
- 'plugin_info.plugin_id': makeDistinctValueHandler('alert_manager.Webhook', 'plugin_info.plugin_id', 'string', [{ k: 'service_id', v: storeState.serviceId, o: 'eq' }]),
+ 'plugin_info.plugin_id': makeDistinctValueHandler('alert_manager.Webhook', 'plugin_info.plugin_id', 'string', [{ k: 'service_id', v: serviceId.value, o: 'eq' }]),
})),
});
const storeState = reactive({
plugins: computed(() => serviceDetailPageGetters.pluginsReferenceMap),
timezone: computed(() => serviceDetailPageGetters.timezone),
- serviceId: computed(() => serviceDetailPageState.serviceInfo.service_id),
selectedWebhookId: computed(() => serviceDetailPageState.selectedWebhookId),
});
const state = reactive({
- loading: true,
items: [] as WebhookModel[],
- totalCount: 0,
selectIndex: undefined as number|undefined,
- selectedItem: computed(() => state.items[state.selectIndex]),
+ selectedItem: computed(() => webhookListData.value[state.selectIndex]),
});
const modalState = reactive({
visible: false,
type: undefined as WebhookModalType|undefined,
});
+const filterState = reactive({
+ thisPage: 1,
+ pageSize: 15,
+ sortKey: 'created_at',
+ sortDesc: true,
+});
-const webhookListApiQueryHelper = new ApiQueryHelper().setSort('created_at', true)
- .setPage(1, 15);
+const webhookListApiQueryHelper = new ApiQueryHelper();
const queryTagHelper = useQueryTags({ keyItemSets: WEBHOOK_MANAGEMENT_TABLE_KEY_ITEMS_SETS });
const { queryTags } = queryTagHelper;
+const queryClient = useQueryClient();
+const { webhookListQueryKey } = useWebhookListQuery(serviceId);
+
const handleCloseModal = () => {
state.selectIndex = undefined;
- fetchWebhookList();
+ queryClient.invalidateQueries({ queryKey: webhookListQueryKey.value });
+ refreshWebhookList();
serviceDetailPageStore.setSelectedWebhookId(undefined);
};
const initSelectedWebhook = () => {
- state.selectIndex = state.items.findIndex((item) => item.webhook_id === storeState.selectedWebhookId);
+ state.selectIndex = webhookListData.value?.findIndex((item) => item.webhook_id === storeState.selectedWebhookId);
};
const handleClickCreateButton = () => {
if (!hasReadWriteAccess) return;
@@ -144,17 +153,15 @@ const handleSelectDropdownItem = (name: WebhookModalType) => {
modalState.type = name;
};
const handleChangeToolbox = async (options: any = {}) => {
- if (options.sortBy !== undefined) webhookListApiQueryHelper.setSort(options.sortBy, options.sortDesc);
+ if (options.sortBy !== undefined) filterState.sortKey = options.sortBy;
+ if (options.sortDesc !== undefined) filterState.sortDesc = options.sortDesc;
if (options.queryTags !== undefined) queryTagHelper.setQueryTags(options.queryTags);
- if (options.pageStart !== undefined) webhookListApiQueryHelper.setPageStart(options.pageStart);
- if (options.pageLimit !== undefined) webhookListApiQueryHelper.setPageLimit(options.pageLimit);
- await fetchWebhookList();
};
const handleExportExcel = async () => {
await downloadExcel({
url: '/alert-manager/webhook/list',
param: {
- service_id: storeState.serviceId,
+ service_id: serviceId.value,
query: { ...webhookListApiQueryHelper.data, only: ALERT_EXCEL_FIELDS.map((d) => d.key) },
},
fields: ALERT_EXCEL_FIELDS,
@@ -165,35 +172,32 @@ const handleExportExcel = async () => {
const handleSelectTableRow = (item:number[]) => {
if (item.length === 0) return;
state.selectIndex = item[0];
- serviceDetailPageStore.setSelectedWebhookId(state.items[item[0]].webhook_id);
+ serviceDetailPageStore.setSelectedWebhookId(webhookListData.value[item[0]].webhook_id);
};
-const fetchWebhookList = async () => {
- state.loading = true;
- try {
+const {
+ data: webhookListData,
+ totalCount: webhookListTotalCount,
+ isLoading: webhookListLoading,
+ refresh: refreshWebhookList,
+} = useWebhookListPaginationQuery({
+ thisPage: computed(() => filterState.thisPage),
+ pageSize: computed(() => filterState.pageSize),
+ params: computed(() => {
webhookListApiQueryHelper.setFilters([
...queryTagHelper.filters.value,
]);
- const { results, total_count } = await SpaceConnector.clientV2.alertManager.webhook.list>({
- query: webhookListApiQueryHelper.data,
- service_id: storeState.serviceId,
- });
- state.items = results || [];
- state.totalCount = total_count || 0;
- } catch (e) {
- ErrorHandler.handleError(e);
- state.items = [];
- state.totalCount = 0;
- } finally {
- state.loading = false;
- }
-};
+ return {
+ query: {
+ ...webhookListApiQueryHelper.data,
+ sort: [{ key: filterState.sortKey, desc: filterState.sortDesc }],
+ },
+ service_id: serviceId.value,
+ };
+ }),
+});
-watch(() => storeState.serviceId, (id) => {
- if (!id) return;
- fetchWebhookList();
-}, { immediate: true });
-watch([() => storeState.selectedWebhookId, () => state.items], ([selectedWebhookId]) => {
+watch([() => storeState.selectedWebhookId, () => webhookListData.value], ([selectedWebhookId]) => {
if (!selectedWebhookId) return;
initSelectedWebhook();
}, { immediate: true });
@@ -212,9 +216,11 @@ onUnmounted(() => {
sortable
exportable
:multi-select="false"
- :loading="state.loading"
- :total-count="state.totalCount"
- :items="state.items"
+ :loading="webhookListLoading"
+ :total-count="webhookListTotalCount"
+ :this-page.sync="filterState.thisPage"
+ :page-size.sync="filterState.pageSize"
+ :items="webhookListData"
:fields="tableState.fields"
:select-index="[state.selectIndex]"
:query-tags="queryTags"
@@ -222,7 +228,7 @@ onUnmounted(() => {
:value-handler-map="tableState.valueHandlerMap"
:style="{height: `${props.tableHeight - SERVICE_TAB_HEIGHT}px`}"
@change="handleChangeToolbox"
- @refresh="handleChangeToolbox()"
+ @refresh="refreshWebhookList"
@export="handleExportExcel"
@select="handleSelectTableRow"
>
@@ -231,7 +237,7 @@ onUnmounted(() => {
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookDeleteModal.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookDeleteModal.vue
index 22e5992dbd..779031e176 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookDeleteModal.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookDeleteModal.vue
@@ -1,11 +1,13 @@
@@ -61,7 +64,7 @@ const handleConfirm = async () => {
:confirm-text="$t('ALERT_MANAGER.WEBHOOK.MODAL_DELETE_BUTTON')"
:visible.sync="state.proxyVisible"
:disabled="!state.isNameValid"
- :loading="state.loading"
+ :loading="deleteWebhookLoading"
@confirm="handleConfirm"
>
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookDetail.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookDetail.vue
index 9c8004c54f..e8afe6011b 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookDetail.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookDetail.vue
@@ -4,6 +4,7 @@ import {
computed, reactive, ref, watch,
} from 'vue';
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
import { isEmpty } from 'lodash';
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
@@ -16,11 +17,13 @@ import type { TabItem } from '@cloudforet/mirinae/types/navigation/tabs/tab/type
import { iso8601Formatter } from '@cloudforet/utils';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { WebhookGetParameters } from '@/schema/alert-manager/webhook/api-verbs/get';
-import type { WebhookListErrorSParameters } from '@/schema/alert-manager/webhook/api-verbs/list-errors';
-import type { WebhookUpdateMessageFormatParameters } from '@/schema/alert-manager/webhook/api-verbs/update-message-format';
-import type { WebhookModel, WebhookListErrorsModel } from '@/schema/alert-manager/webhook/model';
-import type { WebhookMessageFormatType } from '@/schema/alert-manager/webhook/type';
+import { useWebhookApi } from '@/api-clients/alert-manager/webhook/composables/use-webhook-api';
+import type { WebhookUpdateMessageFormatParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/update-message-format';
+import type { WebhookModel, WebhookListErrorsModel } from '@/api-clients/alert-manager/webhook/schema/model';
+import type { WebhookMessageFormatType } from '@/api-clients/alert-manager/webhook/schema/type';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useScopedPaginationQuery } from '@/query/pagination/use-scoped-pagination-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import type { PluginGetParameters } from '@/schema/repository/plugin/api-verbs/get';
import type { PluginModel } from '@/schema/repository/plugin/model';
import type { RepositoryListParameters } from '@/schema/repository/repository/api-verbs/list';
@@ -96,32 +99,74 @@ const tabState = reactive({
activeWebhookDetailTab: WEBHOOK_DETAIL_TABS.DETAIL as WebhookDetailTabsType,
});
const state = reactive({
- webhookInfo: {} as WebhookModel,
+ webhookInfo: computed(() => webhookDetailData.value || {} as WebhookModel),
rawDataModalVisible: false,
rawData: {} as Record,
selectedPlugin: {} as PluginModel,
- errorListLoading: false,
errorList: [] as WebhookListErrorsModel[],
- refinedErrorList: computed(() => state.errorList.map((i, idx) => ({
+ refinedErrorList: computed(() => (webhookErrorListData.value?.results || []).map((i, idx) => ({
number: idx + 1,
...i,
}))),
errorTotalCount: 0,
});
const messageState = reactive({
- loading: false,
formatList: [] as WebhookMessageFormatType[],
editFormVisible: false,
sortBy: 'created_at',
sortDesc: true,
formats: {},
+ pagination: {
+ thisPage: 1,
+ pageLimit: 15,
+ },
});
-const errorListApiQueryHelper = new ApiQueryHelper().setSort('created_at', true)
- .setPage(1, 15);
+const queryClient = useQueryClient();
+const { webhookAPI } = useWebhookApi();
+const { key: webhookDetailQueryKey, params: webhookDetailQueryParams } = useServiceQueryKey('alert-manager', 'webhook', 'get', {
+ params: computed(() => ({
+ webhook_id: storeState.selectedWebhookId || '',
+ })),
+});
+const { data: webhookDetailData } = useScopedQuery({
+ queryKey: webhookDetailQueryKey,
+ queryFn: async () => webhookAPI.get(webhookDetailQueryParams.value),
+ enabled: computed(() => !!storeState.selectedWebhookId),
+ gcTime: 1000 * 60 * 2,
+}, ['WORKSPACE']);
+
+const errorListApiQueryHelper = new ApiQueryHelper();
const queryTagHelper = useQueryTags({ keyItemSets: WEBHOOK_ERROR_TABLE_KEY_ITEM_SETS });
const { queryTags } = queryTagHelper;
+const { key: webhookErrorListQueryKey, params: webhookErrorListQueryParams } = useServiceQueryKey('alert-manager', 'webhook', 'list-errors', {
+ params: computed(() => {
+ errorListApiQueryHelper.setFilters([
+ ...queryTagHelper.filters.value,
+ ]);
+ return {
+ webhook_id: storeState.selectedWebhookId || '',
+ query: {
+ ...errorListApiQueryHelper.data,
+ sort: [{ key: messageState.sortBy, desc: messageState.sortDesc }],
+ },
+ };
+ }),
+ pagination: true,
+});
+const { data: webhookErrorListData, isLoading: webhookErrorListFetching, totalCount: webhookErrorListTotalCount } = useScopedPaginationQuery({
+ queryKey: webhookErrorListQueryKey,
+ queryFn: webhookAPI.listErrors,
+ params: webhookErrorListQueryParams,
+ gcTime: 1000 * 60 * 2,
+ enabled: true,
+}, {
+ thisPage: computed(() => messageState.pagination.thisPage),
+ pageSize: computed(() => messageState.pagination.pageLimit),
+ verb: 'list',
+}, ['WORKSPACE']);
+
const handleClickShowRawData = (item) => {
state.rawDataModalVisible = true;
state.rawData = item.raw_data;
@@ -135,25 +180,15 @@ const handleChangeMessageSort = (sortBy, sortDesc) => {
messageState.formatList = sortTableItems(messageState.formatList, sortBy, sortDesc);
};
const handleChange = async (options: any = {}) => {
- if (options.sortBy !== undefined) errorListApiQueryHelper.setSort(options.sortBy, options.sortDesc);
+ if (options.sortBy !== undefined) messageState.sortBy = options.sortBy;
+ if (options.sortDesc !== undefined) messageState.sortDesc = options.sortDesc;
if (options.queryTags !== undefined) queryTagHelper.setQueryTags(options.queryTags);
- if (options.pageStart !== undefined) errorListApiQueryHelper.setPageStart(options.pageStart);
- if (options.pageLimit !== undefined) errorListApiQueryHelper.setPageLimit(options.pageLimit);
- await fetchWebhookErrorList();
};
-const fetchWebhookDetail = async () => {
+const setWebhookDetail = () => {
if (!storeState.selectedWebhookId) return;
- try {
- state.webhookInfo = await SpaceConnector.clientV2.alertManager.webhook.get({
- webhook_id: storeState.selectedWebhookId,
- });
- messageState.formatList = state.webhookInfo.message_formats || [];
- messageState.formats = state.webhookInfo.message_formats?.map((i) => ({ [i.from]: i.to })).reduce((acc, cur) => ({ ...acc, ...cur }), {});
- } catch (e) {
- ErrorHandler.handleError(e);
- state.webhookInfo = {} as WebhookModel;
- }
+ messageState.formatList = state.webhookInfo.message_formats || [];
+ messageState.formats = state.webhookInfo.message_formats?.map((i) => ({ [i.from]: i.to })).reduce((acc, cur) => ({ ...acc, ...cur }), {});
};
const getRepositoryID = async () => {
const res = await SpaceConnector.clientV2.repository.repository.list>({
@@ -173,55 +208,37 @@ const fetchPluginInfo = async () => {
state.selectedPlugin = {} as PluginModel;
}
};
-const fetchWebhookErrorList = async () => {
- if (!storeState.selectedWebhookId) return;
- state.errorListLoading = true;
- try {
- errorListApiQueryHelper.setFilters([
- ...queryTagHelper.filters.value,
- ]);
- const { results, total_count } = await SpaceConnector.clientV2.alertManager.webhook.listErrors>({
- webhook_id: storeState.selectedWebhookId,
- query: errorListApiQueryHelper.data,
- });
- state.errorList = results || [];
- state.errorTotalCount = total_count || 0;
- } catch (e) {
- ErrorHandler.handleError(e);
- state.errorList = [];
- state.errorTotalCount = 0;
- } finally {
- state.errorListLoading = false;
- }
-};
-const fetchMessageUpdate = async (tags) => {
- messageState.loading = true;
- try {
- await SpaceConnector.clientV2.alertManager.webhook.updateMessageFormat({
- webhook_id: state.webhookInfo.webhook_id,
- message_formats: Object.entries(tags).map(([key, value]) => ({
- from: key,
- to: value,
- })) as WebhookMessageFormatType[],
- });
+
+const { mutateAsync: updateMessageFormat, isPending: updateMessageFormatLoading } = useMutation({
+ mutationFn: (params: WebhookUpdateMessageFormatParameters) => webhookAPI.updateMessageFormat(params),
+ onSuccess: async () => {
+ await queryClient.invalidateQueries({ queryKey: webhookDetailQueryKey.value });
await handleEditMessageFormat(false);
- await fetchWebhookDetail();
- } catch (e) {
- ErrorHandler.handleError(e, true);
- } finally {
- messageState.loading = false;
- }
+ },
+ onError: (error) => {
+ ErrorHandler.handleError(error, true);
+ },
+});
+const fetchMessageUpdate = (tags) => {
+ updateMessageFormat({
+ webhook_id: state.webhookInfo.webhook_id,
+ message_formats: Object.entries(tags).map(([key, value]) => ({
+ from: key,
+ to: value,
+ })) as WebhookMessageFormatType[],
+ });
};
+watch(() => webhookDetailData.value, () => {
+ setWebhookDetail();
+});
watch(() => tabState.activeWebhookDetailTab, (activeTab) => {
if (activeTab === WEBHOOK_DETAIL_TABS.ERROR) {
- fetchWebhookErrorList();
+ queryClient.invalidateQueries({ queryKey: webhookErrorListQueryKey.value });
}
});
watch(() => storeState.selectedWebhookId, async () => {
- await fetchWebhookDetail();
if (isEmpty(state.webhookInfo)) return;
- await fetchWebhookErrorList();
if (!state.webhookInfo.plugin_info?.plugin_id) return;
await fetchPluginInfo();
}, { immediate: true });
@@ -312,7 +329,7 @@ watch(() => storeState.selectedWebhookId, async () => {
@@ -324,13 +341,15 @@ watch(() => storeState.selectedWebhookId, async () => {
search-type="query"
sort-by="created_at"
:query-tags="queryTags"
- :loading="state.errorListLoading"
- :total-count="state.errorTotalCount"
+ :loading="webhookErrorListFetching"
+ :total-count="webhookErrorListTotalCount"
+ :this-page.sync="messageState.pagination.thisPage"
+ :page-size.sync="messageState.pagination.pageLimit"
:fields="tabState.webhookErrorTableFields"
:items="state.refinedErrorList"
class="w-full border-none"
@change="handleChange"
- @refresh="fetchWebhookErrorList"
+ @refresh="queryClient.invalidateQueries({ queryKey: webhookErrorListQueryKey.value })"
>
{{ iso8601Formatter(value, storeState.timezone) }}
@@ -391,7 +410,7 @@ watch(() => storeState.selectedWebhookId, async () => {
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookTableModal.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookTableModal.vue
index ab0852a839..9eb33e5b8a 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookTableModal.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookTableModal.vue
@@ -2,13 +2,15 @@
import { computed, reactive } from 'vue';
import type { TranslateResult } from 'vue-i18n';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+import { useMutation } from '@tanstack/vue-query';
+
import { PTableCheckModal, PLazyImg, PStatus } from '@cloudforet/mirinae';
-import type { WebhookDisableParameters } from '@/schema/alert-manager/webhook/api-verbs/disable';
-import type { WebhookEnableParameters } from '@/schema/alert-manager/webhook/api-verbs/enable';
-import { WEBHOOK_STATE } from '@/schema/alert-manager/webhook/constants';
-import type { WebhookModel } from '@/schema/alert-manager/webhook/model';
+import { useWebhookApi } from '@/api-clients/alert-manager/webhook/composables/use-webhook-api';
+import type { WebhookDisableParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/disable';
+import type { WebhookEnableParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/enable';
+import { WEBHOOK_STATE } from '@/api-clients/alert-manager/webhook/schema/constants';
+import type { WebhookModel } from '@/api-clients/alert-manager/webhook/schema/model';
import { i18n } from '@/translations';
import type { PluginReferenceMap } from '@/store/reference/plugin-reference-store';
@@ -43,7 +45,6 @@ const emit = defineEmits<{(e: 'close'): void;
}>();
const state = reactive({
- loading: false,
headerTitle: computed(() => {
if (props.selectedItem?.state === WEBHOOK_STATE.ENABLED) {
return i18n.t('ALERT_MANAGER.WEBHOOK.MODAL_DISABLE_TITLE');
@@ -53,27 +54,31 @@ const state = reactive({
proxyVisible: useProxyValue('visible', props, emit),
});
-const handleConfirm = async () => {
- state.loading = true;
- try {
+const { webhookAPI } = useWebhookApi();
+const { mutateAsync: webhookStatusMutation, isPending: webhookStatusLoading } = useMutation({
+ mutationFn: (params: WebhookDisableParameters|WebhookEnableParameters) => {
+ if (props.selectedItem?.state === WEBHOOK_STATE.ENABLED) {
+ return webhookAPI.disable(params);
+ }
+ return webhookAPI.enable(params);
+ },
+ onSuccess: () => {
if (props.selectedItem?.state === WEBHOOK_STATE.ENABLED) {
- await SpaceConnector.clientV2.alertManager.webhook.disable({
- webhook_id: props.selectedItem?.webhook_id || '',
- });
showSuccessMessage(i18n.t('ALERT_MANAGER.WEBHOOK.ALT_S_DISABLE_WEBHOOK'), '');
} else {
- await SpaceConnector.clientV2.alertManager.webhook.enable({
- webhook_id: props.selectedItem?.webhook_id || '',
- });
showSuccessMessage(i18n.t('ALERT_MANAGER.WEBHOOK.ALT_S_ENABLE_WEBHOOK'), '');
}
state.proxyVisible = false;
emit('close');
- } catch (e) {
- ErrorHandler.handleError(e, true);
- } finally {
- state.loading = false;
- }
+ },
+ onError: (error) => {
+ ErrorHandler.handleError(error, true);
+ },
+});
+const handleConfirm = async () => {
+ webhookStatusMutation({
+ webhook_id: props.selectedItem?.webhook_id || '',
+ });
};
@@ -82,7 +87,7 @@ const handleConfirm = async () => {
:header-title="state.headerTitle"
:theme-color="props.selectedItem?.state === WEBHOOK_STATE.ENABLED ? 'alert' : 'primary'"
:fields="WEBHOOK_MANAGEMENT_TABLE_FIELDS"
- :loading="state.loading"
+ :loading="webhookStatusLoading"
:items="[props.selectedItem]"
modal-size="md"
@confirm="handleConfirm"
diff --git a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookUpdateModal.vue b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookUpdateModal.vue
index 2e7d83d297..4b52c6787f 100644
--- a/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookUpdateModal.vue
+++ b/apps/web/src/services/alert-manager/v2/components/ServiceDetailTabsWebhookUpdateModal.vue
@@ -3,14 +3,16 @@ import {
computed, reactive,
} from 'vue';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+import { useMutation } from '@tanstack/vue-query';
+
import {
PButtonModal, PFieldGroup, PTextInput, PSelectDropdown, PLazyImg,
} from '@cloudforet/mirinae';
-import type { WebhookUpdateParameters } from '@/schema/alert-manager/webhook/api-verbs/update';
-import type { WebhookModel } from '@/schema/alert-manager/webhook/model';
+import { useWebhookApi } from '@/api-clients/alert-manager/webhook/composables/use-webhook-api';
+import type { WebhookUpdateParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/update';
+import type { WebhookModel } from '@/api-clients/alert-manager/webhook/schema/model';
import { i18n } from '@/translations';
import type { PluginItem, PluginReferenceMap } from '@/store/reference/plugin-reference-store';
@@ -43,7 +45,6 @@ const storeState = reactive({
plugins: computed(() => serviceDetailPageGetters.pluginsReferenceMap),
});
const state = reactive({
- loading: false,
proxyVisible: useProxyValue('visible', props, emit),
selectedPlugin: computed(() => storeState.plugins[props.selectedItem?.plugin_info.plugin_id || '']),
});
@@ -68,21 +69,23 @@ const {
},
});
-const handleConfirm = async () => {
- state.loading = true;
- try {
- await SpaceConnector.clientV2.alertManager.webhook.update({
- webhook_id: props.selectedItem?.webhook_id || '',
- name: name.value,
- });
+const { webhookAPI } = useWebhookApi();
+const { mutateAsync: updateWebhook, isPending: updateWebhookLoading } = useMutation({
+ mutationFn: (params: WebhookUpdateParameters) => webhookAPI.update(params),
+ onSuccess: () => {
showSuccessMessage(i18n.t('ALERT_MANAGER.WEBHOOK.ALT_S_UPDATE_WEBHOOK'), '');
state.proxyVisible = false;
emit('close');
- } catch (e) {
- ErrorHandler.handleError(e, true);
- } finally {
- state.loading = false;
- }
+ },
+ onError: (error) => {
+ ErrorHandler.handleError(error, true);
+ },
+});
+const handleConfirm = () => {
+ updateWebhook({
+ webhook_id: props.selectedItem?.webhook_id || '',
+ name: name.value,
+ });
};
@@ -90,7 +93,7 @@ const handleConfirm = async () => {
import {
- onMounted, reactive, watch, computed,
+ onMounted, watch, computed, onBeforeUnmount,
} from 'vue';
import {
useRoute, useRouter,
@@ -10,24 +10,21 @@ import { debounce } from 'lodash';
import { makeDistinctValueHandler } from '@cloudforet/core-lib/component-util/query-search';
import { QueryHelper } from '@cloudforet/core-lib/query';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+import type { ConsoleFilter } from '@cloudforet/core-lib/query/type';
import { ApiQueryHelper } from '@cloudforet/core-lib/space-connector/helper';
import {
PToolbox, PDataLoader, PEmpty, PButton, PPagination,
} from '@cloudforet/mirinae';
import type { ToolboxOptions } from '@cloudforet/mirinae/types/controls/toolbox/type';
-import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { ServiceListParameters } from '@/schema/alert-manager/service/api-verbs/list';
-import { SERVICE_HEALTHY_TYPE } from '@/schema/alert-manager/service/constants';
-import type { ServiceModel } from '@/schema/alert-manager/service/model';
+import { SERVICE_HEALTHY_TYPE } from '@/api-clients/alert-manager/service/schema/constants';
import { replaceUrlQuery } from '@/lib/router-query-string';
-import ErrorHandler from '@/common/composables/error/errorHandler';
import { usePageEditableStatus } from '@/common/composables/page-editable-status';
import ServiceListContent from '@/services/alert-manager/v2/components/ServiceListContent.vue';
+import { useServiceListPaginationQuery } from '@/services/alert-manager/v2/composables/use-service-list-pagination-query';
import { ALERT_MANAGER_ROUTE } from '@/services/alert-manager/v2/routes/route-constant';
import { useServiceListPageStore } from '@/services/alert-manager/v2/stores/service-list-page-store';
@@ -48,27 +45,87 @@ const SERVICE_SEARCH_HANDLER = {
},
};
-const state = reactive({
- loading: true,
- healthyLoading: true,
- totalCount: 0,
- healthyTotalCount: 0,
- alertServiceList: [] as ServiceModel[],
- healthyServiceList: [] as ServiceModel[],
-});
-
const serviceListPageStore = useServiceListPageStore();
const serviceListApiQueryHelper = new ApiQueryHelper().setSort('created_at', true);
const healthyServiceListApiQueryHelper = new ApiQueryHelper().setSort('created_at', true);
const searchQueryHelper = new QueryHelper();
+const currentSearchFilters = computed(() => serviceListPageStore.searchFilters);
+
const queryTags = computed(() => searchQueryHelper.setFilters(serviceListPageStore.searchFilters).queryTags);
+const {
+ data: unhealthyServiceList,
+ totalCount: unhealthyTotalCount,
+ isLoading: unhealthyLoading,
+ refresh: refreshUnhealthyList,
+} = useServiceListPaginationQuery({
+ thisPage: computed(() => serviceListPageStore.unhealthyThisPage),
+ pageSize: computed(() => serviceListPageStore.unhealthyPageSize),
+ params: computed(() => {
+ const isFullNameOnly = currentSearchFilters.value.length === 1
+ && currentSearchFilters.value[0].k === 'name'
+ && Array.isArray(currentSearchFilters.value[0].v)
+ && currentSearchFilters.value[0].v.length === 1
+ && typeof currentSearchFilters.value[0].v[0] === 'string'
+ && currentSearchFilters.value[0].v[0].length > 2;
+
+ const pageSize = serviceListPageStore.unhealthyPageSize;
+ const pageStart = isFullNameOnly ? 1 : ((Math.max(1, serviceListPageStore.unhealthyThisPage) - 1) * pageSize + 1);
+
+ serviceListApiQueryHelper
+ .setPage(pageStart, pageSize)
+ .setSort('created_at', true)
+ .setFilters([
+ ...currentSearchFilters.value,
+ { k: 'service_healthy', v: SERVICE_HEALTHY_TYPE.UNHEALTHY, o: '=' },
+ ]);
+
+ return {
+ query: serviceListApiQueryHelper.data,
+ details: true,
+ };
+ }),
+});
+
+const {
+ data: healthyServiceList,
+ totalCount: healthyTotalCount,
+ isLoading: healthyLoading,
+ refresh: refreshHealthyList,
+} = useServiceListPaginationQuery({
+ thisPage: computed(() => serviceListPageStore.healthyThisPage),
+ pageSize: computed(() => serviceListPageStore.healthyPageSize),
+ params: computed(() => {
+ const isFullNameOnly = currentSearchFilters.value.length === 1
+ && currentSearchFilters.value[0].k === 'name'
+ && Array.isArray(currentSearchFilters.value[0].v)
+ && currentSearchFilters.value[0].v.length === 1
+ && typeof currentSearchFilters.value[0].v[0] === 'string'
+ && currentSearchFilters.value[0].v[0].length > 2;
+
+ const pageSize = serviceListPageStore.healthyPageSize;
+ const pageStart = isFullNameOnly ? 1 : ((Math.max(1, serviceListPageStore.healthyThisPage) - 1) * pageSize + 1);
+
+ healthyServiceListApiQueryHelper
+ .setPage(pageStart, pageSize)
+ .setSort('created_at', true)
+ .setFilters([
+ ...currentSearchFilters.value,
+ { k: 'service_healthy', v: SERVICE_HEALTHY_TYPE.HEALTHY, o: '=' },
+ ]);
+
+ return {
+ query: healthyServiceListApiQueryHelper.data,
+ details: true,
+ };
+ }),
+});
+
const handleToolbox = async (options: ToolboxOptions = {}) => {
if (options.queryTags !== undefined) {
searchQueryHelper.setFiltersAsQueryTag(options.queryTags);
-
serviceListPageStore.$patch((_state) => {
_state.searchFilters = searchQueryHelper.filters;
});
@@ -93,88 +150,12 @@ const handleToolbox = async (options: ToolboxOptions = {}) => {
replaceUrlQuery(newQuery);
}
- await fetchBothLists();
-};
-
-const fetchBothLists = async () => {
await Promise.all([
- fetchServiceList(),
- fetchHealthyServiceList(),
+ refreshUnhealthyList(),
+ refreshHealthyList(),
]);
};
-const handleUnhealthyPageChange = async () => {
- await fetchServiceList();
-};
-
-const handleHealthyPageChange = async () => {
- await fetchHealthyServiceList();
-};
-
-const fetchServiceList = async () => {
- state.loading = true;
- try {
- const isFullNameOnly = searchQueryHelper.filters.length === 1
- && searchQueryHelper.filters[0].k === 'name'
- && Array.isArray(searchQueryHelper.filters[0].v)
- && searchQueryHelper.filters[0].v.length === 1
- && typeof searchQueryHelper.filters[0].v[0] === 'string'
- && searchQueryHelper.filters[0].v[0].length > 2;
-
- const pageSize = serviceListPageStore.unhealthyPageSize;
- const pageStart = isFullNameOnly ? 1 : ((Math.max(1, serviceListPageStore.unhealthyThisPage) - 1) * pageSize + 1);
-
- serviceListApiQueryHelper.setPage(pageStart, pageSize).setFilters([
- ...searchQueryHelper.filters,
- { k: 'service_healthy', v: SERVICE_HEALTHY_TYPE.UNHEALTHY, o: '=' },
- ]);
- const { results, total_count } = await SpaceConnector.clientV2.alertManager.service.list>({
- query: serviceListApiQueryHelper.data,
- details: true,
- });
- state.alertServiceList = results || [];
- state.totalCount = total_count || 0;
- } catch (e) {
- ErrorHandler.handleError(e);
- state.alertServiceList = [];
- state.totalCount = 0;
- } finally {
- state.loading = false;
- }
-};
-
-const fetchHealthyServiceList = async () => {
- state.healthyLoading = true;
- try {
- const isFullNameOnly = searchQueryHelper.filters.length === 1
- && searchQueryHelper.filters[0].k === 'name'
- && Array.isArray(searchQueryHelper.filters[0].v)
- && searchQueryHelper.filters[0].v.length === 1
- && typeof searchQueryHelper.filters[0].v[0] === 'string'
- && searchQueryHelper.filters[0].v[0].length > 2;
-
- const pageSize = serviceListPageStore.healthyPageSize;
- const pageStart = isFullNameOnly ? 1 : ((Math.max(1, serviceListPageStore.healthyThisPage) - 1) * pageSize + 1);
-
- healthyServiceListApiQueryHelper.setPage(pageStart, pageSize).setFilters([
- ...searchQueryHelper.filters,
- { k: 'service_healthy', v: SERVICE_HEALTHY_TYPE.HEALTHY, o: '=' },
- ]);
- const { results, total_count } = await SpaceConnector.clientV2.alertManager.service.list>({
- query: healthyServiceListApiQueryHelper.data,
- details: true,
- });
- state.healthyServiceList = results || [];
- state.healthyTotalCount = total_count || 0;
- } catch (e) {
- ErrorHandler.handleError(e);
- state.healthyServiceList = [];
- state.healthyTotalCount = 0;
- } finally {
- state.healthyLoading = false;
- }
-};
-
const handleClickCreateButton = () => {
router.push({
name: ALERT_MANAGER_ROUTE.SERVICE.CREATE._NAME,
@@ -212,9 +193,9 @@ const handleResize = debounce(async () => {
serviceListPageStore.setHealthyPageSize(newPageSize);
serviceListPageStore.setHealthyPage(newPage);
- fetchHealthyServiceList();
+ refreshHealthyList();
}
-}, 300);
+}, 100);
onMounted(async () => {
await handleResize();
@@ -251,7 +232,16 @@ onMounted(async () => {
serviceListPageStore.setHealthyPage(parsedHealthy);
}
- await fetchBothLists();
+ await Promise.all([
+ refreshUnhealthyList(),
+ refreshHealthyList(),
+ ]);
+});
+
+window.addEventListener('resize', handleResize);
+
+onBeforeUnmount(() => {
+ window.removeEventListener('resize', handleResize);
});
watch(() => serviceListPageStore.unhealthyThisPage, (val) => {
@@ -261,7 +251,7 @@ watch(() => serviceListPageStore.unhealthyThisPage, (val) => {
healthyPage: String(serviceListPageStore.healthyThisPage),
});
}
- handleUnhealthyPageChange();
+ refreshUnhealthyList();
});
watch(() => serviceListPageStore.healthyThisPage, (val) => {
@@ -271,7 +261,7 @@ watch(() => serviceListPageStore.healthyThisPage, (val) => {
healthyPage: String(val),
});
}
- handleHealthyPageChange();
+ refreshHealthyList();
});
watch(async () => route.query.serviceName, async (newServiceName: any) => {
@@ -296,7 +286,10 @@ watch(async () => route.query.serviceName, async (newServiceName: any) => {
searchQueryHelper.setFilters(splitNameFilters);
serviceListPageStore.setSearchFilters(searchQueryHelper.filters);
- await fetchBothLists();
+ await Promise.all([
+ refreshUnhealthyList(),
+ refreshHealthyList(),
+ ]);
} else if (!newServiceName) {
searchQueryHelper.setFiltersAsQueryTag([]);
serviceListPageStore.$patch((_state) => {
@@ -317,60 +310,60 @@ watch(async () => route.query.serviceName, async (newServiceName: any) => {
:key-item-sets="SERVICE_SEARCH_HANDLER.keyItemSets"
:value-handler-map="SERVICE_SEARCH_HANDLER.valueHandlerMap"
@change="handleToolbox"
- @refresh="fetchBothLists"
+ @refresh="handleToolbox"
/>
-
;
+}
+
+export const useAlertGetQuery = (alertId: string): UseAlertGetQueryReturn => {
+ const { alertAPI } = useAlertApi();
+
+ const { key: alertQueryKey, params: alertQueryParams } = useServiceQueryKey('alert-manager', 'alert', 'get', {
+ params: computed(() => ({
+ alert_id: alertId,
+ })),
+ });
+
+ const { data: alertData } = useScopedQuery({
+ queryKey: alertQueryKey,
+ queryFn: () => alertAPI.get(alertQueryParams.value),
+ gcTime: 1000 * 60 * 2,
+ staleTime: 1000 * 30,
+ }, ['WORKSPACE']);
+
+ return {
+ alertData,
+ };
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-alert-list-pagination-query.ts b/apps/web/src/services/alert-manager/v2/composables/use-alert-list-pagination-query.ts
new file mode 100644
index 0000000000..b4035deee7
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-alert-list-pagination-query.ts
@@ -0,0 +1,70 @@
+import type { ComputedRef } from 'vue';
+import { computed } from 'vue';
+
+
+import { useQueryClient } from '@tanstack/vue-query';
+
+import { iso8601Formatter } from '@cloudforet/utils';
+
+import { useAlertApi } from '@/api-clients/alert-manager/alert/composables/use-alert-api';
+import type { AlertListParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/list';
+import { ALERT_STATUS } from '@/api-clients/alert-manager/alert/schema/constants';
+import type { AlertModel } from '@/api-clients/alert-manager/alert/schema/model';
+import { useScopedPaginationQuery } from '@/query/pagination/use-scoped-pagination-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+
+import { useUserStore } from '@/store/user/user-store';
+
+import { calculateTime } from '@/services/iam/composables/refined-table-data';
+
+interface UseAlertListPaginationQueryOptions {
+ params: ComputedRef;
+ thisPage: ComputedRef;
+ pageSize: ComputedRef;
+}
+
+export const useAlertListPaginationQuery = ({ params, thisPage, pageSize }: UseAlertListPaginationQueryOptions) => {
+ const userStore = useUserStore();
+ const userState = userStore.state;
+ const queryClient = useQueryClient();
+
+ const { alertAPI } = useAlertApi();
+
+ const timezone = computed(() => userState.timezone || 'UTC');
+
+ const { key: alertListPaginationQueryKey, params: alertListPaginationQueryParams } = useServiceQueryKey('alert-manager', 'alert', 'list', {
+ params: computed(() => params.value),
+ pagination: true,
+ });
+
+ const query = useScopedPaginationQuery({
+ queryKey: alertListPaginationQueryKey,
+ queryFn: alertAPI.list,
+ params: alertListPaginationQueryParams,
+ gcTime: 1000 * 60 * 2,
+ enabled: true,
+ }, {
+ thisPage,
+ pageSize,
+ verb: 'list',
+ }, ['WORKSPACE']);
+
+
+ const refresh = async () => {
+ await queryClient.resetQueries({ queryKey: alertListPaginationQueryKey.value });
+ };
+
+ return {
+ data: computed(() => query.data.value?.results?.map((alert) => ({
+ ...alert,
+ duration: alert.status === ALERT_STATUS.RESOLVED
+ ? calculateTime(alert?.resolved_at, timezone.value)
+ : calculateTime(alert?.created_at, timezone.value),
+ created_at: iso8601Formatter(alert.created_at, timezone.value),
+ resolved_at: iso8601Formatter(alert.resolved_at, timezone.value) || '-',
+ })) || []),
+ totalCount: query.totalCount,
+ isLoading: query.isLoading,
+ refresh,
+ };
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-alert-list-query.ts b/apps/web/src/services/alert-manager/v2/composables/use-alert-list-query.ts
new file mode 100644
index 0000000000..baa4d0306e
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-alert-list-query.ts
@@ -0,0 +1,67 @@
+import type { ComputedRef, Ref } from 'vue';
+import { computed } from 'vue';
+
+import type { QueryKey } from '@tanstack/vue-query';
+
+import { iso8601Formatter } from '@cloudforet/utils';
+
+import { useAlertApi } from '@/api-clients/alert-manager/alert/composables/use-alert-api';
+import type { AlertListParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/list';
+import { ALERT_STATUS } from '@/api-clients/alert-manager/alert/schema/constants';
+import type { AlertModel } from '@/api-clients/alert-manager/alert/schema/model';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+
+import { useUserStore } from '@/store/user/user-store';
+
+import { calculateTime } from '@/services/iam/composables/refined-table-data';
+
+interface UseAlertListQueryReturn {
+ alertListData: Ref;
+ alertListTotalCount: Ref;
+ alertListFetching: Ref;
+ alertListQueryKey: Ref;
+}
+interface UseAlertListQueryOptions {
+ params: ComputedRef;
+}
+
+export const useAlertListQuery = ({ params }: UseAlertListQueryOptions): UseAlertListQueryReturn => {
+ const userStore = useUserStore();
+ const userState = userStore.state;
+
+ const { alertAPI } = useAlertApi();
+
+ const timezone = computed(() => userState.timezone || 'UTC');
+
+ const { key: alertListQueryKey, params: alertListQueryParams } = useServiceQueryKey('alert-manager', 'alert', 'list', {
+ params: computed(() => params.value),
+ });
+
+ const { data: queryData, isFetching: alertListFetching } = useScopedQuery({
+ queryKey: alertListQueryKey,
+ queryFn: async () => alertAPI.list(alertListQueryParams.value),
+ initialData: {
+ results: [],
+ total_count: 0,
+ },
+ gcTime: 1000 * 60 * 2,
+ }, ['WORKSPACE']);
+
+ const alertListData = computed(() => (queryData.value?.results ?? []).map((alert) => ({
+ ...alert,
+ duration: alert.status === ALERT_STATUS.RESOLVED
+ ? calculateTime(alert?.resolved_at, timezone.value)
+ : calculateTime(alert?.created_at, timezone.value),
+ created_at: iso8601Formatter(alert.created_at, timezone.value),
+ resolved_at: iso8601Formatter(alert.resolved_at, timezone.value) || '-',
+ })));
+ const alertListTotalCount = computed(() => queryData.value?.total_count ?? 0);
+
+ return {
+ alertListData,
+ alertListTotalCount,
+ alertListFetching,
+ alertListQueryKey,
+ };
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-alert-update-mutation.ts b/apps/web/src/services/alert-manager/v2/composables/use-alert-update-mutation.ts
new file mode 100644
index 0000000000..e1e98bebe6
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-alert-update-mutation.ts
@@ -0,0 +1,40 @@
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
+
+import { useAlertApi } from '@/api-clients/alert-manager/alert/composables/use-alert-api';
+import type { AlertUpdateParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/update';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+import { i18n } from '@/translations';
+
+import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
+
+import ErrorHandler from '@/common/composables/error/errorHandler';
+
+interface UseAlertUpdateMutationOptions {
+ onSuccess?: (data: unknown, variables: AlertUpdateParameters) => void|Promise;
+ onError?: (error: Error, variables: AlertUpdateParameters) => void|Promise;
+ onSettled?: (data: unknown|undefined, error: Error|null, variables: AlertUpdateParameters) => void|Promise;
+}
+
+export const useAlertUpdateMutation = (options?: UseAlertUpdateMutationOptions) => {
+ const { alertAPI } = useAlertApi();
+ const queryClient = useQueryClient();
+
+ const { withSuffix: alertQueryKey } = useServiceQueryKey('alert-manager', 'alert', 'get');
+
+ return useMutation({
+ mutationFn: (params: AlertUpdateParameters) => alertAPI.update(params),
+ onSuccess: async (data, variables) => {
+ const _alertId = { alert_id: variables.alert_id };
+ queryClient.invalidateQueries({ queryKey: alertQueryKey(_alertId) });
+ showSuccessMessage(i18n.t('ALERT_MANAGER.ALERTS.ALT_S_UPDATE'), '');
+ if (options?.onSuccess) await options.onSuccess(data, variables);
+ },
+ onError: (error, variables) => {
+ ErrorHandler.handleError(error, true);
+ if (options?.onError) options.onError(error, variables);
+ },
+ onSettled: (data, error, variables) => {
+ if (options?.onSettled) options.onSettled(data, error, variables);
+ },
+ });
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-escalation-policy-list-query.ts b/apps/web/src/services/alert-manager/v2/composables/use-escalation-policy-list-query.ts
new file mode 100644
index 0000000000..757dad545a
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-escalation-policy-list-query.ts
@@ -0,0 +1,41 @@
+import type { ComputedRef, Ref } from 'vue';
+import { computed } from 'vue';
+
+import { useEscalationPolicyApi } from '@/api-clients/alert-manager/escalation-policy/composables/use-escalation-policy-api';
+import type { EscalationPolicyListParameters } from '@/api-clients/alert-manager/escalation-policy/schema/api-verbs/list';
+import type { EscalationPolicyModel } from '@/api-clients/alert-manager/escalation-policy/schema/model';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+
+interface UseEscalationPolicyListQueryReturn {
+ escalationPolicyListData: Ref;
+ escalationPolicyListTotalCount: Ref;
+ escalationPolicyListFetching: Ref;
+}
+interface UseEscalationPolicyListQueryOptions {
+ params: ComputedRef;
+}
+
+export const useEscalationPolicyListQuery = ({ params }: UseEscalationPolicyListQueryOptions): UseEscalationPolicyListQueryReturn => {
+ const { escalationPolicyAPI } = useEscalationPolicyApi();
+
+ const { key: escalationPolicyListQueryKey, params: escalationPolicyListQueryParams } = useServiceQueryKey('alert-manager', 'escalation-policy', 'list', {
+ params: computed(() => params.value),
+ });
+
+ const { data: escalationPolicyListData, isFetching: escalationPolicyListFetching } = useScopedQuery({
+ queryKey: escalationPolicyListQueryKey,
+ queryFn: async () => escalationPolicyAPI.list(escalationPolicyListQueryParams.value),
+ initialData: {
+ results: [],
+ total_count: 0,
+ },
+ gcTime: 1000 * 60 * 2,
+ }, ['WORKSPACE']);
+
+ return {
+ escalationPolicyListData: computed(() => escalationPolicyListData.value?.results ?? []),
+ escalationPolicyListTotalCount: computed(() => escalationPolicyListData.value?.total_count ?? 0),
+ escalationPolicyListFetching,
+ };
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-event-rule-get-query.ts b/apps/web/src/services/alert-manager/v2/composables/use-event-rule-get-query.ts
new file mode 100644
index 0000000000..4c1ddb7b74
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-event-rule-get-query.ts
@@ -0,0 +1,42 @@
+import type { ComputedRef, Ref } from 'vue';
+import { computed } from 'vue';
+import { useRoute } from 'vue-router/composables';
+
+import { useEventRuleApi } from '@/api-clients/alert-manager/event-rule/composables/use-event-rule-api';
+import type { EventRuleModel } from '@/api-clients/alert-manager/event-rule/schema/model';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import type { QueryKeyArray } from '@/query/query-key/_types/query-key-type';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+
+interface UseEventRuleGetQueryReturn {
+ eventRuleData: Ref;
+ eventRuleLoading: Ref;
+ eventRuleQueryKey: ComputedRef;
+}
+
+export const useEventRuleGetQuery = (): UseEventRuleGetQueryReturn => {
+ const { eventRuleAPI } = useEventRuleApi();
+ const route = useRoute();
+
+ const eventRuleId = computed(() => route.query?.eventRuleId as string);
+
+ const { key: eventRuleQueryKey, params: eventRuleQueryParams } = useServiceQueryKey('alert-manager', 'event-rule', 'get', {
+ params: computed(() => ({
+ event_rule_id: eventRuleId.value,
+ })),
+ });
+
+ const { data: eventRuleData, isFetching: eventRuleLoading } = useScopedQuery({
+ queryKey: eventRuleQueryKey,
+ queryFn: () => eventRuleAPI.get(eventRuleQueryParams.value),
+ enabled: computed(() => !!eventRuleId.value),
+ gcTime: 1000 * 60 * 2,
+ staleTime: 1000 * 30,
+ }, ['WORKSPACE']);
+
+ return {
+ eventRuleData,
+ eventRuleLoading,
+ eventRuleQueryKey,
+ };
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-event-rule-list-query.ts b/apps/web/src/services/alert-manager/v2/composables/use-event-rule-list-query.ts
new file mode 100644
index 0000000000..318c8d5c16
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-event-rule-list-query.ts
@@ -0,0 +1,39 @@
+import type { ComputedRef, Ref } from 'vue';
+import { computed } from 'vue';
+
+import type { QueryKey } from '@tanstack/vue-query';
+
+import { useEventRuleApi } from '@/api-clients/alert-manager/event-rule/composables/use-event-rule-api';
+import type { EventRuleModel } from '@/api-clients/alert-manager/event-rule/schema/model';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+
+interface UseEventRuleListQueryReturn {
+ eventRuleListData: Ref;
+ eventRuleListFetching: Ref;
+ eventRuleListQueryKey: Ref;
+}
+
+export const useEventRuleListQuery = (serviceId: ComputedRef): UseEventRuleListQueryReturn => {
+ const { eventRuleAPI } = useEventRuleApi();
+
+ const { key: eventRuleListQueryKey, params: eventRuleListQueryParams } = useServiceQueryKey('alert-manager', 'event-rule', 'list', {
+ params: computed(() => ({
+ service_id: serviceId.value,
+ })),
+ });
+
+ const { data: queryData, isFetching: eventRuleListFetching } = useScopedQuery({
+ queryKey: eventRuleListQueryKey,
+ queryFn: async () => eventRuleAPI.list(eventRuleListQueryParams.value),
+ enabled: computed(() => !!serviceId.value),
+ gcTime: 1000 * 60 * 2,
+ staleTime: 1000 * 60 * 2,
+ }, ['WORKSPACE']);
+
+ return {
+ eventRuleListData: computed(() => queryData.value?.results ?? []),
+ eventRuleListFetching,
+ eventRuleListQueryKey,
+ };
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-notification-protocol-list-query.ts b/apps/web/src/services/alert-manager/v2/composables/use-notification-protocol-list-query.ts
new file mode 100644
index 0000000000..269186a422
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-notification-protocol-list-query.ts
@@ -0,0 +1,44 @@
+import type { Ref } from 'vue';
+import { computed } from 'vue';
+
+import { useNotificationProtocolApi } from '@/api-clients/alert-manager/notification-protocol/composables/use-notification-protocol-api';
+import type { NotificationProtocolModel } from '@/api-clients/alert-manager/notification-protocol/schema/model';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+
+import { useAllReferenceStore } from '@/store/reference/all-reference-store';
+import type { PluginReferenceMap } from '@/store/reference/plugin-reference-store';
+
+type NotificationProtocolItem = NotificationProtocolModel & {
+ icon: string;
+};
+interface UseNotificationProtocolListQueryReturn {
+ notificationProtocolListData: Ref;
+ notificationProtocolListFetching: Ref;
+}
+
+export const useNotificationProtocolListQuery = (): UseNotificationProtocolListQueryReturn => {
+ const { notificationProtocolAPI } = useNotificationProtocolApi();
+ const allReferenceStore = useAllReferenceStore();
+ const allReferenceGetters = allReferenceStore.getters;
+
+ const pluginsReferenceMap = computed(() => allReferenceGetters.plugin);
+
+ const { key: notificationProtocolListQueryKey } = useServiceQueryKey('alert-manager', 'notification-protocol', 'list');
+
+ const { data: notificationProtocolListData, isFetching: notificationProtocolListFetching } = useScopedQuery({
+ queryKey: notificationProtocolListQueryKey,
+ queryFn: async () => notificationProtocolAPI.list(),
+ select: (data) => data.results?.map((i) => ({
+ ...i,
+ icon: pluginsReferenceMap.value[i.plugin_info.plugin_id]?.icon || '',
+ })),
+ gcTime: 1000 * 60 * 2,
+ staleTime: 1000 * 30,
+ }, ['WORKSPACE']);
+
+ return {
+ notificationProtocolListData: computed(() => notificationProtocolListData.value ?? []),
+ notificationProtocolListFetching,
+ };
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-service-channel-create-mutation.ts b/apps/web/src/services/alert-manager/v2/composables/use-service-channel-create-mutation.ts
new file mode 100644
index 0000000000..6f43f0d2f1
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-service-channel-create-mutation.ts
@@ -0,0 +1,51 @@
+import type { ComputedRef } from 'vue';
+
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
+
+import { useServiceChannelApi } from '@/api-clients/alert-manager/service-channel/composables/use-service-channel-api';
+import type { ServiceChannelCreateParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/create';
+import type { ServiceChannelCreateForwardChannelParameters } from '@/api-clients/alert-manager/service-channel/schema/api-verbs/create-forward-channel';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+import { i18n } from '@/translations';
+
+import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
+
+import ErrorHandler from '@/common/composables/error/errorHandler';
+
+type ServiceChannelCreateParametersType = Partial;
+
+interface ServiceChannelCreateMutationOptions {
+ onSuccess?: (data: unknown, variables: ServiceChannelCreateParametersType) => void | Promise;
+ onError?: (error: Error, variables: ServiceChannelCreateParametersType) => void | Promise;
+ onSettled?: (data: unknown | undefined, error: Error | null, variables: ServiceChannelCreateParametersType) => void | Promise;
+ isForwardTypeProtocol?: ComputedRef;
+}
+
+export const useServiceChannelCreateMutation = (options?: ServiceChannelCreateMutationOptions) => {
+ const { serviceChannelAPI } = useServiceChannelApi();
+ const queryClient = useQueryClient();
+
+ const { withSuffix: serviceGetBaseQueryKey } = useServiceQueryKey('alert-manager', 'service', 'get');
+
+ return useMutation({
+ mutationFn: (params: ServiceChannelCreateParametersType) => {
+ if (options?.isForwardTypeProtocol?.value) {
+ return serviceChannelAPI.createForwardChannel(params as ServiceChannelCreateForwardChannelParameters);
+ }
+ return serviceChannelAPI.create(params as ServiceChannelCreateParameters);
+ },
+ onSuccess: async (data, variables) => {
+ const _serviceId = { service_id: variables.service_id };
+ queryClient.invalidateQueries({ queryKey: serviceGetBaseQueryKey(_serviceId) });
+ showSuccessMessage(i18n.t('ALERT_MANAGER.NOTIFICATIONS.ALT_S_CREATED'), '');
+ if (options?.onSuccess) await options.onSuccess(data, variables);
+ },
+ onError: (error, variables) => {
+ ErrorHandler.handleError(error, true);
+ if (options?.onError) options.onError(error, variables);
+ },
+ onSettled: (data, error, variables) => {
+ if (options?.onSettled) options.onSettled(data, error, variables);
+ },
+ });
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-service-channel-list-query.ts b/apps/web/src/services/alert-manager/v2/composables/use-service-channel-list-query.ts
new file mode 100644
index 0000000000..4e1d911fa7
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-service-channel-list-query.ts
@@ -0,0 +1,37 @@
+import type { ComputedRef, Ref } from 'vue';
+import { computed } from 'vue';
+
+import { useServiceChannelApi } from '@/api-clients/alert-manager/service-channel/composables/use-service-channel-api';
+import type { ServiceChannelModel } from '@/api-clients/alert-manager/service-channel/schema/model';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+
+interface UseServiceChannelListQueryReturn {
+ serviceChannelListData: Ref;
+ serviceChannelListFetching: Ref;
+}
+
+export const useServiceChannelListQuery = (serviceId: ComputedRef): UseServiceChannelListQueryReturn => {
+ const { serviceChannelAPI } = useServiceChannelApi();
+
+ const { key: serviceChannelListQueryKey, params: serviceChannelListQueryParams } = useServiceQueryKey('alert-manager', 'service-channel', 'list', {
+ params: computed(() => ({
+ service_id: serviceId.value,
+ query: {
+ sort: [{ key: 'created_at', desc: true }],
+ },
+ })),
+ });
+
+ const { data: queryData, isFetching: serviceChannelListFetching } = useScopedQuery({
+ queryKey: serviceChannelListQueryKey,
+ queryFn: async () => serviceChannelAPI.list(serviceChannelListQueryParams.value),
+ staleTime: 1000 * 60 * 2,
+ gcTime: 1000 * 60 * 2,
+ }, ['WORKSPACE']);
+
+ return {
+ serviceChannelListData: computed(() => queryData.value?.results ?? []),
+ serviceChannelListFetching,
+ };
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-service-get-query.ts b/apps/web/src/services/alert-manager/v2/composables/use-service-get-query.ts
new file mode 100644
index 0000000000..32b8e4e5a6
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-service-get-query.ts
@@ -0,0 +1,63 @@
+import type { ComputedRef, Ref } from 'vue';
+import { computed } from 'vue';
+
+import { useServiceApi } from '@/api-clients/alert-manager/service/composables/use-service-api';
+import { NOTIFICATION_URGENCY, RECOVERY_MODE, SERVICE_ALERTS_TYPE } from '@/api-clients/alert-manager/service/schema/constants';
+import type { AlertsInfoType, AlertsType } from '@/api-clients/alert-manager/service/schema/type';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+
+import type { Service } from '@/services/alert-manager/v2/types/alert-manager-type';
+
+interface UseServiceGetQueryReturn {
+ serviceData: Ref | undefined>;
+}
+
+export const useServiceGetQuery = (serviceId: ComputedRef): UseServiceGetQueryReturn => {
+ const { serviceAPI } = useServiceApi();
+
+ const { key: serviceQueryKey, params: serviceQueryParams } = useServiceQueryKey('alert-manager', 'service', 'get', {
+ params: computed(() => ({
+ service_id: serviceId.value,
+ details: true,
+ })),
+ });
+
+ const { data: serviceData } = useScopedQuery({
+ queryKey: serviceQueryKey,
+ queryFn: () => serviceAPI.get(serviceQueryParams.value),
+ gcTime: 1000 * 60 * 2,
+ staleTime: 1000 * 30,
+ }, ['WORKSPACE']);
+
+ const refinedServiceData = computed(() => {
+ const getAlerts = (alertKey: AlertsType): AlertsInfoType => {
+ const alertValue = serviceData.value?.alerts?.[alertKey] || { HIGH: 0, LOW: 0 };
+ return {
+ HIGH: alertValue.HIGH || 0,
+ LOW: alertValue.LOW || 0,
+ };
+ };
+ return {
+ ...serviceData.value,
+ members: {
+ USER_GROUP: serviceData.value?.members?.USER_GROUP || [],
+ USER: serviceData.value?.members?.USER || [],
+ },
+ options: {
+ notification_urgency: serviceData.value?.options?.notification_urgency || NOTIFICATION_URGENCY.ALL,
+ recovery_mode: serviceData.value?.options?.recovery_mode || RECOVERY_MODE.MANUAL,
+ },
+ alerts: {
+ TRIGGERED: getAlerts(SERVICE_ALERTS_TYPE.TRIGGERED),
+ ACKNOWLEDGED: getAlerts(SERVICE_ALERTS_TYPE.ACKNOWLEDGED),
+ RESOLVED: getAlerts(SERVICE_ALERTS_TYPE.RESOLVED),
+ TOTAL: getAlerts(SERVICE_ALERTS_TYPE.TOTAL),
+ },
+ };
+ });
+
+ return {
+ serviceData: computed(() => refinedServiceData.value),
+ };
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-service-list-pagination-query.ts b/apps/web/src/services/alert-manager/v2/composables/use-service-list-pagination-query.ts
new file mode 100644
index 0000000000..59a022fffa
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-service-list-pagination-query.ts
@@ -0,0 +1,50 @@
+import type { ComputedRef } from 'vue';
+import { computed } from 'vue';
+
+import { useQueryClient } from '@tanstack/vue-query';
+
+import { useServiceApi } from '@/api-clients/alert-manager/service/composables/use-service-api';
+import type { ServiceListParameters } from '@/api-clients/alert-manager/service/schema/api-verbs/list';
+import type { ServiceModel } from '@/api-clients/alert-manager/service/schema/model';
+import { useScopedPaginationQuery } from '@/query/pagination/use-scoped-pagination-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+
+interface UseServiceListPaginationQueryOptions {
+ params: ComputedRef;
+ thisPage: ComputedRef;
+ pageSize: ComputedRef;
+}
+
+export const useServiceListPaginationQuery = ({ params, thisPage, pageSize }: UseServiceListPaginationQueryOptions) => {
+ const queryClient = useQueryClient();
+
+ const { serviceAPI } = useServiceApi();
+
+ const { key: serviceListPaginationQueryKey, params: serviceListPaginationQueryParams } = useServiceQueryKey('alert-manager', 'service', 'list', {
+ params: computed(() => params.value),
+ pagination: true,
+ });
+
+ const query = useScopedPaginationQuery({
+ queryKey: serviceListPaginationQueryKey,
+ queryFn: serviceAPI.list,
+ params: serviceListPaginationQueryParams,
+ gcTime: 1000 * 60 * 2,
+ enabled: true,
+ }, {
+ thisPage,
+ pageSize,
+ verb: 'list',
+ }, ['WORKSPACE', 'USER', 'DOMAIN']);
+
+ const refresh = async () => {
+ await queryClient.invalidateQueries({ queryKey: serviceListPaginationQueryKey.value });
+ };
+
+ return {
+ data: computed(() => query.data.value?.results || []),
+ totalCount: query.totalCount,
+ isLoading: query.isLoading,
+ refresh,
+ };
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-service-update-mutation.ts b/apps/web/src/services/alert-manager/v2/composables/use-service-update-mutation.ts
new file mode 100644
index 0000000000..123bd0f4b0
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-service-update-mutation.ts
@@ -0,0 +1,40 @@
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
+
+import { useServiceApi } from '@/api-clients/alert-manager/service/composables/use-service-api';
+import type { ServiceUpdateParameters } from '@/api-clients/alert-manager/service/schema/api-verbs/update';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+import { i18n } from '@/translations';
+
+import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
+
+import ErrorHandler from '@/common/composables/error/errorHandler';
+
+interface UseServiceUpdateMutationOptions {
+ onSuccess?: (data: unknown, variables: ServiceUpdateParameters) => void|Promise;
+ onError?: (error: Error, variables: ServiceUpdateParameters) => void|Promise;
+ onSettled?: (data: unknown|undefined, error: Error|null, variables: ServiceUpdateParameters) => void|Promise;
+}
+
+export const useServiceUpdateMutation = (options?: UseServiceUpdateMutationOptions) => {
+ const { serviceAPI } = useServiceApi();
+ const queryClient = useQueryClient();
+
+ const { withSuffix: serviceQueryKey } = useServiceQueryKey('alert-manager', 'service', 'get');
+
+ return useMutation({
+ mutationFn: (params: ServiceUpdateParameters) => serviceAPI.update(params),
+ onSuccess: async (data, variables) => {
+ const _serviceId = { service_id: variables.service_id };
+ queryClient.invalidateQueries({ queryKey: serviceQueryKey(_serviceId) });
+ showSuccessMessage(i18n.t('ALERT_MANAGER.SERVICE.ALT_S_UPDATE_SERVICE'), '');
+ if (options?.onSuccess) await options.onSuccess(data, variables);
+ },
+ onError: (error, variables) => {
+ ErrorHandler.handleError(error, true);
+ if (options?.onError) options.onError(error, variables);
+ },
+ onSettled: (data, error, variables) => {
+ if (options?.onSettled) options.onSettled(data, error, variables);
+ },
+ });
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-webhook-create-mutation.ts b/apps/web/src/services/alert-manager/v2/composables/use-webhook-create-mutation.ts
new file mode 100644
index 0000000000..98d466207e
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-webhook-create-mutation.ts
@@ -0,0 +1,39 @@
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
+
+import { useWebhookApi } from '@/api-clients/alert-manager/webhook/composables/use-webhook-api';
+import type { WebhookCreateParameters } from '@/api-clients/alert-manager/webhook/schema/api-verbs/create';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+import { i18n } from '@/translations';
+
+import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
+
+import ErrorHandler from '@/common/composables/error/errorHandler';
+
+interface UseWebhookCreateMutationOptions {
+ onSuccess?: (data: unknown, variables: WebhookCreateParameters) => void|Promise;
+ onError?: (error: Error, variables: WebhookCreateParameters) => void|Promise;
+ onSettled?: (data: unknown|undefined, error: Error|null, variables: WebhookCreateParameters) => void|Promise;
+}
+
+export const useWebhookCreateMutation = (options?: UseWebhookCreateMutationOptions) => {
+ const { webhookAPI } = useWebhookApi();
+ const queryClient = useQueryClient();
+
+ const { key: webhookListBaseQueryKey } = useServiceQueryKey('alert-manager', 'webhook', 'list');
+
+ return useMutation({
+ mutationFn: (params: WebhookCreateParameters) => webhookAPI.create(params),
+ onSuccess: async (data, variables) => {
+ queryClient.invalidateQueries({ queryKey: webhookListBaseQueryKey.value });
+ showSuccessMessage(i18n.t('ALERT_MANAGER.WEBHOOK.ALT_S_CREATE_WEBHOOK'), '');
+ if (options?.onSuccess) await options.onSuccess(data, variables);
+ },
+ onError: (error, variables) => {
+ ErrorHandler.handleError(error, true);
+ if (options?.onError) options.onError(error, variables);
+ },
+ onSettled: (data, error, variables) => {
+ if (options?.onSettled) options.onSettled(data, error, variables);
+ },
+ });
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-webhook-list-pagination-query.ts b/apps/web/src/services/alert-manager/v2/composables/use-webhook-list-pagination-query.ts
new file mode 100644
index 0000000000..e709b23ac3
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-webhook-list-pagination-query.ts
@@ -0,0 +1,52 @@
+import type { ComputedRef } from 'vue';
+import { computed } from 'vue';
+
+import { useQueryClient } from '@tanstack/vue-query';
+
+import type { AlertListParameters } from '@/api-clients/alert-manager/alert/schema/api-verbs/list';
+import { useWebhookApi } from '@/api-clients/alert-manager/webhook/composables/use-webhook-api';
+import type { WebhookModel } from '@/api-clients/alert-manager/webhook/schema/model';
+import { useScopedPaginationQuery } from '@/query/pagination/use-scoped-pagination-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+
+interface UseWebhookListPaginationQueryOptions {
+ params: ComputedRef;
+ thisPage: ComputedRef;
+ pageSize: ComputedRef;
+}
+
+export const useWebhookListPaginationQuery = ({ params, thisPage, pageSize }: UseWebhookListPaginationQueryOptions) => {
+ const queryClient = useQueryClient();
+
+ const { webhookAPI } = useWebhookApi();
+
+
+ const { key: webhookListPaginationQueryKey, params: webhookListPaginationQueryParams } = useServiceQueryKey('alert-manager', 'webhook', 'list', {
+ params: computed(() => params.value),
+ pagination: true,
+ });
+
+ const query = useScopedPaginationQuery({
+ queryKey: webhookListPaginationQueryKey,
+ queryFn: webhookAPI.list,
+ params: webhookListPaginationQueryParams,
+ gcTime: 1000 * 60 * 2,
+ enabled: true,
+ }, {
+ thisPage,
+ pageSize,
+ verb: 'list',
+ }, ['WORKSPACE']);
+
+
+ const refresh = async () => {
+ await queryClient.resetQueries({ queryKey: webhookListPaginationQueryKey.value });
+ };
+
+ return {
+ data: computed(() => query.data.value?.results || []),
+ totalCount: computed(() => query.data.value?.total_count || 0),
+ isLoading: query.isLoading,
+ refresh,
+ };
+};
diff --git a/apps/web/src/services/alert-manager/v2/composables/use-webhook-list-query.ts b/apps/web/src/services/alert-manager/v2/composables/use-webhook-list-query.ts
new file mode 100644
index 0000000000..cb3ea2e5ca
--- /dev/null
+++ b/apps/web/src/services/alert-manager/v2/composables/use-webhook-list-query.ts
@@ -0,0 +1,46 @@
+import type { ComputedRef, Ref } from 'vue';
+import { computed } from 'vue';
+
+import type { QueryKey } from '@tanstack/vue-query';
+
+import { useWebhookApi } from '@/api-clients/alert-manager/webhook/composables/use-webhook-api';
+import type { WebhookModel } from '@/api-clients/alert-manager/webhook/schema/model';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+
+interface UseWebhookListQueryReturn {
+ webhookListData: Ref;
+ webhookListTotalCount: Ref;
+ webhookListFetching: Ref;
+ webhookListQueryKey: Ref;
+}
+
+export const useWebhookListQuery = (serviceId: ComputedRef): UseWebhookListQueryReturn => {
+ const { webhookAPI } = useWebhookApi();
+
+ const { key: webhookListQueryKey, params: webhookListQueryParams } = useServiceQueryKey('alert-manager', 'webhook', 'list', {
+ params: computed(() => ({
+ service_id: serviceId.value,
+ query: {
+ sort: [{ key: 'created_at', desc: true }],
+ },
+ })),
+ });
+
+ const { data: queryData, isFetching: webhookListFetching } = useScopedQuery({
+ queryKey: webhookListQueryKey,
+ queryFn: async () => webhookAPI.list(webhookListQueryParams.value),
+ initialData: {
+ results: [],
+ total_count: 0,
+ },
+ gcTime: 1000 * 60 * 2,
+ }, ['WORKSPACE']);
+
+ return {
+ webhookListData: computed(() => queryData.value?.results ?? []),
+ webhookListTotalCount: computed(() => queryData.value?.total_count ?? 0),
+ webhookListFetching,
+ webhookListQueryKey,
+ };
+};
diff --git a/apps/web/src/services/alert-manager/v2/pages/AlertsDetailPage.vue b/apps/web/src/services/alert-manager/v2/pages/AlertsDetailPage.vue
index c4c56fd208..900eee04e8 100644
--- a/apps/web/src/services/alert-manager/v2/pages/AlertsDetailPage.vue
+++ b/apps/web/src/services/alert-manager/v2/pages/AlertsDetailPage.vue
@@ -1,17 +1,15 @@
diff --git a/apps/web/src/services/alert-manager/v2/pages/ServiceDetailNotificationsCreatePage.vue b/apps/web/src/services/alert-manager/v2/pages/ServiceDetailNotificationsCreatePage.vue
index 9658e0118c..b0d42662d6 100644
--- a/apps/web/src/services/alert-manager/v2/pages/ServiceDetailNotificationsCreatePage.vue
+++ b/apps/web/src/services/alert-manager/v2/pages/ServiceDetailNotificationsCreatePage.vue
@@ -4,23 +4,12 @@ import {
} from 'vue';
import { useRouter } from 'vue-router/composables';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import { PButton, PCenteredLayoutHeader } from '@cloudforet/mirinae';
-import type { ServiceChannelCreateParameters } from '@/schema/alert-manager/service-channel/api-verbs/create';
-import type {
- ServiceChannelCreateForwardChannelParameters,
-} from '@/schema/alert-manager/service-channel/api-verbs/create-forward-channel';
-import type { ServiceChannelModel } from '@/schema/alert-manager/service-channel/model';
-import { i18n } from '@/translations';
-
-import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
-
-import ErrorHandler from '@/common/composables/error/errorHandler';
-
import NotificationsCreateForm from '@/services/alert-manager/v2/components/NotificationsCreateForm.vue';
import NotificationsCreateTypeSelector
from '@/services/alert-manager/v2/components/NotificationsCreateTypeSelector.vue';
+import { useServiceChannelCreateMutation } from '@/services/alert-manager/v2/composables/use-service-channel-create-mutation';
import { SERVICE_DETAIL_TABS } from '@/services/alert-manager/v2/constants/common-constant';
import { ALERT_MANAGER_ROUTE } from '@/services/alert-manager/v2/routes/route-constant';
import { useServiceCreateFormStore } from '@/services/alert-manager/v2/stores/service-create-form-store';
@@ -53,6 +42,13 @@ const state = reactive({
isForwardTypeProtocol: computed(() => storeState.selectedProtocolId?.toLowerCase().includes('forward') || false),
});
+const { mutate: serviceChannelCreateMutate } = useServiceChannelCreateMutation({
+ onSuccess: async () => {
+ await handleClickCancelButton();
+ },
+ isForwardTypeProtocol: computed(() => state.isForwardTypeProtocol),
+});
+
const handleChangeForm = (form: CreatedNotificationInfoType, formValid: boolean) => {
state.form = form;
state.formValid = formValid;
@@ -85,23 +81,15 @@ const handleActionButton = () => {
fetchCreateNotifications();
};
-const fetchCreateNotifications = async () => {
- const fetcher = state.isForwardTypeProtocol
- ? SpaceConnector.clientV2.alertManager.serviceChannel.createForwardChannel
- : SpaceConnector.clientV2.alertManager.serviceChannel.create;
+const fetchCreateNotifications = () => {
const defaultParams = {
service_id: props.serviceId,
...state.form,
};
- try {
- await fetcher(state.isForwardTypeProtocol
- ? defaultParams
- : { protocol_id: storeState.selectedProtocolId, ...defaultParams });
- showSuccessMessage(i18n.t('ALERT_MANAGER.NOTIFICATIONS.ALT_S_CREATED'), '');
- handleClickCancelButton();
- } catch (e) {
- ErrorHandler.handleError(e, true);
+ if (!state.isForwardTypeProtocol) {
+ defaultParams.protocol_id = storeState.selectedProtocolId;
}
+ serviceChannelCreateMutate(defaultParams);
};
onUnmounted(() => {
diff --git a/apps/web/src/services/alert-manager/v2/pages/ServiceDetailPage.vue b/apps/web/src/services/alert-manager/v2/pages/ServiceDetailPage.vue
index 60a8d68948..32d0476679 100644
--- a/apps/web/src/services/alert-manager/v2/pages/ServiceDetailPage.vue
+++ b/apps/web/src/services/alert-manager/v2/pages/ServiceDetailPage.vue
@@ -51,13 +51,9 @@ const state = reactive({
{ name: storeState.serviceList[props.serviceId].label },
]),
});
+
watch(() => props.serviceId, async (serviceId) => {
if (!serviceId) return;
- await serviceDetailPageStore.fetchNotificationProtocolList();
- await serviceDetailPageStore.fetchEventRuleList({
- service_id: serviceId,
- });
- await serviceDetailPageStore.fetchServiceDetailData(serviceId);
await gnbStore.setFavoriteItemId(state.favoriteOptions);
}, { immediate: true });
watch(() => storeState.serviceList, async (serviceList) => {
diff --git a/apps/web/src/services/alert-manager/v2/pages/ServiceDetailWebhookCreatePage.vue b/apps/web/src/services/alert-manager/v2/pages/ServiceDetailWebhookCreatePage.vue
index afb67fb503..a70101a8ce 100644
--- a/apps/web/src/services/alert-manager/v2/pages/ServiceDetailWebhookCreatePage.vue
+++ b/apps/web/src/services/alert-manager/v2/pages/ServiceDetailWebhookCreatePage.vue
@@ -4,21 +4,16 @@ import {
} from 'vue';
import { useRouter } from 'vue-router/composables';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import { PButton, PCenteredLayoutHeader } from '@cloudforet/mirinae';
-import type { WebhookCreateParameters } from '@/schema/alert-manager/webhook/api-verbs/create';
-import type { WebhookModel } from '@/schema/alert-manager/webhook/model';
+import type { WebhookModel } from '@/api-clients/alert-manager/webhook/schema/model';
import type { PluginModel } from '@/schema/repository/plugin/model';
import { i18n } from '@/translations';
-import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
-
-import ErrorHandler from '@/common/composables/error/errorHandler';
-
import WebhookCreateForm from '@/services/alert-manager/v2/components/WebhookCreateForm.vue';
import WebhookCreateSuccessMode from '@/services/alert-manager/v2/components/WebhookCreateSuccessMode.vue';
import WebhookCreateTypeSelector from '@/services/alert-manager/v2/components/WebhookCreateTypeSelector.vue';
+import { useWebhookCreateMutation } from '@/services/alert-manager/v2/composables/use-webhook-create-mutation';
import { SERVICE_DETAIL_TABS } from '@/services/alert-manager/v2/constants/common-constant';
import { ALERT_MANAGER_ROUTE } from '@/services/alert-manager/v2/routes/route-constant';
import { useServiceCreateFormStore } from '@/services/alert-manager/v2/stores/service-create-form-store';
@@ -44,7 +39,6 @@ const storeState = reactive({
webhookVersion: computed(() => serviceCreateFormState.webhookVersion || ''),
});
const state = reactive({
- loading: false,
currentStep: 1,
isAllFormValid: computed(() => {
if (state.currentStep === 1) return storeState.selectedWebhookTypeId !== '';
@@ -69,6 +63,16 @@ const state = reactive({
succeedWebhook: undefined as undefined|WebhookModel,
});
+const { mutateAsync: createWebhook, isPending: createWebhookLoading } = useWebhookCreateMutation({
+ onSuccess: (data) => {
+ state.succeedWebhook = data as WebhookModel;
+ state.currentStep = 3;
+ },
+ onError: () => {
+ state.succeedWebhook = undefined;
+ },
+});
+
const handleClickCancelButton = () => {
router.push({
name: ALERT_MANAGER_ROUTE.SERVICE.DETAIL._NAME,
@@ -98,24 +102,14 @@ const handleActionButton = () => {
};
const fetchCreateWebhook = async () => {
- state.loading = true;
- try {
- state.succeedWebhook = await SpaceConnector.clientV2.alertManager.webhook.create({
- name: storeState.webhookName,
- plugin_info: {
- plugin_id: storeState.selectedWebhookType?.plugin_id || '',
- version: storeState.webhookVersion,
- },
- service_id: props.serviceId,
- });
- showSuccessMessage(i18n.t('ALERT_MANAGER.WEBHOOK.ALT_S_CREATE_WEBHOOK'), '');
- state.currentStep = 3;
- } catch (e) {
- state.succeedWebhook = undefined;
- ErrorHandler.handleError(e, true);
- } finally {
- state.loading = false;
- }
+ createWebhook({
+ name: storeState.webhookName,
+ plugin_info: {
+ plugin_id: storeState.selectedWebhookType?.plugin_id || '',
+ version: storeState.webhookVersion,
+ },
+ service_id: props.serviceId,
+ });
};
onUnmounted(() => {
@@ -169,7 +163,7 @@ onUnmounted(() => {
style-type="substitutive"
size="lg"
class="ml-4"
- :loading="state.loading"
+ :loading="createWebhookLoading"
@click="handleActionButton"
>
{{ state.currentStep === 1 ? $t('ALERT_MANAGER.CONTINUE') : $t('ALERT_MANAGER.CREATE') }}
diff --git a/apps/web/src/services/alert-manager/v2/stores/alert-detail-page-store.ts b/apps/web/src/services/alert-manager/v2/stores/alert-detail-page-store.ts
deleted file mode 100644
index c98c07cd11..0000000000
--- a/apps/web/src/services/alert-manager/v2/stores/alert-detail-page-store.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-import type { ComputedRef } from 'vue';
-import { computed, reactive } from 'vue';
-
-import { defineStore } from 'pinia';
-
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
-
-import type { AlertGetParameters } from '@/schema/alert-manager/alert/api-verbs/get';
-import type { AlertUpdateParameters } from '@/schema/alert-manager/alert/api-verbs/update';
-import type { AlertModel } from '@/schema/alert-manager/alert/model';
-import { i18n } from '@/translations';
-
-import { useUserStore } from '@/store/user/user-store';
-
-import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
-
-import ErrorHandler from '@/common/composables/error/errorHandler';
-
-interface AlertDetailPageStoreState {
- alertInfo: AlertModel;
-}
-interface AlertDetailPageStoreGetters {
- timezone: ComputedRef;
-}
-
-export const useAlertDetailPageStore = defineStore('page-alert-detail', () => {
- const userStore = useUserStore();
- const userState = userStore.state;
-
- const state = reactive({
- alertInfo: {} as AlertModel,
- });
-
- const getters = reactive({
- timezone: computed(() => userState.timezone || 'UTC'),
- });
-
- const actions = {
- async init() {
- state.alertInfo = {} as AlertModel;
- },
- async fetchAlertDetail(alertId: string): Promise {
- try {
- state.alertInfo = await SpaceConnector.clientV2.alertManager.alert.get({
- alert_id: alertId,
- });
- } catch (e: any) {
- ErrorHandler.handleError(e);
- }
- },
- async updateAlertDetail(param: AlertUpdateParameters): Promise {
- try {
- state.alertInfo = await SpaceConnector.clientV2.alertManager.alert.update(param);
- showSuccessMessage(i18n.t('ALERT_MANAGER.ALERTS.ALT_S_UPDATE'), '');
- } catch (e: any) {
- ErrorHandler.handleError(e, true);
- }
- },
-
- };
-
- return {
- state,
- getters,
- ...actions,
- };
-});
diff --git a/apps/web/src/services/alert-manager/v2/stores/alert-page-store.ts b/apps/web/src/services/alert-manager/v2/stores/alert-page-store.ts
index f84040a3b3..fe8b1d6743 100644
--- a/apps/web/src/services/alert-manager/v2/stores/alert-page-store.ts
+++ b/apps/web/src/services/alert-manager/v2/stores/alert-page-store.ts
@@ -2,25 +2,14 @@ import { computed, reactive } from 'vue';
import { defineStore } from 'pinia';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
-import type { Query } from '@cloudforet/core-lib/space-connector/type';
import type { SelectDropdownMenuItem } from '@cloudforet/mirinae/types/controls/dropdown/select-dropdown/type';
-import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { AlertListParameters } from '@/schema/alert-manager/alert/api-verbs/list';
-import type { AlertModel } from '@/schema/alert-manager/alert/model';
-
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
-import ErrorHandler from '@/common/composables/error/errorHandler';
-
import { ALERT_PERIOD_DROPDOWN_MENU } from '@/services/alert-manager/v2/constants/alert-table-constant';
import type { Period } from '@/services/alert-manager/v2/types/alert-manager-type';
interface AlertPageStoreState {
- alertList: AlertModel[]
- totalAlertCount: number;
- alertListQuery?: Query;
selectedServiceId: string;
selectedStatus: string;
selectedUrgency: string;
@@ -34,9 +23,6 @@ export const useAlertPageStore = defineStore('page-alert', () => {
const allReferenceStore = useAllReferenceStore();
const allReferenceGetters = allReferenceStore.getters;
const state = reactive({
- alertList: [],
- totalAlertCount: 0,
- alertListQuery: undefined,
selectedServiceId: '',
selectedStatus: 'OPEN',
selectedUrgency: 'ALL',
@@ -52,9 +38,6 @@ export const useAlertPageStore = defineStore('page-alert', () => {
}))),
};
const mutations = {
- setAlertListQuery(query: Query) {
- state.alertListQuery = query;
- },
setSelectedServiceId(serviceId: string) {
state.selectedServiceId = serviceId;
},
@@ -81,31 +64,10 @@ export const useAlertPageStore = defineStore('page-alert', () => {
state.selectedPeriodRange = periodRange;
},
};
- const actions = {
- async init() {
- state.alertList = [];
- state.totalAlertCount = 0;
- state.alertListQuery = undefined;
- },
- async fetchAlertsList(params?: AlertListParameters) {
- try {
- const { results, total_count } = await SpaceConnector.clientV2.alertManager.alert.list>(params);
- state.alertList = results || [];
- state.totalAlertCount = total_count || 0;
- } catch (e) {
- ErrorHandler.handleError(e);
- state.alertList = [];
- state.totalAlertCount = 0;
- throw e;
- }
- },
-
- };
return {
state,
getters,
...mutations,
- ...actions,
};
});
diff --git a/apps/web/src/services/alert-manager/v2/stores/service-create-form-store.ts b/apps/web/src/services/alert-manager/v2/stores/service-create-form-store.ts
index 7fd3ac9fd7..921a1d48c5 100644
--- a/apps/web/src/services/alert-manager/v2/stores/service-create-form-store.ts
+++ b/apps/web/src/services/alert-manager/v2/stores/service-create-form-store.ts
@@ -2,28 +2,18 @@ import { reactive } from 'vue';
import { defineStore } from 'pinia';
-
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
-
-import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { NotificationProtocolListParameters } from '@/schema/alert-manager/notification-protocol/api-verbs/list';
-import type { NotificationProtocolModel } from '@/schema/alert-manager/notification-protocol/model';
-import type { ServiceModel } from '@/schema/alert-manager/service/model';
import type { PluginModel } from '@/schema/repository/plugin/model';
-import ErrorHandler from '@/common/composables/error/errorHandler';
-
-import type { ProtocolCardItemType } from '@/services/alert-manager/v2/types/alert-manager-type';
+import type { ProtocolCardItemType, Service } from '@/services/alert-manager/v2/types/alert-manager-type';
interface ServiceFormStoreState {
currentStep: number;
currentSubStep: number;
- createdService: ServiceModel;
+ createdService: Partial;
selectedWebhookType: PluginModel;
webhookName: string;
webhookVersion?: string;
selectedProtocol: ProtocolCardItemType;
- protocolList: NotificationProtocolModel[];
}
export const useServiceCreateFormStore = defineStore('service-create-form', () => {
@@ -31,14 +21,13 @@ export const useServiceCreateFormStore = defineStore('service-create-form', () =
currentStep: 1,
currentSubStep: 1,
// service
- createdService: {} as ServiceModel,
+ createdService: {} as Partial,
// webhook
selectedWebhookType: {} as PluginModel,
webhookName: '',
webhookVersion: undefined,
// notification
selectedProtocol: {} as ProtocolCardItemType,
- protocolList: [],
});
const mutations = {
@@ -49,7 +38,7 @@ export const useServiceCreateFormStore = defineStore('service-create-form', () =
state.currentSubStep = step;
},
- setCreatedService(service: ServiceModel) {
+ setCreatedService(service: Partial) {
state.createdService = service;
},
@@ -71,7 +60,7 @@ export const useServiceCreateFormStore = defineStore('service-create-form', () =
initState() {
state.currentStep = 1;
state.currentSubStep = 1;
- state.createdService = {} as ServiceModel;
+ state.createdService = {} as Partial;
state.selectedWebhookType = {} as PluginModel;
state.webhookName = '';
state.webhookVersion = undefined;
@@ -82,16 +71,6 @@ export const useServiceCreateFormStore = defineStore('service-create-form', () =
state.selectedWebhookType = {} as PluginModel;
state.webhookName = '';
},
- async fetchNotificationProtocolList() {
- try {
- const { results } = await SpaceConnector.clientV2.alertManager.notificationProtocol.list>();
- state.protocolList = results || [];
- } catch (e) {
- ErrorHandler.handleError(e);
- state.protocolList = [];
- throw e;
- }
- },
};
return {
diff --git a/apps/web/src/services/alert-manager/v2/stores/service-detail-page-store.ts b/apps/web/src/services/alert-manager/v2/stores/service-detail-page-store.ts
index 5d6b50954b..b30467ebe9 100644
--- a/apps/web/src/services/alert-manager/v2/stores/service-detail-page-store.ts
+++ b/apps/web/src/services/alert-manager/v2/stores/service-detail-page-store.ts
@@ -3,24 +3,6 @@ import { computed, reactive } from 'vue';
import { defineStore } from 'pinia';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
-
-import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { EventRuleGetParameters } from '@/schema/alert-manager/event-rule/api-verbs/get';
-import type { EventRuleListParameters } from '@/schema/alert-manager/event-rule/api-verbs/list';
-import type { EventRuleModel } from '@/schema/alert-manager/event-rule/model';
-import type { NotificationProtocolListParameters } from '@/schema/alert-manager/notification-protocol/api-verbs/list';
-import type { NotificationProtocolModel } from '@/schema/alert-manager/notification-protocol/model';
-import type { ServiceChannelListParameters } from '@/schema/alert-manager/service-channel/api-verbs/list';
-import type { ServiceChannelModel } from '@/schema/alert-manager/service-channel/model';
-import type { ServiceDeleteParameters } from '@/schema/alert-manager/service/api-verbs/delete';
-import type { ServiceGetParameters } from '@/schema/alert-manager/service/api-verbs/get';
-import type { ServiceUpdateParameters } from '@/schema/alert-manager/service/api-verbs/update';
-import { NOTIFICATION_URGENCY, RECOVERY_MODE, SERVICE_ALERTS_TYPE } from '@/schema/alert-manager/service/constants';
-import type { ServiceModel } from '@/schema/alert-manager/service/model';
-import type { AlertsInfoType, AlertsType } from '@/schema/alert-manager/service/type';
-import { i18n } from '@/translations';
-
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
import type { PluginReferenceMap } from '@/store/reference/plugin-reference-store';
import type { ServiceReferenceMap } from '@/store/reference/service-reference-store';
@@ -28,41 +10,26 @@ import type { UserGroupReferenceMap } from '@/store/reference/user-group-referen
import type { UserReferenceMap } from '@/store/reference/user-reference-store';
import { useUserStore } from '@/store/user/user-store';
-import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
-
-import ErrorHandler from '@/common/composables/error/errorHandler';
-
import type {
ServiceDetailTabsType,
- Service,
- ProtocolCardItemType,
} from '@/services/alert-manager/v2/types/alert-manager-type';
interface ServiceFormStoreState {
- loading: boolean;
currentTab?: ServiceDetailTabsType;
- serviceInfo: ServiceModel;
- notificationProtocolListData: NotificationProtocolModel[];
selectedWebhookId?: string;
selectedNotificationId?: string;
selectedEscalationPolicyId?: string;
- serviceChannelList: ServiceChannelModel[];
- eventRuleList: EventRuleModel[];
- eventRuleInfo: EventRuleModel;
eventRuleScopeModalVisible: boolean;
showEventRuleFormCard: boolean;
isEventRuleEditMode: boolean;
- eventRuleInfoLoading: boolean;
}
interface ServiceFormStoreGetters {
- serviceInfo: ComputedRef;
pluginsReferenceMap: ComputedRef;
userGroupReferenceMap: ComputedRef;
userReferenceMap: ComputedRef;
serviceReferenceMap: ComputedRef;
timezone: ComputedRef;
language: ComputedRef;
- notificationProtocolList: ComputedRef;
}
export const useServiceDetailPageStore = defineStore('page-service-detail', () => {
@@ -72,60 +39,22 @@ export const useServiceDetailPageStore = defineStore('page-service-detail', () =
const userState = userStore.state;
const state = reactive({
- loading: false,
currentTab: undefined,
- serviceInfo: {} as ServiceModel,
- notificationProtocolListData: [],
selectedWebhookId: undefined,
selectedNotificationId: undefined,
selectedEscalationPolicyId: undefined,
- serviceChannelList: [],
- eventRuleList: [],
- eventRuleInfo: {} as EventRuleModel,
eventRuleScopeModalVisible: false,
showEventRuleFormCard: false,
isEventRuleEditMode: false,
- eventRuleInfoLoading: false,
});
const getters = reactive({
- serviceInfo: computed(() => {
- const getAlerts = (alertKey: AlertsType): AlertsInfoType => {
- const alertValue = state.serviceInfo.alerts?.[alertKey] || { HIGH: 0, LOW: 0 };
- return {
- HIGH: alertValue.HIGH || 0,
- LOW: alertValue.LOW || 0,
- };
- };
- return {
- ...state.serviceInfo,
- members: {
- USER_GROUP: state.serviceInfo.members?.USER_GROUP || [],
- USER: state.serviceInfo.members?.USER || [],
- },
- options: {
- notification_urgency: state.serviceInfo.options?.notification_urgency || NOTIFICATION_URGENCY.ALL,
- recovery_mode: state.serviceInfo.options?.recovery_mode || RECOVERY_MODE.MANUAL,
- },
- alerts: {
- TRIGGERED: getAlerts(SERVICE_ALERTS_TYPE.TRIGGERED),
- ACKNOWLEDGED: getAlerts(SERVICE_ALERTS_TYPE.ACKNOWLEDGED),
- RESOLVED: getAlerts(SERVICE_ALERTS_TYPE.RESOLVED),
- TOTAL: getAlerts(SERVICE_ALERTS_TYPE.TOTAL),
- },
- rules: state.eventRuleList.length,
- };
- }),
pluginsReferenceMap: computed(() => allReferenceGetters.plugin),
userGroupReferenceMap: computed(() => allReferenceGetters.user_group),
userReferenceMap: computed(() => allReferenceGetters.user),
serviceReferenceMap: computed(() => allReferenceGetters.service),
timezone: computed(() => userState.timezone || 'UTC'),
language: computed(() => userStore.state.language || 'en'),
- notificationProtocolList: computed(() => state.notificationProtocolListData.map((i) => ({
- ...i,
- icon: getters.pluginsReferenceMap[i.plugin_info.plugin_id]?.icon || '',
- }))),
});
const mutations = {
@@ -154,110 +83,19 @@ export const useServiceDetailPageStore = defineStore('page-service-detail', () =
const actions = {
initState() {
- state.loading = false;
state.currentTab = undefined;
- state.serviceInfo = {} as ServiceModel;
- state.notificationProtocolListData = [];
state.selectedWebhookId = undefined;
state.selectedNotificationId = undefined;
state.selectedEscalationPolicyId = undefined;
- state.eventRuleList = [];
- state.eventRuleInfo = {} as EventRuleModel;
state.eventRuleScopeModalVisible = false;
state.showEventRuleFormCard = false;
state.isEventRuleEditMode = false;
},
initEscalationPolicyState() {
- state.eventRuleList = [];
- state.eventRuleInfo = {} as EventRuleModel;
state.eventRuleScopeModalVisible = false;
state.showEventRuleFormCard = false;
state.isEventRuleEditMode = false;
},
- async fetchServiceDetailData(id: string) {
- state.loading = true;
- try {
- state.serviceInfo = await SpaceConnector.clientV2.alertManager.service.get({
- service_id: id,
- details: true,
- });
- } catch (e) {
- ErrorHandler.handleError(e);
- state.serviceInfo = {} as ServiceModel;
- throw e;
- } finally {
- state.loading = false;
- }
- },
- async updateServiceDetailData({ name, description }: { name: string, description: string }) {
- try {
- await SpaceConnector.clientV2.alertManager.service.update({
- service_id: getters.serviceInfo.service_id,
- name,
- description,
- });
- showSuccessMessage(i18n.t('ALERT_MANAGER.SERVICE.ALT_S_UPDATE_SERVICE'), '');
- } catch (e) {
- ErrorHandler.handleError(e, true);
- state.serviceInfo = {} as ServiceModel;
- throw e;
- }
- },
- async deleteServiceDetailData() {
- try {
- await SpaceConnector.clientV2.alertManager.service.delete({
- service_id: getters.serviceInfo.service_id,
- force: true,
- });
- } catch (e) {
- ErrorHandler.handleError(e, true);
- throw e;
- }
- },
- async fetchNotificationProtocolList() {
- try {
- const { results } = await SpaceConnector.clientV2.alertManager.notificationProtocol.list>();
- state.notificationProtocolListData = results || [];
- } catch (e) {
- ErrorHandler.handleError(e);
- state.notificationProtocolListData = [];
- }
- },
- async fetchEventRuleList(params?: EventRuleListParameters) {
- try {
- const { results } = await SpaceConnector.clientV2.alertManager.eventRule.list>(params);
- state.eventRuleList = results || [];
- } catch (e) {
- ErrorHandler.handleError(e);
- state.eventRuleList = [];
- throw e;
- }
- },
- async fetchEventRuleInfo(params: EventRuleGetParameters) {
- state.eventRuleInfoLoading = true;
- try {
- state.eventRuleInfo = await SpaceConnector.clientV2.alertManager.eventRule.get(params);
- } catch (e) {
- ErrorHandler.handleError(e);
- state.eventRuleInfo = {} as EventRuleModel;
- } finally {
- state.eventRuleInfoLoading = false;
- }
- },
- async fetchServiceChannelList(serviceId: string) {
- try {
- const { results } = await SpaceConnector.clientV2.alertManager.serviceChannel.list>({
- service_id: serviceId,
- query: {
- sort: [{ key: 'created_at', desc: true }],
- },
- });
- state.serviceChannelList = results || [];
- } catch (e) {
- state.serviceChannelList = [];
- throw e;
- }
- },
};
return {
diff --git a/apps/web/src/services/alert-manager/v2/types/alert-manager-type.ts b/apps/web/src/services/alert-manager/v2/types/alert-manager-type.ts
index ec548a7750..66699cd41f 100644
--- a/apps/web/src/services/alert-manager/v2/types/alert-manager-type.ts
+++ b/apps/web/src/services/alert-manager/v2/types/alert-manager-type.ts
@@ -7,16 +7,16 @@ import type {
AlertHistoryNotificationChannelInfoType,
AlertStatusType,
AlertUrgencyType,
-} from '@/schema/alert-manager/alert/type';
+} from '@/api-clients/alert-manager/alert/schema/type';
import type {
EventRuleConditionsPolicyType,
EventRuleConditionsKeyType,
EventRuleConditionsOperatorType, EventRuleUrgencyType, EventRuleConditionsType,
-} from '@/schema/alert-manager/event-rule/type';
-import type { NotificationProtocolModel } from '@/schema/alert-manager/notification-protocol/model';
-import type { ServiceChannelDataType, ServiceChannelScheduleInfoType } from '@/schema/alert-manager/service-channel/type';
-import type { ServiceModel } from '@/schema/alert-manager/service/model';
-import type { AlertsInfoType, AlertsType } from '@/schema/alert-manager/service/type';
+} from '@/api-clients/alert-manager/event-rule/schema/type';
+import type { NotificationProtocolModel } from '@/api-clients/alert-manager/notification-protocol/schema/model';
+import type { ServiceChannelDataType, ServiceChannelScheduleInfoType } from '@/api-clients/alert-manager/service-channel/schema/type';
+import type { ServiceModel } from '@/api-clients/alert-manager/service/schema/model';
+import type { AlertsInfoType, AlertsType } from '@/api-clients/alert-manager/service/schema/type';
import type { ALERT_PERIOD_DROPDOWN_MENU } from '@/services/alert-manager/v2/constants/alert-table-constant';
import type {
@@ -74,7 +74,6 @@ export type createHeaderInfoByStep = {
export interface Service extends ServiceModel {
alerts: Record;
- rules: number;
}
export type CreatedNotificationInfoType = {
diff --git a/apps/web/src/services/asset-inventory/components/CloudServiceAlertsTab.vue b/apps/web/src/services/asset-inventory/components/CloudServiceAlertsTab.vue
index 0d6f5c9d07..d78844dbca 100644
--- a/apps/web/src/services/asset-inventory/components/CloudServiceAlertsTab.vue
+++ b/apps/web/src/services/asset-inventory/components/CloudServiceAlertsTab.vue
@@ -3,8 +3,9 @@ import {
computed, reactive, watch,
} from 'vue';
+import { useQueryClient } from '@tanstack/vue-query';
+
import { makeDistinctValueHandler } from '@cloudforet/core-lib/component-util/query-search';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import { ApiQueryHelper } from '@cloudforet/core-lib/space-connector/helper';
import {
PHeading, PToolboxTable, PSelectStatus, PBadge, PDivider, PLink, PI,
@@ -13,10 +14,11 @@ import type { SelectDropdownMenuItem } from '@cloudforet/mirinae/types/controls/
import type { DataTableFieldType } from '@cloudforet/mirinae/types/data-display/tables/data-table/type';
import { iso8601Formatter } from '@cloudforet/utils';
-import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { AlertListParameters } from '@/schema/alert-manager/alert/api-verbs/list';
-import { ALERT_STATUS, ALERT_URGENCY } from '@/schema/alert-manager/alert/constants';
-import type { AlertModel } from '@/schema/alert-manager/alert/model';
+import { useAlertApi } from '@/api-clients/alert-manager/alert/composables/use-alert-api';
+import { ALERT_STATUS, ALERT_URGENCY } from '@/api-clients/alert-manager/alert/schema/constants';
+import type { AlertModel } from '@/api-clients/alert-manager/alert/schema/model';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import { i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
@@ -26,7 +28,6 @@ import { useUserStore } from '@/store/user/user-store';
import { FILE_NAME_PREFIX } from '@/lib/excel-export/constant';
import { downloadExcel } from '@/lib/helper/file-download-helper';
-import ErrorHandler from '@/common/composables/error/errorHandler';
import { useQueryTags } from '@/common/composables/query-tags';
import CustomFieldModal from '@/common/modules/custom-table/custom-field-modal/CustomFieldModal.vue';
@@ -44,10 +45,6 @@ import {
import { ALERT_MANAGER_ROUTE } from '@/services/alert-manager/v2/routes/route-constant';
import type { AlertFilterType } from '@/services/alert-manager/v2/types/alert-manager-type';
-
-
-
-
interface Props {
cloudServiceId?: string;
}
@@ -66,22 +63,21 @@ const storeState = reactive({
});
const state = reactive({
fields: ALERT_MANAGEMENT_TABLE_FIELDS,
- items: [] as AlertModel[],
- refinedItems: computed(() => state.items.map((alert:AlertModel) => ({
- ...alert,
- created_at: iso8601Formatter(alert.created_at, storeState.timezone),
- }))),
alertStateLabels: getAlertStateI18n(),
urgencyLabels: getAlertUrgencyI18n(),
- loading: true,
totalCount: 0,
searchText: '',
pageLimit: 15,
pageStart: 1,
+ listTotalCount: 0,
visibleCustomFieldModal: false,
});
const filterState = reactive({
+ pageStart: 1,
+ pageLimit: 15,
+ sortKey: 'created_at',
+ sortDesc: true,
selectedServiceId: '',
statusFields: computed(() => ([
{ label: i18n.t('ALERT_MANAGER.ALERTS.OPEN'), name: ALERT_STATUS_FILTERS.OPEN },
@@ -102,45 +98,52 @@ const filterState = reactive({
selectedLabels: [] as SelectDropdownMenuItem[],
});
-
-const alertListApiQueryHelper = new ApiQueryHelper().setSort('created_at', true)
- .setPage(1, 15);
const queryTagHelper = useQueryTags({ keyItemSets: ALERT_MANAGEMENT_TABLE_HANDLER.keyItemSets });
const { queryTags } = queryTagHelper;
-const getAlertsFilter = ():AlertListParameters => {
- alertListApiQueryHelper.setFilters(queryTagHelper.filters.value);
- if (filterState.selectedStatusFilter === ALERT_STATUS_FILTERS.OPEN) {
- alertListApiQueryHelper.addFilter({ k: 'status', v: [ALERT_STATUS_FILTERS.TRIGGERED, ALERT_STATUS_FILTERS.ACKNOWLEDGED], o: '=' });
- } else if (filterState.selectedStatusFilter !== 'ALL') {
- alertListApiQueryHelper.addFilter({ k: 'status', v: filterState.selectedStatusFilter, o: '=' });
- }
- if (filterState.selectedUrgencyFilter !== 'ALL') {
- alertListApiQueryHelper.addFilter({ k: 'urgency', v: filterState.selectedUrgencyFilter, o: '=' });
- }
- if (filterState.selectedLabels.length > 0) {
- alertListApiQueryHelper.addFilter({ k: 'labels', v: filterState.selectedLabels.map((i) => i.name), o: '=' });
- }
- return ({
- query: alertListApiQueryHelper.data,
- asset_id: props.cloudServiceId,
- });
-};
+const queryClient = useQueryClient();
+const { alertAPI } = useAlertApi();
+const alertListApiQueryHelper = new ApiQueryHelper();
+const { key: alertListBaseQueryKey } = useServiceQueryKey('alert-manager', 'alert', 'list');
+const { key: alertListQueryKey, params: alertListQueryParams } = useServiceQueryKey('alert-manager', 'alert', 'list', {
+ params: computed(() => {
+ alertListApiQueryHelper
+ .setPage(filterState.pageStart, filterState.pageLimit)
+ .setSort(filterState.sortKey, filterState.sortDesc)
+ .setFilters(queryTagHelper.filters.value);
+ if (filterState.selectedStatusFilter === ALERT_STATUS_FILTERS.OPEN) {
+ alertListApiQueryHelper.addFilter({ k: 'status', v: [ALERT_STATUS_FILTERS.TRIGGERED, ALERT_STATUS_FILTERS.ACKNOWLEDGED], o: '=' });
+ } else if (filterState.selectedStatusFilter !== 'ALL') {
+ alertListApiQueryHelper.addFilter({ k: 'status', v: filterState.selectedStatusFilter, o: '=' });
+ }
+ if (filterState.selectedUrgencyFilter !== 'ALL') {
+ alertListApiQueryHelper.addFilter({ k: 'urgency', v: filterState.selectedUrgencyFilter, o: '=' });
+ }
+ if (filterState.selectedLabels.length > 0) {
+ alertListApiQueryHelper.addFilter({ k: 'labels', v: filterState.selectedLabels.map((i) => i.name), o: '=' });
+ }
-const fetchAlerts = async () => {
- state.loading = true;
- const params:AlertListParameters = getAlertsFilter();
- try {
- const { results, total_count } = await SpaceConnector.clientV2.alertManager.alert.list>(params);
- state.items = results || [];
- state.totalCount = total_count || 0;
- } catch (e) {
- ErrorHandler.handleError(e);
- state.items = [];
- state.totalCount = 0;
- } finally {
- state.loading = false;
- }
+ return ({
+ query: alertListApiQueryHelper.data,
+ asset_id: props.cloudServiceId,
+ });
+ }),
+});
+const { data: alertListData, isFetching: alertListLoading } = useScopedQuery({
+ queryKey: alertListQueryKey,
+ queryFn: async () => alertAPI.list(alertListQueryParams.value),
+ select: (data) => ({
+ results: (data.results ?? []).map((alert:AlertModel) => ({
+ ...alert,
+ created_at: iso8601Formatter(alert.created_at, storeState.timezone),
+ })),
+ totalCount: data.total_count ?? 0,
+ }),
+ gcTime: 1000 * 60 * 2,
+ staleTime: 1000 * 30,
+}, ['DOMAIN', 'WORKSPACE']);
+const refreshhAlertData = () => {
+ queryClient.invalidateQueries({ queryKey: alertListBaseQueryKey.value });
};
const getCreatedByNames = (id: string): string => {
if (id.includes('webhook')) {
@@ -159,14 +162,11 @@ const handleCustomFieldUpdate = (fields: DataTableFieldType[]) => {
};
const handleChange = async (options: any = {}) => {
- if (options.sortBy !== undefined) alertListApiQueryHelper.setSort(options.sortBy, options.sortDesc);
+ if (options.sortBy !== undefined) filterState.sortKey = options.sortBy;
+ if (options.sortDesc !== undefined) filterState.sortDesc = options.sortDesc;
if (options.queryTags !== undefined) queryTagHelper.setQueryTags(options.queryTags);
- if (options.pageStart !== undefined) alertListApiQueryHelper.setPageStart(options.pageStart);
- if (options.pageLimit !== undefined) alertListApiQueryHelper.setPageLimit(options.pageLimit);
- await fetchAlerts();
-};
-const handleRefreshAlertData = async () => {
- await fetchAlerts();
+ if (options.pageStart !== undefined) filterState.pageStart = options.pageStart;
+ if (options.pageLimit !== undefined) filterState.pageLimit = options.pageLimit;
};
const handleSelectFilter = (type: 'status' | 'urgency', value: string) => {
@@ -175,7 +175,6 @@ const handleSelectFilter = (type: 'status' | 'urgency', value: string) => {
} else {
filterState.selectedUrgencyFilter = value;
}
- fetchAlerts();
};
const handleExport = async () => {
@@ -191,10 +190,12 @@ const handleExport = async () => {
};
watch(() => props.cloudServiceId, (after, before) => {
- if (!after) {
- state.projectUserIdList = [];
- } else if (after !== before) fetchAlerts();
+ if (after !== before) refreshhAlertData();
}, { immediate: true });
+watch(alertListData, (d) => {
+ if (!d || !d.totalCount || state.listTotalCount === d.totalCount) return;
+ state.listTotalCount = d.totalCount || 0;
+});
@@ -203,7 +204,7 @@ watch(() => props.cloudServiceId, (after, before) => {
heading-type="sub"
use-total-count
:title="$t('INVENTORY.CLOUD_SERVICE.PAGE.TAB_ALERTS')"
- :total-count="state.totalCount"
+ :total-count="state.listTotalCount"
/>
props.cloudServiceId, (after, before) => {
sort-by="created_at"
:sort-desc="true"
:query-tags="queryTags"
- :loading="state.loading"
- :total-count="state.totalCount"
+ :loading="alertListLoading"
+ :total-count="state.listTotalCount"
:fields="state.fields"
- :items="state.refinedItems"
+ :items="alertListData?.results"
:key-item-sets="ALERT_MANAGEMENT_TABLE_HANDLER.keyItemSets"
:value-handler-map="ALERT_MANAGEMENT_TABLE_HANDLER.valueHandlerMap"
settings-visible
@change="handleChange"
@click-settings="handleClickSettings"
- @refresh="handleRefreshAlertData"
+ @refresh="refreshhAlertData"
@export="handleExport"
>
@@ -304,7 +305,7 @@ watch(() => props.cloudServiceId, (after, before) => {
resource-type="cloudService.alert"
:default-field="ALERT_MANAGEMENT_TABLE_FIELDS"
@update:visible="handleVisibleCustomFieldModal"
- @complete="fetchAlerts"
+ @complete="refreshhAlertData"
@custom-field-loaded="handleCustomFieldUpdate"
/>
diff --git a/apps/web/src/services/asset-inventory/components/CloudServiceLogTab.vue b/apps/web/src/services/asset-inventory/components/CloudServiceLogTab.vue
index 67ae196d4c..322957bfcd 100644
--- a/apps/web/src/services/asset-inventory/components/CloudServiceLogTab.vue
+++ b/apps/web/src/services/asset-inventory/components/CloudServiceLogTab.vue
@@ -89,10 +89,10 @@ import type { DynamicLayout } from '@cloudforet/mirinae/types/data-display/dynam
import type { TabItem } from '@cloudforet/mirinae/types/navigation/tabs/tab/type';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { DataSourceListParameters } from '@/schema/monitoring/data-source/api-verbs/list';
-import type { DataSourceModel } from '@/schema/monitoring/data-source/model';
-import type { MonitoringLogListParameters } from '@/schema/monitoring/log/api-verbs/list';
-import type { LogDataModel } from '@/schema/monitoring/log/model';
+import type { DataSourceListParameters } from '@/api-clients/monitoring/data-source/schema/api-verbs/list';
+import type { DataSourceModel } from '@/api-clients/monitoring/data-source/schema/model';
+import type { MonitoringLogListParameters } from '@/api-clients/monitoring/log/schema/api-verbs/list';
+import type { LogDataModel } from '@/api-clients/monitoring/log/schema/model';
import { i18n } from '@/translations';
import { useUserStore } from '@/store/user/user-store';
diff --git a/apps/web/src/services/cost-explorer/routes/admin/routes.ts b/apps/web/src/services/cost-explorer/routes/admin/routes.ts
index c70f0004ac..7250b23ed5 100644
--- a/apps/web/src/services/cost-explorer/routes/admin/routes.ts
+++ b/apps/web/src/services/cost-explorer/routes/admin/routes.ts
@@ -4,7 +4,7 @@ import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { CostDataSourceListParameters } from '@/api-clients/cost-analysis/data-source/schema/api-verbs/list';
-import type { DataSourceModel } from '@/schema/monitoring/data-source/model';
+import type { DataSourceModel } from '@/api-clients/monitoring/data-source/schema/model';
import { MENU_ID } from '@/lib/menu/config';
import { MENU_INFO_MAP } from '@/lib/menu/menu-info';
diff --git a/apps/web/src/services/iam/components/SelectChannelCard.vue b/apps/web/src/services/iam/components/SelectChannelCard.vue
index 1ee70dbad2..3817fbd3cc 100644
--- a/apps/web/src/services/iam/components/SelectChannelCard.vue
+++ b/apps/web/src/services/iam/components/SelectChannelCard.vue
@@ -3,16 +3,17 @@ import { computed, reactive } from 'vue';
import { PSelectCard, PLazyImg } from '@cloudforet/mirinae';
+import { useNotificationProtocolApi } from '@/api-clients/alert-manager/notification-protocol/composables/use-notification-protocol-api';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
+
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
import type { PluginReferenceMap } from '@/store/reference/plugin-reference-store';
import { assetUrlConverter } from '@/lib/helper/asset-helper';
import { useNotificationChannelCreateFormStore } from '@/services/iam/store/notification-channel-create-form-store';
-import { useUserGroupPageStore } from '@/services/iam/store/user-group-page-store';
-const userGroupPageStore = useUserGroupPageStore();
-const userGroupPageState = userGroupPageStore.state;
const notificationChannelCreateFormStore = useNotificationChannelCreateFormStore();
@@ -24,14 +25,25 @@ const storeState = reactive({
});
const state = reactive({
- protocolList: computed<{ icon: string; label: string; value: string; }[]>(() => userGroupPageState.protocolList.map((protocol) => ({
- icon: storeState.plugins[protocol.plugin_info.plugin_id]?.icon || '',
- label: protocol.name,
- value: protocol.protocol_id,
- }))),
selectedProtocol: {},
});
+const { notificationProtocolAPI } = useNotificationProtocolApi();
+const { key: notificationProtocolListQueryKey } = useServiceQueryKey('alert-manager', 'notification-protocol', 'list');
+
+const { data: notificationProtocolListData } = useScopedQuery({
+ queryKey: notificationProtocolListQueryKey,
+ queryFn: async () => notificationProtocolAPI.list(),
+ select: (data) => data.results?.map((i) => ({
+ label: i.name,
+ value: i.protocol_id,
+ icon: storeState.plugins[i.plugin_info.plugin_id]?.icon || '',
+ })),
+ enabled: computed(() => Object.keys(storeState.plugins).length > 0),
+ gcTime: 1000 * 60 * 2,
+ staleTime: 1000 * 30,
+}, ['DOMAIN', 'WORKSPACE']);
+
/* Component */
const handleSelectChannel = (selectedProtocol) => {
notificationChannelCreateFormStore.$patch((_state) => {
@@ -46,7 +58,7 @@ const handleSelectChannel = (selectedProtocol) => {
-
();
@@ -24,14 +16,21 @@ const userStore = useUserStore();
const notificationChannelCreateFormStore = useNotificationChannelCreateFormStore();
const notificationChannelCreateFormState = notificationChannelCreateFormStore.state;
+interface Props {
+ schema: JsonSchema;
+}
+
interface ChannelState {
schemaForm: Record;
- schema: JsonSchema | null;
isSchemaFormValid: boolean;
isJsonSchema: ComputedRef;
isDataValid: ComputedRef;
}
+const props = withDefaults(defineProps(), {
+ schema: () => ({}),
+});
+
const storeState = reactive({
protocolId: computed(() => notificationChannelCreateFormState.selectedProtocol.protocol_id),
language: computed(() => userStore.state.language),
@@ -39,32 +38,12 @@ const storeState = reactive({
const state = reactive({
schemaForm: {},
- schema: null,
isSchemaFormValid: false,
- isJsonSchema: computed((): boolean => (state.schema ? Object.keys(state.schema).length !== 0 : false)),
+ isJsonSchema: computed((): boolean => (props.schema ? Object.keys(props.schema).length !== 0 : false)),
isDataValid: computed(() => (!state.isJsonSchema && !state.isNameInvalid)),
});
-const apiQuery = new ApiQueryHelper();
-const getSchema = async (): Promise => {
- try {
- apiQuery.setFilters([{ k: 'protocol_id', v: storeState.protocolId, o: '=' }]);
- const res = await SpaceConnector.clientV2.alertManager.notificationProtocol.list>({
- query: apiQuery.data,
- });
- return res.results?.[0]?.plugin_info.metadata.data.schema ?? {};
- } catch (e) {
- ErrorHandler.handleError(e, true);
- return null;
- }
-};
-
/* Watcher */
-watch(() => storeState.protocolId, async (nv_selected_protocol) => {
- if (!nv_selected_protocol) return;
- state.schema = await getSchema();
-}, { deep: true, immediate: true });
-
watch(() => state.schemaForm, (nv_schema_form) => {
if (nv_schema_form) {
notificationChannelCreateFormStore.$patch((_state) => {
@@ -91,7 +70,7 @@ const handleSchemaFormChange = (isValid, form) => {
-import { reactive } from 'vue';
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import { PButtonModal } from '@cloudforet/mirinae';
-import type { UserGroupChannelDeleteParameters } from '@/schema/alert-manager/user-group-channel/api-verbs/delete';
-import type { UserGroupChannelModel } from '@/schema/alert-manager/user-group-channel/model';
+import { useUserGroupChannelApi } from '@/api-clients/alert-manager/user-group-channel/composables/use-user-group-channel-api';
+import type { UserGroupChannelDeleteParameters } from '@/api-clients/alert-manager/user-group-channel/schema/api-verbs/delete';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import { i18n } from '@/translations';
import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
@@ -19,28 +19,36 @@ const userGroupPageStore = useUserGroupPageStore();
const userGroupPageState = userGroupPageStore.state;
const userGroupPageGetters = userGroupPageStore.getters;
+const queryClient = useQueryClient();
+const { userGroupChannelAPI } = useUserGroupChannelApi();
+const { key: userGroupChannelListQueryKey } = useServiceQueryKey('alert-manager', 'user-group-channel', 'list');
+
const emit = defineEmits<{(e: 'confirm'): void; }>();
-const state = reactive({
- loading: false,
+const { mutate: userGroupChannelDeleteMutate, isPending: userGroupChannelDeletePending } = useMutation({
+ mutationFn: (params: UserGroupChannelDeleteParameters) => userGroupChannelAPI.delete(params),
+ onSuccess: () => {
+ emit('confirm');
+ showSuccessMessage('', i18n.t('IAM.USER_GROUP.MODAL.DELETE.SHOW_SUCCESS_MESSAGE'));
+ userGroupPageState.userGroupChannels.selectedIndices = [];
+ queryClient.invalidateQueries({ queryKey: userGroupChannelListQueryKey.value });
+ },
+ onError: (error) => {
+ ErrorHandler.handleError(error, true);
+ },
+ onSettled: () => {
+ handleCancel();
+ },
});
/* Component */
-const handleConfirm = async () => {
- try {
- state.loading = true;
- if (userGroupPageGetters.selectedUserGroups && userGroupPageGetters.selectedUserGroups[0].notification_channel && userGroupPageGetters.selectedUserGroups[0].notification_channel.length > 0) {
- await fetchDeleteNotificationChannel({
- channel_id: userGroupPageGetters.selectedUserGroups[0].notification_channel[userGroupPageState.userGroupChannels.selectedIndices[0]].channel_id,
- });
- emit('confirm');
- showSuccessMessage('', i18n.t('IAM.USER_GROUP.MODAL.DELETE.SHOW_SUCCESS_MESSAGE'));
- userGroupPageState.userGroupChannels.selectedIndices = [];
- }
- } finally {
- state.loading = false;
- handleCancel();
+const handleConfirm = () => {
+ if (!userGroupPageGetters.selectedUserGroupChannel?.[0]?.channel_id) {
+ return;
}
+ userGroupChannelDeleteMutate({
+ channel_id: userGroupPageGetters.selectedUserGroupChannel[0].channel_id,
+ });
};
const handleCancel = () => {
@@ -50,21 +58,12 @@ const handleCancel = () => {
themeColor: 'primary',
};
};
-
-/* API */
-const fetchDeleteNotificationChannel = async (params: UserGroupChannelDeleteParameters) => {
- try {
- await SpaceConnector.clientV2.alertManager.userGroupChannel.delete(params);
- } catch (e) {
- ErrorHandler.handleError(e, true);
- }
-};
-import { onMounted, reactive, watch } from 'vue';
+import {
+ computed, reactive, watch,
+} from 'vue';
+import type { ComputedRef } from 'vue';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import {
PFieldGroup, PTextInput,
} from '@cloudforet/mirinae';
-import type { MenuItem } from '@cloudforet/mirinae/types/inputs/context-menu/type';
-
+import type { MenuItem } from '@cloudforet/mirinae/types/controls/context-menu/type';
+import type { JsonSchema } from '@cloudforet/mirinae/types/controls/forms/json-schema-form/type';
-import type { NotificationProtocolGetParameters } from '@/schema/alert-manager/notification-protocol/api-verbs/get';
-import type { NotificationProtocolModel } from '@/schema/alert-manager/notification-protocol/model';
+import { useNotificationProtocolApi } from '@/api-clients/alert-manager/notification-protocol/composables/use-notification-protocol-api';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import { i18n } from '@/translations';
-import ErrorHandler from '@/common/composables/error/errorHandler';
import { useFormValidator } from '@/common/composables/form-validator';
import UserGroupChannelAddFormData from '@/services/iam/components/UserGroupChannelAddFormData.vue';
@@ -29,9 +31,9 @@ const userGroupPageState = userGroupPageStore.state;
interface ChannelInfo {
channelName: string;
- channelData: Record
+ schema: ComputedRef;
+ channelData: ComputedRef>;
channelInput: any;
- selectedProtocolData: any;
}
interface UserModeInfo {
@@ -39,11 +41,29 @@ interface UserModeInfo {
users: MenuItem[]
}
+const protocolId = computed(() => notificationChannelCreateFormState.selectedProtocol.protocol_id);
+
+const { notificationProtocolAPI } = useNotificationProtocolApi();
+
+const { key: notificationProtocolQueryKey, params: notificationProtocolQueryParams } = useServiceQueryKey('alert-manager', 'notification-protocol', 'get', {
+ params: computed(() => ({
+ protocol_id: protocolId.value,
+ })),
+});
+
+const { data: notificationProtocolData } = useScopedQuery({
+ queryKey: notificationProtocolQueryKey,
+ queryFn: () => notificationProtocolAPI.get(notificationProtocolQueryParams.value),
+ enabled: computed(() => !!protocolId.value),
+ gcTime: 1000 * 60 * 2,
+ staleTime: 1000 * 30,
+}, ['DOMAIN', 'WORKSPACE']);
+
const state = reactive({
channelName: '',
- channelData: {},
+ schema: computed(() => notificationProtocolData.value?.plugin_info.metadata.data.schema ?? {}),
+ channelData: computed(() => state.schema.properties || {}),
channelInput: {},
- selectedProtocolData: {},
userMode: {},
users: [],
});
@@ -82,20 +102,13 @@ watch(() => channelName, (nv_channel_name) => {
}
}, { immediate: true });
-watch(() => state.selectedProtocolData, (nv_selected_protocol_data) => {
- if (nv_selected_protocol_data) {
- const { schema } = nv_selected_protocol_data.plugin_info.metadata.data;
- state.channelData = schema.properties;
- // store value. (not using both of them - will be deprecated one of them later)
- notificationChannelCreateFormStore.$patch((_state) => {
- _state.state.protocolSchemaForm = schema.properties;
- });
- }
-});
-
watch(() => state.channelData, (nv_channel_data) => {
if (nv_channel_data) {
state.channelInput = Object.keys(nv_channel_data);
+ // store value. (not using both of them - will be deprecated one of them later)
+ notificationChannelCreateFormStore.$patch((_state) => {
+ _state.state.protocolSchemaForm = nv_channel_data;
+ });
}
}, { deep: true, immediate: true });
@@ -106,24 +119,6 @@ watch(() => validateState, (nv_validate_state) => {
emit('update-valid', false);
}
}, { deep: true, immediate: true });
-
-/* API */
-const fetchGetNotificationProtocol = async (params: NotificationProtocolGetParameters) => {
- try {
- state.selectedProtocolData = await SpaceConnector.clientV2.alertManager.notificationProtocol.get(params);
- } catch (e) {
- ErrorHandler.handleError(e, true);
- }
-};
-
-/* Mounted */
-onMounted(async () => {
- if (notificationChannelCreateFormState.selectedProtocol) {
- await fetchGetNotificationProtocol({
- protocol_id: notificationChannelCreateFormState.selectedProtocol.protocol_id,
- });
- }
-});
@@ -141,6 +136,7 @@ onMounted(async () => {
diff --git a/apps/web/src/services/iam/components/UserGroupChannelSetModal.vue b/apps/web/src/services/iam/components/UserGroupChannelSetModal.vue
index 4d435447b8..8265eab540 100644
--- a/apps/web/src/services/iam/components/UserGroupChannelSetModal.vue
+++ b/apps/web/src/services/iam/components/UserGroupChannelSetModal.vue
@@ -3,16 +3,17 @@ import {
computed, reactive, ref, watch,
} from 'vue';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
+
import { PButtonModal, PButton, PLazyImg } from '@cloudforet/mirinae';
-import type { NotificationProtocolModel } from '@/schema/alert-manager/notification-protocol/model';
-import type { UserGroupChannelCreateParameters } from '@/schema/alert-manager/user-group-channel/api-verbs/create';
-import type { UserGroupChannelUpdateParameters } from '@/schema/alert-manager/user-group-channel/api-verbs/update';
-import type { UserGroupChannelModel } from '@/schema/alert-manager/user-group-channel/model';
+import { useUserGroupChannelApi } from '@/api-clients/alert-manager/user-group-channel/composables/use-user-group-channel-api';
+import type { UserGroupChannelCreateParameters } from '@/api-clients/alert-manager/user-group-channel/schema/api-verbs/create';
+import type { UserGroupChannelUpdateParameters } from '@/api-clients/alert-manager/user-group-channel/schema/api-verbs/update';
import type {
UserGroupChannelScheduleInfoType,
-} from '@/schema/alert-manager/user-group-channel/type';
+} from '@/api-clients/alert-manager/user-group-channel/schema/type';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import { i18n } from '@/translations';
import { assetUrlConverter } from '@/lib/helper/asset-helper';
@@ -38,13 +39,16 @@ const emit = defineEmits<{(e: 'confirm'): void; }>();
interface ChannelSetModalState {
loading: boolean;
channelName: string;
- selectedProtocolData?: NotificationProtocolModel | undefined,
scheduleInfo: UserGroupChannelScheduleInfoType;
}
const isCreateAble = ref(false);
const isSchemaValid = ref(false);
+const queryClient = useQueryClient();
+const { userGroupChannelAPI } = useUserGroupChannelApi();
+const { key: userGroupChannelListQueryKey } = useServiceQueryKey('alert-manager', 'user-group-channel', 'list');
+
const storeState = reactive({
protocolIcon: computed(() => notificationChannelCreateFormState.selectedProtocol.icon),
protocolName: computed(() => notificationChannelCreateFormState.selectedProtocol.name),
@@ -54,10 +58,39 @@ const storeState = reactive({
const state = reactive({
loading: false,
channelName: '',
- selectedProtocolData: {},
scheduleInfo: notificationChannelCreateFormState.scheduleInfo,
});
+// TODO: Distinguishing conditions using modal types, etc.
+const { mutate: userGroupChannelMutate } = useMutation({
+ mutationFn: (params: UserGroupChannelCreateParameters|UserGroupChannelUpdateParameters) => {
+ if (userGroupPageState.modal.title === i18n.t('IAM.USER_GROUP.MODAL.CREATE_CHANNEL.TITLE')) {
+ return userGroupChannelAPI.create(params as UserGroupChannelCreateParameters);
+ }
+ return userGroupChannelAPI.update(params as UserGroupChannelUpdateParameters);
+ },
+ onSuccess: () => {
+ emit('confirm');
+ queryClient.invalidateQueries({ queryKey: userGroupChannelListQueryKey.value });
+ if (userGroupPageState.modal.title === i18n.t('IAM.USER_GROUP.MODAL.CREATE_CHANNEL.TITLE')) {
+ showSuccessMessage('', i18n.t('IAM.USER_GROUP.MODAL.CREATE_CHANNEL.SUCCESS_MESSAGE'));
+ } else {
+ showSuccessMessage('', i18n.t('IAM.USER_GROUP.MODAL.CREATE_CHANNEL.UPDATE_SUCCESS_MESSAGE'));
+ }
+ },
+ onError: (error) => {
+ ErrorHandler.handleError(error, true);
+ },
+ onSettled: () => {
+ notificationChannelCreateFormStore.initState();
+ userGroupPageState.modal = {
+ type: '',
+ title: '',
+ themeColor: 'primary',
+ };
+ },
+});
+
/* Component */
const handleChannelName = (value: string) => {
state.channelName = value;
@@ -72,40 +105,22 @@ const handleSchemaValid = (value: boolean) => {
};
const handleConfirm = async () => {
- try {
- state.loading = true;
- if (userGroupPageState.modal.title === i18n.t('IAM.USER_GROUP.MODAL.CREATE_CHANNEL.TITLE')) {
- await fetchCreateUserGroupChannel({
- protocol_id: notificationChannelCreateFormState.selectedProtocol.protocol_id,
- name: state.channelName,
- schedule: notificationChannelCreateFormState.scheduleInfo,
- data: {
- ...notificationChannelCreateFormState.protocolSchemaForm,
- },
- tags: {},
- user_group_id: userGroupPageGetters.selectedUserGroups[0].user_group_id,
- });
- emit('confirm');
- showSuccessMessage('', i18n.t('IAM.USER_GROUP.MODAL.CREATE_CHANNEL.SUCCESS_MESSAGE'));
- } else if (userGroupPageState.modal.title === i18n.t('IAM.USER_GROUP.MODAL.CREATE_CHANNEL.UPDATE_TITLE')) {
- await fetchUpdateUserGroupChannel({
- channel_id: userGroupPageGetters.selectedUserGroupChannel[0].channel_id,
- name: state.channelName,
- data: {},
- schedule: notificationChannelCreateFormState.scheduleInfo,
- });
- emit('confirm');
- showSuccessMessage('', i18n.t('IAM.USER_GROUP.MODAL.CREATE_CHANNEL.UPDATE_SUCCESS_MESSAGE'));
- }
- } finally {
- state.loading = false;
- notificationChannelCreateFormStore.initState();
- userGroupPageState.modal = {
- type: '',
- title: '',
- themeColor: 'primary',
- };
- }
+ const params: UserGroupChannelCreateParameters|UserGroupChannelUpdateParameters = userGroupPageState.modal.title === i18n.t('IAM.USER_GROUP.MODAL.CREATE_CHANNEL.TITLE') ? {
+ protocol_id: notificationChannelCreateFormState.selectedProtocol.protocol_id,
+ name: state.channelName,
+ schedule: notificationChannelCreateFormState.scheduleInfo,
+ data: {
+ ...notificationChannelCreateFormState.protocolSchemaForm,
+ },
+ tags: {},
+ user_group_id: userGroupPageGetters.selectedUserGroups[0]?.user_group_id,
+ } as UserGroupChannelCreateParameters : {
+ channel_id: userGroupPageGetters.selectedUserGroupChannel[0].channel_id,
+ name: state.channelName,
+ data: {},
+ schedule: notificationChannelCreateFormState.scheduleInfo,
+ } as UserGroupChannelUpdateParameters;
+ userGroupChannelMutate(params);
};
const handleCancel = () => {
@@ -130,25 +145,6 @@ const handleClose = () => {
};
};
-/* API */
-const fetchCreateUserGroupChannel = async (params: UserGroupChannelCreateParameters) => {
- try {
- return await SpaceConnector.clientV2.alertManager.userGroupChannel.create(params);
- } catch (e) {
- ErrorHandler.handleError(e, true);
- return {};
- }
-};
-
-const fetchUpdateUserGroupChannel = async (params: UserGroupChannelUpdateParameters) => {
- try {
- return await SpaceConnector.clientV2.alertManager.userGroupChannel.update(params);
- } catch (e) {
- ErrorHandler.handleError(e, true);
- return {};
- }
-};
-
/* Watcher */
watch([() => notificationChannelCreateFormState, isSchemaValid], (nv_channel_state, nv_is_schema_valid) => {
// isCreateAble.value = !!nv_channel_state.channelName;
diff --git a/apps/web/src/services/iam/components/UserGroupManagementTabNotificationChannel.vue b/apps/web/src/services/iam/components/UserGroupManagementTabNotificationChannel.vue
index 637bdbb9d6..8fdb54e850 100644
--- a/apps/web/src/services/iam/components/UserGroupManagementTabNotificationChannel.vue
+++ b/apps/web/src/services/iam/components/UserGroupManagementTabNotificationChannel.vue
@@ -1,28 +1,26 @@
@@ -374,7 +342,7 @@ onMounted(async () => {
@@ -411,33 +379,29 @@ onMounted(async () => {
searchable
selectable
sortable
- sort-desc
- :loading="state.loading"
+ :loading="userGroupChannelListFetching"
:multi-select="false"
:key-item-sets="USER_GROUP_CHANNELS_SEARCH_HANDLERS"
:query-tags="queryTags"
+ :this-page.sync="paginationState.thisPage"
+ :page-size.sync="paginationState.pageSize"
+ :total-count="userGroupChannelListTotalCount"
:value-handler-map="tableState.valueHandlerMap"
:select-index="userGroupPageState.userGroupChannels.selectedIndices"
:fields="tableState.fields"
:items="tableState.items"
@select="handleSelect"
@change="handleChange"
- @refresh="handleChange()"
+ @refresh="refreshUserGroupChannelList"
>
-
-
-
-
{{ protocol.label }}
-
+
+
+
{{ getProtocolInfo(value)?.name }}
diff --git a/apps/web/src/services/iam/components/UserGroupManagementTable.vue b/apps/web/src/services/iam/components/UserGroupManagementTable.vue
index 01a5ed5bc2..7591c91390 100644
--- a/apps/web/src/services/iam/components/UserGroupManagementTable.vue
+++ b/apps/web/src/services/iam/components/UserGroupManagementTable.vue
@@ -12,6 +12,10 @@ import { PToolboxTable, PSelectDropdown } from '@cloudforet/mirinae';
import type { DataTableFieldType } from '@cloudforet/mirinae/types/data-display/tables/data-table/type';
import type { MenuItem } from '@cloudforet/mirinae/types/inputs/context-menu/type';
+import { useUserGroupChannelApi } from '@/api-clients/alert-manager/user-group-channel/composables/use-user-group-channel-api';
+import type { UserGroupChannelModel } from '@/api-clients/alert-manager/user-group-channel/schema/model';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import { i18n } from '@/translations';
import { useQueryTags } from '@/common/composables/query-tags';
@@ -40,6 +44,16 @@ let userGroupListApiQuery = userGroupListApiQueryHelper.data;
const queryTagHelper = useQueryTags({ keyItemSets: USER_GROUP_SEARCH_HANDLERS });
const { queryTags } = queryTagHelper;
+const { userGroupChannelAPI } = useUserGroupChannelApi();
+const { key: userGroupChannelListQueryKey, params: userGroupChannelListQueryParams } = useServiceQueryKey('alert-manager', 'user-group-channel', 'list');
+const { data: userGroupChannelListData } = useScopedQuery({
+ queryKey: userGroupChannelListQueryKey,
+ queryFn: async () => userGroupChannelAPI.list(userGroupChannelListQueryParams.value),
+ staleTime: 1000 * 60 * 2,
+ gcTime: 1000 * 60 * 2,
+}, ['DOMAIN', 'WORKSPACE']);
+
+
const storeState = reactive({
loading: computed(() => userGroupPageState.loading),
});
@@ -47,6 +61,7 @@ const storeState = reactive({
const state = reactive({
userGroupItems: computed(() => userGroupPageState.userGroups.map((userGroup) => ({
...userGroup,
+ notification_channel: countChannelsByUserGroupId(userGroupChannelListData.value?.results || [], userGroup.user_group_id || ''),
}))),
});
@@ -93,6 +108,16 @@ const dropdownState = reactive({
});
/* Component */
+const countChannelsByUserGroupId = (channels: UserGroupChannelModel[], targetId: string): number => {
+ const grouped = channels.reduce>((acc, item) => {
+ const groupId = item.user_group_id;
+ if (!acc[groupId]) acc[groupId] = [];
+ acc[groupId].push(item);
+ return acc;
+ }, {});
+
+ return grouped[targetId]?.length ?? 0;
+};
const handleSelect = async (index) => {
userGroupPageState.selectedIndices = index;
};
@@ -186,7 +211,7 @@ onMounted(async () => {
/>
- {{ Array.isArray(value) && value.length > 0 ? value.length : 0 }}
+ {{ value }}
{{ Array.isArray(value) && value.length > 0 ? value.length : 0 }}
diff --git a/apps/web/src/services/iam/store/notification-channel-create-form-store.ts b/apps/web/src/services/iam/store/notification-channel-create-form-store.ts
index cd4cf576cb..b2dd4f15f4 100644
--- a/apps/web/src/services/iam/store/notification-channel-create-form-store.ts
+++ b/apps/web/src/services/iam/store/notification-channel-create-form-store.ts
@@ -2,7 +2,7 @@ import { reactive } from 'vue';
import { defineStore } from 'pinia';
-import type { UserGroupChannelScheduleInfoType } from '@/schema/alert-manager/user-group-channel/type';
+import type { UserGroupChannelScheduleInfoType } from '@/api-clients/alert-manager/user-group-channel/schema/type';
interface NotificationChannelCreateFormState {
selectedProtocol: {
diff --git a/apps/web/src/services/iam/store/user-group-page-store.ts b/apps/web/src/services/iam/store/user-group-page-store.ts
index 616b382f79..909caa0942 100644
--- a/apps/web/src/services/iam/store/user-group-page-store.ts
+++ b/apps/web/src/services/iam/store/user-group-page-store.ts
@@ -9,14 +9,13 @@ import type { ConsoleFilter } from '@cloudforet/core-lib/query/type';
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { UserGroupChannelModel } from '@/api-clients/alert-manager/user-group-channel/schema/model';
import type { UserGroupGetParameters } from '@/api-clients/identity/user-group/schema/api-verbs/get';
import type { UserGroupListParameters } from '@/api-clients/identity/user-group/schema/api-verbs/list';
import type { UserGroupModel } from '@/api-clients/identity/user-group/schema/model';
import type { UserGroupListItemType } from '@/api-clients/identity/user-group/schema/type';
import type { WorkspaceUserListParameters } from '@/api-clients/identity/workspace-user/schema/api-verbs/list';
import type { WorkspaceUserModel } from '@/api-clients/identity/workspace-user/schema/model';
-import type { UserGroupChannelListParameters } from '@/schema/alert-manager/user-group-channel/api-verbs/list';
-import type { UserGroupChannelModel } from '@/schema/alert-manager/user-group-channel/model';
import ErrorHandler from '@/common/composables/error/errorHandler';
@@ -47,7 +46,6 @@ interface UserGroupPageState {
selectedIndices: number[];
searchFilters: ConsoleFilter[];
}
- protocolList?: any[];
modal: ModalState;
}
@@ -76,13 +74,20 @@ export const useUserGroupPageStore = defineStore('page-user-group', () => {
selectedIndices: [],
searchFilters: [],
},
- protocolList: [],
modal: {
type: '',
title: '',
themeColor: 'primary',
},
});
+ const mutations = {
+ selectedUserGroupChannelIdx(index: number[]) {
+ state.userGroupChannels.selectedIndices = index;
+ },
+ setSelectedUserGroupChannel(list: UserGroupChannelModel[]) {
+ state.userGroupChannels.list = list;
+ },
+ };
const getters = reactive({
selectedUserGroups: computed((): UserGroupListItemType[] => {
if (state.selectedIndices.length === 1 && !isEmpty(state.selectedUserGroup)) return [state.selectedUserGroup];
@@ -94,10 +99,9 @@ export const useUserGroupPageStore = defineStore('page-user-group', () => {
}),
selectedUserGroupChannel: computed(() => {
const userGroupChannels: UserGroupChannelModel[] = [];
- state.userGroupChannels.selectedIndices.forEach((d: number) => {
- if (getters.selectedUserGroups && getters.selectedUserGroups.length > 0 && getters.selectedUserGroups[0].notification_channel) {
- userGroupChannels.push(state.userGroupChannels.list[d]);
- }
+ state.userGroupChannels.selectedIndices.forEach((index) => {
+ const channel = state.userGroupChannels.list[index];
+ if (channel) userGroupChannels.push(channel);
});
return userGroupChannels ?? [];
}),
@@ -127,7 +131,6 @@ export const useUserGroupPageStore = defineStore('page-user-group', () => {
selectedIndices: [],
searchFilters: [],
};
- state.protocolList = [];
state.modal = {
type: '',
title: '',
@@ -138,15 +141,7 @@ export const useUserGroupPageStore = defineStore('page-user-group', () => {
try {
const { results = [], total_count = 0 } = await SpaceConnector.clientV2.identity.userGroup.list>(params);
- const userGroupIdToChannelMap = await this.fetchUserGroupChannels(results.map((result) => result.user_group_id));
-
- state.userGroups = results.map((item) => {
- state.userGroupChannels.list = userGroupIdToChannelMap[item.user_group_id] || [];
- return {
- ...item,
- notification_channel: userGroupIdToChannelMap[item.user_group_id] || [],
- };
- }) || [];
+ state.userGroups = results || [];
state.totalCount = total_count ?? 0;
} catch (e) {
ErrorHandler.handleError(e, true);
@@ -155,24 +150,6 @@ export const useUserGroupPageStore = defineStore('page-user-group', () => {
throw e;
}
},
- async fetchUserGroupChannels(userGroupIds: string[]) {
- const userGroupChannelPromises = userGroupIds.map(async (userGroupId) => {
- try {
- const { results = [] } = await SpaceConnector.clientV2.alertManager.userGroupChannel.list>({
- user_group_id: userGroupId,
- });
- return { userGroupId, userGroupChannels: results };
- } catch (e) {
- ErrorHandler.handleError(e, true);
- return { userGroupId: '', userGroupChannels: [] };
- }
- });
- const results = await Promise.all(userGroupChannelPromises);
- return results.reduce((acc, { userGroupId, userGroupChannels }) => {
- acc[userGroupId] = userGroupChannels;
- return acc;
- }, {} as Record);
- },
async getUserGroup(params: UserGroupGetParameters) {
try {
const response = await SpaceConnector.clientV2.identity.userGroup.get(params);
@@ -192,14 +169,6 @@ export const useUserGroupPageStore = defineStore('page-user-group', () => {
ErrorHandler.handleError(e, true);
}
},
- async listUserGroupChannels(params: UserGroupChannelListParameters) {
- try {
- const response = await SpaceConnector.clientV2.alertManager.userGroupChannel.list>(params);
- state.userGroupChannels.list = response.results || [];
- } catch (e) {
- ErrorHandler.handleError(e, true);
- }
- },
updateModalSettings({
type, title, themeColor,
}: ModalState) {
@@ -215,6 +184,7 @@ export const useUserGroupPageStore = defineStore('page-user-group', () => {
return {
state,
getters,
+ ...mutations,
...actions,
};
});
diff --git a/apps/web/src/services/my-page/components/NotificationAddForm.vue b/apps/web/src/services/my-page/components/NotificationAddForm.vue
index d1aa6f4ec5..800347c31f 100644
--- a/apps/web/src/services/my-page/components/NotificationAddForm.vue
+++ b/apps/web/src/services/my-page/components/NotificationAddForm.vue
@@ -2,13 +2,16 @@
import { computed, reactive } from 'vue';
import { useRouter } from 'vue-router/composables';
+import { useMutation, useQueryClient } from '@tanstack/vue-query';
+
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import {
PButton, PPaneLayout,
} from '@cloudforet/mirinae';
-
-import type { UserChannelCreateParameters } from '@/schema/alert-manager/user-channel/api-verbs/create';
+import { useUserChannelApi } from '@/api-clients/alert-manager/user-channel/composables/use-user-channel-api';
+import type { UserChannelCreateParameters } from '@/api-clients/alert-manager/user-channel/schema/api-verbs/create';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import type { NotificationLevel } from '@/schema/notification/notification/type';
import type { ProjectChannelCreateParameters } from '@/schema/notification/project-channel/api-verbs/create';
import type { ChannelSchedule } from '@/schema/notification/type';
@@ -37,8 +40,13 @@ const props = withDefaults(defineProps<{
});
const router = useRouter();
+
const alertManagerUiAffectsSchema = useGlobalConfigUiAffectsSchema('ALERT_MANAGER');
+const queryClient = useQueryClient();
+const { userChannelAPI } = useUserChannelApi();
+const { key: userChannelListBaseQueryKey } = useServiceQueryKey('alert-manager', 'user-channel', 'list');
+
const state = reactive({
visibleUserNotification: computed(() => alertManagerUiAffectsSchema.value?.visibleUserNotification ?? false),
isDataValid: false,
@@ -60,29 +68,40 @@ const state = reactive({
isInputValid: false,
});
-const createUserChannel = async () => {
- try {
- const fetcher = state.visibleUserNotification
- ? SpaceConnector.clientV2.alertManager.userChannel.create({
- protocol_id: props.protocolId,
- name: state.channelName,
- schedule: state.scheduleSettingData,
- data: state.schemaForm,
- tags: {},
- }) : SpaceConnector.clientV2.notification.userChannel.create({
- protocol_id: props.protocolId,
- name: state.channelName,
- data: state.data,
- is_subscribe: state.topicMode,
- subscriptions: state.topicList,
- schedule: state.schedule,
- is_scheduled: state.isScheduled,
- });
- await fetcher;
+const { mutate: userChannelCreateMutate } = useMutation({
+ mutationFn: (params: UserChannelCreateParameters|UserChannelCreateParametersV1) => {
+ if (state.visibleUserNotification) {
+ return userChannelAPI.create(params as UserChannelCreateParameters);
+ }
+ return SpaceConnector.clientV2.notification.userChannel.create(params as UserChannelCreateParametersV1);
+ },
+ onSuccess: () => {
showSuccessMessage(i18n.t('IDENTITY.USER.NOTIFICATION.FORM.ALT_S_CREATE_USER_CHANNEL'), '');
- } catch (e) {
- ErrorHandler.handleRequestError(e, i18n.t('IDENTITY.USER.NOTIFICATION.FORM.ALT_E_CREATE_USER_CHANNEL'));
- }
+ queryClient.invalidateQueries({ queryKey: userChannelListBaseQueryKey.value });
+ },
+ onError: (error) => {
+ ErrorHandler.handleRequestError(error, i18n.t('IDENTITY.USER.NOTIFICATION.FORM.ALT_E_CREATE_USER_CHANNEL'));
+ },
+});
+
+const createUserChannel = async () => {
+ const params = state.visibleUserNotification
+ ? {
+ protocol_id: props.protocolId,
+ name: state.channelName,
+ schedule: state.scheduleSettingData,
+ data: state.schemaForm,
+ tags: {},
+ } : {
+ protocol_id: props.protocolId,
+ name: state.channelName,
+ data: state.data,
+ is_subscribe: state.topicMode,
+ subscriptions: state.topicList,
+ schedule: state.schedule,
+ is_scheduled: state.isScheduled,
+ };
+ userChannelCreateMutate(params);
};
const createProjectChannel = async () => {
diff --git a/apps/web/src/services/my-page/components/NotificationAddFormData.vue b/apps/web/src/services/my-page/components/NotificationAddFormData.vue
index 293adf0bbf..bb894d7888 100644
--- a/apps/web/src/services/my-page/components/NotificationAddFormData.vue
+++ b/apps/web/src/services/my-page/components/NotificationAddFormData.vue
@@ -4,28 +4,23 @@ import {
} from 'vue';
import type { TranslateResult } from 'vue-i18n';
-import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
-import { ApiQueryHelper } from '@cloudforet/core-lib/space-connector/helper';
import {
PFieldGroup, PTextInput, PJsonSchemaForm, PRadioGroup, PRadio,
} from '@cloudforet/mirinae';
import type { MenuItem } from '@cloudforet/mirinae/types/controls/context-menu/type';
import type { JsonSchema } from '@cloudforet/mirinae/types/controls/forms/json-schema-form/type';
-import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { NotificationProtocolListParameters } from '@/schema/alert-manager/notification-protocol/api-verbs/list';
-import type { NotificationProtocolModel } from '@/schema/alert-manager/notification-protocol/model';
+import { useNotificationProtocolApi } from '@/api-clients/alert-manager/notification-protocol/composables/use-notification-protocol-api';
+import { useProtocolApi } from '@/api-clients/notification/protocol/composables/use-protocol-api';
+import { useScopedQuery } from '@/query/composables/use-scoped-query';
+import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import type { NotificationLevel } from '@/schema/notification/notification/type';
-import type { ProtocolListParameters } from '@/schema/notification/protocol/api-verbs/list';
-import type { ProtocolModel } from '@/schema/notification/protocol/model';
import { i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
import type { ProtocolReferenceMap } from '@/store/reference/protocol-reference-store';
import { useUserStore } from '@/store/user/user-store';
-import ErrorHandler from '@/common/composables/error/errorHandler';
-
import NotificationAddLevel from '@/services/my-page/components/NotificationAddLevel.vue';
import NotificationAddMemberGroup from '@/services/my-page/components/NotificationAddMemberGroup.vue';
import type { NotificationAddFormDataPayload } from '@/services/my-page/types/notification-add-form-type';
@@ -62,7 +57,9 @@ const state = reactive({
channelName: undefined as string|undefined,
notificationLevel: 'LV1' as NotificationLevel,
schemaForm: {} as Record,
- schema: null as null|JsonSchema,
+ schema: computed(() => (props.visibleUserNotification
+ ? notificationProtocolData.value?.plugin_info.metadata.data.schema ?? null
+ : protocolData.value?.plugin_info.metadata.data.schema ?? null)),
isSchemaFormValid: false,
nameInvalidText: computed(() => {
if (state.channelName !== undefined && state.channelName.length === 0) {
@@ -93,22 +90,33 @@ const state = reactive({
selectedRadioIdx: 0,
});
-const apiQuery = new ApiQueryHelper();
-const getSchema = async (): Promise => {
- try {
- apiQuery.setFilters([{ k: 'protocol_id', v: props.protocolId, o: '=' }]);
- const fetcher = props.visibleUserNotification
- ? SpaceConnector.clientV2.alertManager.notificationProtocol.list>
- : SpaceConnector.clientV2.notification.protocol.list>;
- const res = await fetcher({
- query: apiQuery.data,
- });
- return res.results?.[0]?.plugin_info.metadata.data.schema ?? {};
- } catch (e) {
- ErrorHandler.handleError(e);
- return null;
- }
-};
+const { notificationProtocolAPI } = useNotificationProtocolApi();
+const { protocolAPI } = useProtocolApi();
+const { key: notificationProtocolQueryKey, params: notificationProtocolQueryParams } = useServiceQueryKey('alert-manager', 'notification-protocol', 'get', {
+ params: computed(() => ({
+ protocol_id: props.protocolId,
+ })),
+});
+const { key: protocolQueryKey, params: protocolQueryParams } = useServiceQueryKey('notification', 'protocol', 'get', {
+ params: computed(() => ({
+ protocol_id: props.protocolId,
+ })),
+});
+
+const { data: notificationProtocolData } = useScopedQuery({
+ queryKey: notificationProtocolQueryKey,
+ queryFn: () => notificationProtocolAPI.get(notificationProtocolQueryParams.value),
+ enabled: computed(() => props.visibleUserNotification && !!props.protocolId),
+ gcTime: 1000 * 60 * 2,
+ staleTime: 1000 * 30,
+}, ['USER']);
+const { data: protocolData } = useScopedQuery({
+ queryKey: protocolQueryKey,
+ queryFn: () => protocolAPI.get(protocolQueryParams.value),
+ enabled: computed(() => !props.visibleUserNotification && !!props.protocolId),
+ gcTime: 1000 * 60 * 2,
+ staleTime: 1000 * 30,
+}, ['USER']);
const emitChange = () => {
emit('change', !props.visibleUserNotification ? {
@@ -156,14 +164,11 @@ const initStates = () => {
state.schemaForm = {};
state.isSchemaFormValid = false;
state.selectedMember = ['*'];
- state.schema = null;
};
-watch([() => props.protocolId, () => props.protocolType], async ([protocolId, protocolType]) => {
+watch(() => props.protocolId, async (protocolId) => {
if (!protocolId) return;
initStates();
- if (!props.visibleUserNotification && protocolType !== PROTOCOL_TYPE.EXTERNAL) return;
- state.schema = await getSchema();
}, { immediate: true });
diff --git a/apps/web/src/services/my-page/components/NotificationChannelItem.vue b/apps/web/src/services/my-page/components/NotificationChannelItem.vue
index f2160d4761..4a20329262 100644
--- a/apps/web/src/services/my-page/components/NotificationChannelItem.vue
+++ b/apps/web/src/services/my-page/components/NotificationChannelItem.vue
@@ -1,14 +1,18 @@
@@ -207,7 +221,7 @@ onActivated(async () => {
{{ $t('MY_PAGE.NOTIFICATION.NOTIFICATION_CHANNEL') }}
{
= {
export const useNotificationItem = (_state: NotificationItemState, emit: Emit) => {
const alertManagerUiAffectsSchema = useGlobalConfigUiAffectsSchema('ALERT_MANAGER');
+ const queryClient = useQueryClient();
+ const { userChannelAPI } = useUserChannelApi();
+ const { key: userChannelListBaseQueryKey } = useServiceQueryKey('alert-manager', 'user-channel', 'list');
const state = reactive({
visibleUserNotification: computed(() => alertManagerUiAffectsSchema.value?.visibleUserNotification ?? false),
@@ -39,6 +44,25 @@ export const useNotificationItem = (_state: NotificationItemState, e
userChannelId: _state.userChannelId,
projectChannelId: _state.projectChannelId,
}) as NotificationItemState;
+
+ const { mutate: userChannelUpdateMutate } = useMutation({
+ mutationFn: (params: UserChannelUpdateParameters|UserChannelUpdateParametersV1) => {
+ if (state.visibleUserNotification) {
+ return userChannelAPI.update(params as UserChannelUpdateParameters);
+ }
+ return SpaceConnector.clientV2.notification.userChannel.update(params as UserChannelUpdateParametersV1);
+ },
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: userChannelListBaseQueryKey.value });
+ showSuccessMessage(i18n.t('IDENTITY.USER.NOTIFICATION.FORM.ALT_S_UPDATE_USER_CHANNEL'), '');
+ state.isEditMode = false;
+ emit('edit', undefined);
+ },
+ onError: (error) => {
+ ErrorHandler.handleRequestError(error, i18n.t('IDENTITY.USER.NOTIFICATION.FORM.ALT_E_UPDATE_USER_CHANNEL'));
+ },
+ });
+
const cancelEdit = (initialData: Data) => {
state.isEditMode = false;
if (typeof initialData === 'object') {
@@ -61,33 +85,23 @@ export const useNotificationItem = (_state: NotificationItemState, e
const updateUserChannel = async
&Partial) = 'name'|'data'|'schedule'>(paramKey: Key, paramValue: (Partial & Partial)[Key]) => {
- try {
- if (!state.userChannelId) throw new Error('userChannelId is undefined');
- const paramV1: UserChannelUpdateParametersV1 = {
- user_channel_id: state.userChannelId,
- };
- const param: UserChannelUpdateParameters = {
- channel_id: state.userChannelId,
- };
- if (paramKey === 'name') {
- paramV1.name = paramValue as string;
- param.name = paramValue as string;
- } else if (paramKey === 'data') {
- paramV1.data = paramValue as object;
- param.data = paramValue as object;
- } else if (paramKey === 'schedule') {
- param.schedule = paramValue;
- }
- const fetcher = state.visibleUserNotification
- ? SpaceConnector.clientV2.alertManager.userChannel.update(param)
- : SpaceConnector.clientV2.notification.userChannel.update(paramV1);
- await fetcher;
- showSuccessMessage(i18n.t('IDENTITY.USER.NOTIFICATION.FORM.ALT_S_UPDATE_USER_CHANNEL'), '');
- state.isEditMode = false;
- emit('edit', undefined);
- } catch (e) {
- ErrorHandler.handleRequestError(e, i18n.t('IDENTITY.USER.NOTIFICATION.FORM.ALT_E_UPDATE_USER_CHANNEL'));
+ if (!state.userChannelId) throw new Error('userChannelId is undefined');
+ const paramV1: UserChannelUpdateParametersV1 = {
+ user_channel_id: state.userChannelId,
+ };
+ const param: UserChannelUpdateParameters = {
+ channel_id: state.userChannelId,
+ };
+ if (paramKey === 'name') {
+ paramV1.name = paramValue as string;
+ param.name = paramValue as string;
+ } else if (paramKey === 'data') {
+ paramV1.data = paramValue as object;
+ param.data = paramValue as object;
+ } else if (paramKey === 'schedule') {
+ param.schedule = paramValue;
}
+ userChannelUpdateMutate(state.visibleUserNotification ? param : paramV1);
};
const updateProjectChannel = async (paramKey: Key, paramValue: ProjectChannelUpdateParameters[Key]) => {
diff --git a/apps/web/src/services/my-page/types/notification-channel-item-type.ts b/apps/web/src/services/my-page/types/notification-channel-item-type.ts
index e51bf155e4..09d304e408 100644
--- a/apps/web/src/services/my-page/types/notification-channel-item-type.ts
+++ b/apps/web/src/services/my-page/types/notification-channel-item-type.ts
@@ -1,6 +1,6 @@
import type { JsonSchema } from '@cloudforet/mirinae/types/controls/forms/json-schema-form/type';
-import type { UserChannelModel } from '@/schema/alert-manager/user-channel/model';
+import type { UserChannelModel } from '@/api-clients/alert-manager/user-channel/schema/model';
import type { ProjectChannelModel } from '@/schema/notification/project-channel/model';
import type { UserChannelModel as UserChannelModelV1 } from '@/schema/notification/user-channel/model';
diff --git a/apps/web/src/services/ops-flow/components/BoardTaskTable.vue b/apps/web/src/services/ops-flow/components/BoardTaskTable.vue
index 7c21b9abb5..96df282b83 100644
--- a/apps/web/src/services/ops-flow/components/BoardTaskTable.vue
+++ b/apps/web/src/services/ops-flow/components/BoardTaskTable.vue
@@ -4,8 +4,6 @@ import {
watch,
} from 'vue';
-import { useQuery } from '@tanstack/vue-query';
-
import { QueryHelper } from '@cloudforet/core-lib/query';
import type { ConsoleFilter } from '@cloudforet/core-lib/query/type';
import { ApiQueryHelper } from '@cloudforet/core-lib/space-connector/helper';
@@ -19,6 +17,7 @@ import type { DataTableField } from '@cloudforet/mirinae/types/data-display/tabl
import type { TaskCategoryModel } from '@/api-clients/opsflow/task-category/schema/model';
import type { TaskTypeModel } from '@/api-clients/opsflow/task-type/schema/model';
import { useTaskApi } from '@/api-clients/opsflow/task/composables/use-task-api';
+import { useScopedPaginationQuery } from '@/query/pagination/use-scoped-pagination-query';
import { useServiceQueryKey } from '@/query/query-key/use-service-query-key';
import { i18n } from '@/translations';
@@ -52,20 +51,17 @@ const search = ref('');
const pagination = reactive({
page: 1,
size: 15,
- total: 0,
+ // total: 0,
});
const sort = reactive({
key: 'created_at',
desc: true,
});
const handleRefresh = () => {
- refetch();
- // refetch({ throwOnError: true, cancelRefetch: false });
+ query.refetch();
};
const handleChange = (options: ToolboxOptions) => {
if (options.searchText !== undefined) search.value = options.searchText;
- if (options.pageStart !== undefined) pagination.page = options.pageStart;
- if (options.pageLimit !== undefined) pagination.size = options.pageLimit;
if (options.sortBy !== undefined) sort.key = options.sortBy;
if (options.sortDesc !== undefined) sort.desc = options.sortDesc;
};
@@ -130,33 +126,30 @@ const { key: taskListQueryKey, params: taskListQueryParams } = useServiceQueryKe
params: computed(() => ({
query: taskListApiQuery.value,
})),
+ pagination: true,
});
+
const {
- data, error, refetch, isLoading,
-} = useQuery({
- queryKey: computed(() => taskListQueryKey.value),
- queryFn: async () => {
- const res = await taskAPI.list(taskListQueryParams.value);
- return {
- results: res.results ?? [],
- totalCount: res.total_count,
- };
- },
+ data, totalCount, isLoading, query,
+} = useScopedPaginationQuery({
+ queryKey: taskListQueryKey,
+ queryFn: taskAPI.list,
+ params: taskListQueryParams,
enabled: computed(() => !isLoadingCategories.value && !isLoadingTaskTypes.value),
refetchOnMount: true,
// time control
gcTime: 1000 * 60 * 2, // 2 minutes
staleTime: 1000 * 30, // 30 seconds
-});
+}, {
+ thisPage: computed(() => pagination.page),
+ pageSize: computed(() => pagination.size),
+ verb: 'list',
+}, ['WORKSPACE']);
+
const tasks = computed(() => data.value?.results);
-watch(error, (err) => {
+watch(query.error, (err) => {
if (err) ErrorHandler.handleError(err);
});
-watch(data, (d) => {
- if (!d) return;
- pagination.total = d.totalCount || 0;
-}, { immediate: true });
-
/* table fields */
const fields = computed(() => [
@@ -237,8 +230,9 @@ const { getTimezoneDate, getDuration } = useTimezoneDate();
diff --git a/apps/web/src/services/project/v1/ProjectLSB.vue b/apps/web/src/services/project/v1/ProjectLSB.vue
index 37963f1d2a..69d3224730 100644
--- a/apps/web/src/services/project/v1/ProjectLSB.vue
+++ b/apps/web/src/services/project/v1/ProjectLSB.vue
@@ -11,7 +11,7 @@ import {
} from '@cloudforet/mirinae';
import type { SelectDropdownMenuItem } from '@cloudforet/mirinae/types/controls/dropdown/select-dropdown/type';
-import { ALERT_STATE } from '@/schema/monitoring/alert/constants';
+import { ALERT_STATE } from '@/api-clients/monitoring/alert/schema/constants';
import { i18n } from '@/translations';
import { useUserWorkspaceStore } from '@/store/app-context/workspace/user-workspace-store';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertEventRuleActionForm.vue b/apps/web/src/services/project/v1/components/ProjectAlertEventRuleActionForm.vue
index 5a725ce4c6..f0e3e3a5c8 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertEventRuleActionForm.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertEventRuleActionForm.vue
@@ -9,8 +9,8 @@ import {
} from '@cloudforet/mirinae';
import type { MenuItem } from '@cloudforet/mirinae/types/controls/context-menu/type';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
-import type { EventRuleActions, EventRuleOptions } from '@/schema/monitoring/event-rule/type';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
+import type { EventRuleActions, EventRuleOptions } from '@/api-clients/monitoring/event-rule/schema/type';
import { i18n as _i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertEventRuleConditionForm.vue b/apps/web/src/services/project/v1/components/ProjectAlertEventRuleConditionForm.vue
index 2551ccf136..6355277fb4 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertEventRuleConditionForm.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertEventRuleConditionForm.vue
@@ -9,8 +9,8 @@ import {
import type { SelectDropdownMenuItem } from '@cloudforet/mirinae/types/controls/dropdown/select-dropdown/type';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { WebhookListParameters } from '@/schema/monitoring/webhook/api-verbs/list';
-import type { WebhookModel } from '@/schema/monitoring/webhook/model';
+import type { WebhookListParameters } from '@/api-clients/monitoring/webhook/schema/api-verbs/list';
+import type { WebhookModel } from '@/api-clients/monitoring/webhook/schema/model';
import { i18n } from '@/translations';
import ErrorHandler from '@/common/composables/error/errorHandler';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertEventRuleContent.vue b/apps/web/src/services/project/v1/components/ProjectAlertEventRuleContent.vue
index a7fd7aad62..65bcaf24bb 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertEventRuleContent.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertEventRuleContent.vue
@@ -9,8 +9,8 @@ import type { ConsoleFilter } from '@cloudforet/core-lib/query/type';
import { PLink } from '@cloudforet/mirinae';
import { isNotEmpty } from '@cloudforet/utils';
-import type { EventRuleModel } from '@/schema/monitoring/event-rule/model';
-import type { EventRuleActions, EventRuleOptions } from '@/schema/monitoring/event-rule/type';
+import type { EventRuleModel } from '@/api-clients/monitoring/event-rule/schema/model';
+import type { EventRuleActions, EventRuleOptions } from '@/api-clients/monitoring/event-rule/schema/type';
import { i18n as _i18n } from '@/translations';
import { useReferenceRouter } from '@/router/composables/use-reference-router';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertEventRuleForm.vue b/apps/web/src/services/project/v1/components/ProjectAlertEventRuleForm.vue
index 054b9c70e6..1d1cc6573a 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertEventRuleForm.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertEventRuleForm.vue
@@ -9,16 +9,16 @@ import {
} from '@cloudforet/mirinae';
-import type { EventRuleCreateParameters } from '@/schema/monitoring/event-rule/api-verbs/create';
-import type { EventRuleGetParameters } from '@/schema/monitoring/event-rule/api-verbs/get';
-import type { EventRuleUpdateParameters } from '@/schema/monitoring/event-rule/api-verbs/update';
-import type { EventRuleModel } from '@/schema/monitoring/event-rule/model';
+import type { EventRuleCreateParameters } from '@/api-clients/monitoring/event-rule/schema/api-verbs/create';
+import type { EventRuleGetParameters } from '@/api-clients/monitoring/event-rule/schema/api-verbs/get';
+import type { EventRuleUpdateParameters } from '@/api-clients/monitoring/event-rule/schema/api-verbs/update';
+import type { EventRuleModel } from '@/api-clients/monitoring/event-rule/schema/model';
import type {
EventRuleActions,
EventRuleCondition,
EventRuleConditionsPolicy,
EventRuleOptions,
-} from '@/schema/monitoring/event-rule/type';
+} from '@/api-clients/monitoring/event-rule/schema/type';
import { i18n } from '@/translations';
import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertSettingsAutoRecoveryUpdateModal.vue b/apps/web/src/services/project/v1/components/ProjectAlertSettingsAutoRecoveryUpdateModal.vue
index 25c48d22b0..83bc0cd48f 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertSettingsAutoRecoveryUpdateModal.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertSettingsAutoRecoveryUpdateModal.vue
@@ -10,9 +10,9 @@ import {
} from '@cloudforet/mirinae';
-import type { ProjectAlertConfigUpdateParameters } from '@/schema/monitoring/project-alert-config/api-verbs/update';
-import type { ProjectAlertConfigModel } from '@/schema/monitoring/project-alert-config/model';
-import type { ProjectAlertConfigRecoveryMode } from '@/schema/monitoring/project-alert-config/type';
+import type { ProjectAlertConfigUpdateParameters } from '@/api-clients/monitoring/project-alert-config/schema/api-verbs/update';
+import type { ProjectAlertConfigModel } from '@/api-clients/monitoring/project-alert-config/schema/model';
+import type { ProjectAlertConfigRecoveryMode } from '@/api-clients/monitoring/project-alert-config/schema/type';
import { i18n } from '@/translations';
import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertSettingsEscalationPolicy.vue b/apps/web/src/services/project/v1/components/ProjectAlertSettingsEscalationPolicy.vue
index 71959d3910..1a1f2bf9df 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertSettingsEscalationPolicy.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertSettingsEscalationPolicy.vue
@@ -17,9 +17,9 @@ import {
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import { ESCALATION_POLICY_FINISH_CONDITION } from '@/schema/monitoring/escalation-policy/constant';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
-import type { EscalationPolicyFinishCondition, EscalationPolicyRule } from '@/schema/monitoring/escalation-policy/type';
+import { ESCALATION_POLICY_FINISH_CONDITION } from '@/api-clients/monitoring/escalation-policy/schema/constants';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
+import type { EscalationPolicyFinishCondition, EscalationPolicyRule } from '@/api-clients/monitoring/escalation-policy/schema/type';
import type { ProjectChannelListParameters } from '@/schema/notification/project-channel/api-verbs/list';
import type { ProjectChannelModel } from '@/schema/notification/project-channel/model';
import { i18n as _i18n } from '@/translations';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertSettingsEscalationPolicyChangeModal.vue b/apps/web/src/services/project/v1/components/ProjectAlertSettingsEscalationPolicyChangeModal.vue
index f49f79dc92..5af3e8ffc1 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertSettingsEscalationPolicyChangeModal.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertSettingsEscalationPolicyChangeModal.vue
@@ -13,14 +13,14 @@ import {
import type { TabItem } from '@cloudforet/mirinae/types/navigation/tabs/tab/type';
import { iso8601Formatter } from '@cloudforet/utils';
-import type { EscalationPolicyCreateParameters } from '@/schema/monitoring/escalation-policy/api-verbs/create';
+import type { EscalationPolicyCreateParameters } from '@/api-clients/monitoring/escalation-policy/schema/api-verbs/create';
import type {
EscalationPolicyListParameters,
EscalationPolicyListResponse,
-} from '@/schema/monitoring/escalation-policy/api-verbs/list';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
-import type { ProjectAlertConfigUpdateParameters } from '@/schema/monitoring/project-alert-config/api-verbs/update';
-import type { ProjectAlertConfigModel } from '@/schema/monitoring/project-alert-config/model';
+} from '@/api-clients/monitoring/escalation-policy/schema/api-verbs/list';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
+import type { ProjectAlertConfigUpdateParameters } from '@/api-clients/monitoring/project-alert-config/schema/api-verbs/update';
+import type { ProjectAlertConfigModel } from '@/api-clients/monitoring/project-alert-config/schema/model';
import { i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertSettingsNotificationPolicyUpdateModal.vue b/apps/web/src/services/project/v1/components/ProjectAlertSettingsNotificationPolicyUpdateModal.vue
index 272e73afa9..4bcef8d24f 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertSettingsNotificationPolicyUpdateModal.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertSettingsNotificationPolicyUpdateModal.vue
@@ -9,9 +9,9 @@ import {
} from '@cloudforet/mirinae';
-import type { ProjectAlertConfigUpdateParameters } from '@/schema/monitoring/project-alert-config/api-verbs/update';
-import type { ProjectAlertConfigModel } from '@/schema/monitoring/project-alert-config/model';
-import type { ProjectAlertConfigNotiUrgency } from '@/schema/monitoring/project-alert-config/type';
+import type { ProjectAlertConfigUpdateParameters } from '@/api-clients/monitoring/project-alert-config/schema/api-verbs/update';
+import type { ProjectAlertConfigModel } from '@/api-clients/monitoring/project-alert-config/schema/model';
+import type { ProjectAlertConfigNotiUrgency } from '@/api-clients/monitoring/project-alert-config/schema/type';
import { i18n } from '@/translations';
import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertSettingsTab.vue b/apps/web/src/services/project/v1/components/ProjectAlertSettingsTab.vue
index b987de287f..e557c0e4ff 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertSettingsTab.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertSettingsTab.vue
@@ -13,16 +13,16 @@ import {
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import { RESOURCE_GROUP } from '@/api-clients/_common/schema/constant';
-import type { EscalationPolicyGetParameters } from '@/schema/monitoring/escalation-policy/api-verbs/get';
-import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model';
-import type { EventRuleListParameters } from '@/schema/monitoring/event-rule/api-verbs/list';
-import type { EventRuleModel } from '@/schema/monitoring/event-rule/model';
-import type { ProjectAlertConfigGetParameters } from '@/schema/monitoring/project-alert-config/api-verbs/get';
-import type { ProjectAlertConfigModel } from '@/schema/monitoring/project-alert-config/model';
+import type { EscalationPolicyGetParameters } from '@/api-clients/monitoring/escalation-policy/schema/api-verbs/get';
+import type { EscalationPolicyModel } from '@/api-clients/monitoring/escalation-policy/schema/model';
+import type { EventRuleListParameters } from '@/api-clients/monitoring/event-rule/schema/api-verbs/list';
+import type { EventRuleModel } from '@/api-clients/monitoring/event-rule/schema/model';
+import type { ProjectAlertConfigGetParameters } from '@/api-clients/monitoring/project-alert-config/schema/api-verbs/get';
+import type { ProjectAlertConfigModel } from '@/api-clients/monitoring/project-alert-config/schema/model';
import type {
ProjectAlertConfigNotiUrgency,
ProjectAlertConfigRecoveryMode,
-} from '@/schema/monitoring/project-alert-config/type';
+} from '@/api-clients/monitoring/project-alert-config/schema/type';
import { i18n } from '@/translations';
import ErrorHandler from '@/common/composables/error/errorHandler';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertTab.vue b/apps/web/src/services/project/v1/components/ProjectAlertTab.vue
index d00b2bde61..b8e23a7788 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertTab.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertTab.vue
@@ -13,7 +13,7 @@ import type { DefinitionField } from '@cloudforet/mirinae/types/data-display/tab
import type { TabItem } from '@cloudforet/mirinae/types/navigation/tabs/tab/type';
import type { ProjectModel } from '@/api-clients/identity/project/schema/model';
-import type { WebhookModel } from '@/schema/monitoring/webhook/model.js';
+import type { WebhookModel } from '@/api-clients/monitoring/webhook/schema/model';
import { i18n } from '@/translations';
import { useUserStore } from '@/store/user/user-store.js';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertWebhookCreateStep2.vue b/apps/web/src/services/project/v1/components/ProjectAlertWebhookCreateStep2.vue
index c1127d605d..6277f409c8 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertWebhookCreateStep2.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertWebhookCreateStep2.vue
@@ -12,8 +12,8 @@ import {
import type { JsonSchema } from '@cloudforet/mirinae/types/controls/forms/json-schema-form/type';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { WebhookCreateParameters } from '@/schema/monitoring/webhook/api-verbs/create';
-import type { WebhookModel } from '@/schema/monitoring/webhook/model';
+import type { WebhookCreateParameters } from '@/api-clients/monitoring/webhook/schema/api-verbs/create';
+import type { WebhookModel } from '@/api-clients/monitoring/webhook/schema/model';
import type { PluginGetVersionsParameters } from '@/schema/repository/plugin/api-verbs/get-versions';
import { i18n } from '@/translations';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertWebhookCreatedModal.vue b/apps/web/src/services/project/v1/components/ProjectAlertWebhookCreatedModal.vue
index 854edfccb1..ef3475dfd6 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertWebhookCreatedModal.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertWebhookCreatedModal.vue
@@ -10,7 +10,7 @@ import {
PIconModal, PDefinitionTable, PButton, PStatus, PMarkdown,
} from '@cloudforet/mirinae';
-import type { WebhookModel } from '@/schema/monitoring/webhook/model';
+import type { WebhookModel } from '@/api-clients/monitoring/webhook/schema/model';
import { i18n as _i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertWebhookTab.vue b/apps/web/src/services/project/v1/components/ProjectAlertWebhookTab.vue
index 94e60b53ba..5affaefb81 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertWebhookTab.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertWebhookTab.vue
@@ -25,11 +25,11 @@ import type { MenuItem } from '@cloudforet/mirinae/types/controls/context-menu/t
import type { KeyItemSet } from '@cloudforet/mirinae/types/controls/search/query-search/type';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { WebhookDeleteParameters } from '@/schema/monitoring/webhook/api-verbs/delete';
-import type { WebhookDisableParameters } from '@/schema/monitoring/webhook/api-verbs/disable';
-import type { WebhookEnableParameters } from '@/schema/monitoring/webhook/api-verbs/enable';
-import type { WebhookListParameters } from '@/schema/monitoring/webhook/api-verbs/list';
-import type { WebhookModel } from '@/schema/monitoring/webhook/model';
+import type { WebhookDeleteParameters } from '@/api-clients/monitoring/webhook/schema/api-verbs/delete';
+import type { WebhookDisableParameters } from '@/api-clients/monitoring/webhook/schema/api-verbs/disable';
+import type { WebhookEnableParameters } from '@/api-clients/monitoring/webhook/schema/api-verbs/enable';
+import type { WebhookListParameters } from '@/api-clients/monitoring/webhook/schema/api-verbs/list';
+import type { WebhookModel } from '@/api-clients/monitoring/webhook/schema/model';
import { i18n as _i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
diff --git a/apps/web/src/services/project/v1/components/ProjectAlertWebhookUpdateModal.vue b/apps/web/src/services/project/v1/components/ProjectAlertWebhookUpdateModal.vue
index 46aaf6f609..4b1abd8924 100644
--- a/apps/web/src/services/project/v1/components/ProjectAlertWebhookUpdateModal.vue
+++ b/apps/web/src/services/project/v1/components/ProjectAlertWebhookUpdateModal.vue
@@ -9,7 +9,7 @@ import {
} from '@cloudforet/mirinae';
-import type { WebhookUpdateParameters } from '@/schema/monitoring/webhook/api-verbs/update';
+import type { WebhookUpdateParameters } from '@/api-clients/monitoring/webhook/schema/api-verbs/update';
import { i18n } from '@/translations';
import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
diff --git a/apps/web/src/services/project/v1/components/ProjectDetailTab.vue b/apps/web/src/services/project/v1/components/ProjectDetailTab.vue
index 59bcecc731..52a295ad27 100644
--- a/apps/web/src/services/project/v1/components/ProjectDetailTab.vue
+++ b/apps/web/src/services/project/v1/components/ProjectDetailTab.vue
@@ -9,7 +9,7 @@ import type { TabItem } from '@cloudforet/mirinae/types/navigation/tabs/tab/type
import { numberFormatter } from '@cloudforet/utils';
import type { ProjectModel } from '@/api-clients/identity/project/schema/model';
-import { ALERT_STATE } from '@/schema/monitoring/alert/constants';
+import { ALERT_STATE } from '@/api-clients/monitoring/alert/schema/constants';
import BetaMark from '@/common/components/marks/BetaMark.vue';
import { useProxyValue } from '@/common/composables/proxy-state';
diff --git a/apps/web/src/services/project/v1/components/ProjectDetailTabHeader.vue b/apps/web/src/services/project/v1/components/ProjectDetailTabHeader.vue
index 05e37a912a..7407af38e5 100644
--- a/apps/web/src/services/project/v1/components/ProjectDetailTabHeader.vue
+++ b/apps/web/src/services/project/v1/components/ProjectDetailTabHeader.vue
@@ -21,15 +21,15 @@ import type { ProjectModel } from '@/api-clients/identity/project/schema/model';
import { ROLE_TYPE } from '@/api-clients/identity/role/constant';
import type { WorkspaceUserListParameters } from '@/api-clients/identity/workspace-user/schema/api-verbs/list';
import type { WorkspaceUserModel } from '@/api-clients/identity/workspace-user/schema/model';
+import type { ProjectAlertConfigListParameters } from '@/api-clients/monitoring/project-alert-config/schema/api-verbs/list';
+import type { ProjectAlertConfigModel } from '@/api-clients/monitoring/project-alert-config/schema/model';
+import type { WebhookListParameters } from '@/api-clients/monitoring/webhook/schema/api-verbs/list';
+import type { WebhookModel } from '@/api-clients/monitoring/webhook/schema/model';
import DomainAdminImage from '@/assets/images/role/img_avatar_admin.png';
import UserImage from '@/assets/images/role/img_avatar_no-role.png';
import SystemAdminImage from '@/assets/images/role/img_avatar_system-admin.png';
import WorkspaceMemberImage from '@/assets/images/role/img_avatar_workspace-member.png';
import WorkspaceOwnerImage from '@/assets/images/role/img_avatar_workspace-owner.png';
-import type { ProjectAlertConfigListParameters } from '@/schema/monitoring/project-alert-config/api-verbs/list';
-import type { ProjectAlertConfigModel } from '@/schema/monitoring/project-alert-config/model';
-import type { WebhookListParameters } from '@/schema/monitoring/webhook/api-verbs/list';
-import type { WebhookModel } from '@/schema/monitoring/webhook/model';
import { i18n } from '@/translations';
import { useAppContextStore } from '@/store/app-context/app-context-store';
diff --git a/apps/web/src/services/project/v1/components/ProjectSummaryAlertWidget.vue b/apps/web/src/services/project/v1/components/ProjectSummaryAlertWidget.vue
index 2976dc5221..22a711d503 100644
--- a/apps/web/src/services/project/v1/components/ProjectSummaryAlertWidget.vue
+++ b/apps/web/src/services/project/v1/components/ProjectSummaryAlertWidget.vue
@@ -16,9 +16,9 @@ import {
import { numberFormatter } from '@cloudforet/utils';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { AlertListParameters } from '@/schema/monitoring/alert/api-verbs/list';
-import { ALERT_STATE } from '@/schema/monitoring/alert/constants';
-import type { AlertModelV1 } from '@/schema/monitoring/alert/model';
+import type { AlertListParameters } from '@/api-clients/monitoring/alert/schema/api-verbs/list';
+import { ALERT_STATE } from '@/api-clients/monitoring/alert/schema/constants';
+import type { AlertModelV1 } from '@/api-clients/monitoring/alert/schema/model';
import { i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
diff --git a/apps/web/src/services/project/v1/pages/ProjectAlertEventRulePage.vue b/apps/web/src/services/project/v1/pages/ProjectAlertEventRulePage.vue
index de8e3c03ac..0647819de5 100644
--- a/apps/web/src/services/project/v1/pages/ProjectAlertEventRulePage.vue
+++ b/apps/web/src/services/project/v1/pages/ProjectAlertEventRulePage.vue
@@ -10,10 +10,10 @@ import {
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { EventRuleChangeOrderParameters } from '@/schema/monitoring/event-rule/api-verbs/change-order';
-import type { EventRuleDeleteParameters } from '@/schema/monitoring/event-rule/api-verbs/delete';
-import type { EventRuleListParameters } from '@/schema/monitoring/event-rule/api-verbs/list';
-import type { EventRuleModel } from '@/schema/monitoring/event-rule/model';
+import type { EventRuleChangeOrderParameters } from '@/api-clients/monitoring/event-rule/schema/api-verbs/change-order';
+import type { EventRuleDeleteParameters } from '@/api-clients/monitoring/event-rule/schema/api-verbs/delete';
+import type { EventRuleListParameters } from '@/api-clients/monitoring/event-rule/schema/api-verbs/list';
+import type { EventRuleModel } from '@/api-clients/monitoring/event-rule/schema/model';
import { i18n } from '@/translations';
import { useAllReferenceStore } from '@/store/reference/all-reference-store';
diff --git a/apps/web/src/services/project/v1/pages/ProjectAlertPage.vue b/apps/web/src/services/project/v1/pages/ProjectAlertPage.vue
index bfaa81052c..c5ed9ee83a 100644
--- a/apps/web/src/services/project/v1/pages/ProjectAlertPage.vue
+++ b/apps/web/src/services/project/v1/pages/ProjectAlertPage.vue
@@ -10,9 +10,9 @@ import type { TabItem } from '@cloudforet/mirinae/types/navigation/tabs/tab/type
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { ProjectAlertConfigCreateParameters } from '@/schema/monitoring/project-alert-config/api-verbs/create';
-import type { ProjectAlertConfigListParameters } from '@/schema/monitoring/project-alert-config/api-verbs/list';
-import type { ProjectAlertConfigModel } from '@/schema/monitoring/project-alert-config/model';
+import type { ProjectAlertConfigCreateParameters } from '@/api-clients/monitoring/project-alert-config/schema/api-verbs/create';
+import type { ProjectAlertConfigListParameters } from '@/api-clients/monitoring/project-alert-config/schema/api-verbs/list';
+import type { ProjectAlertConfigModel } from '@/api-clients/monitoring/project-alert-config/schema/model';
import { i18n } from '@/translations';
import { showSuccessMessage } from '@/lib/helper/notice-alert-helper';
diff --git a/apps/web/src/services/project/v1/pages/ProjectDetailPageLegacy.vue b/apps/web/src/services/project/v1/pages/ProjectDetailPageLegacy.vue
index 083bbd64c2..412de7a156 100644
--- a/apps/web/src/services/project/v1/pages/ProjectDetailPageLegacy.vue
+++ b/apps/web/src/services/project/v1/pages/ProjectDetailPageLegacy.vue
@@ -16,7 +16,7 @@ import type { Route } from '@cloudforet/mirinae/types/navigation/breadcrumbs/typ
import type { ProjectDeleteParameters } from '@/api-clients/identity/project/schema/api-verbs/delete';
import type { ProjectModel } from '@/api-clients/identity/project/schema/model';
-import { ALERT_STATE } from '@/schema/monitoring/alert/constants';
+import { ALERT_STATE } from '@/api-clients/monitoring/alert/schema/constants';
import { i18n } from '@/translations';
import { useReferenceRouter } from '@/router/composables/use-reference-router';
diff --git a/apps/web/src/services/project/v1/pages/ProjectSummaryPage.vue b/apps/web/src/services/project/v1/pages/ProjectSummaryPage.vue
index fdb83e4bee..7669f709e2 100644
--- a/apps/web/src/services/project/v1/pages/ProjectSummaryPage.vue
+++ b/apps/web/src/services/project/v1/pages/ProjectSummaryPage.vue
@@ -8,8 +8,8 @@ import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import { PI, PIconButton } from '@cloudforet/mirinae';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
-import type { ProjectAlertConfigListParameters } from '@/schema/monitoring/project-alert-config/api-verbs/list';
-import type { ProjectAlertConfigModel } from '@/schema/monitoring/project-alert-config/model';
+import type { ProjectAlertConfigListParameters } from '@/api-clients/monitoring/project-alert-config/schema/api-verbs/list';
+import type { ProjectAlertConfigModel } from '@/api-clients/monitoring/project-alert-config/schema/model';
import { useGlobalConfigUiAffectsSchema } from '@/lib/config/global-config/composables/use-global-config-ui-affects-schema';
import { MENU_ID } from '@/lib/menu/config';
diff --git a/apps/web/src/services/project/v1/stores/project-detail-page-store.ts b/apps/web/src/services/project/v1/stores/project-detail-page-store.ts
index e403ce4658..561e266b52 100644
--- a/apps/web/src/services/project/v1/stores/project-detail-page-store.ts
+++ b/apps/web/src/services/project/v1/stores/project-detail-page-store.ts
@@ -8,8 +8,8 @@ import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
import type { ProjectGetParameters } from '@/api-clients/identity/project/schema/api-verbs/get';
import type { ProjectModel } from '@/api-clients/identity/project/schema/model';
import type { ProjectType } from '@/api-clients/identity/project/schema/type';
-import type { AlertState } from '@/schema/monitoring/alert/type';
-import type { WebhookModel } from '@/schema/monitoring/webhook/model';
+import type { AlertState } from '@/api-clients/monitoring/alert/schema/type';
+import type { WebhookModel } from '@/api-clients/monitoring/webhook/schema/model';
import type { PluginListParameters } from '@/schema/repository/plugin/api-verbs/list';
import type { PluginModel } from '@/schema/repository/plugin/model';
import type { RepositoryListParameters } from '@/schema/repository/repository/api-verbs/list';
diff --git a/apps/web/src/store/reference/escalation-policy-reference-store.ts b/apps/web/src/store/reference/escalation-policy-reference-store.ts
index c7578cebb0..db42ea3790 100644
--- a/apps/web/src/store/reference/escalation-policy-reference-store.ts
+++ b/apps/web/src/store/reference/escalation-policy-reference-store.ts
@@ -3,8 +3,8 @@ import { computed, reactive } from 'vue';
import { defineStore } from 'pinia';
-import type { EscalationPolicyModel } from '@/schema/alert-manager/escalation-policy/model';
-import type { EscalationPolicyModel as EscalationPolicyModelV1 } from '@/schema/monitoring/escalation-policy/model';
+import type { EscalationPolicyModel } from '@/api-clients/alert-manager/escalation-policy/schema/model';
+import type { EscalationPolicyModel as EscalationPolicyModelV1 } from '@/api-clients/monitoring/escalation-policy/schema/model';
import type {
ReferenceLoadOptions, ReferenceItem, ReferenceMap, ReferenceTypeInfo,
diff --git a/apps/web/src/store/reference/protocol-reference-store.ts b/apps/web/src/store/reference/protocol-reference-store.ts
index 33cb30b81d..f979534866 100644
--- a/apps/web/src/store/reference/protocol-reference-store.ts
+++ b/apps/web/src/store/reference/protocol-reference-store.ts
@@ -6,6 +6,8 @@ import { defineStore } from 'pinia';
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list';
+import type { NotificationProtocolListParameters } from '@/api-clients/alert-manager/notification-protocol/schema/api-verbs/list';
+import type { NotificationProtocolModel } from '@/api-clients/alert-manager/notification-protocol/schema/model';
import type { ProtocolListParameters } from '@/schema/notification/protocol/api-verbs/list';
import type { ProtocolModel } from '@/schema/notification/protocol/model';
@@ -14,8 +16,9 @@ import type {
ReferenceItem, ReferenceLoadOptions, ReferenceMap, ReferenceTypeInfo,
} from '@/store/reference/type';
-import ErrorHandler from '@/common/composables/error/errorHandler';
+import APIClientManager from '@/lib/config/global-config/api-client-manager';
+import ErrorHandler from '@/common/composables/error/errorHandler';
export type ProtocolItem = Required
, 'key'|'label'|'name'>>;
export type ProtocolReferenceMap = ReferenceMap;
@@ -53,8 +56,13 @@ export const useProtocolReferenceStore = defineStore('reference-protocol', () =>
) return;
const referenceMap: ProtocolReferenceMap = {};
+ const alertManagerClient = APIClientManager.alertManager;
+ if (!alertManagerClient) return;
try {
- const response = await SpaceConnector.clientV2.notification.protocol.list>({
+ const fetcher = alertManagerClient.version === 'V1'
+ ? SpaceConnector.clientV2.notification.protocol.list>
+ : SpaceConnector.clientV2.alertManager.notificationProtocol.list>;
+ const response = await fetcher({
query: {
only: ['protocol_id', 'name'],
},
diff --git a/apps/web/src/store/reference/service-reference-store.ts b/apps/web/src/store/reference/service-reference-store.ts
index a554941ce4..99d1c211d8 100644
--- a/apps/web/src/store/reference/service-reference-store.ts
+++ b/apps/web/src/store/reference/service-reference-store.ts
@@ -3,8 +3,8 @@ import { computed, reactive } from 'vue';
import { defineStore } from 'pinia';
-import type { ServiceListParameters } from '@/schema/alert-manager/service/api-verbs/list';
-import type { ServiceModel } from '@/schema/alert-manager/service/model';
+import type { ServiceListParameters } from '@/api-clients/alert-manager/service/schema/api-verbs/list';
+import type { ServiceModel } from '@/api-clients/alert-manager/service/schema/model';
import { useAuthorizationStore } from '@/store/authorization/authorization-store';
import type {
diff --git a/apps/web/src/store/reference/webhook-reference-store.ts b/apps/web/src/store/reference/webhook-reference-store.ts
index 1703fc0aa7..249b350caa 100644
--- a/apps/web/src/store/reference/webhook-reference-store.ts
+++ b/apps/web/src/store/reference/webhook-reference-store.ts
@@ -3,8 +3,8 @@ import { computed, reactive } from 'vue';
import { defineStore } from 'pinia';
-import type { WebhookModel } from '@/schema/alert-manager/webhook/model';
-import type { WebhookModel as WebhookModelV1 } from '@/schema/monitoring/webhook/model';
+import type { WebhookModel } from '@/api-clients/alert-manager/webhook/schema/model';
+import type { WebhookModel as WebhookModelV1 } from '@/api-clients/monitoring/webhook/schema/model';
import { useAuthorizationStore } from '@/store/authorization/authorization-store';
import type {
diff --git a/packages/mirinae/src/controls/toolbox/PToolbox.vue b/packages/mirinae/src/controls/toolbox/PToolbox.vue
index 288f0025bb..2b1bdbd490 100644
--- a/packages/mirinae/src/controls/toolbox/PToolbox.vue
+++ b/packages/mirinae/src/controls/toolbox/PToolbox.vue
@@ -290,8 +290,14 @@ export default defineComponent({
};
const onChangePageSize = (pageSize) => {
- proxyState.pageSize = pageSize;
- emitChange({ pageLimit: pageSize });
+ const converted = Number(pageSize);
+
+ if (Number.isNaN(converted)) {
+ console.warn('[PToolbox] pageSizeOptions must be the array of number:', pageSize);
+ return;
+ }
+ proxyState.pageSize = converted;
+ emitChange({ pageLimit: converted });
};
const onChangeSortBy = (sortBy) => {