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
5ff1c51b
Commit
5ff1c51b
authored
Aug 18, 2020
by
Taurie Davis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate loading buttons on cluster applications
parent
d9424e5d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
28 deletions
+43
-28
app/assets/javascripts/clusters/components/application_row.vue
...ssets/javascripts/clusters/components/application_row.vue
+21
-15
app/assets/javascripts/clusters/components/uninstall_application_button.vue
...ipts/clusters/components/uninstall_application_button.vue
+5
-3
spec/frontend/clusters/components/application_row_spec.js
spec/frontend/clusters/components/application_row_spec.js
+5
-5
spec/frontend/clusters/components/uninstall_application_button_spec.js
.../clusters/components/uninstall_application_button_spec.js
+12
-5
No files found.
app/assets/javascripts/clusters/components/application_row.vue
View file @
5ff1c51b
<
script
>
<
script
>
import
{
GlLink
,
GlModalDirective
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
{
GlLink
,
GlModalDirective
,
GlSprintf
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
s__
,
__
,
sprintf
}
from
'
~/locale
'
;
import
{
s__
,
__
,
sprintf
}
from
'
~/locale
'
;
import
eventHub
from
'
../event_hub
'
;
import
eventHub
from
'
../event_hub
'
;
import
identicon
from
'
../../vue_shared/components/identicon.vue
'
;
import
identicon
from
'
../../vue_shared/components/identicon.vue
'
;
import
loadingButton
from
'
../../vue_shared/components/loading_button.vue
'
;
import
UninstallApplicationButton
from
'
./uninstall_application_button.vue
'
;
import
UninstallApplicationButton
from
'
./uninstall_application_button.vue
'
;
import
UninstallApplicationConfirmationModal
from
'
./uninstall_application_confirmation_modal.vue
'
;
import
UninstallApplicationConfirmationModal
from
'
./uninstall_application_confirmation_modal.vue
'
;
import
UpdateApplicationConfirmationModal
from
'
./update_application_confirmation_modal.vue
'
;
import
UpdateApplicationConfirmationModal
from
'
./update_application_confirmation_modal.vue
'
;
...
@@ -12,7 +11,7 @@ import { APPLICATION_STATUS, ELASTIC_STACK } from '../constants';
...
@@ -12,7 +11,7 @@ import { APPLICATION_STATUS, ELASTIC_STACK } from '../constants';
export
default
{
export
default
{
components
:
{
components
:
{
loading
Button
,
Gl
Button
,
identicon
,
identicon
,
GlLink
,
GlLink
,
GlSprintf
,
GlSprintf
,
...
@@ -390,16 +389,18 @@ export default {
...
@@ -390,16 +389,18 @@ export default {
</div>
</div>
<
template
v-if=
"updateAvailable || updateFailed || isUpdating"
>
<
template
v-if=
"updateAvailable || updateFailed || isUpdating"
>
<template
v-if=
"updatingNeedsConfirmation"
>
<template
v-if=
"updatingNeedsConfirmation"
>
<
loading
-button
<
gl
-button
v-gl-modal-directive=
"updateModalId"
v-gl-modal-directive=
"updateModalId"
class=
"btn btn-primary js-cluster-application-update-button mt-2"
class=
"js-cluster-application-update-button mt-2"
variant=
"info"
category=
"primary"
:loading=
"isUpdating"
:loading=
"isUpdating"
:disabled=
"isUpdating"
:disabled=
"isUpdating"
:label=
"updateButtonLabel"
data-qa-selector=
"update_button_with_confirmation"
data-qa-selector=
"update_button_with_confirmation"
:data-qa-application=
"id"
:data-qa-application=
"id"
/>
>
{{
updateButtonLabel
}}
</gl-button>
<update-application-confirmation-modal
<update-application-confirmation-modal
:application=
"id"
:application=
"id"
:application-title=
"title"
:application-title=
"title"
...
@@ -407,16 +408,19 @@ export default {
...
@@ -407,16 +408,19 @@ export default {
/>
/>
</
template
>
</
template
>
<
loading
-button
<
gl
-button
v-else
v-else
class=
"btn btn-primary js-cluster-application-update-button mt-2"
class=
"js-cluster-application-update-button mt-2"
variant=
"info"
category=
"primary"
:loading=
"isUpdating"
:loading=
"isUpdating"
:disabled=
"isUpdating"
:disabled=
"isUpdating"
:label=
"updateButtonLabel"
data-qa-selector=
"update_button"
data-qa-selector=
"update_button"
:data-qa-application=
"id"
:data-qa-application=
"id"
@
click=
"updateConfirmed"
@
click=
"updateConfirmed"
/>
>
{{ updateButtonLabel }}
</gl-button>
</template>
</template>
</div>
</div>
</div>
</div>
...
@@ -431,16 +435,18 @@ export default {
...
@@ -431,16 +435,18 @@ export default {
}}
</a>
}}
</a>
</div>
</div>
<div
class=
"btn-group table-action-buttons"
>
<div
class=
"btn-group table-action-buttons"
>
<
loading
-button
<
gl
-button
v-if=
"displayInstallButton"
v-if=
"displayInstallButton"
:loading=
"installButtonLoading"
:loading=
"installButtonLoading"
:disabled=
"disabled || installButtonDisabled"
:disabled=
"disabled || installButtonDisabled"
:label=
"installButtonLabel"
class=
"js-cluster-application-install-button"
class=
"js-cluster-application-install-button"
variant=
"default"
data-qa-selector=
"install_button"
data-qa-selector=
"install_button"
:data-qa-application=
"id"
:data-qa-application=
"id"
@
click=
"installClicked"
@
click=
"installClicked"
/>
>
{{ installButtonLabel }}
</gl-button>
<uninstall-application-button
<uninstall-application-button
v-if=
"displayUninstallButton"
v-if=
"displayUninstallButton"
v-gl-modal-directive=
"uninstallModalId"
v-gl-modal-directive=
"uninstallModalId"
...
...
app/assets/javascripts/clusters/components/uninstall_application_button.vue
View file @
5ff1c51b
<
script
>
<
script
>
import
LoadingButton
from
'
~/vue_shared/components/loading_button.vue
'
;
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
APPLICATION_STATUS
}
from
'
~/clusters/constants
'
;
import
{
APPLICATION_STATUS
}
from
'
~/clusters/constants
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
...
@@ -7,7 +7,7 @@ const { UPDATING, UNINSTALLING } = APPLICATION_STATUS;
...
@@ -7,7 +7,7 @@ const { UPDATING, UNINSTALLING } = APPLICATION_STATUS;
export
default
{
export
default
{
components
:
{
components
:
{
Loading
Button
,
Gl
Button
,
},
},
props
:
{
props
:
{
status
:
{
status
:
{
...
@@ -30,5 +30,7 @@ export default {
...
@@ -30,5 +30,7 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<loading-button
:label=
"label"
:disabled=
"disabled"
:loading=
"loading"
/>
<gl-button
:disabled=
"disabled"
variant=
"default"
:loading=
"loading"
>
{{
label
}}
</gl-button>
</
template
>
</
template
>
spec/frontend/clusters/components/application_row_spec.js
View file @
5ff1c51b
...
@@ -48,7 +48,7 @@ describe('Application Row', () => {
...
@@ -48,7 +48,7 @@ describe('Application Row', () => {
describe
(
'
Install button
'
,
()
=>
{
describe
(
'
Install button
'
,
()
=>
{
const
button
=
()
=>
wrapper
.
find
(
'
.js-cluster-application-install-button
'
);
const
button
=
()
=>
wrapper
.
find
(
'
.js-cluster-application-install-button
'
);
const
checkButtonState
=
(
label
,
loading
,
disabled
)
=>
{
const
checkButtonState
=
(
label
,
loading
,
disabled
)
=>
{
expect
(
button
().
props
(
'
label
'
)).
toEqual
(
label
);
expect
(
button
().
text
(
)).
toEqual
(
label
);
expect
(
button
().
props
(
'
loading
'
)).
toEqual
(
loading
);
expect
(
button
().
props
(
'
loading
'
)).
toEqual
(
loading
);
expect
(
button
().
props
(
'
disabled
'
)).
toEqual
(
disabled
);
expect
(
button
().
props
(
'
disabled
'
)).
toEqual
(
disabled
);
};
};
...
@@ -56,7 +56,7 @@ describe('Application Row', () => {
...
@@ -56,7 +56,7 @@ describe('Application Row', () => {
it
(
'
has indeterminate state on page load
'
,
()
=>
{
it
(
'
has indeterminate state on page load
'
,
()
=>
{
mountComponent
({
status
:
null
});
mountComponent
({
status
:
null
});
expect
(
button
().
props
(
'
label
'
)).
toBeUndefined
(
);
expect
(
button
().
text
()).
toBe
(
''
);
});
});
it
(
'
has install button
'
,
()
=>
{
it
(
'
has install button
'
,
()
=>
{
...
@@ -225,7 +225,7 @@ describe('Application Row', () => {
...
@@ -225,7 +225,7 @@ describe('Application Row', () => {
mountComponent
({
updateAvailable
:
true
});
mountComponent
({
updateAvailable
:
true
});
expect
(
button
().
exists
()).
toBe
(
true
);
expect
(
button
().
exists
()).
toBe
(
true
);
expect
(
button
().
props
(
'
label
'
)).
toContain
(
'
Update
'
);
expect
(
button
().
text
(
)).
toContain
(
'
Update
'
);
});
});
it
(
'
has enabled "Retry update" when update process fails
'
,
()
=>
{
it
(
'
has enabled "Retry update" when update process fails
'
,
()
=>
{
...
@@ -235,14 +235,14 @@ describe('Application Row', () => {
...
@@ -235,14 +235,14 @@ describe('Application Row', () => {
});
});
expect
(
button
().
exists
()).
toBe
(
true
);
expect
(
button
().
exists
()).
toBe
(
true
);
expect
(
button
().
props
(
'
label
'
)).
toContain
(
'
Retry update
'
);
expect
(
button
().
text
(
)).
toContain
(
'
Retry update
'
);
});
});
it
(
'
has disabled "Updating" when APPLICATION_STATUS.UPDATING
'
,
()
=>
{
it
(
'
has disabled "Updating" when APPLICATION_STATUS.UPDATING
'
,
()
=>
{
mountComponent
({
status
:
APPLICATION_STATUS
.
UPDATING
});
mountComponent
({
status
:
APPLICATION_STATUS
.
UPDATING
});
expect
(
button
().
exists
()).
toBe
(
true
);
expect
(
button
().
exists
()).
toBe
(
true
);
expect
(
button
().
props
(
'
label
'
)).
toContain
(
'
Updating
'
);
expect
(
button
().
text
(
)).
toContain
(
'
Updating
'
);
});
});
it
(
'
clicking update button emits event
'
,
()
=>
{
it
(
'
clicking update button emits event
'
,
()
=>
{
...
...
spec/frontend/clusters/components/uninstall_application_button_spec.js
View file @
5ff1c51b
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
UninstallApplicationButton
from
'
~/clusters/components/uninstall_application_button.vue
'
;
import
UninstallApplicationButton
from
'
~/clusters/components/uninstall_application_button.vue
'
;
import
LoadingButton
from
'
~/vue_shared/components/loading_button.vue
'
;
import
{
APPLICATION_STATUS
}
from
'
~/clusters/constants
'
;
import
{
APPLICATION_STATUS
}
from
'
~/clusters/constants
'
;
const
{
INSTALLED
,
UPDATING
,
UNINSTALLING
}
=
APPLICATION_STATUS
;
const
{
INSTALLED
,
UPDATING
,
UNINSTALLING
}
=
APPLICATION_STATUS
;
...
@@ -19,14 +19,21 @@ describe('UninstallApplicationButton', () => {
...
@@ -19,14 +19,21 @@ describe('UninstallApplicationButton', () => {
});
});
describe
.
each
`
describe
.
each
`
status | loading | disabled |
label
status | loading | disabled |
text
${
INSTALLED
}
|
${
false
}
|
${
false
}
|
${
'
Uninstall
'
}
${
INSTALLED
}
|
${
false
}
|
${
false
}
|
${
'
Uninstall
'
}
${
UPDATING
}
|
${
false
}
|
${
true
}
|
${
'
Uninstall
'
}
${
UPDATING
}
|
${
false
}
|
${
true
}
|
${
'
Uninstall
'
}
${
UNINSTALLING
}
|
${
true
}
|
${
true
}
|
${
'
Uninstalling
'
}
${
UNINSTALLING
}
|
${
true
}
|
${
true
}
|
${
'
Uninstalling
'
}
`
(
'
when app status is $status
'
,
({
loading
,
disabled
,
status
,
label
})
=>
{
`
(
'
when app status is $status
'
,
({
loading
,
disabled
,
status
,
text
})
=>
{
it
(
`renders a loading=
${
loading
}
, disabled=
${
disabled
}
button with label="
${
label
}
"`
,
()
=>
{
beforeAll
(
()
=>
{
createComponent
({
status
});
createComponent
({
status
});
expect
(
wrapper
.
find
(
LoadingButton
).
props
()).
toMatchObject
({
loading
,
disabled
,
label
});
});
it
(
`renders a button with loading=
${
loading
}
and disabled=
${
disabled
}
`
,
()
=>
{
expect
(
wrapper
.
find
(
GlButton
).
props
()).
toMatchObject
({
loading
,
disabled
});
});
it
(
`renders a button with text="
${
text
}
"`
,
()
=>
{
expect
(
wrapper
.
find
(
GlButton
).
text
()).
toBe
(
text
);
});
});
});
});
});
});
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