Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
9d5d5a163f
commit
4714aa72e3
15 changed files with 5 additions and 243 deletions
|
@ -51,11 +51,6 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
logsPath: {
|
|
||||||
type: String,
|
|
||||||
required: false,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
graphql: {
|
graphql: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
|
@ -186,7 +181,6 @@ export default {
|
||||||
:status="instance.status"
|
:status="instance.status"
|
||||||
:tooltip-text="instance.tooltip"
|
:tooltip-text="instance.tooltip"
|
||||||
:pod-name="podName(instance)"
|
:pod-name="podName(instance)"
|
||||||
:logs-path="logsPath"
|
|
||||||
:stable="instance.stable"
|
:stable="instance.stable"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -164,7 +164,6 @@ export default {
|
||||||
:deploy-board-data="model.deployBoardData"
|
:deploy-board-data="model.deployBoardData"
|
||||||
:is-loading="model.isLoadingDeployBoard"
|
:is-loading="model.isLoadingDeployBoard"
|
||||||
:is-empty="model.isEmptyDeployBoard"
|
:is-empty="model.isEmptyDeployBoard"
|
||||||
:logs-path="model.logs_path"
|
|
||||||
@changeCanaryWeight="changeCanaryWeight(model, $event)"
|
@changeCanaryWeight="changeCanaryWeight(model, $event)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -199,7 +198,6 @@ export default {
|
||||||
:deploy-board-data="child.deployBoardData"
|
:deploy-board-data="child.deployBoardData"
|
||||||
:is-loading="child.isLoadingDeployBoard"
|
:is-loading="child.isLoadingDeployBoard"
|
||||||
:is-empty="child.isEmptyDeployBoard"
|
:is-empty="child.isEmptyDeployBoard"
|
||||||
:logs-path="child.logs_path"
|
|
||||||
@changeCanaryWeight="changeCanaryWeight(child, $event)"
|
@changeCanaryWeight="changeCanaryWeight(child, $event)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -358,10 +358,6 @@ export default {
|
||||||
actionToRun = 'onExpandFromKeyboardShortcut';
|
actionToRun = 'onExpandFromKeyboardShortcut';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case keyboardShortcutKeys.VISIT_LOGS:
|
|
||||||
actionToRun = 'visitLogsPageFromKeyboardShortcut';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case keyboardShortcutKeys.SHOW_ALERT:
|
case keyboardShortcutKeys.SHOW_ALERT:
|
||||||
actionToRun = 'showAlertModalFromKeyboardShortcut';
|
actionToRun = 'showAlertModalFromKeyboardShortcut';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -15,15 +15,13 @@ import {
|
||||||
} from '@gitlab/ui';
|
} from '@gitlab/ui';
|
||||||
import { mapState } from 'vuex';
|
import { mapState } from 'vuex';
|
||||||
import { convertToFixedRange } from '~/lib/utils/datetime_range';
|
import { convertToFixedRange } from '~/lib/utils/datetime_range';
|
||||||
import invalidUrl from '~/lib/utils/invalid_url';
|
import { isSafeURL } from '~/lib/utils/url_utility';
|
||||||
import { relativePathToAbsolute, getBaseURL, visitUrl, isSafeURL } from '~/lib/utils/url_utility';
|
|
||||||
import { __, n__ } from '~/locale';
|
import { __, n__ } from '~/locale';
|
||||||
import TrackEventDirective from '~/vue_shared/directives/track_event';
|
import TrackEventDirective from '~/vue_shared/directives/track_event';
|
||||||
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
|
|
||||||
import { panelTypes } from '../constants';
|
import { panelTypes } from '../constants';
|
||||||
|
|
||||||
import { graphDataToCsv } from '../csv_export';
|
import { graphDataToCsv } from '../csv_export';
|
||||||
import { timeRangeToUrl, downloadCSVOptions, generateLinkToChartOptions } from '../utils';
|
import { downloadCSVOptions, generateLinkToChartOptions } from '../utils';
|
||||||
import MonitorAnomalyChart from './charts/anomaly.vue';
|
import MonitorAnomalyChart from './charts/anomaly.vue';
|
||||||
import MonitorBarChart from './charts/bar.vue';
|
import MonitorBarChart from './charts/bar.vue';
|
||||||
import MonitorColumnChart from './charts/column.vue';
|
import MonitorColumnChart from './charts/column.vue';
|
||||||
|
@ -58,7 +56,6 @@ export default {
|
||||||
GlTooltip: GlTooltipDirective,
|
GlTooltip: GlTooltipDirective,
|
||||||
TrackEvent: TrackEventDirective,
|
TrackEvent: TrackEventDirective,
|
||||||
},
|
},
|
||||||
mixins: [glFeatureFlagsMixin()],
|
|
||||||
props: {
|
props: {
|
||||||
clipboardText: {
|
clipboardText: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -106,9 +103,6 @@ export default {
|
||||||
projectPath(state) {
|
projectPath(state) {
|
||||||
return state[this.namespace].projectPath;
|
return state[this.namespace].projectPath;
|
||||||
},
|
},
|
||||||
logsPath(state) {
|
|
||||||
return state[this.namespace].logsPath;
|
|
||||||
},
|
|
||||||
timeRange(state) {
|
timeRange(state) {
|
||||||
return state[this.namespace].timeRange;
|
return state[this.namespace].timeRange;
|
||||||
},
|
},
|
||||||
|
@ -142,17 +136,6 @@ export default {
|
||||||
const metrics = this.graphData?.metrics || [];
|
const metrics = this.graphData?.metrics || [];
|
||||||
return metrics.some(({ loading }) => loading);
|
return metrics.some(({ loading }) => loading);
|
||||||
},
|
},
|
||||||
logsPathWithTimeRange() {
|
|
||||||
if (!this.glFeatures.monitorLogging) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const timeRange = this.zoomedTimeRange || this.timeRange;
|
|
||||||
|
|
||||||
if (this.logsPath && this.logsPath !== invalidUrl && timeRange) {
|
|
||||||
return timeRangeToUrl(timeRange, this.logsPath);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
csvText() {
|
csvText() {
|
||||||
if (this.graphData) {
|
if (this.graphData) {
|
||||||
return graphDataToCsv(this.graphData);
|
return graphDataToCsv(this.graphData);
|
||||||
|
@ -278,16 +261,6 @@ export default {
|
||||||
safeUrl(url) {
|
safeUrl(url) {
|
||||||
return isSafeURL(url) ? url : '#';
|
return isSafeURL(url) ? url : '#';
|
||||||
},
|
},
|
||||||
visitLogsPage() {
|
|
||||||
if (this.logsPathWithTimeRange) {
|
|
||||||
visitUrl(relativePathToAbsolute(this.logsPathWithTimeRange, getBaseURL()));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visitLogsPageFromKeyboardShortcut() {
|
|
||||||
if (this.isContextualMenuShown) {
|
|
||||||
this.visitLogsPage();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
downloadCsvFromKeyboardShortcut() {
|
downloadCsvFromKeyboardShortcut() {
|
||||||
if (this.csvText && this.isContextualMenuShown) {
|
if (this.csvText && this.isContextualMenuShown) {
|
||||||
this.$refs.downloadCsvLink.$el.firstChild.click();
|
this.$refs.downloadCsvLink.$el.firstChild.click();
|
||||||
|
@ -351,13 +324,6 @@ export default {
|
||||||
>
|
>
|
||||||
{{ editCustomMetricLinkText }}
|
{{ editCustomMetricLinkText }}
|
||||||
</gl-dropdown-item>
|
</gl-dropdown-item>
|
||||||
<gl-dropdown-item
|
|
||||||
v-if="logsPathWithTimeRange"
|
|
||||||
ref="viewLogsLink"
|
|
||||||
:href="logsPathWithTimeRange"
|
|
||||||
>
|
|
||||||
{{ s__('Metrics|View logs') }}
|
|
||||||
</gl-dropdown-item>
|
|
||||||
|
|
||||||
<gl-dropdown-item
|
<gl-dropdown-item
|
||||||
v-if="csvText"
|
v-if="csvText"
|
||||||
|
|
|
@ -172,7 +172,6 @@ export const endpointKeys = [
|
||||||
'dashboardsEndpoint',
|
'dashboardsEndpoint',
|
||||||
'currentDashboard',
|
'currentDashboard',
|
||||||
'projectPath',
|
'projectPath',
|
||||||
'logsPath',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -271,7 +270,6 @@ export const VARIABLE_PREFIX = 'var-';
|
||||||
|
|
||||||
export const keyboardShortcutKeys = {
|
export const keyboardShortcutKeys = {
|
||||||
EXPAND: 'e',
|
EXPAND: 'e',
|
||||||
VISIT_LOGS: 'l',
|
|
||||||
SHOW_ALERT: 'a',
|
SHOW_ALERT: 'a',
|
||||||
DOWNLOAD_CSV: 'd',
|
DOWNLOAD_CSV: 'd',
|
||||||
CHART_COPY: 'c',
|
CHART_COPY: 'c',
|
||||||
|
|
|
@ -83,7 +83,6 @@ export default () => ({
|
||||||
externalDashboardUrl: '',
|
externalDashboardUrl: '',
|
||||||
projectPath: null,
|
projectPath: null,
|
||||||
operationsSettingsPath: '',
|
operationsSettingsPath: '',
|
||||||
logsPath: invalidUrl,
|
|
||||||
addDashboardDocumentationPath: '',
|
addDashboardDocumentationPath: '',
|
||||||
|
|
||||||
// static paths
|
// static paths
|
||||||
|
|
|
@ -29,7 +29,6 @@ export const stateAndPropsFromDataset = (dataset = {}) => {
|
||||||
canAccessOperationsSettings,
|
canAccessOperationsSettings,
|
||||||
operationsSettingsPath,
|
operationsSettingsPath,
|
||||||
projectPath,
|
projectPath,
|
||||||
logsPath,
|
|
||||||
externalDashboardUrl,
|
externalDashboardUrl,
|
||||||
currentEnvironmentName,
|
currentEnvironmentName,
|
||||||
customDashboardBasePath,
|
customDashboardBasePath,
|
||||||
|
@ -53,7 +52,6 @@ export const stateAndPropsFromDataset = (dataset = {}) => {
|
||||||
canAccessOperationsSettings,
|
canAccessOperationsSettings,
|
||||||
operationsSettingsPath,
|
operationsSettingsPath,
|
||||||
projectPath,
|
projectPath,
|
||||||
logsPath,
|
|
||||||
externalDashboardUrl,
|
externalDashboardUrl,
|
||||||
currentEnvironmentName,
|
currentEnvironmentName,
|
||||||
customDashboardBasePath,
|
customDashboardBasePath,
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
* Mockup is https://gitlab.com/gitlab-org/gitlab/issues/35570
|
* Mockup is https://gitlab.com/gitlab-org/gitlab/issues/35570
|
||||||
*/
|
*/
|
||||||
import { GlLink, GlTooltipDirective } from '@gitlab/ui';
|
import { GlLink, GlTooltipDirective } from '@gitlab/ui';
|
||||||
import { mergeUrlParams } from '~/lib/utils/url_utility';
|
|
||||||
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -23,7 +21,6 @@ export default {
|
||||||
directives: {
|
directives: {
|
||||||
GlTooltip: GlTooltipDirective,
|
GlTooltip: GlTooltipDirective,
|
||||||
},
|
},
|
||||||
mixins: [glFeatureFlagsMixin()],
|
|
||||||
props: {
|
props: {
|
||||||
/**
|
/**
|
||||||
* Represents the status of the pod. Each state is represented with a different
|
* Represents the status of the pod. Each state is represented with a different
|
||||||
|
@ -54,17 +51,11 @@ export default {
|
||||||
required: false,
|
required: false,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
|
||||||
logsPath: {
|
|
||||||
type: String,
|
|
||||||
required: false,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
isLink() {
|
isLink() {
|
||||||
return this.logsPath !== '' && this.podName !== '';
|
return this.podName !== '';
|
||||||
},
|
},
|
||||||
|
|
||||||
cssClass() {
|
cssClass() {
|
||||||
|
@ -74,12 +65,6 @@ export default {
|
||||||
link: this.isLink,
|
link: this.isLink,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
computedLogPath() {
|
|
||||||
return this.isLink && this.glFeatures.monitorLogging
|
|
||||||
? mergeUrlParams({ pod_name: this.podName }, this.logsPath)
|
|
||||||
: null;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -88,7 +73,6 @@ export default {
|
||||||
v-gl-tooltip
|
v-gl-tooltip
|
||||||
:class="cssClass"
|
:class="cssClass"
|
||||||
:title="tooltipText"
|
:title="tooltipText"
|
||||||
:href="computedLogPath"
|
|
||||||
class="deployment-instance d-flex justify-content-center align-items-center"
|
class="deployment-instance d-flex justify-content-center align-items-center"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -24948,9 +24948,6 @@ msgstr ""
|
||||||
msgid "Metrics|View documentation"
|
msgid "Metrics|View documentation"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "Metrics|View logs"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Metrics|Y-axis label"
|
msgid "Metrics|Y-axis label"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,9 @@ import { mount } from '@vue/test-utils';
|
||||||
import Vue, { nextTick } from 'vue';
|
import Vue, { nextTick } from 'vue';
|
||||||
import CanaryIngress from '~/environments/components/canary_ingress.vue';
|
import CanaryIngress from '~/environments/components/canary_ingress.vue';
|
||||||
import DeployBoard from '~/environments/components/deploy_board.vue';
|
import DeployBoard from '~/environments/components/deploy_board.vue';
|
||||||
import { deployBoardMockData, environment } from './mock_data';
|
import { deployBoardMockData } from './mock_data';
|
||||||
import { rolloutStatus } from './graphql/mock_data';
|
import { rolloutStatus } from './graphql/mock_data';
|
||||||
|
|
||||||
const logsPath = `gitlab-org/gitlab-test/-/logs?environment_name=${environment.name}`;
|
|
||||||
|
|
||||||
describe('Deploy Board', () => {
|
describe('Deploy Board', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
|
|
||||||
|
@ -17,7 +15,6 @@ describe('Deploy Board', () => {
|
||||||
deployBoardData: deployBoardMockData,
|
deployBoardData: deployBoardMockData,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isEmpty: false,
|
isEmpty: false,
|
||||||
logsPath,
|
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -132,7 +129,6 @@ describe('Deploy Board', () => {
|
||||||
deployBoardData: {},
|
deployBoardData: {},
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isEmpty: true,
|
isEmpty: true,
|
||||||
logsPath,
|
|
||||||
});
|
});
|
||||||
return nextTick();
|
return nextTick();
|
||||||
});
|
});
|
||||||
|
@ -151,7 +147,6 @@ describe('Deploy Board', () => {
|
||||||
deployBoardData: {},
|
deployBoardData: {},
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
isEmpty: false,
|
isEmpty: false,
|
||||||
logsPath,
|
|
||||||
});
|
});
|
||||||
return nextTick();
|
return nextTick();
|
||||||
});
|
});
|
||||||
|
@ -167,7 +162,6 @@ describe('Deploy Board', () => {
|
||||||
wrapper = createComponent({
|
wrapper = createComponent({
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isEmpty: false,
|
isEmpty: false,
|
||||||
logsPath: environment.log_path,
|
|
||||||
deployBoardData: deployBoardMockData,
|
deployBoardData: deployBoardMockData,
|
||||||
});
|
});
|
||||||
({ statuses } = wrapper.vm);
|
({ statuses } = wrapper.vm);
|
||||||
|
|
|
@ -64,7 +64,6 @@ describe('Environment table', () => {
|
||||||
name: 'review',
|
name: 'review',
|
||||||
size: 1,
|
size: 1,
|
||||||
environment_path: 'url',
|
environment_path: 'url',
|
||||||
logs_path: 'url',
|
|
||||||
id: 1,
|
id: 1,
|
||||||
hasDeployBoard: true,
|
hasDeployBoard: true,
|
||||||
deployBoardData: deployBoardMockData,
|
deployBoardData: deployBoardMockData,
|
||||||
|
@ -92,7 +91,6 @@ describe('Environment table', () => {
|
||||||
name: 'review',
|
name: 'review',
|
||||||
size: 1,
|
size: 1,
|
||||||
environment_path: 'url',
|
environment_path: 'url',
|
||||||
logs_path: 'url',
|
|
||||||
id: 1,
|
id: 1,
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
isOpen: true,
|
isOpen: true,
|
||||||
|
@ -161,7 +159,6 @@ describe('Environment table', () => {
|
||||||
name: 'review',
|
name: 'review',
|
||||||
size: 1,
|
size: 1,
|
||||||
environment_path: 'url',
|
environment_path: 'url',
|
||||||
logs_path: 'url',
|
|
||||||
id: 1,
|
id: 1,
|
||||||
hasDeployBoard: true,
|
hasDeployBoard: true,
|
||||||
deployBoardData: deployBoardMockData,
|
deployBoardData: deployBoardMockData,
|
||||||
|
|
|
@ -5,7 +5,6 @@ import Vuex from 'vuex';
|
||||||
import { nextTick } from 'vue';
|
import { nextTick } from 'vue';
|
||||||
import { setTestTimeout } from 'helpers/timeout';
|
import { setTestTimeout } from 'helpers/timeout';
|
||||||
import axios from '~/lib/utils/axios_utils';
|
import axios from '~/lib/utils/axios_utils';
|
||||||
import invalidUrl from '~/lib/utils/invalid_url';
|
|
||||||
|
|
||||||
import MonitorAnomalyChart from '~/monitoring/components/charts/anomaly.vue';
|
import MonitorAnomalyChart from '~/monitoring/components/charts/anomaly.vue';
|
||||||
import MonitorBarChart from '~/monitoring/components/charts/bar.vue';
|
import MonitorBarChart from '~/monitoring/components/charts/bar.vue';
|
||||||
|
@ -27,13 +26,7 @@ import {
|
||||||
heatmapGraphData,
|
heatmapGraphData,
|
||||||
barGraphData,
|
barGraphData,
|
||||||
} from '../graph_data';
|
} from '../graph_data';
|
||||||
import {
|
import { mockNamespace, mockNamespacedData, mockTimeRange } from '../mock_data';
|
||||||
mockLogsHref,
|
|
||||||
mockLogsPath,
|
|
||||||
mockNamespace,
|
|
||||||
mockNamespacedData,
|
|
||||||
mockTimeRange,
|
|
||||||
} from '../mock_data';
|
|
||||||
|
|
||||||
const mocks = {
|
const mocks = {
|
||||||
$toast: {
|
$toast: {
|
||||||
|
@ -65,7 +58,6 @@ describe('Dashboard Panel', () => {
|
||||||
},
|
},
|
||||||
store,
|
store,
|
||||||
mocks,
|
mocks,
|
||||||
provide: { glFeatures: { monitorLogging: true } },
|
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -335,86 +327,6 @@ describe('Dashboard Panel', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('View Logs dropdown item', () => {
|
|
||||||
const findViewLogsLink = () => wrapper.find({ ref: 'viewLogsLink' });
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
createWrapper();
|
|
||||||
await nextTick();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('is not present by default', async () => {
|
|
||||||
await nextTick();
|
|
||||||
expect(findViewLogsLink().exists()).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('is not present if a time range is not set', async () => {
|
|
||||||
state.logsPath = mockLogsPath;
|
|
||||||
state.timeRange = null;
|
|
||||||
|
|
||||||
await nextTick();
|
|
||||||
expect(findViewLogsLink().exists()).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('is not present if the logs path is default', async () => {
|
|
||||||
state.logsPath = invalidUrl;
|
|
||||||
state.timeRange = mockTimeRange;
|
|
||||||
|
|
||||||
await nextTick();
|
|
||||||
expect(findViewLogsLink().exists()).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('is not present if the logs path is not set', async () => {
|
|
||||||
state.logsPath = null;
|
|
||||||
state.timeRange = mockTimeRange;
|
|
||||||
|
|
||||||
await nextTick();
|
|
||||||
expect(findViewLogsLink().exists()).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('is present when logs path and time a range is present', async () => {
|
|
||||||
state.logsPath = mockLogsPath;
|
|
||||||
state.timeRange = mockTimeRange;
|
|
||||||
|
|
||||||
await nextTick();
|
|
||||||
expect(findViewLogsLink().attributes('href')).toMatch(mockLogsHref);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe(':monitor_logging feature flag', () => {
|
|
||||||
it.each`
|
|
||||||
flagState | logsState | expected
|
|
||||||
${true} | ${'shows'} | ${true}
|
|
||||||
${false} | ${'hides'} | ${false}
|
|
||||||
`('$logsState logs when flag state is $flagState', async ({ flagState, expected }) => {
|
|
||||||
createWrapper({}, { provide: { glFeatures: { monitorLogging: flagState } } });
|
|
||||||
state.logsPath = mockLogsPath;
|
|
||||||
state.timeRange = mockTimeRange;
|
|
||||||
await nextTick();
|
|
||||||
|
|
||||||
expect(findViewLogsLink().exists()).toBe(expected);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('it is overridden when a datazoom event is received', async () => {
|
|
||||||
state.logsPath = mockLogsPath;
|
|
||||||
state.timeRange = mockTimeRange;
|
|
||||||
|
|
||||||
const zoomedTimeRange = {
|
|
||||||
start: '2020-01-01T00:00:00.000Z',
|
|
||||||
end: '2020-01-01T01:00:00.000Z',
|
|
||||||
};
|
|
||||||
|
|
||||||
findTimeChart().vm.$emit('datazoom', zoomedTimeRange);
|
|
||||||
|
|
||||||
await nextTick();
|
|
||||||
const start = encodeURIComponent(zoomedTimeRange.start);
|
|
||||||
const end = encodeURIComponent(zoomedTimeRange.end);
|
|
||||||
expect(findViewLogsLink().attributes('href')).toMatch(
|
|
||||||
`${mockLogsPath}?start=${start}&end=${end}`,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when clipboard data is available', () => {
|
describe('when clipboard data is available', () => {
|
||||||
const clipboardText = 'A value to copy.';
|
const clipboardText = 'A value to copy.';
|
||||||
|
|
||||||
|
@ -507,14 +419,6 @@ describe('Dashboard Panel', () => {
|
||||||
createWrapper({ namespace: mockNamespace });
|
createWrapper({ namespace: mockNamespace });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles namespaced time range and logs path state', async () => {
|
|
||||||
store.state[mockNamespace].timeRange = mockTimeRange;
|
|
||||||
store.state[mockNamespace].logsPath = mockLogsPath;
|
|
||||||
|
|
||||||
await nextTick();
|
|
||||||
expect(wrapper.find({ ref: 'viewLogsLink' }).attributes().href).toBe(mockLogsHref);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('handles namespaced deployment data state', async () => {
|
it('handles namespaced deployment data state', async () => {
|
||||||
store.state[mockNamespace].deploymentData = mockDeploymentData;
|
store.state[mockNamespace].deploymentData = mockDeploymentData;
|
||||||
|
|
||||||
|
|
|
@ -180,11 +180,6 @@ describe('Monitoring mutations', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not remove previously set properties', () => {
|
it('should not remove previously set properties', () => {
|
||||||
const defaultLogsPath = stateCopy.logsPath;
|
|
||||||
|
|
||||||
mutations[types.SET_INITIAL_STATE](stateCopy, {
|
|
||||||
logsPath: defaultLogsPath,
|
|
||||||
});
|
|
||||||
mutations[types.SET_INITIAL_STATE](stateCopy, {
|
mutations[types.SET_INITIAL_STATE](stateCopy, {
|
||||||
dashboardEndpoint: 'dashboard.json',
|
dashboardEndpoint: 'dashboard.json',
|
||||||
});
|
});
|
||||||
|
@ -196,7 +191,6 @@ describe('Monitoring mutations', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(stateCopy).toMatchObject({
|
expect(stateCopy).toMatchObject({
|
||||||
logsPath: defaultLogsPath,
|
|
||||||
dashboardEndpoint: 'dashboard.json',
|
dashboardEndpoint: 'dashboard.json',
|
||||||
projectPath: '/gitlab-org/gitlab-foss',
|
projectPath: '/gitlab-org/gitlab-foss',
|
||||||
currentEnvironmentName: 'canary',
|
currentEnvironmentName: 'canary',
|
||||||
|
@ -227,11 +221,6 @@ describe('Monitoring mutations', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not remove previously set properties', () => {
|
it('should not remove previously set properties', () => {
|
||||||
const defaultLogsPath = stateCopy.logsPath;
|
|
||||||
|
|
||||||
mutations[types.SET_ENDPOINTS](stateCopy, {
|
|
||||||
logsPath: defaultLogsPath,
|
|
||||||
});
|
|
||||||
mutations[types.SET_ENDPOINTS](stateCopy, {
|
mutations[types.SET_ENDPOINTS](stateCopy, {
|
||||||
dashboardEndpoint: 'dashboard.json',
|
dashboardEndpoint: 'dashboard.json',
|
||||||
});
|
});
|
||||||
|
@ -240,7 +229,6 @@ describe('Monitoring mutations', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(stateCopy).toMatchObject({
|
expect(stateCopy).toMatchObject({
|
||||||
logsPath: defaultLogsPath,
|
|
||||||
dashboardEndpoint: 'dashboard.json',
|
dashboardEndpoint: 'dashboard.json',
|
||||||
projectPath: '/gitlab-org/gitlab-foss',
|
projectPath: '/gitlab-org/gitlab-foss',
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import { nextTick } from 'vue';
|
import { nextTick } from 'vue';
|
||||||
import DeployBoardInstance from '~/vue_shared/components/deployment_instance.vue';
|
import DeployBoardInstance from '~/vue_shared/components/deployment_instance.vue';
|
||||||
import { folder } from './mock_data';
|
|
||||||
|
|
||||||
describe('Deploy Board Instance', () => {
|
describe('Deploy Board Instance', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
|
@ -13,7 +12,6 @@ describe('Deploy Board Instance', () => {
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
provide: {
|
provide: {
|
||||||
glFeatures: { monitorLogging: true },
|
|
||||||
...provide,
|
...provide,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -25,7 +23,6 @@ describe('Deploy Board Instance', () => {
|
||||||
|
|
||||||
it('should render a div with the correct css status and tooltip data', () => {
|
it('should render a div with the correct css status and tooltip data', () => {
|
||||||
wrapper = createComponent({
|
wrapper = createComponent({
|
||||||
logsPath: folder.logs_path,
|
|
||||||
tooltipText: 'This is a pod',
|
tooltipText: 'This is a pod',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -43,17 +40,6 @@ describe('Deploy Board Instance', () => {
|
||||||
expect(wrapper.classes('deployment-instance-deploying')).toBe(true);
|
expect(wrapper.classes('deployment-instance-deploying')).toBe(true);
|
||||||
expect(wrapper.attributes('title')).toEqual('');
|
expect(wrapper.attributes('title')).toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have a log path computed with a pod name as a parameter', () => {
|
|
||||||
wrapper = createComponent({
|
|
||||||
logsPath: folder.logs_path,
|
|
||||||
podName: 'tanuki-1',
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(wrapper.vm.computedLogPath).toEqual(
|
|
||||||
'/root/review-app/-/logs?environment_name=foo&pod_name=tanuki-1',
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as a canary deployment', () => {
|
describe('as a canary deployment', () => {
|
||||||
|
@ -76,46 +62,10 @@ describe('Deploy Board Instance', () => {
|
||||||
wrapper.destroy();
|
wrapper.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be a link without a logsPath prop', async () => {
|
|
||||||
wrapper = createComponent({
|
|
||||||
stable: false,
|
|
||||||
logsPath: '',
|
|
||||||
});
|
|
||||||
|
|
||||||
await nextTick();
|
|
||||||
expect(wrapper.vm.computedLogPath).toBeNull();
|
|
||||||
expect(wrapper.vm.isLink).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render a link without href if path is not passed', () => {
|
|
||||||
wrapper = createComponent();
|
|
||||||
|
|
||||||
expect(wrapper.attributes('href')).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not have a tooltip', () => {
|
it('should not have a tooltip', () => {
|
||||||
wrapper = createComponent();
|
wrapper = createComponent();
|
||||||
|
|
||||||
expect(wrapper.attributes('title')).toEqual('');
|
expect(wrapper.attributes('title')).toEqual('');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe(':monitor_logging feature flag', () => {
|
|
||||||
afterEach(() => {
|
|
||||||
wrapper.destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it.each`
|
|
||||||
flagState | logsState | expected
|
|
||||||
${true} | ${'shows'} | ${'/root/review-app/-/logs?environment_name=foo&pod_name=tanuki-1'}
|
|
||||||
${false} | ${'hides'} | ${undefined}
|
|
||||||
`('$logsState log link when flag state is $flagState', async ({ flagState, expected }) => {
|
|
||||||
wrapper = createComponent(
|
|
||||||
{ logsPath: folder.logs_path, podName: 'tanuki-1' },
|
|
||||||
{ glFeatures: { monitorLogging: flagState } },
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(wrapper.attributes('href')).toEqual(expected);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -140,5 +140,4 @@ export const folder = {
|
||||||
created_at: '2017-02-01T19:42:18.400Z',
|
created_at: '2017-02-01T19:42:18.400Z',
|
||||||
updated_at: '2017-02-01T19:42:18.400Z',
|
updated_at: '2017-02-01T19:42:18.400Z',
|
||||||
rollout_status: {},
|
rollout_status: {},
|
||||||
logs_path: '/root/review-app/-/logs?environment_name=foo',
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue