fix #1105 add development mode icon

This commit is contained in:
Shinsuke Sugaya 2017-06-13 23:45:09 +09:00
parent fccb1b2d0f
commit a49109a685
10 changed files with 41 additions and 1 deletions

View file

@ -211,6 +211,10 @@ public class FessEsClient implements Client {
this.runner = runner;
}
public boolean isEmbedded() {
return this.runner != null;
}
public void addTransportAddress(final String host, final int port) {
try {
transportAddressList.add(new InetSocketTransportAddress(InetAddress.getByName(host), port));

View file

@ -179,6 +179,10 @@ public class SystemHelper {
public String getHelpLink(final String name) {
final String url = ComponentUtil.getFessConfig().getOnlineHelpBaseLink() + name + "-guide.html";
return getHelpUrl(url);
}
protected String getHelpUrl(final String url) {
final Locale locale = ComponentUtil.getRequestManager().getUserLocale();
if (locale != null) {
final String lang = locale.getLanguage();
@ -278,7 +282,9 @@ public class SystemHelper {
}
public void setupAdminHtmlData(final TypicalAction action, final ActionRuntime runtime) {
// nothing
runtime.registerData("developmentMode", ComponentUtil.getFessEsClient().isEmbedded());
final String url = ComponentUtil.getFessConfig().getOnlineHelpInstallation();
runtime.registerData("installationLink", getHelpUrl(url));
}
public String getSearchRoleByUser(final String name) {

View file

@ -2670,6 +2670,9 @@ public class FessLabels extends UserMessages {
/** The key of the message: Score: */
public static final String LABELS_doc_score = "{labels.doc_score}";
/** The key of the message: Running as Development mode. For production use, please install a standalone elasticsearch server. */
public static final String LABELS_development_mode_warning = "{labels.development_mode_warning}";
/**
* Assert the property is not null.
* @param property The value of the property. (NotNull)

View file

@ -827,6 +827,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. http://fess.codelibs.org/{lang}/{version}/admin/ */
String ONLINE_HELP_BASE_LINK = "online.help.base.link";
/** The key of the configuration. e.g. http://fess.codelibs.org/{lang}/{version}/install/install.html */
String ONLINE_HELP_INSTALLATION = "online.help.installation";
/** The key of the configuration. e.g. failureurl */
String ONLINE_HELP_NAME_FAILUREURL = "online.help.name.failureurl";
@ -4006,6 +4009,13 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
String getOnlineHelpBaseLink();
/**
* Get the value for the key 'online.help.installation'. <br>
* The value is, e.g. http://fess.codelibs.org/{lang}/{version}/install/install.html <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getOnlineHelpInstallation();
/**
* Get the value for the key 'online.help.name.failureurl'. <br>
* The value is, e.g. failureurl <br>
@ -6565,6 +6575,10 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return get(FessConfig.ONLINE_HELP_BASE_LINK);
}
public String getOnlineHelpInstallation() {
return get(FessConfig.ONLINE_HELP_INSTALLATION);
}
public String getOnlineHelpNameFailureurl() {
return get(FessConfig.ONLINE_HELP_NAME_FAILUREURL);
}

View file

@ -430,6 +430,7 @@ scheduler.monitor.interval=30
# OnlineHelp
# ------
online.help.base.link=http://fess.codelibs.org/{lang}/{version}/admin/
online.help.installation=http://fess.codelibs.org/{lang}/{version}/install/install.html
online.help.name.failureurl=failureurl
online.help.name.elevateword=elevateword
online.help.name.reqheader=reqheader

View file

@ -880,3 +880,4 @@ labels.requestFile=Request File
labels.esreq_button_upload=Send
labels.facet_is_not_found=No match
labels.doc_score=Score:
labels.development_mode_warning=Running as Development mode. For production use, please install a standalone elasticsearch server.

View file

@ -880,3 +880,4 @@ labels.requestFile=Request File
labels.esreq_button_upload=Send
labels.facet_is_not_found=No match.
labels.doc_score=Score:
labels.development_mode_warning=Running as Development mode. For production use, please install a standalone elasticsearch server.

View file

@ -882,3 +882,4 @@ labels.requestFile=\u30ea\u30af\u30a8\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb
labels.esreq_button_upload=\u9001\u4fe1
labels.facet_is_not_found=\u8a72\u5f53\u306a\u3057
labels.doc_score=\u30b9\u30b3\u30a2:
labels.development_mode_warning=\u958b\u767a\u30e2\u30fc\u30c9\u3067\u8d77\u52d5\u3057\u3066\u3044\u307e\u3059\u3002\u672c\u904b\u7528\u74b0\u5883\u3067\u306fElasticsearch\u3092\u5225\u9014\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002

View file

@ -17,6 +17,11 @@
<!-- Navbar Right Menu -->
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<c:if test="${developmentMode}">
<li data-toggle="tooltip" data-placement="left" title="<la:message
key="labels.development_mode_warning" />">
<a href="${installationLink}" target="_olh"><i class="fa fa-exclamation-triangle"></i></a></li>
</c:if>
<li><a href="${contextPath}/"><i class="fa fa-list-alt"></i></a></li>
<li><a
href="${contextPath}/admin/scheduler/details/4/default_crawler"><i

View file

@ -84,4 +84,8 @@ $(function() {
showInputs : false
});
// tooltips
$(function() {
$('[data-toggle="tooltip"]').tooltip()
})
});