Commit 77671465 authored by Anna Vovchenko's avatar Anna Vovchenko Committed by Natalia Tepluhina

Updated the terraform empty state

To fix the UX bug on the /terraform page if no terraform states exist,
we are updating the copy of the empty state component.

Changelog: fixed
parent 8edfaf0b
<script> <script>
import { GlEmptyState, GlIcon, GlLink } from '@gitlab/ui'; import { GlEmptyState, GlLink } from '@gitlab/ui';
import { s__ } from '~/locale';
import { helpPagePath } from '~/helpers/help_page_helper'; import { helpPagePath } from '~/helpers/help_page_helper';
export default { export default {
i18n: {
title: s__("Terraform|Your project doesn't have any Terraform state files"),
description: s__('Terraform|How to use GitLab-managed Terraform state?'),
},
docsUrl: helpPagePath('user/infrastructure/iac/terraform_state'),
components: { components: {
GlEmptyState, GlEmptyState,
GlIcon,
GlLink, GlLink,
}, },
props: { props: {
...@@ -14,23 +19,13 @@ export default { ...@@ -14,23 +19,13 @@ export default {
required: true, required: true,
}, },
}, },
computed: {
docsUrl() {
return helpPagePath('user/infrastructure/iac/terraform_state');
},
},
}; };
</script> </script>
<template> <template>
<gl-empty-state :svg-path="image" :title="s__('Terraform|Get started with Terraform')"> <gl-empty-state :svg-path="image" :title="$options.i18n.title">
<template #description> <template #description>
<p> <gl-link :href="$options.docsUrl">{{ $options.i18n.description }}</gl-link>
<gl-link :href="docsUrl" target="_blank"
>{{ s__('Terraform|How to use GitLab-managed Terraform State?') }}
<gl-icon name="external-link"
/></gl-link>
</p>
</template> </template>
</gl-empty-state> </gl-empty-state>
</template> </template>
...@@ -37180,10 +37180,7 @@ msgstr "" ...@@ -37180,10 +37180,7 @@ msgstr ""
msgid "Terraform|Generating the report caused an error." msgid "Terraform|Generating the report caused an error."
msgstr "" msgstr ""
msgid "Terraform|Get started with Terraform" msgid "Terraform|How to use GitLab-managed Terraform state?"
msgstr ""
msgid "Terraform|How to use GitLab-managed Terraform State?"
msgstr "" msgstr ""
msgid "Terraform|Job status" msgid "Terraform|Job status"
...@@ -37264,6 +37261,9 @@ msgstr "" ...@@ -37264,6 +37261,9 @@ msgstr ""
msgid "Terraform|You cannot remove the State file because it's locked. Unlock the State file first before removing it." msgid "Terraform|You cannot remove the State file because it's locked. Unlock the State file first before removing it."
msgstr "" msgstr ""
msgid "Terraform|Your project doesn't have any Terraform state files"
msgstr ""
msgid "Test" msgid "Test"
msgstr "" msgstr ""
......
...@@ -22,7 +22,7 @@ RSpec.describe 'Terraform', :js do ...@@ -22,7 +22,7 @@ RSpec.describe 'Terraform', :js do
end end
it 'sees an empty state' do it 'sees an empty state' do
expect(page).to have_content('Get started with Terraform') expect(page).to have_content("Your project doesn't have any Terraform state files")
end end
end end
......
...@@ -13,15 +13,20 @@ describe('EmptyStateComponent', () => { ...@@ -13,15 +13,20 @@ describe('EmptyStateComponent', () => {
const findLink = () => wrapper.findComponent(GlLink); const findLink = () => wrapper.findComponent(GlLink);
beforeEach(() => { beforeEach(() => {
wrapper = shallowMount(EmptyState, { propsData, stubs: { GlEmptyState, GlLink } }); wrapper = shallowMount(EmptyState, { propsData });
});
afterEach(() => {
wrapper.destroy();
}); });
it('should render content', () => { it('should render content', () => {
expect(findEmptyState().exists()).toBe(true); expect(findEmptyState().props('title')).toBe(
expect(wrapper.text()).toContain('Get started with Terraform'); "Your project doesn't have any Terraform state files",
);
}); });
it('should have a link to the GitLab managed Terraform States docs', () => { it('should have a link to the GitLab managed Terraform states docs', () => {
expect(findLink().attributes('href')).toBe(docsUrl); expect(findLink().attributes('href')).toBe(docsUrl);
}); });
}); });
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