SEBSERV-568 fixed

This commit is contained in:
anhefti 2024-07-17 15:37:53 +02:00
parent 95c2057dad
commit 1ef1052275
2 changed files with 29 additions and 11 deletions

View file

@ -186,18 +186,31 @@ public class ExamSignatureKeyForm implements TemplateComposer {
table -> actionBuilder table -> actionBuilder
.newAction(ActionDefinition.EXAM_SECURITY_KEY_SHOW_ADD_GRANT_POPUP) .newAction(ActionDefinition.EXAM_SECURITY_KEY_SHOW_ADD_GRANT_POPUP)
.withParentEntityKey(entityKey) .withParentEntityKey(entityKey)
.withExec(action -> this.addSecurityKeyGrantPopup.showGrantPopup( .withSelect(
action, table::getMultiSelection,
table.getSingleSelectedROWData())) this.addGrant(table),
APP_SIG_KEY_LIST_EMPTY_SELECTION_TEXT_KEY)
.noEventPropagation()
.ignoreMoveAwayFromEdit()
.create())
.withDefaultActionIf(
() -> readonly,
table -> actionBuilder
.newAction(ActionDefinition.EXAM_SECURITY_KEY_SHOW_ASK_POPUP)
.withParentEntityKey(entityKey)
.withSelect(
table::getMultiSelection,
this.showASK(table),
APP_SIG_KEY_LIST_EMPTY_SELECTION_TEXT_KEY)
.noEventPropagation() .noEventPropagation()
.ignoreMoveAwayFromEdit() .ignoreMoveAwayFromEdit()
.create()) .create())
.withSelectionListenerIf( .withSelectionListener(
() -> !readonly,
this.pageService.getSelectionPublisher( this.pageService.getSelectionPublisher(
pageContext, pageContext,
ActionDefinition.EXAM_SECURITY_KEY_SHOW_ADD_GRANT_POPUP)) ActionDefinition.EXAM_SECURITY_KEY_SHOW_ADD_GRANT_POPUP,
ActionDefinition.EXAM_SECURITY_KEY_SHOW_ASK_POPUP))
.compose(pageContext.copyOf(content)); .compose(pageContext.copyOf(content));
@ -225,14 +238,14 @@ public class ExamSignatureKeyForm implements TemplateComposer {
GRANT_LIST_TAG, GRANT_LIST_TAG,
SecurityKey::getTag).widthProportion(1)) SecurityKey::getTag).widthProportion(1))
.withDefaultActionIf( .withDefaultAction(
() -> !readonly,
table -> actionBuilder table -> actionBuilder
.newAction(ActionDefinition.EXAM_SECURITY_KEY_SHOW_GRANT_POPUP) .newAction(ActionDefinition.EXAM_SECURITY_KEY_SHOW_GRANT_POPUP)
.withParentEntityKey(entityKey) .withParentEntityKey(entityKey)
.withExec(action -> this.securityKeyGrantPopup.showGrantPopup( .withSelect(
action, table::getMultiSelection,
table.getSingleSelectedROWData())) this.showGrant(table),
GRANT_LIST_EMPTY_SELECTION_TEXT_KEY)
.noEventPropagation() .noEventPropagation()
.ignoreMoveAwayFromEdit() .ignoreMoveAwayFromEdit()
.create()) .create())
@ -330,6 +343,7 @@ public class ExamSignatureKeyForm implements TemplateComposer {
return action -> { return action -> {
final EntityKey singleSelection = action.getSingleSelection(); final EntityKey singleSelection = action.getSingleSelection();
if (singleSelection != null) { if (singleSelection != null) {
action.setReadonly();
this.addSecurityKeyGrantPopup.showGrantPopup(action, connectionInfoTable.getSingleSelectedROWData()); this.addSecurityKeyGrantPopup.showGrantPopup(action, connectionInfoTable.getSingleSelectedROWData());
} }
return action; return action;

View file

@ -86,6 +86,10 @@ public final class PageAction {
} }
} }
public void setReadonly() {
this.pageContext = this.pageContext.withAttribute(AttributeKeys.READ_ONLY, Constants.TRUE_STRING);
}
public String getName() { public String getName() {
if (this.definition != null) { if (this.definition != null) {
return this.definition.name(); return this.definition.name();