Search in sources :

Example 51 with PageBase

use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.

the class ResourceContentPanel method deleteResourceObjectPerformed.

// TODO: as a task?
protected void deleteResourceObjectPerformed(ShadowType selected, AjaxRequestTarget target) {
    final List<ShadowType> selectedShadow = getSelectedShadowsList(selected);
    final OperationResult result = new OperationResult(OPERATION_DELETE_OBJECT);
    if (selectedShadow == null || selectedShadow.isEmpty()) {
        result.recordWarning(createStringResource("ResourceContentPanel.message.deleteResourceObjectPerformed.warning").getString());
        getPageBase().showResult(result);
        target.add(getPageBase().getFeedbackPanel());
        return;
    }
    ConfirmationPanel dialog = new DeleteConfirmationPanel(((PageBase) getPage()).getMainPopupBodyId(), createDeleteConfirmString(selected, "pageContentAccounts.message.deleteConfirmationSingle", "pageContentAccounts.message.deleteConfirmation")) {

        @Override
        public void yesPerformed(AjaxRequestTarget target) {
            deleteAccountConfirmedPerformed(target, result, selectedShadow);
        }
    };
    ((PageBase) getPage()).showMainPopup(dialog, target);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DeleteConfirmationPanel(com.evolveum.midpoint.web.component.dialog.DeleteConfirmationPanel) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ConfirmationPanel(com.evolveum.midpoint.web.component.dialog.ConfirmationPanel) DeleteConfirmationPanel(com.evolveum.midpoint.web.component.dialog.DeleteConfirmationPanel) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Example 52 with PageBase

use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.

the class AbstractRoleMemberPanel method recomputeMembersPerformed.

protected void recomputeMembersPerformed(AjaxRequestTarget target) {
    StringResourceModel confirmModel;
    if (getSearchBoxConfiguration().isSearchScope(SearchBoxScopeType.SUBTREE)) {
        confirmModel = createStringResource("abstractRoleMemberPanel.recomputeAllSubtreeMembersConfirmationLabel");
    } else {
        confirmModel = getMemberTable().getSelectedObjectsCount() > 0 ? createStringResource("abstractRoleMemberPanel.recomputeSelectedMembersConfirmationLabel") : createStringResource("abstractRoleMemberPanel.recomputeAllMembersConfirmationLabel");
    }
    ConfigureTaskConfirmationPanel dialog = new ConfigureTaskConfirmationPanel(((PageBase) getPage()).getMainPopupBodyId(), confirmModel) {

        private static final long serialVersionUID = 1L;

        @Override
        protected PrismObject<TaskType> getTask(AjaxRequestTarget target) {
            Task task = MemberOperationsHelperOld.createRecomputeMembersTask(getModelObject(), getPageBase(), getQueryScope(), getActionQuery(getQueryScope(), getRelationsForRecomputeTask()), target);
            if (task == null) {
                return null;
            }
            PrismObject<TaskType> recomputeTask = task.getRawTaskObjectClone();
            TaskType recomputeTaskType = recomputeTask.asObjectable();
            recomputeTaskType.getAssignment().add(ObjectTypeUtil.createAssignmentTo(SystemObjectsType.ARCHETYPE_RECOMPUTATION_TASK.value(), ObjectTypes.ARCHETYPE, getPrismContext()));
            return recomputeTask;
        }

        @Override
        public StringResourceModel getTitle() {
            return createStringResource("pageUsers.message.confirmActionPopupTitle");
        }

        @Override
        public void yesPerformed(AjaxRequestTarget target) {
            MemberOperationsHelperOld.recomputeMembersPerformed(getModelObject(), getPageBase(), getQueryScope(), getActionQuery(getQueryScope(), getRelationsForRecomputeTask()), target);
        }
    };
    ((PageBase) getPage()).showMainPopup(dialog, target);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Task(com.evolveum.midpoint.task.api.Task) ConfigureTaskConfirmationPanel(com.evolveum.midpoint.web.component.dialog.ConfigureTaskConfirmationPanel) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 53 with PageBase

use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.

the class PageConnectorHosts method discoveryRemotePerformed.

private void discoveryRemotePerformed(AjaxRequestTarget target) {
    target.add(getFeedbackPanel());
    PageBase page = (PageBase) getPage();
    Task task = page.createSimpleTask(OPERATION_CONNECTOR_DISCOVERY);
    OperationResult result = task.getResult();
    List<ConnectorHostType> selected = getObjectListPanel().getSelectedRealObjects();
    if (selected.isEmpty()) {
        warn(getString("pageResources.message.noHostSelected"));
        return;
    }
    for (ConnectorHostType host : selected) {
        try {
            getModelService().discoverConnectors(host, task, result);
        } catch (Exception ex) {
            result.recordFatalError(createStringResource("PageConnectorHosts.message.discoveryRemotePerformed.fatalError", host.getHostname(), host.getPort()).getString(), ex);
        }
    }
    result.recomputeStatus();
    showResult(result);
}
Also used : ConnectorHostType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Example 54 with PageBase

use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method taskDetailsPerformed.

private void taskDetailsPerformed(AjaxRequestTarget target, String taskOid) {
    PageParameters parameters = new PageParameters();
    parameters.add(OnePageParameterEncoder.PARAMETER, taskOid);
    ((PageBase) getPage()).navigateToNext(PageTask.class, parameters);
}
Also used : PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Example 55 with PageBase

use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.

the class ProgressPanel method addRefreshingProgressPanel.

// mess
public void addRefreshingProgressPanel() {
    if (refreshingBehavior != null) {
        return;
    }
    ProgressReporter reporter = reporterModel.getProcessData();
    int refreshInterval = reporter.getRefreshInterval();
    refreshingBehavior = new AjaxSelfUpdatingTimerBehavior(java.time.Duration.ofMillis(refreshInterval)) {

        @Override
        protected void onPostProcessTarget(AjaxRequestTarget target) {
            invalidateCache();
            ProgressReporter reporter = reporterModel.getProcessData();
            OperationResult asyncOperationResult = reporter.getAsyncOperationResult();
            if (asyncOperationResult != null) {
                // by checking this we know that async operation has been finished
                // because we set it to in-progress
                asyncOperationResult.recomputeStatus();
                PageBase page = getPageBase();
                if (reporter.isAbortRequested()) {
                    page.showResult(asyncOperationResult);
                    target.add(page.getFeedbackPanel());
                    return;
                }
                progressAwarePage.finishProcessing(target, true, asyncOperationResult);
                stopRefreshingProgressPanel(target);
                reporter.setAsyncOperationResult(null);
            }
        }

        @Override
        public boolean isEnabled(Component component) {
            return component != null;
        }
    };
    add(refreshingBehavior);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceOperationResult(com.evolveum.midpoint.web.component.progress.ProgressReportActivityDto.ResourceOperationResult) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) Component(org.apache.wicket.Component) AjaxSelfUpdatingTimerBehavior(org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior)

Aggregations

PageBase (com.evolveum.midpoint.gui.api.page.PageBase)82 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)30 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)25 Task (com.evolveum.midpoint.task.api.Task)16 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)13 IModel (org.apache.wicket.model.IModel)12 Label (org.apache.wicket.markup.html.basic.Label)11 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)9 ArrayList (java.util.ArrayList)9 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)9 List (java.util.List)8 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)7 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)6 RestartResponseException (org.apache.wicket.RestartResponseException)6 StringResourceModel (org.apache.wicket.model.StringResourceModel)6 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)5 PrismObject (com.evolveum.midpoint.prism.PrismObject)5 ConfirmationPanel (com.evolveum.midpoint.web.component.dialog.ConfirmationPanel)5 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)5 QName (javax.xml.namespace.QName)5