use of com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method createLastAvailabilityStatusInfo.
private InfoBoxPanel createLastAvailabilityStatusInfo() {
InfoBoxPanel lastAvailabilityStatus = new BasicInfoBoxPanel(ID_LAST_AVAILABILITY_STATUS, createAvailabilityStatusInfoBoxModel());
lastAvailabilityStatus.setOutputMarkupId(true);
return lastAvailabilityStatus;
}
use of com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method createSchemaStatusInfo.
private InfoBoxPanel createSchemaStatusInfo(ResourceType resource) {
String backgroundColor = "bg-gray";
String icon = "fa fa-times";
String numberMessage;
String description = null;
Integer progress = null;
ResourceSchema refinedSchema;
try {
refinedSchema = ResourceSchemaFactory.getCompleteSchema(resource);
if (refinedSchema != null) {
backgroundColor = "bg-purple";
icon = "fa fa-cubes";
// TODO is this correct?
int numObjectTypes = refinedSchema.getObjectTypeDefinitions().size();
int numAllDefinitions = refinedSchema.getObjectClassDefinitions().size() + numObjectTypes;
numberMessage = numObjectTypes + " " + getPageBase().getString("PageResource.resource.objectTypes");
if (numAllDefinitions != 0) {
progress = numObjectTypes * 100 / numAllDefinitions;
if (progress > 100) {
progress = 100;
}
}
description = numAllDefinitions + " " + getPageBase().getString("PageResource.resource.schemaDefinitions");
} else {
numberMessage = getPageBase().getString("PageResource.resource.noSchema");
}
} catch (SchemaException e) {
backgroundColor = "bg-danger";
icon = "fa fa-warning";
numberMessage = getPageBase().getString("PageResource.resource.schemaError");
}
InfoBoxType infoBoxType = new InfoBoxType(backgroundColor, icon, getPageBase().getString("PageResource.resource.schema"));
infoBoxType.setNumber(numberMessage);
infoBoxType.setProgress(progress);
infoBoxType.setDescription(description);
Model<InfoBoxType> boxModel = new Model<>(infoBoxType);
return new BasicInfoBoxPanel(ID_SCHEMA_STATUS, boxModel);
}
use of com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method createLastAvailabilityStatusInfo.
private InfoBoxPanel createLastAvailabilityStatusInfo(ResourceType resource) {
String messageKey = "PageResource.resource.availabilityUnknown";
String backgroundColor = "bg-gray";
String icon = "fa fa-question";
OperationalStateType operationalState = resource.getOperationalState();
AdministrativeOperationalStateType administrativeOperationalState = resource.getAdministrativeOperationalState();
boolean inMaintenance = false;
if (administrativeOperationalState != null) {
AdministrativeAvailabilityStatusType administrativeAvailabilityStatus = administrativeOperationalState.getAdministrativeAvailabilityStatus();
if (administrativeAvailabilityStatus == AdministrativeAvailabilityStatusType.MAINTENANCE) {
messageKey = "PageResource.resource.maintenance";
backgroundColor = "bg-gray";
icon = "fa fa-wrench";
inMaintenance = true;
}
}
if (operationalState != null && !inMaintenance) {
AvailabilityStatusType lastAvailabilityStatus = operationalState.getLastAvailabilityStatus();
if (lastAvailabilityStatus != null) {
if (lastAvailabilityStatus == AvailabilityStatusType.UP) {
messageKey = "PageResource.resource.up";
backgroundColor = "bg-green";
icon = "fa fa-power-off";
} else if (lastAvailabilityStatus == AvailabilityStatusType.DOWN) {
backgroundColor = "bg-red";
messageKey = "PageResource.resource.down";
icon = "fa fa-ban";
} else if (lastAvailabilityStatus == AvailabilityStatusType.BROKEN) {
backgroundColor = "bg-yellow";
messageKey = "PageResource.resource.broken";
icon = "fa fa-warning";
}
}
}
InfoBoxType infoBoxType = new InfoBoxType(backgroundColor, icon, getPageBase().getString(messageKey));
ConnectorType connectorType = getConnectorType(resource);
if (connectorType == null) {
// Connector not found. Probably bad connectorRef reference.
infoBoxType.setNumber("--");
infoBoxType.setDescription("--");
} else {
String connectorName = StringUtils.substringAfterLast(WebComponentUtil.getEffectiveName(connectorType, ConnectorType.F_CONNECTOR_TYPE), ".");
String connectorVersion = connectorType.getConnectorVersion();
infoBoxType.setNumber(connectorName);
infoBoxType.setDescription(connectorVersion);
}
Model<InfoBoxType> boxModel = new Model<>(infoBoxType);
InfoBoxPanel lastAvailabilityStatus = new BasicInfoBoxPanel(ID_LAST_AVAILABILITY_STATUS, boxModel);
lastAvailabilityStatus.setOutputMarkupId(true);
return lastAvailabilityStatus;
}
use of com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method createSourceTargetInfo.
private BasicInfoBoxPanel createSourceTargetInfo(ResourceType resource) {
String backgroundColor = "bg-aqua";
SourceTarget sourceTarget = determineIfSourceOrTarget(resource);
String numberKey;
switch(sourceTarget) {
case SOURCE:
numberKey = "PageResource.resource.source";
break;
case TARGET:
numberKey = "PageResource.resource.target";
break;
case SOURCE_TARGET:
numberKey = "PageResource.resource.sourceAndTarget";
break;
default:
backgroundColor = "bg-gray";
numberKey = "PageResource.resource.noMappings";
break;
}
InfoBoxType infoBoxType = new InfoBoxType(backgroundColor, sourceTarget.getCssClass(), getPageBase().getString("PageResource.resource.mappings"));
infoBoxType.setNumber(getPageBase().getString(numberKey));
if (isSynchronizationDefined(resource)) {
infoBoxType.setDescription(getPageBase().getString("PageResource.resource.sync"));
}
Model<InfoBoxType> boxModel = new Model<>(infoBoxType);
return new BasicInfoBoxPanel(ID_SOURCE_TARGET, boxModel);
}
Aggregations