Skip to content
Snippets Groups Projects
Commit dd81c573 authored by Payton Burdette's avatar Payton Burdette
Browse files

Add empty artifacts message

When no artifacts are found show
an empty artifacts message.

Changelog: changed
parent 0d286bc6
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -16,6 +16,7 @@ export const i18n = {
downloadArtifact: __('Download %{name} artifact'),
artifactSectionHeader: __('Download artifacts'),
artifactsFetchErrorMessage: s__('Pipelines|Could not load artifacts.'),
emptyArtifactsMessage: __('No artifacts found'),
};
 
export default {
Loading
Loading
@@ -99,6 +100,10 @@ export default {
 
<gl-loading-icon v-if="isLoading" size="sm" />
 
<gl-dropdown-item v-if="!artifacts.length" data-testid="artifacts-empty-message">
{{ $options.i18n.emptyArtifactsMessage }}
</gl-dropdown-item>
<gl-dropdown-item
v-for="(artifact, i) in artifacts"
:key="i"
Loading
Loading
Loading
Loading
@@ -22465,6 +22465,9 @@ msgstr ""
msgid "No approvers"
msgstr ""
 
msgid "No artifacts found"
msgstr ""
msgid "No assignee"
msgstr ""
 
Loading
Loading
Loading
Loading
@@ -53,6 +53,7 @@ describe('Pipeline Multi Actions Dropdown', () => {
const findDropdown = () => wrapper.findComponent(GlDropdown);
const findAllArtifactItems = () => wrapper.findAllByTestId(artifactItemTestId);
const findFirstArtifactItem = () => wrapper.findByTestId(artifactItemTestId);
const findEmptyMessage = () => wrapper.findByTestId('artifacts-empty-message');
 
beforeEach(() => {
mockAxios = new MockAdapter(axios);
Loading
Loading
@@ -86,6 +87,7 @@ describe('Pipeline Multi Actions Dropdown', () => {
createComponent({ mockData: { artifacts } });
 
expect(findAllArtifactItems()).toHaveLength(artifacts.length);
expect(findEmptyMessage().exists()).toBe(false);
});
 
it('should render the correct artifact name and path', () => {
Loading
Loading
@@ -95,6 +97,12 @@ describe('Pipeline Multi Actions Dropdown', () => {
expect(findFirstArtifactItem().text()).toBe(`Download ${artifacts[0].name} artifact`);
});
 
it('should render empty message when no artifacts are found', () => {
createComponent({ mockData: { artifacts: [] } });
expect(findEmptyMessage().exists()).toBe(true);
});
describe('with a failing request', () => {
it('should render an error message', async () => {
const endpoint = artifactsEndpoint.replace(artifactsEndpointPlaceholder, pipelineId);
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment