fixed action disappearing on empty list

This commit is contained in:
anhefti 2020-07-29 12:07:26 +02:00
parent 066df95d0c
commit 63949a9416
12 changed files with 29 additions and 29 deletions

View file

@ -251,7 +251,7 @@ public class ConfigTemplateForm implements TemplateComposer {
attrTable::getSelection,
PageAction::applySingleSelectionAsEntityKey,
EMPTY_ATTRIBUTE_SELECTION_TEXT_KEY)
.publishIf(() -> attrTable.hasAnyContent() && modifyGrant, false)
.publishIf(() -> modifyGrant, false)
.newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_SET_DEFAULT)
.withParentEntityKey(entityKey)
@ -260,7 +260,7 @@ public class ConfigTemplateForm implements TemplateComposer {
action -> this.resetToDefaults(action, attrTable),
EMPTY_ATTRIBUTE_SELECTION_TEXT_KEY)
.noEventPropagation()
.publishIf(() -> attrTable.hasAnyContent() && modifyGrant, false)
.publishIf(() -> modifyGrant, false)
.newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_LIST_REMOVE_VIEW)
.withParentEntityKey(entityKey)
@ -269,7 +269,7 @@ public class ConfigTemplateForm implements TemplateComposer {
action -> this.removeFormView(action, attrTable),
EMPTY_ATTRIBUTE_SELECTION_TEXT_KEY)
.noEventPropagation()
.publishIf(() -> attrTable.hasAnyContent() && modifyGrant, false)
.publishIf(() -> modifyGrant, false)
.newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_LIST_ATTACH_DEFAULT_VIEW)
.withParentEntityKey(entityKey)
@ -278,7 +278,7 @@ public class ConfigTemplateForm implements TemplateComposer {
action -> this.attachView(action, attrTable),
EMPTY_ATTRIBUTE_SELECTION_TEXT_KEY)
.noEventPropagation()
.publishIf(() -> attrTable.hasAnyContent() && modifyGrant, false);
.publishIf(() -> modifyGrant, false);
}
pageActionBuilder

View file

@ -148,12 +148,12 @@ public class ConfigTemplateList implements TemplateComposer {
.newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_VIEW_FROM_LIST)
.withSelect(templateTable::getSelection, PageAction::applySingleSelectionAsEntityKey,
EMPTY_TEMPLATE_SELECTION_TEXT_KEY)
.publishIf(templateTable::hasAnyContent, false)
.publish(false)
.newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_MODIFY_FROM_LIST)
.withSelect(
templateTable.getGrantedSelection(this.currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
PageAction::applySingleSelectionAsEntityKey, EMPTY_TEMPLATE_SELECTION_TEXT_KEY)
.publishIf(() -> examConfigGrant.im() && templateTable.hasAnyContent(), false);
.publishIf(() -> examConfigGrant.im(), false);
}
}

View file

@ -209,14 +209,14 @@ public class ExamList implements TemplateComposer {
actionBuilder
.newAction(ActionDefinition.EXAM_VIEW_FROM_LIST)
.withSelect(table::getSelection, PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY)
.publishIf(table::hasAnyContent, false)
.publish(false)
.newAction(ActionDefinition.EXAM_MODIFY_FROM_LIST)
.withSelect(
table.getGrantedSelection(currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
action -> modifyExam(action, table),
EMPTY_SELECTION_TEXT_KEY)
.publishIf(() -> userGrant.im() && table.hasAnyContent(), false);
.publishIf(() -> userGrant.im(), false);
}

View file

@ -87,8 +87,8 @@ public class InstitutionList implements TemplateComposer {
final Composite content = this.pageService
.getWidgetFactory()
.defaultPageLayout(
pageContext.getParent(),
TITLE_TEXT_KEY);
pageContext.getParent(),
TITLE_TEXT_KEY);
final PageActionBuilder pageActionBuilder =
this.pageService.pageActionBuilder(pageContext.clearEntityKeys());
@ -142,19 +142,19 @@ public class InstitutionList implements TemplateComposer {
table::getSelection,
PageAction::applySingleSelectionAsEntityKey,
EMPTY_SELECTION_TEXT_KEY)
.publishIf(table::hasAnyContent, false)
.publish(false)
.newAction(ActionDefinition.INSTITUTION_MODIFY_FROM_LIST)
.withSelect(
table::getSelection,
PageAction::applySingleSelectionAsEntityKey,
EMPTY_SELECTION_TEXT_KEY)
.publishIf(() -> instGrant.m() && table.hasAnyContent(), false)
.publishIf(() -> instGrant.m(), false)
.newAction(ActionDefinition.INSTITUTION_TOGGLE_ACTIVITY)
.withExec(this.pageService.activationToggleActionFunction(table, EMPTY_SELECTION_TEXT_KEY))
.withConfirm(this.pageService.confirmDeactivation(table))
.publishIf(() -> instGrant.m() && table.hasAnyContent(), false);
.publishIf(() -> instGrant.m(), false);
}
}

View file

@ -169,13 +169,13 @@ public class LmsSetupList implements TemplateComposer {
.newAction(ActionDefinition.LMS_SETUP_VIEW_FROM_LIST)
.withSelect(table::getSelection, PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY)
.publishIf(table::hasAnyContent, false)
.publish(false)
.newAction(ActionDefinition.LMS_SETUP_MODIFY_FROM_LIST)
.withSelect(
table.getGrantedSelection(currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY)
.publishIf(() -> userGrant.im() && table.hasAnyContent(), false)
.publishIf(() -> userGrant.im(), false)
.newAction(ActionDefinition.LMS_SETUP_TOGGLE_ACTIVITY)
.withSelect(
@ -186,7 +186,7 @@ public class LmsSetupList implements TemplateComposer {
action -> LmsSetupForm.testLmsSetup(action, null, restService)),
EMPTY_SELECTION_TEXT_KEY)
.withConfirm(this.pageService.confirmDeactivation(table))
.publishIf(() -> userGrant.iw() && table.hasAnyContent(), false);
.publishIf(() -> userGrant.iw(), false);
}

View file

@ -235,7 +235,7 @@ public class QuizLookupList implements TemplateComposer {
institutionNameFunction),
EMPTY_SELECTION_TEXT)
.noEventPropagation()
.publishIf(table::hasAnyContent, false)
.publish(false)
.newAction(ActionDefinition.QUIZ_DISCOVERY_EXAM_IMPORT)
.withConfirm(importQuizConfirm(table, restService))
@ -243,7 +243,7 @@ public class QuizLookupList implements TemplateComposer {
table.getGrantedSelection(currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
action -> this.importQuizData(action, table),
EMPTY_SELECTION_TEXT)
.publishIf(() -> examGrant.im() && table.hasAnyContent(), false);
.publishIf(() -> examGrant.im(), false);
}
private static Function<QuizData, String> quizDataLmsSetupNameFunction(final ResourceService resourceService) {

View file

@ -172,13 +172,13 @@ public class SEBClientConfigList implements TemplateComposer {
.newAction(ActionDefinition.SEB_CLIENT_CONFIG_VIEW_FROM_LIST)
.withSelect(table::getSelection, PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY)
.publishIf(table::hasAnyContent, false)
.publish(false)
.newAction(ActionDefinition.SEB_CLIENT_CONFIG_MODIFY_FROM_LIST)
.withSelect(
table.getGrantedSelection(this.currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY)
.publishIf(() -> clientConfigGrant.im() && table.hasAnyContent(), false)
.publishIf(() -> clientConfigGrant.im(), false)
.newAction(ActionDefinition.SEB_CLIENT_CONFIG_TOGGLE_ACTIVITY)
.withSelect(
@ -186,7 +186,7 @@ public class SEBClientConfigList implements TemplateComposer {
this.pageService.activationToggleActionFunction(table, EMPTY_SELECTION_TEXT_KEY),
EMPTY_SELECTION_TEXT_KEY)
.withConfirm(this.pageService.confirmDeactivation(table))
.publishIf(() -> clientConfigGrant.im() && table.hasAnyContent(), false);
.publishIf(() -> clientConfigGrant.im(), false);
}

View file

@ -185,7 +185,7 @@ public class SEBClientLogs implements TemplateComposer {
action -> this.sebClientLogDetailsPopup.showDetails(action, table.getSingleSelectedROWData()),
EMPTY_SELECTION_TEXT)
.noEventPropagation()
.publishIf(table::hasAnyContent, false);
.publish(false);
}
private Function<ExtendedClientEvent, String> examNameFunction() {

View file

@ -336,7 +336,7 @@ public class SEBExamConfigForm implements TemplateComposer {
return pageAction.withEntityKey(
new EntityKey(selectedExamMapping.examId, EntityType.EXAM));
})
.publishIf(table::hasAnyContent, false);
.publish(false);
}
}

View file

@ -161,13 +161,13 @@ public class SEBExamConfigList implements TemplateComposer {
.newAction(ActionDefinition.SEB_EXAM_CONFIG_VIEW_PROP_FROM_LIST)
.withSelect(configTable::getSelection, PageAction::applySingleSelectionAsEntityKey,
EMPTY_SELECTION_TEXT_KEY)
.publishIf(configTable::hasAnyContent, false)
.publish(false)
.newAction(ActionDefinition.SEB_EXAM_CONFIG_MODIFY_PROP_FROM_LIST)
.withSelect(
configTable.getGrantedSelection(this.currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY)
.publishIf(() -> examConfigGrant.im() && configTable.hasAnyContent(), false)
.publishIf(() -> examConfigGrant.im(), false)
.newAction(ActionDefinition.SEB_EXAM_CONFIG_IMPORT_TO_NEW_CONFIG)
.withSelect(

View file

@ -223,16 +223,16 @@ public class UserAccountList implements TemplateComposer {
.newAction(ActionDefinition.USER_ACCOUNT_VIEW_FROM_LIST)
.withSelect(table::getSelection, PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY)
.publishIf(table::hasAnyContent, false)
.publish(false)
.newAction(ActionDefinition.USER_ACCOUNT_MODIFY_FROM_LIST)
.withSelect(table::getSelection, this::editAction, EMPTY_SELECTION_TEXT_KEY)
.publishIf(() -> userGrant.im() && table.hasAnyContent(), false)
.publishIf(() -> userGrant.im(), false)
.newAction(ActionDefinition.USER_ACCOUNT_TOGGLE_ACTIVITY)
.withExec(this.pageService.activationToggleActionFunction(table, EMPTY_SELECTION_TEXT_KEY))
.withConfirm(this.pageService.confirmDeactivation(table))
.publishIf(() -> userGrant.m() && table.hasAnyContent(), false);
.publishIf(() -> userGrant.m(), false);
}
private PageAction editAction(final PageAction pageAction) {

View file

@ -216,7 +216,7 @@ public class UserActivityLogs implements TemplateComposer {
action -> this.showDetails(action, table.getSingleSelectedROWData()),
EMPTY_SELECTION_TEXT)
.noEventPropagation()
.publishIf(table::hasAnyContent, false);
.publish(false);
}