Skip to content
Snippets Groups Projects
Commit 2c156e3c authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 8e129497
No related branches found
No related tags found
No related merge requests found
Showing
with 171 additions and 21 deletions
<script> <script>
import { createNamespacedHelpers, mapState, mapActions } from 'vuex'; import { createNamespacedHelpers, mapState, mapActions, mapGetters } from 'vuex';
import { escape as esc } from 'lodash'; import { escape as esc } from 'lodash';
import { GlFormInput, GlFormCheckbox } from '@gitlab/ui'; import { GlFormInput, GlFormCheckbox } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale'; import { sprintf, s__ } from '~/locale';
Loading
@@ -61,6 +61,7 @@ export default {
Loading
@@ -61,6 +61,7 @@ export default {
'gitlabManagedCluster', 'gitlabManagedCluster',
'isCreatingCluster', 'isCreatingCluster',
]), ]),
...mapGetters(['subnetValid']),
...mapRolesState({ ...mapRolesState({
roles: 'items', roles: 'items',
isLoadingRoles: 'isLoadingItems', isLoadingRoles: 'isLoadingItems',
Loading
@@ -119,7 +120,7 @@ export default {
Loading
@@ -119,7 +120,7 @@ export default {
!this.selectedRegion || !this.selectedRegion ||
!this.selectedKeyPair || !this.selectedKeyPair ||
!this.selectedVpc || !this.selectedVpc ||
!this.selectedSubnet || !this.subnetValid ||
!this.selectedRole || !this.selectedRole ||
!this.selectedSecurityGroup || !this.selectedSecurityGroup ||
!this.selectedInstanceType || !this.selectedInstanceType ||
Loading
@@ -127,6 +128,9 @@ export default {
Loading
@@ -127,6 +128,9 @@ export default {
this.isCreatingCluster this.isCreatingCluster
); );
}, },
displaySubnetError() {
return Boolean(this.loadingSubnetsError) || this.selectedSubnet?.length === 1;
},
createClusterButtonLabel() { createClusterButtonLabel() {
return this.isCreatingCluster return this.isCreatingCluster
? s__('ClusterIntegration|Creating Kubernetes cluster') ? s__('ClusterIntegration|Creating Kubernetes cluster')
Loading
@@ -216,6 +220,13 @@ export default {
Loading
@@ -216,6 +220,13 @@ export default {
false, false,
); );
}, },
subnetValidationErrorText() {
if (this.loadingSubnetsError) {
return s__('ClusterIntegration|Could not load subnets for the selected VPC');
}
return s__('ClusterIntegration|You should select at least two subnets');
},
securityGroupDropdownHelpText() { securityGroupDropdownHelpText() {
return sprintf( return sprintf(
s__( s__(
Loading
@@ -289,14 +300,14 @@ export default {
Loading
@@ -289,14 +300,14 @@ export default {
this.setRegion({ region }); this.setRegion({ region });
this.setVpc({ vpc: null }); this.setVpc({ vpc: null });
this.setKeyPair({ keyPair: null }); this.setKeyPair({ keyPair: null });
this.setSubnet({ subnet: null }); this.setSubnet({ subnet: [] });
this.setSecurityGroup({ securityGroup: null }); this.setSecurityGroup({ securityGroup: null });
this.fetchVpcs({ region }); this.fetchVpcs({ region });
this.fetchKeyPairs({ region }); this.fetchKeyPairs({ region });
}, },
setVpcAndFetchSubnets(vpc) { setVpcAndFetchSubnets(vpc) {
this.setVpc({ vpc }); this.setVpc({ vpc });
this.setSubnet({ subnet: null }); this.setSubnet({ subnet: [] });
this.setSecurityGroup({ securityGroup: null }); this.setSecurityGroup({ securityGroup: null });
this.fetchSubnets({ vpc, region: this.selectedRegion }); this.fetchSubnets({ vpc, region: this.selectedRegion });
this.fetchSecurityGroups({ vpc, region: this.selectedRegion }); this.fetchSecurityGroups({ vpc, region: this.selectedRegion });
Loading
@@ -436,8 +447,8 @@ export default {
Loading
@@ -436,8 +447,8 @@ export default {
:placeholder="s__('ClusterIntergation|Select a subnet')" :placeholder="s__('ClusterIntergation|Select a subnet')"
:search-field-placeholder="s__('ClusterIntegration|Search subnets')" :search-field-placeholder="s__('ClusterIntegration|Search subnets')"
:empty-text="s__('ClusterIntegration|No subnet found')" :empty-text="s__('ClusterIntegration|No subnet found')"
:has-errors="Boolean(loadingSubnetsError)" :has-errors="displaySubnetError"
:error-message="s__('ClusterIntegration|Could not load subnets for the selected VPC')" :error-message="subnetValidationErrorText"
@input="setSubnet({ subnet: $event })" @input="setSubnet({ subnet: $event })"
/> />
<p class="form-text text-muted" v-html="subnetDropdownHelpText"></p> <p class="form-text text-muted" v-html="subnetDropdownHelpText"></p>
Loading
Loading
// eslint-disable-next-line import/prefer-default-export
export const subnetValid = ({ selectedSubnet }) =>
Array.isArray(selectedSubnet) && selectedSubnet.length >= 2;
Loading
@@ -21,7 +21,7 @@ export default () => ({
Loading
@@ -21,7 +21,7 @@ export default () => ({
selectedRole: '', selectedRole: '',
selectedKeyPair: '', selectedKeyPair: '',
selectedVpc: '', selectedVpc: '',
selectedSubnet: '', selectedSubnet: [],
selectedSecurityGroup: '', selectedSecurityGroup: '',
selectedInstanceType: 'm5.large', selectedInstanceType: 'm5.large',
nodeCount: '3', nodeCount: '3',
Loading
Loading
Loading
@@ -50,6 +50,11 @@ export default {
Loading
@@ -50,6 +50,11 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
endpointCoverage: {
type: String,
required: false,
default: '',
},
projectPath: { projectPath: {
type: String, type: String,
required: true, required: true,
Loading
@@ -169,6 +174,7 @@ export default {
Loading
@@ -169,6 +174,7 @@ export default {
endpoint: this.endpoint, endpoint: this.endpoint,
endpointMetadata: this.endpointMetadata, endpointMetadata: this.endpointMetadata,
endpointBatch: this.endpointBatch, endpointBatch: this.endpointBatch,
endpointCoverage: this.endpointCoverage,
projectPath: this.projectPath, projectPath: this.projectPath,
dismissEndpoint: this.dismissEndpoint, dismissEndpoint: this.dismissEndpoint,
showSuggestPopover: this.showSuggestPopover, showSuggestPopover: this.showSuggestPopover,
Loading
@@ -218,6 +224,7 @@ export default {
Loading
@@ -218,6 +224,7 @@ export default {
'fetchDiffFiles', 'fetchDiffFiles',
'fetchDiffFilesMeta', 'fetchDiffFilesMeta',
'fetchDiffFilesBatch', 'fetchDiffFilesBatch',
'fetchCoverageFiles',
'startRenderDiffsQueue', 'startRenderDiffsQueue',
'assignDiscussionsToDiff', 'assignDiscussionsToDiff',
'setHighlightedRow', 'setHighlightedRow',
Loading
@@ -292,6 +299,10 @@ export default {
Loading
@@ -292,6 +299,10 @@ export default {
}); });
} }
   
if (this.endpointCoverage) {
this.fetchCoverageFiles();
}
if (!this.isNotesFetched) { if (!this.isNotesFetched) {
eventHub.$emit('fetchNotesData'); eventHub.$emit('fetchNotesData');
} }
Loading
Loading
Loading
@@ -54,7 +54,7 @@ export default {
Loading
@@ -54,7 +54,7 @@ export default {
colspan: { colspan: {
type: Number, type: Number,
required: false, required: false,
default: 3, default: 4,
}, },
}, },
computed: { computed: {
Loading
Loading
Loading
@@ -51,7 +51,7 @@ export default {
Loading
@@ -51,7 +51,7 @@ export default {
   
<template> <template>
<tr v-if="shouldRender" :class="className" class="notes_holder"> <tr v-if="shouldRender" :class="className" class="notes_holder">
<td class="notes-content" colspan="3"> <td class="notes-content" colspan="4">
<div class="content"> <div class="content">
<diff-discussions <diff-discussions
v-if="line.discussions.length" v-if="line.discussions.length"
Loading
Loading
<script> <script>
import { mapActions, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { GlTooltipDirective } from '@gitlab/ui';
import DiffTableCell from './diff_table_cell.vue'; import DiffTableCell from './diff_table_cell.vue';
import { import {
MATCH_LINE_TYPE, MATCH_LINE_TYPE,
Loading
@@ -15,11 +16,18 @@ export default {
Loading
@@ -15,11 +16,18 @@ export default {
components: { components: {
DiffTableCell, DiffTableCell,
}, },
directives: {
GlTooltip: GlTooltipDirective,
},
props: { props: {
fileHash: { fileHash: {
type: String, type: String,
required: true, required: true,
}, },
filePath: {
type: String,
required: true,
},
contextLinesPath: { contextLinesPath: {
type: String, type: String,
required: true, required: true,
Loading
@@ -40,6 +48,7 @@ export default {
Loading
@@ -40,6 +48,7 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters('diffs', ['fileLineCoverage']),
...mapState({ ...mapState({
isHighlighted(state) { isHighlighted(state) {
return this.line.line_code !== null && this.line.line_code === state.diffs.highlightedRow; return this.line.line_code !== null && this.line.line_code === state.diffs.highlightedRow;
Loading
@@ -62,6 +71,9 @@ export default {
Loading
@@ -62,6 +71,9 @@ export default {
isMatchLine() { isMatchLine() {
return this.line.type === MATCH_LINE_TYPE; return this.line.type === MATCH_LINE_TYPE;
}, },
coverageState() {
return this.fileLineCoverage(this.filePath, this.line.new_line);
},
}, },
created() { created() {
this.newLineType = NEW_LINE_TYPE; this.newLineType = NEW_LINE_TYPE;
Loading
@@ -113,6 +125,12 @@ export default {
Loading
@@ -113,6 +125,12 @@ export default {
:is-highlighted="isHighlighted" :is-highlighted="isHighlighted"
class="diff-line-num new_line qa-new-diff-line" class="diff-line-num new_line qa-new-diff-line"
/> />
<td
v-gl-tooltip.hover
:title="coverageState.text"
:class="[line.type, coverageState.class, { hll: isHighlighted }]"
class="line-coverage"
></td>
<td <td
:class="[ :class="[
line.type, line.type,
Loading
@@ -120,7 +138,7 @@ export default {
Loading
@@ -120,7 +138,7 @@ export default {
hll: isHighlighted, hll: isHighlighted,
}, },
]" ]"
class="line_content" class="line_content with-coverage"
v-html="line.rich_text" v-html="line.rich_text"
></td> ></td>
</tr> </tr>
Loading
Loading
Loading
@@ -48,6 +48,7 @@ export default {
Loading
@@ -48,6 +48,7 @@ export default {
<colgroup> <colgroup>
<col style="width: 50px;" /> <col style="width: 50px;" />
<col style="width: 50px;" /> <col style="width: 50px;" />
<col style="width: 8px;" />
<col /> <col />
</colgroup> </colgroup>
<tbody> <tbody>
Loading
@@ -63,6 +64,7 @@ export default {
Loading
@@ -63,6 +64,7 @@ export default {
<inline-diff-table-row <inline-diff-table-row
:key="`${line.line_code || index}`" :key="`${line.line_code || index}`"
:file-hash="diffFile.file_hash" :file-hash="diffFile.file_hash"
:file-path="diffFile.file_path"
:context-lines-path="diffFile.context_lines_path" :context-lines-path="diffFile.context_lines_path"
:line="line" :line="line"
:is-bottom="index + 1 === diffLinesLength" :is-bottom="index + 1 === diffLinesLength"
Loading
Loading
Loading
@@ -122,7 +122,7 @@ export default {
Loading
@@ -122,7 +122,7 @@ export default {
   
<template> <template>
<tr v-if="shouldRender" :class="className" class="notes_holder"> <tr v-if="shouldRender" :class="className" class="notes_holder">
<td class="notes-content parallel old" colspan="2"> <td class="notes-content parallel old" colspan="3">
<div v-if="shouldRenderDiscussionsOnLeft" class="content"> <div v-if="shouldRenderDiscussionsOnLeft" class="content">
<diff-discussions <diff-discussions
:discussions="line.left.discussions" :discussions="line.left.discussions"
Loading
@@ -147,7 +147,7 @@ export default {
Loading
@@ -147,7 +147,7 @@ export default {
</template> </template>
</diff-discussion-reply> </diff-discussion-reply>
</td> </td>
<td class="notes-content parallel new" colspan="2"> <td class="notes-content parallel new" colspan="3">
<div v-if="shouldRenderDiscussionsOnRight" class="content"> <div v-if="shouldRenderDiscussionsOnRight" class="content">
<diff-discussions <diff-discussions
:discussions="line.right.discussions" :discussions="line.right.discussions"
Loading
Loading
Loading
@@ -49,7 +49,7 @@ export default {
Loading
@@ -49,7 +49,7 @@ export default {
:line="line.left" :line="line.left"
:is-top="isTop" :is-top="isTop"
:is-bottom="isBottom" :is-bottom="isBottom"
:colspan="4" :colspan="6"
/> />
</template> </template>
</tr> </tr>
Loading
Loading
<script> <script>
import { mapActions, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import $ from 'jquery'; import $ from 'jquery';
import { GlTooltipDirective } from '@gitlab/ui';
import DiffTableCell from './diff_table_cell.vue'; import DiffTableCell from './diff_table_cell.vue';
import { import {
MATCH_LINE_TYPE, MATCH_LINE_TYPE,
Loading
@@ -18,11 +19,18 @@ export default {
Loading
@@ -18,11 +19,18 @@ export default {
components: { components: {
DiffTableCell, DiffTableCell,
}, },
directives: {
GlTooltip: GlTooltipDirective,
},
props: { props: {
fileHash: { fileHash: {
type: String, type: String,
required: true, required: true,
}, },
filePath: {
type: String,
required: true,
},
contextLinesPath: { contextLinesPath: {
type: String, type: String,
required: true, required: true,
Loading
@@ -44,6 +52,7 @@ export default {
Loading
@@ -44,6 +52,7 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters('diffs', ['fileLineCoverage']),
...mapState({ ...mapState({
isHighlighted(state) { isHighlighted(state) {
const lineCode = const lineCode =
Loading
@@ -82,6 +91,9 @@ export default {
Loading
@@ -82,6 +91,9 @@ export default {
isMatchLineRight() { isMatchLineRight() {
return this.line.right && this.line.right.type === MATCH_LINE_TYPE; return this.line.right && this.line.right.type === MATCH_LINE_TYPE;
}, },
coverageState() {
return this.fileLineCoverage(this.filePath, this.line.right.new_line);
},
}, },
created() { created() {
this.newLineType = NEW_LINE_TYPE; this.newLineType = NEW_LINE_TYPE;
Loading
@@ -99,7 +111,7 @@ export default {
Loading
@@ -99,7 +111,7 @@ export default {
const allCellsInHoveringRow = Array.from(e.currentTarget.children); const allCellsInHoveringRow = Array.from(e.currentTarget.children);
const hoverIndex = allCellsInHoveringRow.indexOf(hoveringCell); const hoverIndex = allCellsInHoveringRow.indexOf(hoveringCell);
   
if (hoverIndex >= 2) { if (hoverIndex >= 3) {
this.isRightHover = isHover; this.isRightHover = isHover;
} else { } else {
this.isLeftHover = isHover; this.isLeftHover = isHover;
Loading
@@ -143,17 +155,19 @@ export default {
Loading
@@ -143,17 +155,19 @@ export default {
line-position="left" line-position="left"
class="diff-line-num old_line" class="diff-line-num old_line"
/> />
<td :class="parallelViewLeftLineType" class="line-coverage left-side"></td>
<td <td
:id="line.left.line_code" :id="line.left.line_code"
:class="parallelViewLeftLineType" :class="parallelViewLeftLineType"
class="line_content parallel left-side" class="line_content with-coverage parallel left-side"
@mousedown="handleParallelLineMouseDown" @mousedown="handleParallelLineMouseDown"
v-html="line.left.rich_text" v-html="line.left.rich_text"
></td> ></td>
</template> </template>
<template v-else> <template v-else>
<td class="diff-line-num old_line empty-cell"></td> <td class="diff-line-num old_line empty-cell"></td>
<td class="line_content parallel left-side empty-cell"></td> <td class="line-coverage left-side empty-cell"></td>
<td class="line_content with-coverage parallel left-side empty-cell"></td>
</template> </template>
<template v-if="line.right && !isMatchLineRight"> <template v-if="line.right && !isMatchLineRight">
<diff-table-cell <diff-table-cell
Loading
@@ -169,6 +183,12 @@ export default {
Loading
@@ -169,6 +183,12 @@ export default {
line-position="right" line-position="right"
class="diff-line-num new_line" class="diff-line-num new_line"
/> />
<td
v-gl-tooltip.hover
:title="coverageState.text"
:class="[line.right.type, coverageState.class, { hll: isHighlighted }]"
class="line-coverage right-side"
></td>
<td <td
:id="line.right.line_code" :id="line.right.line_code"
:class="[ :class="[
Loading
@@ -177,14 +197,15 @@ export default {
Loading
@@ -177,14 +197,15 @@ export default {
hll: isHighlighted, hll: isHighlighted,
}, },
]" ]"
class="line_content parallel right-side" class="line_content with-coverage parallel right-side"
@mousedown="handleParallelLineMouseDown" @mousedown="handleParallelLineMouseDown"
v-html="line.right.rich_text" v-html="line.right.rich_text"
></td> ></td>
</template> </template>
<template v-else> <template v-else>
<td class="diff-line-num old_line empty-cell"></td> <td class="diff-line-num old_line empty-cell"></td>
<td class="line_content parallel right-side empty-cell"></td> <td class="line-coverage right-side empty-cell"></td>
<td class="line_content with-coverage parallel right-side empty-cell"></td>
</template> </template>
</tr> </tr>
</template> </template>
Loading
@@ -47,8 +47,10 @@ export default {
Loading
@@ -47,8 +47,10 @@ export default {
> >
<colgroup> <colgroup>
<col style="width: 50px;" /> <col style="width: 50px;" />
<col style="width: 8px;" />
<col /> <col />
<col style="width: 50px;" /> <col style="width: 50px;" />
<col style="width: 8px;" />
<col /> <col />
</colgroup> </colgroup>
<tbody> <tbody>
Loading
@@ -64,6 +66,7 @@ export default {
Loading
@@ -64,6 +66,7 @@ export default {
<parallel-diff-table-row <parallel-diff-table-row
:key="line.line_code" :key="line.line_code"
:file-hash="diffFile.file_hash" :file-hash="diffFile.file_hash"
:file-path="diffFile.file_path"
:context-lines-path="diffFile.context_lines_path" :context-lines-path="diffFile.context_lines_path"
:line="line" :line="line"
:is-bottom="index + 1 === diffLinesLength" :is-bottom="index + 1 === diffLinesLength"
Loading
Loading
Loading
@@ -69,6 +69,7 @@ export default function initDiffsApp(store) {
Loading
@@ -69,6 +69,7 @@ export default function initDiffsApp(store) {
endpoint: dataset.endpoint, endpoint: dataset.endpoint,
endpointMetadata: dataset.endpointMetadata || '', endpointMetadata: dataset.endpointMetadata || '',
endpointBatch: dataset.endpointBatch || '', endpointBatch: dataset.endpointBatch || '',
endpointCoverage: dataset.endpointCoverage || '',
projectPath: dataset.projectPath, projectPath: dataset.projectPath,
helpPagePath: dataset.helpPagePath, helpPagePath: dataset.helpPagePath,
currentUser: JSON.parse(dataset.currentUserData) || {}, currentUser: JSON.parse(dataset.currentUserData) || {},
Loading
@@ -104,6 +105,7 @@ export default function initDiffsApp(store) {
Loading
@@ -104,6 +105,7 @@ export default function initDiffsApp(store) {
endpoint: this.endpoint, endpoint: this.endpoint,
endpointMetadata: this.endpointMetadata, endpointMetadata: this.endpointMetadata,
endpointBatch: this.endpointBatch, endpointBatch: this.endpointBatch,
endpointCoverage: this.endpointCoverage,
currentUser: this.currentUser, currentUser: this.currentUser,
projectPath: this.projectPath, projectPath: this.projectPath,
helpPagePath: this.helpPagePath, helpPagePath: this.helpPagePath,
Loading
Loading
import Vue from 'vue'; import Vue from 'vue';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import Poll from '~/lib/utils/poll';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import httpStatusCodes from '~/lib/utils/http_status';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { s__ } from '~/locale'; import { __, s__ } from '~/locale';
import { handleLocationHash, historyPushState, scrollToElement } from '~/lib/utils/common_utils'; import { handleLocationHash, historyPushState, scrollToElement } from '~/lib/utils/common_utils';
import { mergeUrlParams, getLocationHash } from '~/lib/utils/url_utility'; import { mergeUrlParams, getLocationHash } from '~/lib/utils/url_utility';
import TreeWorker from '../workers/tree_worker'; import TreeWorker from '../workers/tree_worker';
Loading
@@ -43,6 +45,7 @@ export const setBaseConfig = ({ commit }, options) => {
Loading
@@ -43,6 +45,7 @@ export const setBaseConfig = ({ commit }, options) => {
endpoint, endpoint,
endpointMetadata, endpointMetadata,
endpointBatch, endpointBatch,
endpointCoverage,
projectPath, projectPath,
dismissEndpoint, dismissEndpoint,
showSuggestPopover, showSuggestPopover,
Loading
@@ -52,6 +55,7 @@ export const setBaseConfig = ({ commit }, options) => {
Loading
@@ -52,6 +55,7 @@ export const setBaseConfig = ({ commit }, options) => {
endpoint, endpoint,
endpointMetadata, endpointMetadata,
endpointBatch, endpointBatch,
endpointCoverage,
projectPath, projectPath,
dismissEndpoint, dismissEndpoint,
showSuggestPopover, showSuggestPopover,
Loading
@@ -170,6 +174,26 @@ export const fetchDiffFilesMeta = ({ commit, state }) => {
Loading
@@ -170,6 +174,26 @@ export const fetchDiffFilesMeta = ({ commit, state }) => {
.catch(() => worker.terminate()); .catch(() => worker.terminate());
}; };
   
export const fetchCoverageFiles = ({ commit, state }) => {
const coveragePoll = new Poll({
resource: {
getCoverageReports: endpoint => axios.get(endpoint),
},
data: state.endpointCoverage,
method: 'getCoverageReports',
successCallback: ({ status, data }) => {
if (status === httpStatusCodes.OK) {
commit(types.SET_COVERAGE_DATA, data);
coveragePoll.stop();
}
},
errorCallback: () => createFlash(__('Something went wrong on our end. Please try again!')),
});
coveragePoll.makeRequest();
};
export const setHighlightedRow = ({ commit }, lineCode) => { export const setHighlightedRow = ({ commit }, lineCode) => {
const fileHash = lineCode.split('_')[0]; const fileHash = lineCode.split('_')[0];
commit(types.SET_HIGHLIGHTED_ROW, lineCode); commit(types.SET_HIGHLIGHTED_ROW, lineCode);
Loading
Loading
import { __, n__ } from '~/locale';
import { PARALLEL_DIFF_VIEW_TYPE, INLINE_DIFF_VIEW_TYPE } from '../constants'; import { PARALLEL_DIFF_VIEW_TYPE, INLINE_DIFF_VIEW_TYPE } from '../constants';
   
export const isParallelView = state => state.diffViewType === PARALLEL_DIFF_VIEW_TYPE; export const isParallelView = state => state.diffViewType === PARALLEL_DIFF_VIEW_TYPE;
Loading
@@ -98,6 +99,29 @@ export const allBlobs = (state, getters) =>
Loading
@@ -98,6 +99,29 @@ export const allBlobs = (state, getters) =>
export const getCommentFormForDiffFile = state => fileHash => export const getCommentFormForDiffFile = state => fileHash =>
state.commentForms.find(form => form.fileHash === fileHash); state.commentForms.find(form => form.fileHash === fileHash);
   
/**
* Returns the test coverage hits for a specific line of a given file
* @param {string} file
* @param {number} line
* @returns {number}
*/
export const fileLineCoverage = state => (file, line) => {
if (!state.coverageFiles.files) return {};
const fileCoverage = state.coverageFiles.files[file];
if (!fileCoverage) return {};
const lineCoverage = fileCoverage[String(line)];
if (lineCoverage === 0) {
return { text: __('No test coverage'), class: 'no-coverage' };
} else if (lineCoverage >= 0) {
return {
text: n__('Test coverage: %d hit', 'Test coverage: %d hits', lineCoverage),
class: 'coverage',
};
}
return {};
};
/** /**
* Returns index of a currently selected diff in diffFiles * Returns index of a currently selected diff in diffFiles
* @returns {number} * @returns {number}
Loading
Loading
Loading
@@ -17,6 +17,7 @@ export default () => ({
Loading
@@ -17,6 +17,7 @@ export default () => ({
commit: null, commit: null,
startVersion: null, startVersion: null,
diffFiles: [], diffFiles: [],
coverageFiles: {},
mergeRequestDiffs: [], mergeRequestDiffs: [],
mergeRequestDiff: null, mergeRequestDiff: null,
diffViewType: viewTypeFromQueryString || viewTypeFromCookie || defaultViewType, diffViewType: viewTypeFromQueryString || viewTypeFromCookie || defaultViewType,
Loading
Loading
Loading
@@ -5,6 +5,7 @@ export const SET_RETRIEVING_BATCHES = 'SET_RETRIEVING_BATCHES';
Loading
@@ -5,6 +5,7 @@ export const SET_RETRIEVING_BATCHES = 'SET_RETRIEVING_BATCHES';
export const SET_DIFF_DATA = 'SET_DIFF_DATA'; export const SET_DIFF_DATA = 'SET_DIFF_DATA';
export const SET_DIFF_DATA_BATCH = 'SET_DIFF_DATA_BATCH'; export const SET_DIFF_DATA_BATCH = 'SET_DIFF_DATA_BATCH';
export const SET_DIFF_VIEW_TYPE = 'SET_DIFF_VIEW_TYPE'; export const SET_DIFF_VIEW_TYPE = 'SET_DIFF_VIEW_TYPE';
export const SET_COVERAGE_DATA = 'SET_COVERAGE_DATA';
export const SET_MERGE_REQUEST_DIFFS = 'SET_MERGE_REQUEST_DIFFS'; export const SET_MERGE_REQUEST_DIFFS = 'SET_MERGE_REQUEST_DIFFS';
export const TOGGLE_LINE_HAS_FORM = 'TOGGLE_LINE_HAS_FORM'; export const TOGGLE_LINE_HAS_FORM = 'TOGGLE_LINE_HAS_FORM';
export const ADD_CONTEXT_LINES = 'ADD_CONTEXT_LINES'; export const ADD_CONTEXT_LINES = 'ADD_CONTEXT_LINES';
Loading
Loading
Loading
@@ -16,6 +16,7 @@ export default {
Loading
@@ -16,6 +16,7 @@ export default {
endpoint, endpoint,
endpointMetadata, endpointMetadata,
endpointBatch, endpointBatch,
endpointCoverage,
projectPath, projectPath,
dismissEndpoint, dismissEndpoint,
showSuggestPopover, showSuggestPopover,
Loading
@@ -25,6 +26,7 @@ export default {
Loading
@@ -25,6 +26,7 @@ export default {
endpoint, endpoint,
endpointMetadata, endpointMetadata,
endpointBatch, endpointBatch,
endpointCoverage,
projectPath, projectPath,
dismissEndpoint, dismissEndpoint,
showSuggestPopover, showSuggestPopover,
Loading
@@ -69,6 +71,10 @@ export default {
Loading
@@ -69,6 +71,10 @@ export default {
}); });
}, },
   
[types.SET_COVERAGE_DATA](state, coverageFiles) {
Object.assign(state, { coverageFiles });
},
[types.RENDER_FILE](state, file) { [types.RENDER_FILE](state, file) {
Object.assign(file, { Object.assign(file, {
renderIt: true, renderIt: true,
Loading
Loading
Loading
@@ -29,3 +29,15 @@
Loading
@@ -29,3 +29,15 @@
color: $link; color: $link;
} }
} }
@mixin line-coverage-border-color($coverage, $no-coverage) {
transition: border-left 0.1s ease-out;
&.coverage {
border-left: 3px solid $coverage;
}
&.no-coverage {
border-left: 3px solid $no-coverage;
}
}
Loading
@@ -24,6 +24,8 @@ $dark-pre-hll-bg: #373b41;
Loading
@@ -24,6 +24,8 @@ $dark-pre-hll-bg: #373b41;
$dark-hll-bg: #373b41; $dark-hll-bg: #373b41;
$dark-over-bg: #9f9ab5; $dark-over-bg: #9f9ab5;
$dark-expanded-bg: #3e3e3e; $dark-expanded-bg: #3e3e3e;
$dark-coverage: #b5bd68;
$dark-no-coverage: #de935f;
$dark-c: #969896; $dark-c: #969896;
$dark-err: #c66; $dark-err: #c66;
$dark-k: #b294bb; $dark-k: #b294bb;
Loading
@@ -124,12 +126,18 @@ $dark-il: #de935f;
Loading
@@ -124,12 +126,18 @@ $dark-il: #de935f;
} }
   
td.diff-line-num.hll:not(.empty-cell), td.diff-line-num.hll:not(.empty-cell),
td.line-coverage.hll:not(.empty-cell),
td.line_content.hll:not(.empty-cell) { td.line_content.hll:not(.empty-cell) {
background-color: $dark-diff-not-empty-bg; background-color: $dark-diff-not-empty-bg;
border-color: darken($dark-diff-not-empty-bg, 15%); border-color: darken($dark-diff-not-empty-bg, 15%);
} }
   
.line-coverage {
@include line-coverage-border-color($dark-coverage, $dark-no-coverage);
}
.diff-line-num.new, .diff-line-num.new,
.line-coverage.new,
.line_content.new { .line_content.new {
@include diff-background($dark-new-bg, $dark-new-idiff, $dark-border); @include diff-background($dark-new-bg, $dark-new-idiff, $dark-border);
   
Loading
@@ -140,6 +148,7 @@ $dark-il: #de935f;
Loading
@@ -140,6 +148,7 @@ $dark-il: #de935f;
} }
   
.diff-line-num.old, .diff-line-num.old,
.line-coverage.old,
.line_content.old { .line_content.old {
@include diff-background($dark-old-bg, $dark-old-idiff, $dark-border); @include diff-background($dark-old-bg, $dark-old-idiff, $dark-border);
   
Loading
@@ -168,6 +177,7 @@ $dark-il: #de935f;
Loading
@@ -168,6 +177,7 @@ $dark-il: #de935f;
&:not(.diff-expanded) + .diff-expanded, &:not(.diff-expanded) + .diff-expanded,
&.diff-expanded + .line_holder:not(.diff-expanded) { &.diff-expanded + .line_holder:not(.diff-expanded) {
> .diff-line-num, > .diff-line-num,
> .line-coverage,
> .line_content { > .line_content {
border-top: 1px solid $black; border-top: 1px solid $black;
} }
Loading
@@ -175,6 +185,7 @@ $dark-il: #de935f;
Loading
@@ -175,6 +185,7 @@ $dark-il: #de935f;
   
&.diff-expanded { &.diff-expanded {
> .diff-line-num, > .diff-line-num,
> .line-coverage,
> .line_content { > .line_content {
background: $dark-expanded-bg; background: $dark-expanded-bg;
border-color: $dark-expanded-bg; border-color: $dark-expanded-bg;
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment