Document MessageOfTheDay extension
Change-Id: I99894e9d9b0376e11ac47796cee4c9e2e0c9be5a
This commit is contained in:
@@ -2954,6 +2954,40 @@ to change in order to be compliant. These requirements should be kept once they
|
||||
are met, but marked as `OK`. If the requirements were not displayed, reviewers
|
||||
would need to use their precious time to manually check that they were met.
|
||||
|
||||
[[message-of-the-day]]
|
||||
== Posting Messages (Of The Day) to the UI
|
||||
Gerrit provides an extension point that enables plugins to implement a method to
|
||||
collect messages that will then be shown below the main header in the Gerrit UI.
|
||||
|
||||
[source, java]
|
||||
----
|
||||
import com.google.gerrit.extensions.systemstatus.MessageOfTheDay;
|
||||
|
||||
@Singleton
|
||||
class MessageOfTheDayImpl extends MessageOfTheDay {
|
||||
|
||||
private final String id;
|
||||
private final String msg;
|
||||
|
||||
public MessageOfTheDayImpl() {
|
||||
id = "hello";
|
||||
msg = "I just wanted to say <b>hello</b>.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHtmlMessage() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessageId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
----
|
||||
|
||||
Note, that the message will be added as HTML and parsed into the DOM. Thus,
|
||||
plugins using this extension should ensure that the message content is safe.
|
||||
|
||||
== SEE ALSO
|
||||
|
||||
|
||||
@@ -1908,7 +1908,8 @@ The number of open files.
|
||||
[[message-of-the-day-info]]
|
||||
=== MessageOfTheDayInfo
|
||||
The `MessageOfTheDayInfo` entity contains information about a message
|
||||
that was registered with the `MessageOfTheDay`-extension by plugins.
|
||||
that was registered with the
|
||||
link:dev-plugins.html#message-of-the-day[MessageOfTheDay]-extension by plugins.
|
||||
|
||||
[options="header",cols="1,^1,5"]
|
||||
|===========================
|
||||
@@ -1974,8 +1975,9 @@ Information about the configuration from the
|
||||
link:config-gerrit.html#gerrit[gerrit] section as link:#gerrit-info[
|
||||
GerritInfo] entity.
|
||||
|`messages` ||
|
||||
List of messages registered with the `MessageOfTheDay`-
|
||||
extension containing link:#message-of-the-day-info[
|
||||
List of messages registered with the
|
||||
link:dev-plugins.html#message-of-the-day[MessageOfTheDay]-extension
|
||||
containing link:#message-of-the-day-info[
|
||||
MessageOfTheDayInfo] entities.
|
||||
|`note_db_enabled` |not set if `false`|
|
||||
Whether the NoteDb storage backend is fully enabled.
|
||||
|
||||
Reference in New Issue
Block a user