use of com.helger.html.hc.impl.HCNodeList in project phoss-smp by phax.
the class PageSecureEndpointChangeURL method isValidToDisplayPage.
@Override
@Nonnull
protected IValidityIndicator isValidToDisplayPage(@Nonnull final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr();
if (aServiceGroupMgr.getSMPServiceGroupCount() <= 0) {
aNodeList.addChild(warn("No service group is present! At least one service group must be present to change endpoints."));
aNodeList.addChild(new BootstrapButton().addChild("Create new service group").setOnClick(AbstractWebPageForm.createCreateURL(aWPEC, CMenuSecure.MENU_SERVICE_GROUPS)).setIcon(EDefaultIcon.YES));
return EValidity.INVALID;
}
return super.isValidToDisplayPage(aWPEC);
}
use of com.helger.html.hc.impl.HCNodeList in project phoss-smp by phax.
the class AbstractSMPWebPageForm method onInputFormError.
@Override
protected void onInputFormError(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final FormErrorList aFormErrors) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
// Show all global errors that don't have a specific error field
for (final IError aError : aFormErrors) if (StringHelper.hasNoText(aError.getErrorFieldName())) {
final EBootstrapAlertType eType = aError.isError() ? EBootstrapAlertType.DANGER : EBootstrapAlertType.WARNING;
aNodeList.addChild(new BootstrapBox(eType).addChild(aError.getAsString(aDisplayLocale)));
}
}
use of com.helger.html.hc.impl.HCNodeList in project phoss-smp by phax.
the class PagePublicStart method fillContent.
@Override
protected void fillContent(final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final IRequestWebScopeWithoutResponse aRequestScope = aWPEC.getRequestScope();
if (SMPWebAppConfiguration.isStartPageParticipantsNone()) {
// New in v5.0.4
aNodeList.addChild(info("This SMP has disabled the list of participants."));
} else {
final ISMPServiceGroupManager aSMPServiceGroupMgr = SMPMetaManager.getServiceGroupMgr();
final ICommonsList<ISMPServiceGroup> aServiceGroups = aSMPServiceGroupMgr.getAllSMPServiceGroups();
// Use dynamic or static table?
final boolean bUseDataTables = SMPWebAppConfiguration.isStartPageDynamicTable();
final boolean bShowExtensionDetails = SMPWebAppConfiguration.isStartPageExtensionsShow();
AbstractHCTable<?> aFinalTable;
if (bUseDataTables) {
// Dynamic
final HCTable aTable = new HCTable(new DTCol("Participant ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol(bShowExtensionDetails ? "Extension" : "Extension?").setDataSort(1, 0), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
aFinalTable = aTable;
} else {
// Static
final BootstrapTable aTable = new BootstrapTable();
aTable.setBordered(true);
aTable.setCondensed(true);
aTable.setStriped(true);
aTable.addHeaderRow().addCell("Participant ID").addCell(bShowExtensionDetails ? "Extension" : "Extension?").addCell(EPhotonCoreText.ACTIONS.getDisplayText(aDisplayLocale));
aFinalTable = aTable;
// Sort manually
aServiceGroups.sort(Comparator.comparing(x -> x.getParticipantIdentifier().getURIEncoded()));
}
for (final ISMPServiceGroup aServiceGroup : aServiceGroups) {
final String sDisplayName = aServiceGroup.getParticipantIdentifier().getURIEncoded();
final HCRow aRow = aFinalTable.addBodyRow();
aRow.addCell(sDisplayName);
if (bShowExtensionDetails) {
if (aServiceGroup.extensions().isNotEmpty())
aRow.addCell(code(HCExtHelper.nl2divList(aServiceGroup.getFirstExtensionXML())));
else
aRow.addCell();
} else {
aRow.addCell(EPhotonCoreText.getYesOrNo(aServiceGroup.extensions().isNotEmpty(), aDisplayLocale));
}
final SMPRestDataProvider aDP = new SMPRestDataProvider(aRequestScope, aServiceGroup.getParticipantIdentifier().getURIEncoded());
aRow.addCell(new HCA(new SimpleURL(aDP.getServiceGroupHref(aServiceGroup.getParticipantIdentifier()))).setTitle("Perform SMP query on " + sDisplayName).setTargetBlank().addChild(EFamFamIcon.SCRIPT_GO.getAsNode()));
}
if (aFinalTable.hasBodyRows()) {
aNodeList.addChild(aFinalTable);
if (bUseDataTables) {
final BootstrapDataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aFinalTable);
aNodeList.addChild(aDataTables);
}
} else
aNodeList.addChild(info("This SMP does not manage any participant yet."));
}
}
use of com.helger.html.hc.impl.HCNodeList in project phoss-smp by phax.
the class SMPRendererPublic method getContent.
@Nonnull
public static IHCNode getContent(@Nonnull final LayoutExecutionContext aLEC) {
final Locale aDisplayLocale = aLEC.getDisplayLocale();
final HCNodeList ret = new HCNodeList();
// Header
ret.addChild(_getNavbar(aLEC));
final BootstrapContainer aOuterContainer = ret.addAndReturnChild(new BootstrapContainer().setFluid(true));
// Breadcrumbs
if (false) {
final BootstrapBreadcrumb aBreadcrumbs = BootstrapBreadcrumbProvider.createBreadcrumb(aLEC);
aBreadcrumbs.addClasses(CBootstrapCSS.D_NONE, CBootstrapCSS.D_SM_BLOCK);
aOuterContainer.addChild(aBreadcrumbs);
}
// Content
aOuterContainer.addChild(BootstrapPageRenderer.getPageContent(aLEC));
// Footer
{
final BootstrapContainer aDiv = createDefaultFooter(SMPWebAppConfiguration.isPublicShowApplicationName(), SMPWebAppConfiguration.isPublicShowSource(), SMPWebAppConfiguration.isPublicShowAuthor());
{
final BootstrapMenuItemRendererHorz aRenderer = new BootstrapMenuItemRendererHorz(aDisplayLocale);
final HCUL aUL = new HCUL().addClass(CSS_CLASS_FOOTER_LINKS);
for (final IMenuObject aMenuObj : FOOTER_OBJECTS) {
if (aMenuObj instanceof IMenuSeparator)
aUL.addItem(aRenderer.renderSeparator(aLEC, (IMenuSeparator) aMenuObj));
else if (aMenuObj instanceof IMenuItemPage)
aUL.addItem(aRenderer.renderMenuItemPage(aLEC, (IMenuItemPage) aMenuObj, false, false, false));
else if (aMenuObj instanceof IMenuItemExternal)
aUL.addItem(aRenderer.renderMenuItemExternal(aLEC, (IMenuItemExternal) aMenuObj, false, false, false));
else
throw new IllegalStateException("Unsupported menu object type!");
}
if (aUL.hasChildren())
aDiv.addChild(aUL);
}
if (aDiv.hasChildren())
aOuterContainer.addChild(aDiv);
}
return ret;
}
use of com.helger.html.hc.impl.HCNodeList in project phoss-smp by phax.
the class PageSecureServiceGroupMigrationOutbound method showListOfExistingObjects.
@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final ISMPParticipantMigrationManager aParticipantMigrationMgr = SMPMetaManager.getParticipantMigrationMgr();
final ISMPSettings aSettings = SMPMetaManager.getSettings();
final ISMPServiceGroupManager aServiceGroupManager = SMPMetaManager.getServiceGroupMgr();
{
final HCOL aOL = new HCOL();
aOL.addItem("The migration is initiated on this SMP, and the SML is informed about the upcoming migration");
aOL.addItem("The other SMP, that is taking over the Service Group, must acknowledge the migration by providing the same migration code (created by this SMP) to the SML");
aOL.addItem("If the migration was successful, the Service Group must be deleted from this SMP, ideally a temporary redirect to the new SMP is created. If the migration was cancelled no action is needed.");
aNodeList.addChild(info().addChild(div("The process of migrating a Service Group to another SMP consists of multiple steps:")).addChild(aOL).addChild(div("Therefore each open Migration must either be finished (deleting the Service Group) or cancelled (no action taken)." + " If a Migration is cancelled, it can be retried later.")));
}
EValidity eCanStartMigration = EValidity.VALID;
if (aSettings.getSMLInfo() == null) {
final BootstrapWarnBox aWarn = aNodeList.addAndReturnChild(warn().addChild(div("No valid SML Configuration is selected hence no participant can be migrated.")).addChild(div(new BootstrapButton().addChild("Select SML Configuration in the Settings").setOnClick(aWPEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).setIcon(EDefaultIcon.EDIT))));
if (aSettings.isSMLEnabled() || aSettings.isSMLRequired()) {
aWarn.addChild(div(new BootstrapButton().addChild("Create a new SML Configuration").setOnClick(createCreateURL(aWPEC, CMenuSecure.MENU_SML_CONFIGURATION)).setIcon(EDefaultIcon.YES)));
}
eCanStartMigration = EValidity.INVALID;
} else if (!aSettings.isSMLEnabled()) {
aNodeList.addChild(warn().addChild(div("SML Connection is not enabled hence no participant can be migrated.")).addChild(div(new BootstrapButton().addChild("Enable SML in the Settings").setOnClick(aWPEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).setIcon(EDefaultIcon.EDIT))));
eCanStartMigration = EValidity.INVALID;
} else {
if (aServiceGroupManager.getSMPServiceGroupCount() <= 0) {
aNodeList.addChild(warn("No Service Group is present! At least one Service Group must be present to migrate it."));
// Note: makes no to allow to create a new Service Group here and than
// directly migrate it away
eCanStartMigration = EValidity.INVALID;
}
}
{
final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
aToolbar.addButton("Refresh", aWPEC.getSelfHref(), EDefaultIcon.REFRESH);
aToolbar.addChild(new BootstrapButton().addChild("Start Participant Migration").setOnClick(createCreateURL(aWPEC)).setDisabled(eCanStartMigration.isInvalid()).setIcon(EDefaultIcon.NEW));
aNodeList.addChild(aToolbar);
}
final BootstrapTabBox aTabBox = aNodeList.addAndReturnChild(new BootstrapTabBox());
final ICommonsList<ISMPParticipantMigration> aAllMigs = aParticipantMigrationMgr.getAllOutboundParticipantMigrations(null);
for (final EParticipantMigrationState eState : EParticipantMigrationState.values()) if (eState.isOutboundState()) {
final ICommonsList<ISMPParticipantMigration> aMatchingMigs = aAllMigs.getAll(x -> x.getState() == eState);
aTabBox.addTab(eState.getID(), eState.getDisplayName() + " (" + aMatchingMigs.size() + ")", _createTable(aWPEC, aMatchingMigs, eState));
}
}
Aggregations