Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
migration_notify
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
migration_notify
Commits
d9b4f5cc
Commit
d9b4f5cc
authored
1 month ago
by
Norman Kämper-Leymann
Committed by
Fran Garcia-Linares
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3489204
by leymannx: Make stuck migrations message configurable
parent
079f3a52
No related branches found
Branches containing commit
Tags
8.x-1.1-beta2
Tags containing commit
1 merge request
!5
#3489204 Make stuck migrations message configurable
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
migration_notify.module
+1
-1
1 addition, 1 deletion
migration_notify.module
src/Form/MigrationNotifySettingsForm.php
+18
-3
18 additions, 3 deletions
src/Form/MigrationNotifySettingsForm.php
with
19 additions
and
4 deletions
migration_notify.module
+
1
−
1
View file @
d9b4f5cc
...
...
@@ -62,7 +62,7 @@ function migration_notify_cron() {
}
}
$message
=
t
(
'There are migrations stuck on the site.'
);
$message
=
$config
->
get
(
'stuck_message'
)
??
t
(
'There are migrations stuck on the site.'
);
$sent
=
0
;
if
(
$config
->
get
(
'slack'
))
{
...
...
This diff is collapsed.
Click to expand it.
src/Form/MigrationNotifySettingsForm.php
+
18
−
3
View file @
d9b4f5cc
...
...
@@ -112,7 +112,7 @@ class MigrationNotifySettingsForm extends ConfigFormBase {
$stuck
=
$this
->
helper
->
checkStuck
();
if
(
$stuck
)
{
$message
=
$this
->
t
(
'There are
stuck
migrations.'
);
$message
=
$config
->
get
(
'stuck_message'
)
??
$this
->
t
(
'There are migrations
stuck on the site
.'
);
$this
->
messenger
->
addMessage
(
$message
,
'warning'
);
}
else
{
...
...
@@ -202,6 +202,18 @@ class MigrationNotifySettingsForm extends ConfigFormBase {
];
}
$form
[
'notification_messages'
]
=
[
'#markup'
=>
'<hr /><h3>'
.
$this
->
t
(
'Notification messages'
)
.
'</h3>'
,
];
$form
[
'stuck_message'
]
=
[
'#type'
=>
'textfield'
,
'#required'
=>
TRUE
,
'#title'
=>
$this
->
t
(
'Stuck message'
),
'#description'
=>
$this
->
t
(
'The message to be sent when there are stuck migrations.'
),
'#default_value'
=>
$config
->
get
(
'stuck_message'
)
??
$this
->
t
(
'There are migrations stuck on the site.'
),
];
$form
[
'actions'
][
'#type'
]
=
'actions'
;
if
(
$stuck
)
{
$form
[
'actions'
][
'notify_now'
]
=
[
...
...
@@ -275,9 +287,10 @@ class MigrationNotifySettingsForm extends ConfigFormBase {
$this
->
helper
->
saveState
(
$stuck
);
$message
=
$this
->
t
(
'There are migrations stuck on the site.'
);
$config
=
$this
->
config
(
'migration_notify.settings'
);
$message
=
$config
->
get
(
'stuck_message'
)
??
$this
->
t
(
'There are migrations stuck on the site.'
);
if
(
$config
->
get
(
'slack'
))
{
if
(
$this
->
notifier
->
notifySlack
(
$message
))
{
$this
->
messenger
->
addMessage
(
$this
->
t
(
'Slack: Message was successfully sent.'
));
...
...
@@ -316,6 +329,7 @@ class MigrationNotifySettingsForm extends ConfigFormBase {
$email
=
$form_state
->
getValue
(
'email'
);
$email_to
=
$form_state
->
getValue
(
'email_to'
);
$slack
=
$form_state
->
getValue
(
'slack'
);
$message
=
$form_state
->
getValue
(
'stuck_message'
);
$this
->
config
(
'migration_notify.settings'
)
->
set
(
'cron'
,
$cron
)
...
...
@@ -323,6 +337,7 @@ class MigrationNotifySettingsForm extends ConfigFormBase {
->
set
(
'slack'
,
$slack
)
->
set
(
'email'
,
$email
)
->
set
(
'email_to'
,
$email_to
)
->
set
(
'stuck_message'
,
$message
)
->
save
();
}
...
...
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