Commit d22b477d authored by Phil Hughes's avatar Phil Hughes

Merge branch '25990-web-terminal-improvements' into 'master'

Improve terminal button on job log page

See merge request gitlab-org/gitlab-ce!21094
parents 6d9824c8 8d233e39
<script>
import detailRow from './sidebar_detail_row.vue';
import loadingIcon from '../../vue_shared/components/loading_icon.vue';
import timeagoMixin from '../../vue_shared/mixins/timeago';
import { timeIntervalInWords } from '../../lib/utils/datetime_utility';
import LoadingIcon from '~/vue_shared/components/loading_icon.vue';
import timeagoMixin from '~/vue_shared/mixins/timeago';
import { timeIntervalInWords } from '~/lib/utils/datetime_utility';
import Icon from '~/vue_shared/components/icon.vue';
import DetailRow from './sidebar_detail_row.vue';
export default {
name: 'SidebarDetailsBlock',
components: {
detailRow,
loadingIcon,
DetailRow,
LoadingIcon,
Icon,
},
mixins: [timeagoMixin],
props: {
......@@ -20,16 +22,16 @@ export default {
type: Boolean,
required: true,
},
canUserRetry: {
type: Boolean,
required: false,
default: false,
},
runnerHelpUrl: {
type: String,
required: false,
default: '',
},
terminalPath: {
type: String,
required: false,
default: null,
},
},
computed: {
shouldRenderContent() {
......@@ -92,7 +94,7 @@ export default {
{{ job.name }}
</strong>
<a
v-if="canUserRetry"
v-if="job.retry_path"
:class="retryButtonClass"
:href="job.retry_path"
data-method="post"
......@@ -100,6 +102,16 @@ export default {
>
{{ __('Retry') }}
</a>
<a
v-if="terminalPath"
:href="terminalPath"
class="js-terminal-link pull-right btn btn-primary
btn-inverted visible-md-block visible-lg-block"
target="_blank"
>
{{ __('Debug') }}
<icon name="external-link" />
</a>
<button
:aria-label="__('Toggle Sidebar')"
type="button"
......@@ -125,7 +137,7 @@ export default {
{{ __('New issue') }}
</a>
<a
v-if="canUserRetry"
v-if="job.retry_path"
:href="job.retry_path"
class="js-retry-job btn btn-inverted-secondary"
data-method="post"
......
......@@ -52,9 +52,9 @@ export default () => {
return createElement('details-block', {
props: {
isLoading: this.mediator.state.isLoading,
canUserRetry: !!('canUserRetry' in detailsBlockDataset),
job: this.mediator.store.state.job,
runnerHelpUrl: dataset.runnerHelpUrl,
terminalPath: detailsBlockDataset.terminalPath,
},
});
},
......
%aside.right-sidebar.right-sidebar-expanded.build-sidebar.js-build-sidebar.js-right-sidebar{ data: { "offset-top" => "101", "spy" => "affix" } }
.sidebar-container
.blocks-container
- if can?(current_user, :create_build_terminal, @build)
.block
= link_to terminal_project_job_path(@project, @build), class: 'terminal-button pull-right btn visible-md-block visible-lg-block', title: 'Terminal' do
Terminal
#js-details-block-vue{ data: { can_user_retry: can?(current_user, :update_build, @build) && @build.retryable? } }
#js-details-block-vue{ data: { terminal_path: can?(current_user, :create_build_terminal, @build) && @build.has_terminal? ? terminal_project_job_path(@project, @build) : nil } }
- if can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?)
.block
......
---
title: Make terminal button more visible
merge_request:
author:
type: changed
......@@ -1993,6 +1993,9 @@ msgstr ""
msgid "DashboardProjects|Personal"
msgstr ""
msgid "Debug"
msgstr ""
msgid "Dec"
msgstr ""
......
import Vue from 'vue';
import sidebarDetailsBlock from '~/jobs/components/sidebar_details_block.vue';
import job from './mock_data';
import mountComponent from '../helpers/vue_mount_component_helper';
describe('Sidebar details block', () => {
let SidebarComponent;
......@@ -20,39 +21,53 @@ describe('Sidebar details block', () => {
describe('when it is loading', () => {
it('should render a loading spinner', () => {
vm = new SidebarComponent({
propsData: {
job: {},
isLoading: true,
},
}).$mount();
vm = mountComponent(SidebarComponent, {
job: {},
isLoading: true,
});
expect(vm.$el.querySelector('.fa-spinner')).toBeDefined();
});
});
describe("when user can't retry", () => {
describe('when there is no retry path retry', () => {
it('should not render a retry button', () => {
vm = new SidebarComponent({
propsData: {
job: {},
canUserRetry: false,
isLoading: true,
},
}).$mount();
vm = mountComponent(SidebarComponent, {
job: {},
isLoading: false,
});
expect(vm.$el.querySelector('.js-retry-job')).toBeNull();
});
});
beforeEach(() => {
vm = new SidebarComponent({
propsData: {
describe('without terminal path', () => {
it('does not render terminal link', () => {
vm = mountComponent(SidebarComponent, {
job,
canUserRetry: true,
isLoading: false,
},
}).$mount();
});
expect(vm.$el.querySelector('.js-terminal-link')).toBeNull();
});
});
describe('with terminal path', () => {
it('renders terminal link', () => {
vm = mountComponent(SidebarComponent, {
job,
isLoading: false,
terminalPath: 'job/43123/terminal',
});
expect(vm.$el.querySelector('.js-terminal-link')).not.toBeNull();
});
});
beforeEach(() => {
vm = mountComponent(SidebarComponent, {
job,
isLoading: false,
});
});
describe('actions', () => {
......@@ -102,13 +117,15 @@ describe('Sidebar details block', () => {
});
it('should render runner ID', () => {
expect(trimWhitespace(vm.$el.querySelector('.js-job-runner'))).toEqual('Runner: local ci runner (#1)');
expect(trimWhitespace(vm.$el.querySelector('.js-job-runner'))).toEqual(
'Runner: local ci runner (#1)',
);
});
it('should render timeout information', () => {
expect(
trimWhitespace(vm.$el.querySelector('.js-job-timeout')),
).toEqual('Timeout: 1m 40s (from runner)');
expect(trimWhitespace(vm.$el.querySelector('.js-job-timeout'))).toEqual(
'Timeout: 1m 40s (from runner)',
);
});
it('should render coverage', () => {
......
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