Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automatic_updates
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
automatic_updates
Commits
c441c332
Commit
c441c332
authored
3 years ago
by
Adam G-H
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3260668
by phenaproxima: UpdateReady should have "cancel" button
parent
d4fb6ede
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!189
Issue #3260668: UpdateReady should have "cancel" button
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Form/UpdateReady.php
+14
-0
14 additions, 0 deletions
src/Form/UpdateReady.php
tests/src/Functional/UpdaterFormTest.php
+7
-0
7 additions, 0 deletions
tests/src/Functional/UpdaterFormTest.php
with
21 additions
and
0 deletions
src/Form/UpdateReady.php
+
14
−
0
View file @
c441c332
...
@@ -139,6 +139,11 @@ class UpdateReady extends FormBase {
...
@@ -139,6 +139,11 @@ class UpdateReady extends FormBase {
];
];
$form
[
'actions'
]
=
[
'#type'
=>
'actions'
];
$form
[
'actions'
]
=
[
'#type'
=>
'actions'
];
$form
[
'actions'
][
'cancel'
]
=
[
'#type'
=>
'submit'
,
'#value'
=>
$this
->
t
(
'Cancel update'
),
'#submit'
=>
[
'::cancel'
],
];
$form
[
'actions'
][
'submit'
]
=
[
$form
[
'actions'
][
'submit'
]
=
[
'#type'
=>
'submit'
,
'#type'
=>
'submit'
,
'#value'
=>
$this
->
t
(
'Continue'
),
'#value'
=>
$this
->
t
(
'Continue'
),
...
@@ -184,4 +189,13 @@ class UpdateReady extends FormBase {
...
@@ -184,4 +189,13 @@ class UpdateReady extends FormBase {
batch_set
(
$batch
);
batch_set
(
$batch
);
}
}
/**
* Cancels the in-progress update.
*/
public
function
cancel
(
array
&
$form
,
FormStateInterface
$form_state
):
void
{
$this
->
updater
->
destroy
();
$this
->
messenger
()
->
addStatus
(
$this
->
t
(
'The update was successfully cancelled.'
));
$form_state
->
setRedirect
(
'automatic_updates.report_update'
);
}
}
}
This diff is collapsed.
Click to expand it.
tests/src/Functional/UpdaterFormTest.php
+
7
−
0
View file @
c441c332
...
@@ -263,6 +263,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
...
@@ -263,6 +263,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
// Delete the existing update.
// Delete the existing update.
$page
->
pressButton
(
'Delete existing update'
);
$page
->
pressButton
(
'Delete existing update'
);
$assert_session
->
pageTextContains
(
'Staged update deleted'
);
$assert_session
->
pageTextNotContains
(
'Cannot begin an update because another Composer operation is currently in progress.'
);
$assert_session
->
pageTextNotContains
(
'Cannot begin an update because another Composer operation is currently in progress.'
);
// Ensure we can start another update after deleting the existing one.
// Ensure we can start another update after deleting the existing one.
...
@@ -273,6 +274,12 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
...
@@ -273,6 +274,12 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$this
->
assertUpdateReady
();
$this
->
assertUpdateReady
();
$this
->
assertUpdateStagedTimes
(
2
);
$this
->
assertUpdateStagedTimes
(
2
);
$assert_session
->
buttonExists
(
'Continue'
);
$assert_session
->
buttonExists
(
'Continue'
);
// Cancel the update, then ensure that we are bounced back to the start
// page, and that it will allow us to begin the update anew.
$page
->
pressButton
(
'Cancel update'
);
$assert_session
->
addressEquals
(
'/admin/reports/updates/automatic-update'
);
$assert_session
->
pageTextContains
(
'The update was successfully cancelled.'
);
$assert_session
->
buttonExists
(
'Update'
);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment