Skip to content

Commit

Permalink
Add latest changes from gitlab-org/gitlab@master
Browse files Browse the repository at this point in the history
  • Loading branch information
GitLab Bot committed Mar 17, 2020
1 parent 8e12949 commit 2c156e3
Show file tree
Hide file tree
Showing 116 changed files with 3,131 additions and 289 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { createNamespacedHelpers, mapState, mapActions } from 'vuex';
import { createNamespacedHelpers, mapState, mapActions, mapGetters } from 'vuex';
import { escape as esc } from 'lodash';
import { GlFormInput, GlFormCheckbox } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale';
Expand Down Expand Up @@ -61,6 +61,7 @@ export default {
'gitlabManagedCluster',
'isCreatingCluster',
]),
...mapGetters(['subnetValid']),
...mapRolesState({
roles: 'items',
isLoadingRoles: 'isLoadingItems',
Expand Down Expand Up @@ -119,14 +120,17 @@ export default {
!this.selectedRegion ||
!this.selectedKeyPair ||
!this.selectedVpc ||
!this.selectedSubnet ||
!this.subnetValid ||
!this.selectedRole ||
!this.selectedSecurityGroup ||
!this.selectedInstanceType ||
!this.nodeCount ||
this.isCreatingCluster
);
},
displaySubnetError() {
return Boolean(this.loadingSubnetsError) || this.selectedSubnet?.length === 1;
},
createClusterButtonLabel() {
return this.isCreatingCluster
? s__('ClusterIntegration|Creating Kubernetes cluster')
Expand Down Expand Up @@ -216,6 +220,13 @@ export default {
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() {
return sprintf(
s__(
Expand Down Expand Up @@ -289,14 +300,14 @@ export default {
this.setRegion({ region });
this.setVpc({ vpc: null });
this.setKeyPair({ keyPair: null });
this.setSubnet({ subnet: null });
this.setSubnet({ subnet: [] });
this.setSecurityGroup({ securityGroup: null });
this.fetchVpcs({ region });
this.fetchKeyPairs({ region });
},
setVpcAndFetchSubnets(vpc) {
this.setVpc({ vpc });
this.setSubnet({ subnet: null });
this.setSubnet({ subnet: [] });
this.setSecurityGroup({ securityGroup: null });
this.fetchSubnets({ vpc, region: this.selectedRegion });
this.fetchSecurityGroups({ vpc, region: this.selectedRegion });
Expand Down Expand Up @@ -436,8 +447,8 @@ export default {
:placeholder="s__('ClusterIntergation|Select a subnet')"
:search-field-placeholder="s__('ClusterIntegration|Search subnets')"
:empty-text="s__('ClusterIntegration|No subnet found')"
:has-errors="Boolean(loadingSubnetsError)"
:error-message="s__('ClusterIntegration|Could not load subnets for the selected VPC')"
:has-errors="displaySubnetError"
:error-message="subnetValidationErrorText"
@input="setSubnet({ subnet: $event })"
/>
<p class="form-text text-muted" v-html="subnetDropdownHelpText"></p>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// eslint-disable-next-line import/prefer-default-export
export const subnetValid = ({ selectedSubnet }) =>
Array.isArray(selectedSubnet) && selectedSubnet.length >= 2;
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default () => ({
selectedRole: '',
selectedKeyPair: '',
selectedVpc: '',
selectedSubnet: '',
selectedSubnet: [],
selectedSecurityGroup: '',
selectedInstanceType: 'm5.large',
nodeCount: '3',
Expand Down
11 changes: 11 additions & 0 deletions app/assets/javascripts/diffs/components/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export default {
type: String,
required: true,
},
endpointCoverage: {
type: String,
required: false,
default: '',
},
projectPath: {
type: String,
required: true,
Expand Down Expand Up @@ -169,6 +174,7 @@ export default {
endpoint: this.endpoint,
endpointMetadata: this.endpointMetadata,
endpointBatch: this.endpointBatch,
endpointCoverage: this.endpointCoverage,
projectPath: this.projectPath,
dismissEndpoint: this.dismissEndpoint,
showSuggestPopover: this.showSuggestPopover,
Expand Down Expand Up @@ -218,6 +224,7 @@ export default {
'fetchDiffFiles',
'fetchDiffFilesMeta',
'fetchDiffFilesBatch',
'fetchCoverageFiles',
'startRenderDiffsQueue',
'assignDiscussionsToDiff',
'setHighlightedRow',
Expand Down Expand Up @@ -292,6 +299,10 @@ export default {
});
}
if (this.endpointCoverage) {
this.fetchCoverageFiles();
}
if (!this.isNotesFetched) {
eventHub.$emit('fetchNotesData');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default {
colspan: {
type: Number,
required: false,
default: 3,
default: 4,
},
},
computed: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default {

<template>
<tr v-if="shouldRender" :class="className" class="notes_holder">
<td class="notes-content" colspan="3">
<td class="notes-content" colspan="4">
<div class="content">
<diff-discussions
v-if="line.discussions.length"
Expand Down
22 changes: 20 additions & 2 deletions app/assets/javascripts/diffs/components/inline_diff_table_row.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<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 {
MATCH_LINE_TYPE,
Expand All @@ -15,11 +16,18 @@ export default {
components: {
DiffTableCell,
},
directives: {
GlTooltip: GlTooltipDirective,
},
props: {
fileHash: {
type: String,
required: true,
},
filePath: {
type: String,
required: true,
},
contextLinesPath: {
type: String,
required: true,
Expand All @@ -40,6 +48,7 @@ export default {
};
},
computed: {
...mapGetters('diffs', ['fileLineCoverage']),
...mapState({
isHighlighted(state) {
return this.line.line_code !== null && this.line.line_code === state.diffs.highlightedRow;
Expand All @@ -62,6 +71,9 @@ export default {
isMatchLine() {
return this.line.type === MATCH_LINE_TYPE;
},
coverageState() {
return this.fileLineCoverage(this.filePath, this.line.new_line);
},
},
created() {
this.newLineType = NEW_LINE_TYPE;
Expand Down Expand Up @@ -113,14 +125,20 @@ export default {
:is-highlighted="isHighlighted"
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
:class="[
line.type,
{
hll: isHighlighted,
},
]"
class="line_content"
class="line_content with-coverage"
v-html="line.rich_text"
></td>
</tr>
Expand Down
2 changes: 2 additions & 0 deletions app/assets/javascripts/diffs/components/inline_diff_view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default {
<colgroup>
<col style="width: 50px;" />
<col style="width: 50px;" />
<col style="width: 8px;" />
<col />
</colgroup>
<tbody>
Expand All @@ -63,6 +64,7 @@ export default {
<inline-diff-table-row
:key="`${line.line_code || index}`"
:file-hash="diffFile.file_hash"
:file-path="diffFile.file_path"
:context-lines-path="diffFile.context_lines_path"
:line="line"
:is-bottom="index + 1 === diffLinesLength"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default {

<template>
<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">
<diff-discussions
:discussions="line.left.discussions"
Expand All @@ -147,7 +147,7 @@ export default {
</template>
</diff-discussion-reply>
</td>
<td class="notes-content parallel new" colspan="2">
<td class="notes-content parallel new" colspan="3">
<div v-if="shouldRenderDiscussionsOnRight" class="content">
<diff-discussions
:discussions="line.right.discussions"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default {
:line="line.left"
:is-top="isTop"
:is-bottom="isBottom"
:colspan="4"
:colspan="6"
/>
</template>
</tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script>
import { mapActions, mapState } from 'vuex';
import { mapActions, mapGetters, mapState } from 'vuex';
import $ from 'jquery';
import { GlTooltipDirective } from '@gitlab/ui';
import DiffTableCell from './diff_table_cell.vue';
import {
MATCH_LINE_TYPE,
Expand All @@ -18,11 +19,18 @@ export default {
components: {
DiffTableCell,
},
directives: {
GlTooltip: GlTooltipDirective,
},
props: {
fileHash: {
type: String,
required: true,
},
filePath: {
type: String,
required: true,
},
contextLinesPath: {
type: String,
required: true,
Expand All @@ -44,6 +52,7 @@ export default {
};
},
computed: {
...mapGetters('diffs', ['fileLineCoverage']),
...mapState({
isHighlighted(state) {
const lineCode =
Expand Down Expand Up @@ -82,6 +91,9 @@ export default {
isMatchLineRight() {
return this.line.right && this.line.right.type === MATCH_LINE_TYPE;
},
coverageState() {
return this.fileLineCoverage(this.filePath, this.line.right.new_line);
},
},
created() {
this.newLineType = NEW_LINE_TYPE;
Expand All @@ -99,7 +111,7 @@ export default {
const allCellsInHoveringRow = Array.from(e.currentTarget.children);
const hoverIndex = allCellsInHoveringRow.indexOf(hoveringCell);
if (hoverIndex >= 2) {
if (hoverIndex >= 3) {
this.isRightHover = isHover;
} else {
this.isLeftHover = isHover;
Expand Down Expand Up @@ -143,17 +155,19 @@ export default {
line-position="left"
class="diff-line-num old_line"
/>
<td :class="parallelViewLeftLineType" class="line-coverage left-side"></td>
<td
:id="line.left.line_code"
:class="parallelViewLeftLineType"
class="line_content parallel left-side"
class="line_content with-coverage parallel left-side"
@mousedown="handleParallelLineMouseDown"
v-html="line.left.rich_text"
></td>
</template>
<template v-else>
<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 v-if="line.right && !isMatchLineRight">
<diff-table-cell
Expand All @@ -169,6 +183,12 @@ export default {
line-position="right"
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
:id="line.right.line_code"
:class="[
Expand All @@ -177,14 +197,15 @@ export default {
hll: isHighlighted,
},
]"
class="line_content parallel right-side"
class="line_content with-coverage parallel right-side"
@mousedown="handleParallelLineMouseDown"
v-html="line.right.rich_text"
></td>
</template>
<template v-else>
<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>
</tr>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ export default {
>
<colgroup>
<col style="width: 50px;" />
<col style="width: 8px;" />
<col />
<col style="width: 50px;" />
<col style="width: 8px;" />
<col />
</colgroup>
<tbody>
Expand All @@ -64,6 +66,7 @@ export default {
<parallel-diff-table-row
:key="line.line_code"
:file-hash="diffFile.file_hash"
:file-path="diffFile.file_path"
:context-lines-path="diffFile.context_lines_path"
:line="line"
:is-bottom="index + 1 === diffLinesLength"
Expand Down
2 changes: 2 additions & 0 deletions app/assets/javascripts/diffs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default function initDiffsApp(store) {
endpoint: dataset.endpoint,
endpointMetadata: dataset.endpointMetadata || '',
endpointBatch: dataset.endpointBatch || '',
endpointCoverage: dataset.endpointCoverage || '',
projectPath: dataset.projectPath,
helpPagePath: dataset.helpPagePath,
currentUser: JSON.parse(dataset.currentUserData) || {},
Expand Down Expand Up @@ -104,6 +105,7 @@ export default function initDiffsApp(store) {
endpoint: this.endpoint,
endpointMetadata: this.endpointMetadata,
endpointBatch: this.endpointBatch,
endpointCoverage: this.endpointCoverage,
currentUser: this.currentUser,
projectPath: this.projectPath,
helpPagePath: this.helpPagePath,
Expand Down
Loading

0 comments on commit 2c156e3

Please sign in to comment.