Commit 21d6deca authored by Martin Wortschack's avatar Martin Wortschack

Merge branch '229709-remove-dashboard-props' into 'master'

Remove external url data from props in favor of store

Closes #229709

See merge request gitlab-org/gitlab!38557
parents ab657894 c9a57855
...@@ -48,11 +48,6 @@ export default { ...@@ -48,11 +48,6 @@ export default {
TrackEvent: TrackEventDirective, TrackEvent: TrackEventDirective,
}, },
props: { props: {
externalDashboardUrl: {
type: String,
required: false,
default: '',
},
hasMetrics: { hasMetrics: {
type: Boolean, type: Boolean,
required: false, required: false,
...@@ -410,8 +405,6 @@ export default { ...@@ -410,8 +405,6 @@ export default {
:custom-metrics-available="customMetricsAvailable" :custom-metrics-available="customMetricsAvailable"
:custom-metrics-path="customMetricsPath" :custom-metrics-path="customMetricsPath"
:validate-query-path="validateQueryPath" :validate-query-path="validateQueryPath"
:external-dashboard-url="externalDashboardUrl"
:has-metrics="hasMetrics"
:is-rearranging-panels="isRearrangingPanels" :is-rearranging-panels="isRearrangingPanels"
:selected-time-range="selectedTimeRange" :selected-time-range="selectedTimeRange"
@dateTimePickerInvalid="onDateTimePickerInvalid" @dateTimePickerInvalid="onDateTimePickerInvalid"
......
...@@ -85,16 +85,6 @@ export default { ...@@ -85,16 +85,6 @@ export default {
required: false, required: false,
default: invalidUrl, default: invalidUrl,
}, },
externalDashboardUrl: {
type: String,
required: false,
default: '',
},
hasMetrics: {
type: Boolean,
required: false,
default: true,
},
isRearrangingPanels: { isRearrangingPanels: {
type: Boolean, type: Boolean,
required: true, required: true,
...@@ -121,6 +111,7 @@ export default { ...@@ -121,6 +111,7 @@ export default {
'operationsSettingsPath', 'operationsSettingsPath',
'currentDashboard', 'currentDashboard',
'addDashboardDocumentationPath', 'addDashboardDocumentationPath',
'externalDashboardUrl',
]), ]),
...mapGetters('monitoringDashboard', ['selectedDashboard', 'filteredEnvironments']), ...mapGetters('monitoringDashboard', ['selectedDashboard', 'filteredEnvironments']),
isOutOfTheBoxDashboard() { isOutOfTheBoxDashboard() {
......
...@@ -77,6 +77,7 @@ export default () => ({ ...@@ -77,6 +77,7 @@ export default () => ({
currentEnvironmentName: null, currentEnvironmentName: null,
// GitLab paths to other pages // GitLab paths to other pages
externalDashboardUrl: '',
projectPath: null, projectPath: null,
operationsSettingsPath: '', operationsSettingsPath: '',
logsPath: invalidUrl, logsPath: invalidUrl,
......
...@@ -30,6 +30,7 @@ export const stateAndPropsFromDataset = (dataset = {}) => { ...@@ -30,6 +30,7 @@ export const stateAndPropsFromDataset = (dataset = {}) => {
operationsSettingsPath, operationsSettingsPath,
projectPath, projectPath,
logsPath, logsPath,
externalDashboardUrl,
currentEnvironmentName, currentEnvironmentName,
customDashboardBasePath, customDashboardBasePath,
addDashboardDocumentationPath, addDashboardDocumentationPath,
...@@ -53,6 +54,7 @@ export const stateAndPropsFromDataset = (dataset = {}) => { ...@@ -53,6 +54,7 @@ export const stateAndPropsFromDataset = (dataset = {}) => {
operationsSettingsPath, operationsSettingsPath,
projectPath, projectPath,
logsPath, logsPath,
externalDashboardUrl,
currentEnvironmentName, currentEnvironmentName,
customDashboardBasePath, customDashboardBasePath,
addDashboardDocumentationPath, addDashboardDocumentationPath,
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { createStore } from '~/monitoring/stores'; import { createStore } from '~/monitoring/stores';
import * as types from '~/monitoring/stores/mutation_types'; import * as types from '~/monitoring/stores/mutation_types';
import { GlDeprecatedDropdownItem, GlSearchBoxByType, GlLoadingIcon } from '@gitlab/ui'; import { GlDeprecatedDropdownItem, GlSearchBoxByType, GlLoadingIcon, GlButton } from '@gitlab/ui';
import DateTimePicker from '~/vue_shared/components/date_time_picker/date_time_picker.vue'; import DateTimePicker from '~/vue_shared/components/date_time_picker/date_time_picker.vue';
import RefreshButton from '~/monitoring/components/refresh_button.vue'; import RefreshButton from '~/monitoring/components/refresh_button.vue';
import DashboardHeader from '~/monitoring/components/dashboard_header.vue'; import DashboardHeader from '~/monitoring/components/dashboard_header.vue';
...@@ -289,6 +289,23 @@ describe('Dashboard header', () => { ...@@ -289,6 +289,23 @@ describe('Dashboard header', () => {
}); });
}); });
describe('external dashboard link', () => {
beforeEach(() => {
store.state.monitoringDashboard.externalDashboardUrl = '/mockUrl';
createShallowWrapper();
return wrapper.vm.$nextTick();
});
it('shows the link', () => {
const externalDashboardButton = wrapper.find('.js-external-dashboard-link');
expect(externalDashboardButton.exists()).toBe(true);
expect(externalDashboardButton.is(GlButton)).toBe(true);
expect(externalDashboardButton.text()).toContain('View full dashboard');
});
});
describe('actions menu', () => { describe('actions menu', () => {
beforeEach(() => { beforeEach(() => {
store.state.monitoringDashboard.projectPath = ''; store.state.monitoringDashboard.projectPath = '';
......
import { shallowMount, mount } from '@vue/test-utils'; import { shallowMount, mount } from '@vue/test-utils';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import { ESC_KEY, ESC_KEY_IE11 } from '~/lib/utils/keys'; import { ESC_KEY, ESC_KEY_IE11 } from '~/lib/utils/keys';
import { GlModal, GlButton } from '@gitlab/ui'; import { GlModal } from '@gitlab/ui';
import { objectToQuery } from '~/lib/utils/url_utility'; import { objectToQuery } from '~/lib/utils/url_utility';
import VueDraggable from 'vuedraggable'; import VueDraggable from 'vuedraggable';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
...@@ -883,27 +883,6 @@ describe('Dashboard', () => { ...@@ -883,27 +883,6 @@ describe('Dashboard', () => {
}); });
}); });
describe('external dashboard link', () => {
beforeEach(() => {
createMountedWrapper({
hasMetrics: true,
showPanels: false,
showTimeWindowDropdown: false,
externalDashboardUrl: '/mockUrl',
});
return wrapper.vm.$nextTick();
});
it('shows the link', () => {
const externalDashboardButton = wrapper.find('.js-external-dashboard-link');
expect(externalDashboardButton.exists()).toBe(true);
expect(externalDashboardButton.is(GlButton)).toBe(true);
expect(externalDashboardButton.text()).toContain('View full dashboard');
});
});
describe('Clipboard text in panels', () => { describe('Clipboard text in panels', () => {
const currentDashboard = dashboardGitResponse[1].path; const currentDashboard = dashboardGitResponse[1].path;
const panelIndex = 1; // skip expanded panel const panelIndex = 1; // skip expanded panel
......
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