Add tooltip for username
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -17,7 +17,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEvent;
|
||||
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
|
||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
@@ -172,9 +171,7 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
||||
}
|
||||
|
||||
private Label createHeaderCaption() {
|
||||
final Label captionLabel = SPUIComponentProvider.getLabel(getDefaultCaption(),
|
||||
SPUILabelDefinitions.SP_WIDGET_CAPTION);
|
||||
return captionLabel;
|
||||
return SPUIComponentProvider.getLabel(getDefaultCaption(), SPUILabelDefinitions.SP_WIDGET_CAPTION);
|
||||
}
|
||||
|
||||
protected VerticalLayout getTabLayout() {
|
||||
@@ -220,8 +217,7 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
||||
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.get("label.created.at"),
|
||||
SPDateTimeUtil.formatCreatedAt(selectedBaseEntity)));
|
||||
|
||||
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.get("label.created.by"),
|
||||
UserDetailsFormatter.loadAndFormatCreatedBy(selectedBaseEntity)));
|
||||
logLayout.addComponent(SPUIComponentProvider.createCreatedByLabel(i18n, selectedBaseEntity));
|
||||
|
||||
if (selectedBaseEntity == null || selectedBaseEntity.getLastModifiedAt() == null) {
|
||||
return;
|
||||
@@ -230,8 +226,7 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
|
||||
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.get("label.modified.date"),
|
||||
SPDateTimeUtil.formatLastModifiedAt(selectedBaseEntity)));
|
||||
|
||||
logLayout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.get("label.modified.by"),
|
||||
UserDetailsFormatter.loadAndFormatLastModifiedBy(selectedBaseEntity)));
|
||||
logLayout.addComponent(SPUIComponentProvider.createLastModifiedByLabel(i18n, selectedBaseEntity));
|
||||
}
|
||||
|
||||
protected void updateDescriptionLayout(final String descriptionLabel, final String description) {
|
||||
|
||||
@@ -329,6 +329,17 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
|
||||
columnList.add(
|
||||
new TableColumn(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, i18n.get("header.modifiedDate"), 0.1F));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_DESC, i18n.get("header.description"), 0.2F));
|
||||
setItemDescriptionGenerator((source, itemId, propertyId) -> {
|
||||
|
||||
if (SPUILabelDefinitions.VAR_CREATED_BY.equals(propertyId)) {
|
||||
return getItem(itemId).getItemProperty(SPUILabelDefinitions.VAR_CREATED_BY).getValue().toString();
|
||||
}
|
||||
if (SPUILabelDefinitions.VAR_LAST_MODIFIED_BY.equals(propertyId)) {
|
||||
return getItem(itemId).getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY).getValue().toString();
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
return columnList;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,9 @@ import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIHeaderLayoutDecorator;
|
||||
@@ -20,6 +22,7 @@ import org.eclipse.hawkbit.ui.decorators.SPUILabelDecorator;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUITextAreaDecorator;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUITextFieldDecorator;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIWindowDecorator;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -328,6 +331,50 @@ public final class SPUIComponentProvider {
|
||||
return nameValueLabel;
|
||||
}
|
||||
|
||||
private static Label createUsernameLabel(final String label, final String username) {
|
||||
String loadAndFormatUsername = StringUtils.EMPTY;
|
||||
if (!StringUtils.isEmpty(username)) {
|
||||
loadAndFormatUsername = UserDetailsFormatter.loadAndFormatUsername(username);
|
||||
}
|
||||
|
||||
final Label nameValueLabel = new Label(getBoldHTMLText(label) + loadAndFormatUsername, ContentMode.HTML);
|
||||
nameValueLabel.setSizeFull();
|
||||
nameValueLabel.addStyleName(SPUIDefinitions.TEXT_STYLE);
|
||||
nameValueLabel.addStyleName("label-style");
|
||||
nameValueLabel.setDescription(loadAndFormatUsername);
|
||||
return nameValueLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create label which represents the {@link BaseEntity#getCreatedBy()} by
|
||||
* user name
|
||||
*
|
||||
* @param i18n
|
||||
* the i18n
|
||||
* @param baseEntity
|
||||
* the entity
|
||||
* @return the label
|
||||
*/
|
||||
public static Label createCreatedByLabel(final I18N i18n, final BaseEntity baseEntity) {
|
||||
return createUsernameLabel(i18n.get("label.created.by"),
|
||||
baseEntity == null ? StringUtils.EMPTY : baseEntity.getCreatedBy());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create label which represents the
|
||||
* {@link BaseEntity#getLastModifiedBy()()} by user name
|
||||
*
|
||||
* @param i18n
|
||||
* the i18n
|
||||
* @param baseEntity
|
||||
* the entity
|
||||
* @return the label
|
||||
*/
|
||||
public static Label createLastModifiedByLabel(final I18N i18n, final BaseEntity baseEntity) {
|
||||
return createUsernameLabel(i18n.get("label.modified.by"),
|
||||
baseEntity == null ? StringUtils.EMPTY : baseEntity.getLastModifiedBy());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Bold Text.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user