Skip to content

Commit

Permalink
MID-7976 request access ui bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Aug 8, 2022
1 parent 52f9d08 commit e966dbf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void onItemClickPerformed(ListGroupMenuItem item) {
}

public void activateFirstAvailableItem() {
for (ListGroupMenuItem i : items) {
for (ListGroupMenuItem i : getItems()) {
if (activateFirstAvailableItem(i)) {
i.setOpen(true);
break;
Expand Down Expand Up @@ -84,12 +84,18 @@ public ListGroupMenuItem<T> getActiveMenu() {
return null;
}

private ListGroupMenuItem getActiveMenu(ListGroupMenuItem<T> parent) {
if (parent.isActive()) {
return parent;
private ListGroupMenuItem getActiveMenu(ListGroupMenuItem<T> item) {
if (item.isActive()) {
return item;
}

return parent.getItems().stream().filter(i -> i.isActive()).findFirst().orElse(null);
}
for (ListGroupMenuItem i : item.getItems()) {
ListGroupMenuItem active = getActiveMenu(i);
if (active != null) {
return active;
}
}

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public IModel<String> getTitle() {

private ObjectQuery createQueryFromOrgRef(ObjectReferenceType ref, boolean scopeOne) {
return getPrismContext()
.queryFor(OrgType.class)
.queryFor(RoleType.class)
.isInScopeOf(ref.getOid(), scopeOne ? OrgFilter.Scope.ONE_LEVEL : OrgFilter.Scope.SUBTREE)
.asc(ObjectType.F_NAME)
.build();
Expand Down Expand Up @@ -194,13 +194,15 @@ private ObjectQuery createQueryFromCollectionUri(String collectionUri) {

private void initModels() {
searchModel = new LoadableModel<>(false) {

@Override
protected Search load() {
return SearchFactory.createSearch(RoleType.class, page);
}
};

menuModel = new LoadableModel<>(false) {

@Override
protected ListGroupMenu<RoleCatalogQueryItem> load() {
ListGroupMenu<RoleCatalogQueryItem> menu = loadRoleCatalogMenu();
Expand Down Expand Up @@ -605,7 +607,7 @@ private ContainerPanelConfigurationType createDefaultContainerPanelConfiguration
.label("RoleCatalogPanel.details")
.end();
vcs.identifier("sample-container");
vcs.beginItem().path(new ItemPathType(ItemPath.create(RoleType.F_DESCRIPTION))).end();
vcs.beginItem().path(new ItemPathType(ItemPath.create(ObjectType.F_DESCRIPTION))).end();

return c;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ protected void onConfigure() {
getModelObject().computeConflicts(page);
}

// todo this doesn't work properly first time loading conflict numbers - model is evaluated before computeConflicts...
@Override
public IModel<List<Badge>> getTitleBadges() {
return () -> {
getModelObject().computeConflicts(page);

List<Badge> badges = new ArrayList<>();

long warnings = getModelObject().getWarningCount();
Expand Down

0 comments on commit e966dbf

Please sign in to comment.