Commit 304dc086 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'dbodicherla-add-prop-to-hide-header-in-monitoring-dashboard' into 'master'

Added showHeader prop to monitor dashboard

See merge request gitlab-org/gitlab!23709
parents 4a2a4765 ae621612
...@@ -69,6 +69,11 @@ export default { ...@@ -69,6 +69,11 @@ export default {
required: false, required: false,
default: true, default: true,
}, },
showHeader: {
type: Boolean,
required: false,
default: true,
},
showPanels: { showPanels: {
type: Boolean, type: Boolean,
required: false, required: false,
...@@ -129,7 +134,8 @@ export default { ...@@ -129,7 +134,8 @@ export default {
}, },
environmentsEndpoint: { environmentsEndpoint: {
type: String, type: String,
required: true, required: false,
default: '',
}, },
currentEnvironmentName: { currentEnvironmentName: {
type: String, type: String,
...@@ -356,9 +362,12 @@ export default { ...@@ -356,9 +362,12 @@ export default {
<template> <template>
<div class="prometheus-graphs"> <div class="prometheus-graphs">
<div class="prometheus-graphs-header gl-p-3 pb-0 border-bottom bg-gray-light"> <div
v-if="showHeader"
ref="prometheusGraphsHeader"
class="prometheus-graphs-header gl-p-3 pb-0 border-bottom bg-gray-light"
>
<div class="row"> <div class="row">
<template v-if="environmentsEndpoint">
<gl-form-group <gl-form-group
:label="__('Dashboard')" :label="__('Dashboard')"
label-size="sm" label-size="sm"
...@@ -435,7 +444,6 @@ export default { ...@@ -435,7 +444,6 @@ export default {
@invalid="onDateTimePickerInvalid" @invalid="onDateTimePickerInvalid"
/> />
</gl-form-group> </gl-form-group>
</template>
<gl-form-group <gl-form-group
v-if="hasHeaderButtons" v-if="hasHeaderButtons"
......
...@@ -7,11 +7,11 @@ export default () => { ...@@ -7,11 +7,11 @@ export default () => {
initCeBundle({ initCeBundle({
...el.dataset, ...el.dataset,
showLegend: false, showLegend: false,
showHeader: false,
showPanels: false, showPanels: false,
forceSmallGraph: true, forceSmallGraph: true,
smallEmptyState: true, smallEmptyState: true,
currentEnvironmentName: '', currentEnvironmentName: '',
environmentsEndpoint: '',
hasMetrics: true, hasMetrics: true,
}); });
} }
......
...@@ -412,13 +412,17 @@ describe('Dashboard', () => { ...@@ -412,13 +412,17 @@ describe('Dashboard', () => {
describe('cluster health', () => { describe('cluster health', () => {
beforeEach(done => { beforeEach(done => {
mock.onGet(propsData.metricsEndpoint).reply(statusCodes.OK, JSON.stringify({})); mock.onGet(propsData.metricsEndpoint).reply(statusCodes.OK, JSON.stringify({}));
createShallowWrapper({ hasMetrics: true }); createShallowWrapper({ hasMetrics: true, showHeader: false });
// all_dashboards is not defined in health dashboards // all_dashboards is not defined in health dashboards
wrapper.vm.$store.commit(`monitoringDashboard/${types.SET_ALL_DASHBOARDS}`, undefined); wrapper.vm.$store.commit(`monitoringDashboard/${types.SET_ALL_DASHBOARDS}`, undefined);
wrapper.vm.$nextTick(done); wrapper.vm.$nextTick(done);
}); });
it('hides dashboard header by default', () => {
expect(wrapper.find({ ref: 'prometheusGraphsHeader' }).exists()).toEqual(false);
});
it('renders correctly', () => { it('renders correctly', () => {
expect(wrapper.isVueInstance()).toBe(true); expect(wrapper.isVueInstance()).toBe(true);
expect(wrapper.exists()).toBe(true); expect(wrapper.exists()).toBe(true);
......
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