Skip to content

Commit

Permalink
adding improvement for resource wizard (paging on tiles page, css and…
Browse files Browse the repository at this point in the history
… html fixes, fix for virtual containers)
  • Loading branch information
skublik committed Aug 12, 2022
1 parent b109e8f commit 99908b1
Show file tree
Hide file tree
Showing 24 changed files with 699 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5383,6 +5383,9 @@ public Object getDisplayValue(DisplayableValue val) {
if (val.getValue() instanceof Enum) {
return pageBase.createStringResource((Enum<?>) val.getValue()).getString();
}
if (val.getLabel() == null) {
return pageBase.createStringResource(String.valueOf(val.getValue())).getString();
}
return pageBase.createStringResource(val.getLabel()).getString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public class TileTablePanel<T extends Tile, O extends Serializable> extends Base

private IModel<Search> searchModel;

public TileTablePanel(String id, ISortableDataProvider provider, List<IColumn<O, String>> columns) {
this(id, provider, columns, null);
public TileTablePanel(String id, ISortableDataProvider provider) {
this(id, provider, List.of(), null);
}

public TileTablePanel(String id, ISortableDataProvider provider, List<IColumn<O, String>> columns, IModel<ViewToggle> viewToggle) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</wicket:enclosure>
</div>

<div class="d-flex flex-wrap gap-2">
<div class="d-flex flex-wrap gap-2" wicket:id="resourceChoiceContainer">
<label class="col-form-label-sm mb-0"><wicket:message key="ResourceContentTabPanel.searchType" /></label>
<div class="btn-group btn-group-sm">
<a class="btn btn-default" wicket:id="repositorySearch">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.repeater.RepeatingView;
Expand Down Expand Up @@ -82,6 +83,7 @@ enum Operation {
private static final String ID_OBJECT_CLASS = "objectClass";
private static final String ID_MAIN_FORM = "mainForm";

private static final String ID_RESOURCE_CHOICE_CONTAINER_SEARCH = "resourceChoiceContainer";
private static final String ID_REPO_SEARCH = "repositorySearch";
private static final String ID_RESOURCE_SEARCH = "resourceSearch";

Expand All @@ -90,16 +92,23 @@ enum Operation {
private ShadowKindType kind;

private boolean useObjectClass;
private boolean isRepoSearch = true;
private boolean isRepoSearch;

private IModel<ResourceContentSearchDto> resourceContentSearch;

public ResourceContentPanel(String id, final ShadowKindType kind,
final ResourceDetailsModel model, ContainerPanelConfigurationType config) {
this(id, kind, model, config, true);
}

public ResourceContentPanel(String id, final ShadowKindType kind,
final ResourceDetailsModel model, ContainerPanelConfigurationType config,
boolean isRepoSearch) {
super(id, model, config);

this.kind = kind;
this.resourceContentSearch = createContentSearchModel(kind);
this.isRepoSearch = isRepoSearch;
//TODO config
}

Expand Down Expand Up @@ -249,6 +258,11 @@ public boolean isVisible() {
});
add(objectClassPanel);

WebMarkupContainer resourceChoiceContainer = new WebMarkupContainer(ID_RESOURCE_CHOICE_CONTAINER_SEARCH);
resourceChoiceContainer.setOutputMarkupId(true);
resourceChoiceContainer.add(new VisibleBehaviour( () -> isSourceChoiceVisible()));
add(resourceChoiceContainer);

AjaxLink<Boolean> repoSearch = new AjaxLink<Boolean>(ID_REPO_SEARCH,
new PropertyModel<>(resourceContentSearch, "resourceSearch")) {
private static final long serialVersionUID = 1L;
Expand All @@ -264,7 +278,7 @@ public void onClick(AjaxRequestTarget target) {
mainForm.addOrReplace(initRepoContent(ResourceContentPanel.this.getObjectWrapperModel()));
target.add(getParent().addOrReplace(mainForm));
target.add(this);
target.add(getParent().get(ID_RESOURCE_SEARCH)
target.add(getParent().get(getPageBase().createComponentPath(ID_RESOURCE_CHOICE_CONTAINER_SEARCH, ID_RESOURCE_SEARCH))
.add(AttributeModifier.replace("class", "btn btn-sm btn-default")));
}

Expand All @@ -274,7 +288,7 @@ protected void onBeforeRender() {
if (!getModelObject().booleanValue()) {add(AttributeModifier.replace("class", "btn btn-sm btn-default active"));}
}
};
add(repoSearch);
resourceChoiceContainer.add(repoSearch);

AjaxLink<Boolean> resourceSearch = new AjaxLink<Boolean>(ID_RESOURCE_SEARCH,
new PropertyModel<>(resourceContentSearch, "resourceSearch")) {
Expand All @@ -290,7 +304,7 @@ public void onClick(AjaxRequestTarget target) {
mainForm.addOrReplace(initResourceContent(ResourceContentPanel.this.getObjectWrapperModel()));
target.add(getParent().addOrReplace(mainForm));
target.add(this.add(AttributeModifier.append("class", " active")));
target.add(getParent().get(ID_REPO_SEARCH)
target.add(getParent().get(getPageBase().createComponentPath(ID_RESOURCE_CHOICE_CONTAINER_SEARCH, ID_REPO_SEARCH))
.add(AttributeModifier.replace("class", "btn btn-sm btn-default")));
}

Expand All @@ -301,10 +315,14 @@ protected void onBeforeRender() {
if (getModelObject().booleanValue()) {add(AttributeModifier.replace("class", "btn btn-sm btn-default active"));}
}
};
add(resourceSearch);
resourceChoiceContainer.add(resourceSearch);

}

protected boolean isSourceChoiceVisible() {
return true;
}

private void initAttributeMappingButton(RepeatingView topButtons) {
AjaxIconButton attrMappingButton = new AjaxIconButton(
topButtons.newChildId(),
Expand Down Expand Up @@ -398,7 +416,7 @@ private IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> get
return new ContainerValueWrapperFromObjectWrapperModel<>(getObjectWrapperModel(), foundValue.getPath());
}

private boolean isTopTableButtonsVisible() {
protected boolean isTopTableButtonsVisible() {
return true;
}

Expand Down Expand Up @@ -435,12 +453,21 @@ protected ResourceSchema getRefinedSchema() throws SchemaException, Configuratio
return getObjectDetailsModels().getRefinedSchema();
}
}

@Override
protected boolean isTaskButtonsContainerVisible() {
return ResourceContentPanel.this.isTaskButtonsContainerVisible();
}
};
resourceContent.setOutputMarkupId(true);
return resourceContent;

}

protected boolean isTaskButtonsContainerVisible() {
return true;
}

private ResourceContentRepositoryPanel initRepoContent(IModel<PrismObjectWrapper<ResourceType>> model) {
String searchMode = isRepoSearch ? SessionStorage.KEY_RESOURCE_PAGE_REPOSITORY_CONTENT :
SessionStorage.KEY_RESOURCE_PAGE_RESOURCE_CONTENT;
Expand All @@ -454,6 +481,11 @@ protected ResourceSchema getRefinedSchema() throws SchemaException, Configuratio
return getObjectDetailsModels().getRefinedSchema();
}
}

@Override
protected boolean isTaskButtonsContainerVisible() {
return ResourceContentPanel.this.isTaskButtonsContainerVisible();
}
};
repositoryContent.setOutputMarkupId(true);
return repositoryContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:extend>
<div class="ml-auto mr-auto col-8" wicket:id="table"/>
<div class="ml-auto mr-auto col-8 card" wicket:id="table"/>
</wicket:extend>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel;
import com.evolveum.midpoint.gui.impl.page.admin.AbstractPageObjectDetails;
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.ResourceContentPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.ResourceSchemaHandlingPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.ResourceUncategorizedPanel;
import com.evolveum.midpoint.web.component.AjaxIconButton;
Expand Down Expand Up @@ -45,7 +46,23 @@ protected void onInitialize() {
}

private void initLayout() {
ResourceUncategorizedPanel table = new ResourceUncategorizedPanel(ID_TABLE, getResourceModel(), getConfiguration());
ResourceContentPanel table
= new ResourceContentPanel(ID_TABLE, null, getResourceModel(), getConfiguration(), false) {
@Override
protected boolean isTaskButtonsContainerVisible() {
return false;
}

@Override
protected boolean isTopTableButtonsVisible() {
return false;
}

@Override
protected boolean isSourceChoiceVisible() {
return false;
}
};
table.setOutputMarkupId(true);
add(table);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ private void initLayout() {
protected Fragment createTemplateFragment() {
Fragment fragment = new Fragment(ID_FRAGMENT, ID_TEMPLATE_FRAGMENT, BasicResourceWizardPanel.this);
fragment.setOutputMarkupId(true);
add(fragment);
CreateResourceTemplatePanel templatePanel = new CreateResourceTemplatePanel(ID_TEMPLATE) {

@Override
Expand Down Expand Up @@ -101,7 +100,7 @@ private List<WizardStep> createBasicSteps() {
public boolean onBackPerformed(AjaxRequestTarget target) {
Fragment fragment = createTemplateFragment();
fragment.setOutputMarkupId(true);
BasicResourceWizardPanel.this.replace(fragment);
BasicResourceWizardPanel.this.addOrReplace(fragment);
target.add(fragment);

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@ <h3 class="m-0 pt-1">
<wicket:message key="PageResource.wizard.selection.text"/>
</h3>
</div>
<div class="d-flex mt-3">
<div wicket:id="type" style="width: 300px;"/>
<div class="my-auto d-flex ml-auto" wicket:id="search"/>
</div>
<wicket:fragment wicket:id="searchFragment">
<div class="d-flex mt-3">
<div wicket:id="type" style="width: 300px;"/>
<div class="my-auto d-flex ml-auto" wicket:id="search"/>
</div>
</wicket:fragment>
</div>

<div class="d-flex flex-wrap justify-content-start text-break mt-3 mb-5 mr-n3 pt-3" wicket:id="tileContainer">
<div wicket:id="tiles" class="col-xs-6 col-sm-6 col-md-4 col-lg-3 col-xl-5i col-xxl-2 pr-3 pb-3 p-0">
<div wicket:id="tile"/>
</div>
</div>
<div wicket:id="tileTable"/>

<!-- <div class="d-flex flex-wrap justify-content-start text-break mt-3 mb-5 mr-n3 pt-3" wicket:id="tileContainer">-->
<!-- <div wicket:id="tiles" class="col-xs-6 col-sm-6 col-md-4 col-lg-3 col-xl-5i col-xxl-2 pr-3 pb-3 p-0 btn">-->
<!-- <div wicket:id="tile"/>-->
<!-- </div>-->
<!-- </div>-->
</wicket:panel>
</body>
</html>

0 comments on commit 99908b1

Please sign in to comment.