Commit f9ffc5c4 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents b5260ae9 a91138ba
......@@ -54,7 +54,7 @@ export default {
:is-bottom="index + 1 === diffLinesLength"
/>
<inline-diff-comment-row
:key="`icr-${index}`"
:key="`icr-${line.line_code || index}`"
:diff-file-hash="diffFile.file_hash"
:line="line"
:help-page-path="helpPagePath"
......
......@@ -48,14 +48,14 @@ export default {
<tbody>
<template v-for="(line, index) in diffLines">
<parallel-diff-table-row
:key="index"
:key="line.line_code"
:file-hash="diffFile.file_hash"
:context-lines-path="diffFile.context_lines_path"
:line="line"
:is-bottom="index + 1 === diffLinesLength"
/>
<parallel-diff-comment-row
:key="`dcr-${index}`"
:key="`dcr-${line.line_code || index}`"
:line="line"
:diff-file-hash="diffFile.file_hash"
:line-index="index"
......
......@@ -196,6 +196,15 @@ export function trimFirstCharOfLineContent(line = {}) {
return parsedLine;
}
function getLineCode({ left, right }, index) {
if (left && left.line_code) {
return left.line_code;
} else if (right && right.line_code) {
return right.line_code;
}
return index;
}
// This prepares and optimizes the incoming diff data from the server
// by setting up incremental rendering and removing unneeded data
export function prepareDiffData(diffData) {
......@@ -208,6 +217,8 @@ export function prepareDiffData(diffData) {
const linesLength = file.parallel_diff_lines.length;
for (let u = 0; u < linesLength; u += 1) {
const line = file.parallel_diff_lines[u];
line.line_code = getLineCode(line, u);
if (line.left) {
line.left = trimFirstCharOfLineContent(line.left);
line.left.hasForm = false;
......
......@@ -28,27 +28,29 @@ export default {
</script>
<template>
<div class="block">
<div class="title">{{ s__('Job|Job artifacts') }}</div>
<div class="title font-weight-bold">{{ s__('Job|Job artifacts') }}</div>
<p v-if="isExpired" class="js-artifacts-removed build-detail-row">
{{ s__('Job|The artifacts were removed') }}
<p
v-if="isExpired || willExpire"
:class="{
'js-artifacts-removed': isExpired,
'js-artifacts-will-be-removed': willExpire,
}"
class="build-detail-row"
>
<span v-if="isExpired">{{ s__('Job|The artifacts were removed') }}</span>
<span v-if="willExpire">{{ s__('Job|The artifacts will be removed') }}</span>
<timeago-tooltip v-if="artifact.expire_at" :time="artifact.expire_at" />
</p>
<p v-else-if="willExpire" class="js-artifacts-will-be-removed build-detail-row">
{{ s__('Job|The artifacts will be removed in') }}
</p>
<timeago-tooltip v-if="artifact.expire_at" :time="artifact.expire_at" />
<div class="btn-group d-flex" role="group">
<div class="btn-group d-flex prepend-top-10" role="group">
<gl-link
v-if="artifact.keep_path"
:href="artifact.keep_path"
class="js-keep-artifacts btn btn-sm btn-default"
data-method="post"
>{{ s__('Job|Keep') }}</gl-link
>
{{ s__('Job|Keep') }}
</gl-link>
<gl-link
v-if="artifact.download_path"
......@@ -56,17 +58,15 @@ export default {
class="js-download-artifacts btn btn-sm btn-default"
download
rel="nofollow"
>{{ s__('Job|Download') }}</gl-link
>
{{ s__('Job|Download') }}
</gl-link>
<gl-link
v-if="artifact.browse_path"
:href="artifact.browse_path"
class="js-browse-artifacts btn btn-sm btn-default"
>{{ s__('Job|Browse') }}</gl-link
>
{{ s__('Job|Browse') }}
</gl-link>
</div>
</div>
</template>
......@@ -31,12 +31,12 @@ export default {
block: !isLastBlock,
}"
>
<p>
{{ __('Commit') }}
<p class="append-bottom-5">
<span class="font-weight-bold">{{ __('Commit') }}</span>
<gl-link :href="commit.commit_path" class="js-commit-sha commit-sha link-commit">{{
commit.short_id
}}</gl-link>
<gl-link :href="commit.commit_path" class="js-commit-sha commit-sha link-commit">
{{ commit.short_id }}
</gl-link>
<clipboard-button
:text="commit.short_id"
......@@ -44,11 +44,14 @@ export default {
css-class="btn btn-clipboard btn-transparent"
/>
<gl-link v-if="mergeRequest" :href="mergeRequest.path" class="js-link-commit link-commit"
>!{{ mergeRequest.iid }}</gl-link
>
<span v-if="mergeRequest">
{{ __('in') }}
<gl-link :href="mergeRequest.path" class="js-link-commit link-commit"
>!{{ mergeRequest.iid }}</gl-link
>
</span>
</p>
<p class="build-light-text append-bottom-0">{{ commit.title }}</p>
<p class="append-bottom-0">{{ commit.title }}</p>
</div>
</template>
......@@ -110,22 +110,20 @@ export default {
<aside class="right-sidebar build-sidebar" data-offset-top="101" data-spy="affix">
<div class="sidebar-container">
<div class="blocks-container">
<div class="block">
<strong class="inline prepend-top-8"> {{ job.name }} </strong>
<div class="block d-flex align-items-center">
<h4 class="flex-grow-1 prepend-top-8 m-0">{{ job.name }}</h4>
<gl-link
v-if="job.retry_path"
:class="retryButtonClass"
:href="job.retry_path"
data-method="post"
rel="nofollow"
>{{ __('Retry') }}</gl-link
>
{{ __('Retry') }}
</gl-link>
<gl-link
v-if="job.terminal_path"
:href="job.terminal_path"
class="js-terminal-link pull-right btn btn-primary
btn-inverted visible-md-block visible-lg-block"
class="js-terminal-link pull-right btn btn-primary btn-inverted visible-md-block visible-lg-block"
target="_blank"
>
{{ __('Debug') }} <icon name="external-link" />
......@@ -133,8 +131,7 @@ export default {
<gl-button
:aria-label="__('Toggle Sidebar')"
type="button"
class="btn btn-blank gutter-toggle
float-right d-block d-md-none js-sidebar-build-toggle"
class="btn btn-blank gutter-toggle float-right d-block d-md-none js-sidebar-build-toggle"
@click="toggleSidebar"
>
<i aria-hidden="true" data-hidden="true" class="fa fa-angle-double-right"></i>
......@@ -145,25 +142,18 @@ export default {
v-if="job.new_issue_path"
:href="job.new_issue_path"
class="js-new-issue btn btn-success btn-inverted"
>{{ __('New issue') }}</gl-link
>
{{ __('New issue') }}
</gl-link>
<gl-link
v-if="job.retry_path"
:href="job.retry_path"
class="js-retry-job btn btn-inverted-secondary"
data-method="post"
rel="nofollow"
>{{ __('Retry') }}</gl-link
>
{{ __('Retry') }}
</gl-link>
</div>
<div :class="{ block: renderBlock }">
<p v-if="job.merge_request" class="build-detail-row js-job-mr">
<span class="build-light-text"> {{ __('Merge Request:') }} </span>
<gl-link :href="job.merge_request.path"> !{{ job.merge_request.iid }} </gl-link>
</p>
<detail-row
v-if="job.duration"
:value="duration"
......@@ -198,10 +188,10 @@ export default {
title="Coverage"
/>
<p v-if="job.tags.length" class="build-detail-row js-job-tags">
<span class="build-light-text"> {{ __('Tags:') }} </span>
<span v-for="(tag, i) in job.tags" :key="i" class="badge badge-primary">
{{ tag }}
</span>
<span class="font-weight-bold">{{ __('Tags:') }}</span>
<span v-for="(tag, i) in job.tags" :key="i" class="badge badge-primary mr-1">{{
tag
}}</span>
</p>
<div v-if="job.cancel_path" class="btn-group prepend-top-5" role="group">
......@@ -210,9 +200,8 @@ export default {
class="js-cancel-job btn btn-sm btn-default"
data-method="post"
rel="nofollow"
>{{ __('Cancel') }}</gl-link
>
{{ __('Cancel') }}
</gl-link>
</div>
</div>
......
......@@ -34,8 +34,7 @@ export default {
</script>
<template>
<p class="build-detail-row">
<span v-if="hasTitle" class="build-light-text"> {{ title }}: </span> {{ value }}
<span v-if="hasTitle" class="font-weight-bold">{{ title }}:</span> {{ value }}
<span v-if="hasHelpURL" class="help-button float-right">
<gl-link :href="helpUrl" target="_blank" rel="noopener noreferrer nofollow">
<i class="fa fa-question-circle" aria-hidden="true"></i>
......
......@@ -38,11 +38,11 @@ export default {
<div class="block-last dropdown">
<ci-icon :status="pipeline.details.status" class="vertical-align-middle" />
{{ __('Pipeline') }}
<a :href="pipeline.path" class="js-pipeline-path link-commit"> #{{ pipeline.id }} </a>
<span class="font-weight-bold">{{ __('Pipeline') }}</span>
<a :href="pipeline.path" class="js-pipeline-path link-commit">#{{ pipeline.id }}</a>
<template v-if="hasRef">
{{ __('from') }}
<a :href="pipeline.ref.path" class="link-commit ref-name"> {{ pipeline.ref.name }} </a>
<a :href="pipeline.ref.path" class="link-commit ref-name">{{ pipeline.ref.name }}</a>
</template>
<button
......
......@@ -43,23 +43,24 @@ export default {
<template>
<div class="build-widget block">
<h4 class="title">{{ __('Trigger') }}</h4>
<p
v-if="trigger.short_token"
class="js-short-token"
:class="{ 'append-bottom-0': !hasVariables }"
:class="{ 'append-bottom-5': hasVariables, 'append-bottom-0': !hasVariables }"
>
<span class="build-light-text"> {{ __('Token') }} </span> {{ trigger.short_token }}
<span class="font-weight-bold">{{ __('Trigger token:') }}</span> {{ trigger.short_token }}
</p>
<template v-if="hasVariables">
<p class="trigger-variables-btn-container">
<span class="build-light-text"> {{ __('Variables:') }} </span>
<span class="font-weight-bold">{{ __('Trigger variables:') }}</span>
<gl-button v-if="hasValues" class="group js-reveal-variables" @click="toggleValues">
{{ getToggleButtonText }}
</gl-button>
<gl-button
v-if="hasValues"
class="btn-sm group js-reveal-variables trigger-variables-btn"
@click="toggleValues"
>{{ getToggleButtonText }}</gl-button
>
</p>
<table class="js-build-variables trigger-build-variables">
......
......@@ -225,6 +225,11 @@
@extend .d-flex;
justify-content: space-between;
align-items: center;
.trigger-variables-btn {
margin-top: -5px;
margin-bottom: -5px;
}
}
.trigger-build-variables {
......
---
title: Stop autofocusing on diff comment after initial mount
merge_request: 23849
author:
type: fixed
---
title: Fix label and header styles in the job details sidebar.
merge_request: 23816
author: Nathan Friend
type: changed
---
title: Hide cluster features that don't work yet with Group Clusters
merge_request: 23935
author:
type: fixed
......@@ -4915,7 +4915,7 @@ msgstr ""
msgid "Job|The artifacts were removed"
msgstr ""
msgid "Job|The artifacts will be removed in"
msgid "Job|The artifacts will be removed"
msgstr ""
msgid "Job|This job is stuck because the project doesn't have any runners online assigned to it."
......@@ -5375,9 +5375,6 @@ msgstr ""
msgid "Merge Request"
msgstr ""
msgid "Merge Request:"
msgstr ""
msgid "Merge Requests"
msgstr ""
......@@ -9286,7 +9283,7 @@ msgstr ""
msgid "Trending"
msgstr ""
msgid "Trigger"
msgid "Trigger this manual action"
msgstr ""
msgid "Trigger pipelines for mirror updates"
......@@ -9544,9 +9541,6 @@ msgstr ""
msgid "Variables are applied to environments via the runner. They can be protected by only exposing them to protected branches or tags. You can use variables for passwords, secret keys, or whatever you want."
msgstr ""
msgid "Variables:"
msgstr ""
msgid "Various container registry settings."
msgstr ""
......
......@@ -351,8 +351,8 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
context 'when user is a maintainer' do
shared_examples 'no reveal button variables behavior' do
it 'renders a hidden value with no reveal values button', :js do
expect(page).to have_content('Token')
expect(page).to have_content('Variables')
expect(page).to have_content('Trigger token')
expect(page).to have_content('Trigger variables')
expect(page).not_to have_css('.js-reveal-variables')
......@@ -389,8 +389,8 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
shared_examples 'reveal button variables behavior' do
it 'renders a hidden value with a reveal values button', :js do
expect(page).to have_content('Token')
expect(page).to have_content('Variables')
expect(page).to have_content('Trigger token')
expect(page).to have_content('Trigger variables')
expect(page).to have_css('.js-reveal-variables')
......
......@@ -294,10 +294,14 @@ describe('DiffsStoreUtils', () => {
});
describe('prepareDiffData', () => {
it('sets the renderIt and collapsed attribute on files', () => {
const preparedDiff = { diff_files: [getDiffFileMock()] };
let preparedDiff;
beforeEach(() => {
preparedDiff = { diff_files: [getDiffFileMock()] };
utils.prepareDiffData(preparedDiff);
});
it('sets the renderIt and collapsed attribute on files', () => {
const firstParallelDiffLine = preparedDiff.diff_files[0].parallel_diff_lines[2];
expect(firstParallelDiffLine.left.discussions.length).toBe(0);
......@@ -323,6 +327,18 @@ describe('DiffsStoreUtils', () => {
expect(preparedDiff.diff_files[0].renderIt).toBeTruthy();
expect(preparedDiff.diff_files[0].collapsed).toBeFalsy();
});
it('adds line_code to all lines', () => {
expect(
preparedDiff.diff_files[0].parallel_diff_lines.filter(line => !line.line_code),
).toHaveLength(0);
});
it('uses right line code if left has none', () => {
const firstLine = preparedDiff.diff_files[0].parallel_diff_lines[0];
expect(firstLine.line_code).toEqual(firstLine.right.line_code);
});
});
describe('isDiscussionApplicableToLine', () => {
......
......@@ -2,6 +2,7 @@ import Vue from 'vue';
import { getTimeago } from '~/lib/utils/datetime_utility';
import component from '~/jobs/components/artifacts_block.vue';
import mountComponent from '../../helpers/vue_mount_component_helper';
import { trimText } from '../../helpers/vue_component_helper';
describe('Artifacts block', () => {
const Component = Vue.extend(component);
......@@ -9,7 +10,7 @@ describe('Artifacts block', () => {
const expireAt = '2018-08-14T09:38:49.157Z';
const timeago = getTimeago();
const formatedDate = timeago.format(expireAt);
const formattedDate = timeago.format(expireAt);
const expiredArtifact = {
expire_at: expireAt,
......@@ -36,9 +37,8 @@ describe('Artifacts block', () => {
expect(vm.$el.querySelector('.js-artifacts-removed')).not.toBeNull();
expect(vm.$el.querySelector('.js-artifacts-will-be-removed')).toBeNull();
expect(vm.$el.textContent).toContain(formatedDate);
expect(vm.$el.querySelector('.js-artifacts-removed').textContent.trim()).toEqual(
'The artifacts were removed',
expect(trimText(vm.$el.querySelector('.js-artifacts-removed').textContent)).toEqual(
`The artifacts were removed ${formattedDate}`,
);
});
});
......@@ -51,9 +51,8 @@ describe('Artifacts block', () => {
expect(vm.$el.querySelector('.js-artifacts-removed')).toBeNull();
expect(vm.$el.querySelector('.js-artifacts-will-be-removed')).not.toBeNull();
expect(vm.$el.textContent).toContain(formatedDate);
expect(vm.$el.querySelector('.js-artifacts-will-be-removed').textContent.trim()).toEqual(
'The artifacts will be removed in',
expect(trimText(vm.$el.querySelector('.js-artifacts-will-be-removed').textContent)).toEqual(
`The artifacts will be removed ${formattedDate}`,
);
});
});
......
......@@ -79,14 +79,6 @@ describe('Sidebar details block', () => {
});
describe('information', () => {
it('should render merge request link', () => {
expect(trimText(vm.$el.querySelector('.js-job-mr').textContent)).toEqual('Merge Request: !2');
expect(vm.$el.querySelector('.js-job-mr a').getAttribute('href')).toEqual(
job.merge_request.path,
);
});
it('should render job duration', () => {
expect(trimText(vm.$el.querySelector('.js-job-duration').textContent)).toEqual(
'Duration: 6 seconds',
......
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