Search in sources :

Example 1 with TasksStorage

use of com.evolveum.midpoint.web.session.TasksStorage in project midpoint by Evolveum.

the class PageTasks method searchFilterPerformed.

private void searchFilterPerformed(AjaxRequestTarget target) {
    TasksSearchDto dto = searchModel.getObject();
    //        ObjectQuery query = createTaskQuery(dto.getStatus(), dto.getCategory(), dto.isShowSubtasks());
    ObjectQuery query = createTaskQuery();
    Table panel = getTaskTable();
    DataTable table = panel.getDataTable();
    TaskDtoProvider provider = (TaskDtoProvider) table.getDataProvider();
    provider.setQuery(query);
    table.setCurrentPage(0);
    TasksStorage storage = getSessionStorage().getTasks();
    storage.setTasksSearch(dto);
    target.add(getFeedbackPanel());
    target.add((Component) getTaskTable());
}
Also used : DataTable(org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable) Table(com.evolveum.midpoint.web.component.data.Table) DataTable(org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable) TasksStorage(com.evolveum.midpoint.web.session.TasksStorage)

Example 2 with TasksStorage

use of com.evolveum.midpoint.web.session.TasksStorage in project midpoint by Evolveum.

the class PageTasks method clearSearchPerformed.

private void clearSearchPerformed(AjaxRequestTarget target) {
    TasksSearchDto tasksSearchDto = new TasksSearchDto();
    tasksSearchDto.setCategory(ALL_CATEGORIES);
    tasksSearchDto.setStatus(TaskDtoExecutionStatusFilter.ALL);
    searchModel.setObject(tasksSearchDto);
    Table panel = getTaskTable();
    DataTable table = panel.getDataTable();
    TaskDtoProvider provider = (TaskDtoProvider) table.getDataProvider();
    provider.setQuery(null);
    TasksStorage storage = getSessionStorage().getTasks();
    storage.setTasksSearch(searchModel.getObject());
    panel.setCurrentPage(storage.getPaging());
    target.add((Component) panel);
}
Also used : DataTable(org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable) Table(com.evolveum.midpoint.web.component.data.Table) DataTable(org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable) TasksStorage(com.evolveum.midpoint.web.session.TasksStorage)

Example 3 with TasksStorage

use of com.evolveum.midpoint.web.session.TasksStorage in project midpoint by Evolveum.

the class PageTasks method loadTasksSearchDto.

private TasksSearchDto loadTasksSearchDto() {
    TasksStorage storage = getSessionStorage().getTasks();
    TasksSearchDto dto = storage.getTasksSearch();
    if (dto == null) {
        dto = new TasksSearchDto();
        dto.setShowSubtasks(false);
    }
    if (getPageParameters() != null) {
        StringValue category = getPageParameters().get(SELECTED_CATEGORY);
        if (category != null && category.toString() != null && !category.toString().isEmpty()) {
            dto.setCategory(category.toString());
        }
    }
    if (dto.getStatus() == null) {
        dto.setStatus(TaskDtoExecutionStatusFilter.ALL);
    }
    return dto;
}
Also used : TasksStorage(com.evolveum.midpoint.web.session.TasksStorage) StringValue(org.apache.wicket.util.string.StringValue)

Example 4 with TasksStorage

use of com.evolveum.midpoint.web.session.TasksStorage in project midpoint by Evolveum.

the class PageTasks method initLayout.

private void initLayout() {
    refreshPanel = new AutoRefreshPanel(ID_REFRESH_PANEL, refreshModel, this, false);
    add(refreshPanel);
    Form mainForm = new Form(ID_MAIN_FORM);
    add(mainForm);
    List<IColumn<TaskDto, String>> taskColumns = initTaskColumns();
    TaskDtoProviderOptions options = TaskDtoProviderOptions.minimalOptions();
    options.setGetNextRunStartTime(true);
    options.setUseClusterInformation(true);
    options.setResolveObjectRef(true);
    TaskDtoProvider provider = new TaskDtoProvider(PageTasks.this, options) {

        @Override
        protected void saveProviderPaging(ObjectQuery query, ObjectPaging paging) {
            TasksStorage storage = getSessionStorage().getTasks();
            storage.setPaging(paging);
        }

        @Override
        public TaskDto createTaskDto(PrismObject<TaskType> task, Task opTask, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException {
            TaskDto dto = super.createTaskDto(task, opTask, result);
            addInlineMenuToTaskRow(dto);
            return dto;
        }
    };
    provider.setQuery(createTaskQuery());
    BoxedTablePanel<TaskDto> taskTable = new BoxedTablePanel(ID_TASK_TABLE, provider, taskColumns, UserProfileStorage.TableId.PAGE_TASKS_PANEL, (int) getItemsPerPage(UserProfileStorage.TableId.PAGE_TASKS_PANEL)) {

        @Override
        protected WebMarkupContainer createHeader(String headerId) {
            return new SearchFragment(headerId, ID_TABLE_HEADER, PageTasks.this, searchModel);
        }

        @Override
        protected WebMarkupContainer createButtonToolbar(String id) {
            String fileName = "TaskType_" + createStringResource("MainObjectListPanel.exportFileName").getString();
            CSVDataExporter csvDataExporter = new CSVDataExporter();
            ResourceStreamResource resource = (new ResourceStreamResource() {

                protected IResourceStream getResourceStream() {
                    return new ExportToolbar.DataExportResourceStreamWriter(csvDataExporter, getTaskTable().getDataTable());
                }
            }).setFileName(fileName + "." + csvDataExporter.getFileNameExtension());
            AbstractLink exportDataLink = (new ResourceLink(id, resource)).setBody(csvDataExporter.getDataFormatNameModel());
            exportDataLink.add(new AttributeAppender("class", " btn btn-primary btn-sm"));
            return exportDataLink;
        }
    };
    taskTable.setOutputMarkupId(true);
    TasksStorage storage = getSessionStorage().getTasks();
    taskTable.setCurrentPage(storage.getPaging());
    mainForm.add(taskTable);
    List<IColumn<NodeDto, String>> nodeColumns = initNodeColumns();
    BoxedTablePanel nodeTable = new BoxedTablePanel(ID_NODE_TABLE, new NodeDtoProvider(PageTasks.this) {

        @Override
        public NodeDto createNodeDto(PrismObject<NodeType> node) {
            NodeDto dto = super.createNodeDto(node);
            addInlineMenuToNodeRow(dto);
            return dto;
        }
    }, nodeColumns, UserProfileStorage.TableId.PAGE_TASKS_NODES_PANEL, (int) getItemsPerPage(UserProfileStorage.TableId.PAGE_TASKS_NODES_PANEL));
    nodeTable.setOutputMarkupId(true);
    nodeTable.setShowPaging(false);
    mainForm.add(nodeTable);
    initDiagnosticButtons();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) CSVDataExporter(org.apache.wicket.extensions.markup.html.repeater.data.table.export.CSVDataExporter) Form(org.apache.wicket.markup.html.form.Form) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PrismObject(com.evolveum.midpoint.prism.PrismObject) ResourceStreamResource(org.apache.wicket.request.resource.ResourceStreamResource) AutoRefreshPanel(com.evolveum.midpoint.web.component.refresh.AutoRefreshPanel) ResourceLink(org.apache.wicket.markup.html.link.ResourceLink) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) AttributeAppender(org.apache.wicket.behavior.AttributeAppender) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) TasksStorage(com.evolveum.midpoint.web.session.TasksStorage) AbstractLink(org.apache.wicket.markup.html.link.AbstractLink)

Aggregations

TasksStorage (com.evolveum.midpoint.web.session.TasksStorage)4 Table (com.evolveum.midpoint.web.component.data.Table)2 DataTable (org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable)2 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Task (com.evolveum.midpoint.task.api.Task)1 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)1 AutoRefreshPanel (com.evolveum.midpoint.web.component.refresh.AutoRefreshPanel)1 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)1 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)1 CSVDataExporter (org.apache.wicket.extensions.markup.html.repeater.data.table.export.CSVDataExporter)1 Form (org.apache.wicket.markup.html.form.Form)1 AbstractLink (org.apache.wicket.markup.html.link.AbstractLink)1 ResourceLink (org.apache.wicket.markup.html.link.ResourceLink)1 ResourceStreamResource (org.apache.wicket.request.resource.ResourceStreamResource)1 StringValue (org.apache.wicket.util.string.StringValue)1