use of com.helger.photon.bootstrap4.alert.BootstrapSuccessBox in project phoss-smp by phax.
the class SMPRendererSecure method getMenuContent.
@Nonnull
public static IHCNode getMenuContent(@Nonnull final ILayoutExecutionContext aLEC) {
final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
final HCNodeList ret = new HCNodeList();
final ISMPSettings aSettings = SMPMetaManager.getSettings();
ret.addChild(BootstrapMenuItemRenderer.createSideBarMenu(aLEC));
final BootstrapSuccessBox aBox = new BootstrapSuccessBox().addClass(CBootstrapCSS.MT_2);
if (SMPMetaManager.getInstance().getBackendConnectionState().isFalse()) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" No database connection: ").addChild(new HCA(CAjax.FUNCTION_BACKEND_CONNECTION_RESET.getInvocationURL(aRequestScope)).addChild("Retry")));
aBox.setType(EBootstrapAlertType.DANGER);
}
// Information on SML usage
if (aSettings.isSMLEnabled()) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.YES.getAsNode()).addChild(" SML connection is configured."));
if (aSettings.getSMLInfo() == null) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" No SML is selected. ").addChild(new HCA(aLEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).addChild("Fix me")));
aBox.setType(EBootstrapAlertType.DANGER);
}
} else {
// Warn only if SML is needed
if (aSettings.isSMLRequired()) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" SML connection is NOT configured. ").addChild(new HCA(aLEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).addChild("Fix me")));
aBox.setTypeIfWorse(EBootstrapAlertType.WARNING);
}
}
if (aSettings.isDirectoryIntegrationRequired()) {
if (aSettings.isDirectoryIntegrationEnabled()) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.YES.getAsNode()).addChild(" Directory support is configured."));
if (StringHelper.hasNoText(aSettings.getDirectoryHostName())) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" No Directory host is provided. ").addChild(new HCA(aLEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).addChild("Fix me")));
aBox.setType(EBootstrapAlertType.DANGER);
}
} else {
// Warn only if Directory is needed
aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" Directory support is NOT configured. ").addChild(new HCA(aLEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).addChild("Fix me")));
aBox.setTypeIfWorse(EBootstrapAlertType.WARNING);
}
}
// Information on certificate
if (!SMPKeyManager.isKeyStoreValid()) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" Certificate configuration is invalid."));
aBox.setType(EBootstrapAlertType.DANGER);
}
ret.addChild(aBox);
return ret;
}
Aggregations