Commit 0fb6aef9 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch '34007-artifacts-error-ui' into 'master'

Updates error state in artifacts list

Closes #34007

See merge request gitlab-org/gitlab!18569
parents 8c2bf2c7 b80d7a7f
...@@ -39,9 +39,6 @@ export default { ...@@ -39,9 +39,6 @@ export default {
ariaLabel() { ariaLabel() {
return this.isCollapsed ? __('Expand') : __('Collapse'); return this.isCollapsed ? __('Expand') : __('Collapse');
}, },
isButtonDisabled() {
return this.isLoading || this.hasError;
},
}, },
methods: { methods: {
toggleCollapsed() { toggleCollapsed() {
...@@ -53,10 +50,19 @@ export default { ...@@ -53,10 +50,19 @@ export default {
<template> <template>
<div> <div>
<div class="mr-widget-extension d-flex align-items-center pl-3"> <div class="mr-widget-extension d-flex align-items-center pl-3">
<div v-if="hasError" class="ci-widget media">
<div class="media-body">
<span class="gl-font-size-small mr-widget-margin-left gl-line-height-24 js-error-state">{{
title
}}</span>
</div>
</div>
<template v-else>
<gl-button <gl-button
class="btn-blank btn s32 square append-right-default" class="btn-blank btn s32 square append-right-default"
:aria-label="ariaLabel" :aria-label="ariaLabel"
:disabled="isButtonDisabled" :disabled="isLoading"
@click="toggleCollapsed" @click="toggleCollapsed"
> >
<gl-loading-icon v-if="isLoading" /> <gl-loading-icon v-if="isLoading" />
...@@ -65,13 +71,14 @@ export default { ...@@ -65,13 +71,14 @@ export default {
<gl-button <gl-button
variant="link" variant="link"
class="js-title" class="js-title"
:disabled="isButtonDisabled" :disabled="isLoading"
:class="{ 'border-0': isButtonDisabled }" :class="{ 'border-0': isLoading }"
@click="toggleCollapsed" @click="toggleCollapsed"
> >
<template v-if="isCollapsed">{{ title }}</template> <template v-if="isCollapsed">{{ title }}</template>
<template v-else>{{ __('Collapse') }}</template> <template v-else>{{ __('Collapse') }}</template>
</gl-button> </gl-button>
</template>
</div> </div>
<div v-if="!isCollapsed" class="border-top js-slot-container"> <div v-if="!isCollapsed" class="border-top js-slot-container">
......
...@@ -560,3 +560,6 @@ img.emoji { ...@@ -560,3 +560,6 @@ img.emoji {
} }
} }
} }
.gl-font-size-small { font-size: $gl-font-size-small; }
.gl-line-height-24 { line-height: $gl-line-height-24; }
...@@ -833,6 +833,7 @@ Merge Requests ...@@ -833,6 +833,7 @@ Merge Requests
*/ */
$mr-tabs-height: 48px; $mr-tabs-height: 48px;
$mr-version-controls-height: 56px; $mr-version-controls-height: 56px;
$mr-widget-margin-left: 40px;
/* /*
Compare Branches Compare Branches
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
border-top: 1px solid $border-color; border-top: 1px solid $border-color;
} }
.mr-widget-margin-left { margin-left: $mr-widget-margin-left; }
.media-section { .media-section {
@include media-breakpoint-down(md) { @include media-breakpoint-down(md) {
align-items: flex-start; align-items: flex-start;
......
...@@ -44,6 +44,7 @@ describe('Merge Requests Artifacts list app', () => { ...@@ -44,6 +44,7 @@ describe('Merge Requests Artifacts list app', () => {
const findButtons = () => wrapper.findAll('button'); const findButtons = () => wrapper.findAll('button');
const findTitle = () => wrapper.find('.js-title'); const findTitle = () => wrapper.find('.js-title');
const findErrorMessage = () => wrapper.find('.js-error-state');
const findTableRows = () => wrapper.findAll('tbody tr'); const findTableRows = () => wrapper.findAll('tbody tr');
describe('while loading', () => { describe('while loading', () => {
...@@ -109,13 +110,12 @@ describe('Merge Requests Artifacts list app', () => { ...@@ -109,13 +110,12 @@ describe('Merge Requests Artifacts list app', () => {
}); });
it('renders the error state', () => { it('renders the error state', () => {
expect(findTitle().text()).toBe('An error occurred while fetching the artifacts'); expect(findErrorMessage().text()).toBe('An error occurred while fetching the artifacts');
}); });
it('renders disabled buttons', () => { it('does not render buttons', () => {
const buttons = findButtons(); const buttons = findButtons();
expect(buttons.at(0).attributes('disabled')).toBe('disabled'); expect(buttons.exists()).toBe(false);
expect(buttons.at(1).attributes('disabled')).toBe('disabled');
}); });
}); });
}); });
...@@ -20,6 +20,7 @@ describe('Merge Request Collapsible Extension', () => { ...@@ -20,6 +20,7 @@ describe('Merge Request Collapsible Extension', () => {
}; };
const findTitle = () => wrapper.find('.js-title'); const findTitle = () => wrapper.find('.js-title');
const findErrorMessage = () => wrapper.find('.js-error-state');
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -87,19 +88,12 @@ describe('Merge Request Collapsible Extension', () => { ...@@ -87,19 +88,12 @@ describe('Merge Request Collapsible Extension', () => {
mountComponent(Object.assign({}, data, { hasError: true })); mountComponent(Object.assign({}, data, { hasError: true }));
}); });
it('renders the buttons disabled', () => { it('does not render the buttons', () => {
expect( expect(wrapper.findAll('button').exists()).toBe(false);
wrapper });
.findAll('button')
.at(0) it('renders title message provided', () => {
.attributes('disabled'), expect(findErrorMessage().text()).toBe(data.title);
).toEqual('disabled');
expect(
wrapper
.findAll('button')
.at(1)
.attributes('disabled'),
).toEqual('disabled');
}); });
}); });
}); });
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