Commit c2dd287f authored by Simon Knox's avatar Simon Knox

Merge branch...

Merge branch '229282-migrate-bootstrap-button-to-gitlab-ui-glbutton-in-app-assets-javascripts-ide-components' into 'master'

Resolve "Migrate Bootstrap button to GitLab UI GlButton in app/assets/javascripts/ide/components/terminal/session.vue"

See merge request gitlab-org/gitlab!46990
parents 4ee15998 a5c903c2
<script> <script>
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { GlButton } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import Terminal from './terminal.vue'; import Terminal from './terminal.vue';
import { isEndingStatus } from '../../stores/modules/terminal/utils'; import { isEndingStatus } from '../../stores/modules/terminal/utils';
...@@ -7,6 +8,7 @@ import { isEndingStatus } from '../../stores/modules/terminal/utils'; ...@@ -7,6 +8,7 @@ import { isEndingStatus } from '../../stores/modules/terminal/utils';
export default { export default {
components: { components: {
Terminal, Terminal,
GlButton,
}, },
computed: { computed: {
...mapState('terminal', ['session']), ...mapState('terminal', ['session']),
...@@ -14,15 +16,17 @@ export default { ...@@ -14,15 +16,17 @@ export default {
if (isEndingStatus(this.session.status)) { if (isEndingStatus(this.session.status)) {
return { return {
action: () => this.restartSession(), action: () => this.restartSession(),
variant: 'info',
category: 'primary',
text: __('Restart Terminal'), text: __('Restart Terminal'),
class: 'btn-primary',
}; };
} }
return { return {
action: () => this.stopSession(), action: () => this.stopSession(),
variant: 'danger',
category: 'secondary',
text: __('Stop Terminal'), text: __('Stop Terminal'),
class: 'btn-inverted btn-remove',
}; };
}, },
}, },
...@@ -37,15 +41,13 @@ export default { ...@@ -37,15 +41,13 @@ export default {
<header class="ide-job-header d-flex align-items-center"> <header class="ide-job-header d-flex align-items-center">
<h5>{{ __('Web Terminal') }}</h5> <h5>{{ __('Web Terminal') }}</h5>
<div class="ml-auto align-self-center"> <div class="ml-auto align-self-center">
<button <gl-button
v-if="actionButton" v-if="actionButton"
type="button" :variant="actionButton.variant"
class="btn btn-sm" :category="actionButton.category"
:class="actionButton.class"
@click="actionButton.action" @click="actionButton.action"
>{{ actionButton.text }}</gl-button
> >
{{ actionButton.text }}
</button>
</div> </div>
</header> </header>
<terminal :terminal-path="session.terminalPath" :status="session.status" /> <terminal :terminal-path="session.terminalPath" :status="session.status" />
......
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { createLocalVue, shallowMount } from '@vue/test-utils';
import { GlButton } from '@gitlab/ui';
import Vuex from 'vuex'; import Vuex from 'vuex';
import TerminalSession from '~/ide/components/terminal/session.vue'; import TerminalSession from '~/ide/components/terminal/session.vue';
import Terminal from '~/ide/components/terminal/terminal.vue'; import Terminal from '~/ide/components/terminal/terminal.vue';
...@@ -38,6 +39,8 @@ describe('IDE TerminalSession', () => { ...@@ -38,6 +39,8 @@ describe('IDE TerminalSession', () => {
}); });
}; };
const findButton = () => wrapper.find(GlButton);
beforeEach(() => { beforeEach(() => {
state = { state = {
session: { status: RUNNING, terminalPath: TEST_TERMINAL_PATH }, session: { status: RUNNING, terminalPath: TEST_TERMINAL_PATH },
...@@ -69,8 +72,8 @@ describe('IDE TerminalSession', () => { ...@@ -69,8 +72,8 @@ describe('IDE TerminalSession', () => {
state.session = { status }; state.session = { status };
factory(); factory();
const button = wrapper.find('button'); const button = findButton();
button.trigger('click'); button.vm.$emit('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(button.text()).toEqual('Stop Terminal'); expect(button.text()).toEqual('Stop Terminal');
...@@ -84,8 +87,8 @@ describe('IDE TerminalSession', () => { ...@@ -84,8 +87,8 @@ describe('IDE TerminalSession', () => {
state.session = { status }; state.session = { status };
factory(); factory();
const button = wrapper.find('button'); const button = findButton();
button.trigger('click'); button.vm.$emit('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(button.text()).toEqual('Restart Terminal'); expect(button.text()).toEqual('Restart Terminal');
......
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