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