Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b3fd4581
Commit
b3fd4581
authored
Mar 16, 2020
by
Nicolò Maria Mezzopera
Committed by
Natalia Tepluhina
Mar 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move fetch settings error to alert
- remove toast - add alert - adjust tests
parent
dd4092bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
25 deletions
+51
-25
app/assets/javascripts/registry/settings/components/registry_settings_app.vue
...ts/registry/settings/components/registry_settings_app.vue
+29
-15
changelogs/unreleased/199998-container-expiration-policy-settings-hide-form-on-api-error-2.yml
...r-expiration-policy-settings-hide-form-on-api-error-2.yml
+5
-0
spec/frontend/registry/settings/components/registry_settings_app_spec.js
...egistry/settings/components/registry_settings_app_spec.js
+17
-10
No files found.
app/assets/javascripts/registry/settings/components/registry_settings_app.vue
View file @
b3fd4581
...
...
@@ -18,14 +18,23 @@ export default {
unavailableFeatureText
:
s__
(
'
ContainerRegistry|Currently, the Container Registry tag expiration feature is not available for projects created before GitLab version 12.8. For updates and more information, visit Issue %{linkStart}#196124%{linkEnd}
'
,
),
fetchSettingsErrorText
:
FETCH_SETTINGS_ERROR_MESSAGE
,
},
data
()
{
return
{
fetchSettingsError
:
false
,
};
},
computed
:
{
...
mapState
([
'
isDisabled
'
]),
showSettingForm
()
{
return
!
this
.
isDisabled
&&
!
this
.
fetchSettingsError
;
},
},
mounted
()
{
this
.
fetchSettings
().
catch
(()
=>
this
.
$toast
.
show
(
FETCH_SETTINGS_ERROR_MESSAGE
,
{
type
:
'
error
'
}),
);
this
.
fetchSettings
().
catch
(()
=>
{
this
.
fetchSettingsError
=
true
;
}
);
},
methods
:
{
...
mapActions
([
'
fetchSettings
'
]),
...
...
@@ -48,17 +57,22 @@ export default {
}}
</li>
</ul>
<settings-form
v-if=
"!isDisabled"
/>
<gl-alert
v-else
:dismissible=
"false"
>
<p>
<gl-sprintf
:message=
"$options.i18n.unavailableFeatureText"
>
<template
#link
="
{content}">
<gl-link
href=
"https://gitlab.com/gitlab-org/gitlab/issues/196124"
target=
"_blank"
>
{{
content
}}
</gl-link>
</
template
>
</gl-sprintf>
</p>
</gl-alert>
<settings-form
v-if=
"showSettingForm"
/>
<template
v-else
>
<gl-alert
v-if=
"isDisabled"
:dismissible=
"false"
>
<p>
<gl-sprintf
:message=
"$options.i18n.unavailableFeatureText"
>
<template
#link
="
{content}">
<gl-link
href=
"https://gitlab.com/gitlab-org/gitlab/issues/196124"
target=
"_blank"
>
{{
content
}}
</gl-link>
</
template
>
</gl-sprintf>
</p>
</gl-alert>
<gl-alert
v-else-if=
"fetchSettingsError"
variant=
"warning"
:dismissible=
"false"
>
<gl-sprintf
:message=
"$options.i18n.fetchSettingsErrorText"
/>
</gl-alert>
</template>
</div>
</template>
changelogs/unreleased/199998-container-expiration-policy-settings-hide-form-on-api-error-2.yml
0 → 100644
View file @
b3fd4581
---
title
:
Container expiration policy settings hide form on API error
merge_request
:
26303
author
:
type
:
fixed
spec/frontend/registry/settings/components/registry_settings_app_spec.js
View file @
b3fd4581
...
...
@@ -44,15 +44,6 @@ describe('Registry Settings App', () => {
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
fetchSettings
'
);
});
it
(
'
show a toast if fetchSettings fails
'
,
()
=>
{
mountComponent
({
dispatchMock
:
'
mockRejectedValue
'
});
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
expect
(
wrapper
.
vm
.
$toast
.
show
).
toHaveBeenCalledWith
(
FETCH_SETTINGS_ERROR_MESSAGE
,
{
type
:
'
error
'
,
}),
);
});
it
(
'
renders the setting form
'
,
()
=>
{
mountComponent
();
expect
(
findSettingsComponent
().
exists
()).
toBe
(
true
);
...
...
@@ -68,7 +59,23 @@ describe('Registry Settings App', () => {
});
it
(
'
shows an alert
'
,
()
=>
{
expect
(
findAlert
().
exists
()).
toBe
(
true
);
expect
(
findAlert
().
html
()).
toContain
(
'
Currently, the Container Registry tag expiration feature is not available
'
,
);
});
});
describe
(
'
fetchSettingsError
'
,
()
=>
{
beforeEach
(()
=>
{
mountComponent
({
dispatchMock
:
'
mockRejectedValue
'
});
});
it
(
'
the form is hidden
'
,
()
=>
{
expect
(
findSettingsComponent
().
exists
()).
toBe
(
false
);
});
it
(
'
shows an alert
'
,
()
=>
{
expect
(
findAlert
().
html
()).
toContain
(
FETCH_SETTINGS_ERROR_MESSAGE
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment