Commit 7eba9b7d authored by GitLab Bot's avatar GitLab Bot

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-10-26

parents e8df1bfe 2a8c3f6d
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
}, },
}, },
computed: { computed: {
...mapState(['job', 'stages', 'jobs', 'selectedStage']), ...mapState(['job', 'stages', 'jobs', 'selectedStage', 'isLoadingStages']),
coverage() { coverage() {
return `${this.job.coverage}%`; return `${this.job.coverage}%`;
}, },
...@@ -59,10 +59,10 @@ export default { ...@@ -59,10 +59,10 @@ export default {
return ''; return '';
} }
let t = this.job.metadata.timeout_human_readable; let t = this.job.metadata.timeout_human_readable;
if (this.job.metadata.timeout_source !== '') { if (this.job.metadata.timeout_source !== '') {
t += ` (from ${this.job.metadata.timeout_source})`; t += ` (from ${this.job.metadata.timeout_source})`;
} }
return t; return t;
}, },
...@@ -270,6 +270,7 @@ export default { ...@@ -270,6 +270,7 @@ export default {
/> />
<stages-dropdown <stages-dropdown
v-if="!isLoadingStages"
:stages="stages" :stages="stages"
:pipeline="job.pipeline" :pipeline="job.pipeline"
:selected-stage="selectedStage" :selected-stage="selectedStage"
......
...@@ -22,7 +22,6 @@ export default { ...@@ -22,7 +22,6 @@ export default {
required: true, required: true,
}, },
}, },
computed: { computed: {
hasRef() { hasRef() {
return !_.isEmpty(this.pipeline.ref); return !_.isEmpty(this.pipeline.ref);
......
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
* after the first request, * after the first request,
* and we do not want to hijack that * and we do not want to hijack that
*/ */
if (state.selectedStage === 'More' && job.stage) { if (state.selectedStage === '' && job.stage) {
state.selectedStage = job.stage; state.selectedStage = job.stage;
} }
}, },
......
import { __ } from '~/locale';
export default () => ({ export default () => ({
jobEndpoint: null, jobEndpoint: null,
traceEndpoint: null, traceEndpoint: null,
...@@ -29,7 +27,7 @@ export default () => ({ ...@@ -29,7 +27,7 @@ export default () => ({
// sidebar dropdown & list of jobs // sidebar dropdown & list of jobs
isLoadingStages: false, isLoadingStages: false,
isLoadingJobs: false, isLoadingJobs: false,
selectedStage: __('More'), selectedStage: '',
stages: [], stages: [],
jobs: [], jobs: [],
}); });
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
import $ from 'jquery'; import $ from 'jquery';
import { insertText } from '~/lib/utils/common_utils'; import { insertText } from '~/lib/utils/common_utils';
const LINK_TAG_PATTERN = '[{text}](url)';
function selectedText(text, textarea) { function selectedText(text, textarea) {
return text.substring(textarea.selectionStart, textarea.selectionEnd); return text.substring(textarea.selectionStart, textarea.selectionEnd);
} }
...@@ -76,6 +78,21 @@ export function insertMarkdownText({ textArea, text, tag, blockTag, selected, wr ...@@ -76,6 +78,21 @@ export function insertMarkdownText({ textArea, text, tag, blockTag, selected, wr
removedFirstNewLine = false; removedFirstNewLine = false;
currentLineEmpty = false; currentLineEmpty = false;
// check for link pattern and selected text is an URL
// if so fill in the url part instead of the text part of the pattern.
if (tag === LINK_TAG_PATTERN) {
if (URL) {
try {
const ignoredUrl = new URL(selected);
// valid url
tag = '[text]({text})';
select = 'text';
} catch (e) {
// ignore - no valid url
}
}
}
// Remove the first newline // Remove the first newline
if (selected.indexOf('\n') === 0) { if (selected.indexOf('\n') === 0) {
removedFirstNewLine = true; removedFirstNewLine = true;
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
margin-bottom: 0; margin-bottom: 0;
} }
*:first-child:not(.katex-display) { *:first-child {
margin-top: 0; margin-top: 0;
} }
......
...@@ -111,7 +111,7 @@ class CommitStatus < ActiveRecord::Base ...@@ -111,7 +111,7 @@ class CommitStatus < ActiveRecord::Base
before_transition any => :failed do |commit_status, transition| before_transition any => :failed do |commit_status, transition|
failure_reason = transition.args.first failure_reason = transition.args.first
commit_status.failure_reason = failure_reason commit_status.failure_reason = CommitStatus.failure_reasons[failure_reason]
end end
after_transition do |commit_status, transition| after_transition do |commit_status, transition|
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
%button.dropdown-new.btn.btn-default.has-tooltip.notifications-btn#notifications-button{ type: "button", title: "Notification setting", "aria-label" => "Notification setting: #{notification_title(notification_setting.level)}", data: { container: "body", toggle: "modal", target: "#" + notifications_menu_identifier("modal", notification_setting), display: 'static' } } %button.dropdown-new.btn.btn-default.has-tooltip.notifications-btn#notifications-button{ type: "button", title: "Notification setting", "aria-label" => "Notification setting: #{notification_title(notification_setting.level)}", data: { container: "body", toggle: "modal", target: "#" + notifications_menu_identifier("modal", notification_setting), display: 'static' } }
= icon("bell", class: "js-notification-loading") = icon("bell", class: "js-notification-loading")
= notification_title(notification_setting.level) = notification_title(notification_setting.level)
%button.btn.dropdown-toggle{ data: { toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting) } } %button.btn.dropdown-toggle{ data: { toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), flip: "false" } }
= icon('caret-down') = icon('caret-down')
.sr-only Toggle dropdown .sr-only Toggle dropdown
- else - else
%button.dropdown-new.btn.btn-default.has-tooltip.notifications-btn#notifications-button{ type: "button", title: "Notification setting", "aria-label" => "Notification setting: #{notification_title(notification_setting.level)}", data: { container: "body", toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), display: 'static' } } %button.dropdown-new.btn.btn-default.has-tooltip.notifications-btn#notifications-button{ type: "button", title: "Notification setting", "aria-label" => "Notification setting: #{notification_title(notification_setting.level)}", data: { container: "body", toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), flip: "false" } }
= icon("bell", class: "js-notification-loading") = icon("bell", class: "js-notification-loading")
= notification_title(notification_setting.level) = notification_title(notification_setting.level)
= icon("caret-down") = icon("caret-down")
......
---
title: Fix inaccessible dropdown for code-less projects
merge_request: 22137
author:
type: other
---
title: Link button in markdown editor recognize URLs
merge_request: 1983
author: Johann Hubert Sonntagbauer
type: changed
---
title: Fix stage dropdown not rendering in different languages
merge_request: 22604
author:
type: other
---
title: Support backward compatibility when introduce new failure reason
merge_request: 22566
author:
type: changed
...@@ -142,8 +142,7 @@ module API ...@@ -142,8 +142,7 @@ module API
requires :id, type: Integer, desc: %q(Job's ID) requires :id, type: Integer, desc: %q(Job's ID)
optional :trace, type: String, desc: %q(Job's full trace) optional :trace, type: String, desc: %q(Job's full trace)
optional :state, type: String, desc: %q(Job's status: success, failed) optional :state, type: String, desc: %q(Job's status: success, failed)
optional :failure_reason, type: String, values: CommitStatus.failure_reasons.keys, optional :failure_reason, type: String, desc: %q(Job's failure_reason)
desc: %q(Job's failure_reason)
end end
put '/:id' do put '/:id' do
job = authenticate_job! job = authenticate_job!
......
...@@ -140,10 +140,11 @@ describe('Sidebar details block', () => { ...@@ -140,10 +140,11 @@ describe('Sidebar details block', () => {
}); });
describe('while fetching stages', () => { describe('while fetching stages', () => {
it('renders dropdown with More label', () => { it('it does not render dropdown', () => {
store.dispatch('requestStages');
vm = mountComponentWithStore(SidebarComponent, { store }); vm = mountComponentWithStore(SidebarComponent, { store });
expect(vm.$el.querySelector('.js-selected-stage').textContent.trim()).toEqual('More'); expect(vm.$el.querySelector('.js-selected-stage')).toBeNull();
}); });
}); });
......
...@@ -124,8 +124,8 @@ describe('Jobs Store Mutations', () => { ...@@ -124,8 +124,8 @@ describe('Jobs Store Mutations', () => {
expect(stateCopy.job).toEqual({ id: 1312321 }); expect(stateCopy.job).toEqual({ id: 1312321 });
}); });
it('sets selectedStage when the selectedStage is More', () => { it('sets selectedStage when the selectedStage is empty', () => {
expect(stateCopy.selectedStage).toEqual('More'); expect(stateCopy.selectedStage).toEqual('');
mutations[types.RECEIVE_JOB_SUCCESS](stateCopy, { id: 1312321, stage: 'deploy' }); mutations[types.RECEIVE_JOB_SUCCESS](stateCopy, { id: 1312321, stage: 'deploy' });
expect(stateCopy.selectedStage).toEqual('deploy'); expect(stateCopy.selectedStage).toEqual('deploy');
......
...@@ -166,6 +166,33 @@ describe('init markdown', () => { ...@@ -166,6 +166,33 @@ describe('init markdown', () => {
expect(textArea.selectionStart).toEqual(expectedText.lastIndexOf(select)); expect(textArea.selectionStart).toEqual(expectedText.lastIndexOf(select));
expect(textArea.selectionEnd).toEqual(expectedText.lastIndexOf(select) + select.length); expect(textArea.selectionEnd).toEqual(expectedText.lastIndexOf(select) + select.length);
}); });
it('should support selected urls', () => {
const expectedUrl = 'http://www.gitlab.com';
const expectedSelectionText = 'text';
const expectedText = `text [${expectedSelectionText}](${expectedUrl}) text`;
const initialValue = `text ${expectedUrl} text`;
textArea.value = initialValue;
const selectedIndex = initialValue.indexOf(expectedUrl);
textArea.setSelectionRange(selectedIndex, selectedIndex + expectedUrl.length);
insertMarkdownText({
textArea,
text: textArea.value,
tag,
blockTag: null,
selected: expectedUrl,
wrap: false,
select,
});
expect(textArea.value).toEqual(expectedText);
expect(textArea.selectionStart).toEqual(expectedText.indexOf(expectedSelectionText, 1));
expect(textArea.selectionEnd).toEqual(
expectedText.indexOf(expectedSelectionText, 1) + expectedSelectionText.length,
);
});
}); });
}); });
}); });
...@@ -802,6 +802,15 @@ describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -802,6 +802,15 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
it { expect(job).to be_runner_system_failure } it { expect(job).to be_runner_system_failure }
end end
context 'when failure_reason is unrecognized value' do
before do
update_job(state: 'failed', failure_reason: 'what_is_this')
job.reload
end
it { expect(job).to be_unknown_failure }
end
end end
context 'when trace is given' do context 'when trace is given' do
......
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