Commit bdfd2635 authored by anna_vovchenko's avatar anna_vovchenko Committed by Ezekiel Kigbo

Implemented suggestion after the FE review

parent fe55d8b1
...@@ -21,6 +21,8 @@ import { ...@@ -21,6 +21,8 @@ import {
EVENT_ACTIONS_OPEN, EVENT_ACTIONS_OPEN,
EVENT_ACTIONS_SELECT, EVENT_ACTIONS_SELECT,
EVENT_ACTIONS_CLICK, EVENT_ACTIONS_CLICK,
MODAL_TYPE_EMPTY,
MODAL_TYPE_REGISTER,
} from '../constants'; } from '../constants';
import { addAgentToStore, addAgentConfigToStore } from '../graphql/cache_update'; import { addAgentToStore, addAgentConfigToStore } from '../graphql/cache_update';
import createAgent from '../graphql/mutations/create_agent.mutation.graphql'; import createAgent from '../graphql/mutations/create_agent.mutation.graphql';
...@@ -133,17 +135,17 @@ export default { ...@@ -133,17 +135,17 @@ export default {
}, },
modalType() { modalType() {
return !this.availableAgents?.length && !this.registered return !this.availableAgents?.length && !this.registered
? 'empty_state' ? MODAL_TYPE_EMPTY
: 'agent_registration'; : MODAL_TYPE_REGISTER;
}, },
modalSize() { modalSize() {
return this.isEmptyStateModal ? 'sm' : 'md'; return this.isEmptyStateModal ? 'sm' : 'md';
}, },
isEmptyStateModal() { isEmptyStateModal() {
return this.modalType === 'empty_state'; return this.modalType === MODAL_TYPE_EMPTY;
}, },
isAgentRegistrationModal() { isAgentRegistrationModal() {
return this.modalType === 'agent_registration'; return this.modalType === MODAL_TYPE_REGISTER;
}, },
}, },
methods: { methods: {
......
...@@ -243,3 +243,6 @@ export const EVENT_ACTIONS_OPEN = 'open_modal'; ...@@ -243,3 +243,6 @@ export const EVENT_ACTIONS_OPEN = 'open_modal';
export const EVENT_ACTIONS_SELECT = 'select_agent'; export const EVENT_ACTIONS_SELECT = 'select_agent';
export const EVENT_ACTIONS_CLICK = 'click_button'; export const EVENT_ACTIONS_CLICK = 'click_button';
export const EVENT_ACTIONS_CHANGE = 'change_tab'; export const EVENT_ACTIONS_CHANGE = 'change_tab';
export const MODAL_TYPE_EMPTY = 'empty_state';
export const MODAL_TYPE_REGISTER = 'agent_registration';
...@@ -11,6 +11,8 @@ import { ...@@ -11,6 +11,8 @@ import {
EVENT_LABEL_MODAL, EVENT_LABEL_MODAL,
EVENT_ACTIONS_OPEN, EVENT_ACTIONS_OPEN,
EVENT_ACTIONS_SELECT, EVENT_ACTIONS_SELECT,
MODAL_TYPE_EMPTY,
MODAL_TYPE_REGISTER,
} from '~/clusters_list/constants'; } from '~/clusters_list/constants';
import getAgentsQuery from '~/clusters_list/graphql/queries/get_agents.query.graphql'; import getAgentsQuery from '~/clusters_list/graphql/queries/get_agents.query.graphql';
import getAgentConfigurations from '~/clusters_list/graphql/queries/agent_configurations.query.graphql'; import getAgentConfigurations from '~/clusters_list/graphql/queries/agent_configurations.query.graphql';
...@@ -164,7 +166,7 @@ describe('InstallAgentModal', () => { ...@@ -164,7 +166,7 @@ describe('InstallAgentModal', () => {
findModal().vm.$emit('show'); findModal().vm.$emit('show');
expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTIONS_OPEN, { expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTIONS_OPEN, {
label: EVENT_LABEL_MODAL, label: EVENT_LABEL_MODAL,
property: 'agent_registration', property: MODAL_TYPE_REGISTER,
}); });
}); });
}); });
...@@ -300,7 +302,7 @@ describe('InstallAgentModal', () => { ...@@ -300,7 +302,7 @@ describe('InstallAgentModal', () => {
findModal().vm.$emit('show'); findModal().vm.$emit('show');
expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTIONS_OPEN, { expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTIONS_OPEN, {
label: EVENT_LABEL_MODAL, label: EVENT_LABEL_MODAL,
property: 'empty_state', property: MODAL_TYPE_EMPTY,
}); });
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment