Workplace - An MLJS application without coding
One I created a whole bunch of widgets with test pages that you could mix together on a page there was an obvious next step. I knew that I had applied the same rendering pattern across all widgets, and knew I wanted to implement a setConfiguration() method to pass JSON configuration consistently to complex widgets.
One of my first jobs after graduation was developing for a Java Portal. Also, something I missed from my first pre-sales job was configuring widgets someone else had developed within a page to create an end user 'workplace' with all of their information at their finger tips.
Having this configurable within the web browser via point and click, with a page for 'editing' widget settings, and another for 'viewing' the widget is a core tenet behind J2EE portlet containers.
I wanted to bring the same functionality to MLJS but without a large infrastructure on the server. I decided I could use my standard widget configuration pattern to define concepts of a 'page' with a 'layout', and assign widgets to particular areas of that layout.
Thus the concept of a configurable Workplace was born... A page with a single configured widget (The Workplace) that either loads the page configuration from the server based on the current URL, or provides an 'edit' button to allow the users themselves to drag and drop a palette of widgets on to the page.
Download the app!
This is deployed locally, not on MarkLogic, allowing for blazing fast loading of a web app. This uses the MLJS WebServer Node.js application.
To get started, download the app-workplace.tar.gz file from the dist folder of the MLJS GitHub repo. This contains a simple README file with the procedure for getting up and running.
Alternative: Manual Configuration
A page, its widgets, contexts and onload actions can be configured within a straightforward and consistent JSON structure. Below is an example of that configuration for a search page with searchbar, chart, results and facets all shown:-
This may look complicated, but when you consider this is setting up an entire page with 4 widgets, 1 layout, 1 context, and an initial search action on page load, it's actually pretty straightforward.
Also, the ultimate aim is for this JSON to be created visually via drag and drop, not in code as in the above example. This JSON would be stored on MarkLogic server and loaded based on the URL of the page (as you can see on the first line with /mljstest/workplace).