3

I have been working through the Aikau tutorials on Github but can't work out how to create a list that I can pass on to a view. The requirement is to select all workflow tasks for all users and display the results.

I have added the following widgets which displays the details of one users(hard coded), but I need to cycle through all the users and display all workflows.

model.jsonModel = {
   services: [
      "alfresco/services/CrudService"
   ],
   widgets:[
      {
         name: "alfresco/lists/AlfSortablePaginatedList",
         config: {
            loadDataPublishTopic: "ALF_CRUD_GET_ALL",
            loadDataPublishPayload: {
              url: "api/task-instances?authority=abeecher"
            },
            itemsProperty: "data",
            widgets: [
              {
                name: "alfresco/lists/views/AlfListView",
                config: {
                  additionalCssClasses: "bordered",
                  widgetsForHeader: [
                     {
                        name: "alfresco/lists/views/layouts/HeaderCell",
                        config: {
                           label: "Workflow ID",
                           sortable: true,
                           sortValue: "id"
                        }
                     },
                     {
                        name: "alfresco/lists/views/layouts/HeaderCell",
                        config: {
                           label: "Description"
                        }
                     },
                     {
                        name: "alfresco/lists/views/layouts/HeaderCell",
                        config: {
                           label: "Status"
                        }
                     },
                     {
                        name: "alfresco/lists/views/layouts/HeaderCell",
                        config: {
                           label: "Due Date",
                           sortable: true,
                           sortValue: "properties.bpm_dueDate"
                        }
                     },
                     {
                        name: "alfresco/lists/views/layouts/HeaderCell",
                        config: {
                           label: "Created By"
                        }
                     },
                     {
                        name: "alfresco/lists/views/layouts/HeaderCell",
                        config: {
                           label: "Assigned To",
                           sortable: true,
                           sortValue: "owner.firstName"
                        }
                     },
                     {
                        name: "alfresco/lists/views/layouts/HeaderCell",
                        config: {
                           label: "Tag1"
                        }
                     },
                     {
                        name: "alfresco/lists/views/layouts/HeaderCell",
                        config: {
                           label: "Tag2"
                        }
                     },
                     {
                        name: "alfresco/lists/views/layouts/HeaderCell",
                        config: {
                           label: "Tag3"
                        }
                     }
                  ],
                  widgets: [
                    {
                      name: "alfresco/lists/views/layouts/Row",
                      config: {
                        widgets: [
                          {
                            name: "alfresco/lists/views/layouts/Cell",
                            config: {
                              additionalCssClasses: "mediumpad",
                              widgets: [
                                {
                                  name: "alfresco/renderers/Property",
                                  config: {
                                    propertyToRender: "id",
                                  }
                                }
                              ]
                            }
                          },
                          {
                            name: "alfresco/lists/views/layouts/Cell",
                            config: {
                              widgets: [
                                {
                                  name: "alfresco/renderers/Property",
                                  config: {
                                    propertyToRender: "workflowInstance.message",
                                  }
                                }
                              ]
                            }
                          },
                          {
                            name: "alfresco/lists/views/layouts/Cell",
                            config: {
                              widgets: [
                                {
                                  name: "alfresco/renderers/Property",
                                  config: {
                                    propertyToRender: "state",
                                  }
                                }
                              ]
                            }
                          },
                          {
                            name: "alfresco/lists/views/layouts/Cell",
                            config: {
                              widgets: [
                                {
                                  name: "alfresco/renderers/Property",
                                  config: {
                                    propertyToRender: "properties.bpm_dueDate",
                                  }
                                }
                              ]
                            }
                          },
                          {
                            name: "alfresco/lists/views/layouts/Cell",
                            config: {
                              widgets: [
                                {
                                  name: "alfresco/renderers/Property",
                                  config: {
                                    propertyToRender: "workflowInstance.initiator.firstName" ,
                                  }
                                }
                              ]
                            }
                          },
                          {
                            name: "alfresco/lists/views/layouts/Cell",
                            config: {
                              widgets: [
                                {
                                  name: "alfresco/renderers/Property",
                                  config: {
                                    propertyToRender: "owner.firstName",
                                  }
                                }
                              ]
                            }
                          },
                        ]
                      }
                    }
                  ]
                }
              }
            ]
         }
      }
   ]
};

The final solution will require the ability to sort the columns and be able to click on a task to see the underlying workflow. What would be the best way to create the initial list based on these requirements?

If I was to write a widget that did the building of the list, how do I couple the widget to the form? Is this a pub/sub solution since the user is not clicking on anything - just loading the page?

I assume that I would need to write custom a webscript if I use the "url" keyword under the loadDataPublishPayload option? If I did write a webscript, what would be the final statement to return the json data to the form?

I just need some guidance on the best way forward.

user1398017
  • 149
  • 1
  • 1
  • 4

1 Answers1

1

At the time of writing, using the latest released version of Aikau (1.0.83) it is not possible to do this using out-of-the-box widgets and services.

The main problem is that there is no full mapping between Aikau and the Share XML based forms runtime. This blog post explains the issue at hand. It is however something that we're working on.

Once the "alfresco/services/FormsRuntimeService" is complete this will be an easier exercise to complete. There would be no need to write additional widgets for the lists because the existing list widgets handle all the requirements for sorting/pagination (if the underlying REST API supports sorting and pagination!).

I guess your best way forward is very dependent upon how quickly require this solution. We're making progress with the FormsRuntimeService, but I can't say when it will be fully ready.

The existing pages in Share that show tasks and workflow that do use the Share Forms Runtime rely on APIs that return HTML that is hard-coded to work with the Share YUI2 based widgets - it might be possible to achieve what you want to using the older Surf Component / YUI2 widget approach. That might be one other area to explore.

The main thing to do is to establish whether or not there are existing REST APIs that will meet you core requirements

Dave Draper
  • 1,837
  • 11
  • 25