Commit Graph

10 Commits

Author SHA1 Message Date
Timur Sufiev f605ff7b8c Refactor templates to make them composable
The main goal of this change is to free the potential Merlin users
from the burden of writing their custom templates when it just
involves combining widgets into different levels of nesting. Writing
custom templates still remains obligatory when some additional
controls/rendering (not provided with built-in widgets) is needed,
e.g. YAQLField.

To ease the pain of laying out the DOM snippets not known in advance I
switched from conventional Bootstrap Grid system to the Flexgrid
package which reimplements Bootstrap Grid over CSS3 Flexbox module. It
provides all the existing grid features w/o the need to cancel
floating effects with div.clearfix and adds pretty vertical/horizontal
aligning options which are very useful in Merlin.

Besides templates refactoring the filters system was also
rewritten. Filter extractPanels() now accepts one required argument,
keyExtractor function which is used to calculate a numeric values for
every field of Barricade object recursively. The fields with the same
numeric values go to the same panel, so we could define the logic of
panel extraction separately for each application built on Merlin. For
the filters following on the pipeline extractPanels() provides .each()
method, which they should use for enumeration over the panel
contents. This way the panel implements the same interface as every
other Barricade container does.

Old extractRows() and extractItems() filters are removed, as well as
the necessity to embed positioning hints into the model. As of now
precise fields ordering is lost, but will be reimplemented with an
extractFields() upgrade (ability to pass a list of field keys is yet
to come, as well as the removal of 'index' hints).

Implements blueprint: composable-templates
Implements blueprint: decouple-ui-hints-and-models

Change-Id: I73f480034730099b33afec88cddf919a7bfc441b
2015-07-30 12:06:01 +03:00
Timur Sufiev d82d48453f Add Mistral js files to linter and fix linting errors
As a consequence, change how the workbookCtrl controller is used (and
unit-tests for it).

Change-Id: I21514ac01baa81c5a760abd9e7d0f909d89617d6
2015-07-13 15:05:58 +03:00
Timur Sufiev 7ccf4f0dd3 Rewrite WB Action->Base to use @ref facility
Now all standard actions are put into top-level
Barricade object in WB controller and then Base field
just fetches id-s from them (and we use them same 
standardActions top-level property for resetting a 
'Base Input' field with a list of keys corresponding 
to a specific standardAction.

Also new unit-tests (for filters and for dictionary
Merlin model) are added.

Change-Id: Ieb6e9330db8fbeb83e4f0f2a64611e1b6b31006c
Closes-Bug: #1467511
2015-06-26 16:08:24 +00:00
Timur Sufiev d9f94958c2 Add stub api calls for Mistral server integration
Store the workbooks being edited inside sqlite database of Horizon
django app. Now it's possible to:
* create a workbook;
* see it in the list of workbooks;
* edit it;
* delete it.

To use the models.py DATABASES variable in openstack_dashboard
settings needs to be set at least to sqlite3.

Change-Id: I9d4c013470e0fc13ef65484c8f6fae69cdad0a05
Implements: blueprint mistral-server-integration
2015-04-30 21:29:27 +03:00
Timur Sufiev 531dc56c64 Fix changing Action/Workflow/Task id
To make it happen <collapsible-group> directive had to undergo the
same transformation that was applied to <panel> directive: instead of
passing just a '@title' reference, the whole '=content' reference is
now passed to the <collapsible-group>'s scope. This allows to use
<editable> directive inside it with 'ng-model=group.title' as
getter/setter method. Yet <collapsible-group>'s scope wasn't remade as
radically as <panel>'s was - '&on-add' and '&on-remove' are still
there and left for future refactoring.

Change-Id: I4de7a542f282efee6deb34d4957a5873d617ad64
Closes-Bug: #1446171
Closes-Bug: #1446226
2015-04-28 21:05:32 +03:00
Timur Sufiev 0b92f674a4 Enable changing Task structure
Provide unit-tests for verifying that Task structure depends both on
parent Workflow type and on Task type.

This commits also depends on a change made to Barricade.js library:
now it passes the parameters of a parent container to the children
containers, which add new elements to it via prototype inheritance.

Closes-Bug: #1446230
Implements: blueprint merlin-unittests
Change-Id: Ic4c0539297d6df9a0b1450a824eeca4749455cfd
2015-04-23 21:37:42 +03:00
Timur Sufiev 5014b8de58 Enable the Workflow structure change on changing its type
To enable this fix, a massive refactoring to panel/row/item - i.e.,
the 'view' mixins - was done. Now these mixins are implemented as
filters, which has the following benefits:
 * once the underlying Barricade model changes, the following change is
 immediately propagated to the view (input events are no longer
 catched by some obsolete piece of model just because view is not
 updated and is still sending events to an old model);
 * at the same time the filter results are memoized (with the
 appropriate function from underscore.js) so not infinite $digest
 looping happens, with the Barricade objects' string hash being used
 as a parts of a composite caching key.

Also change .toJSON() usage in Mistral models to .toJSON({pretty: true})
usage to not interfere with deserializing JSON blobs when we need to
recreate a Barricade object from JSON blob.

Provide a foundation of a suite of filters unit-tests - just a list of
specs being verified with an actual code to be written later.

Closes-Bug: #1436409
Change-Id: I7af36abbdcfab70a6b867c39e49420d1716c1310
2015-04-22 14:24:39 +03:00
Timur Sufiev 1454a2792d Move out Merlin and Mistral code into separate modules
Unit-testing would be easier this way.

Also clean up some remaining bits of previous version of
Mistral Workbook builder.

Implements blueprint: merlin-unittests
Change-Id: Ie82a5fd19fcd5e98d7c9d2321a9a8c93495af07f
2015-03-31 07:43:55 -07:00
Timur Sufiev 5a138fe066 Remove hard-coded sample Workflow panel
Among other things are:
* finally port yaqllist field to new models
* support YAML dynamic updates

Change-Id: I109e2d4ae50ebf5cf60dd838ec074740d64360a9
2015-03-03 17:21:27 +03:00
Timur Sufiev fc14e3c993 Take data for Angular.js from Barricade.js object
Along with this perform major code cleanup and change directory
structure.

Change-Id: I1736ded46ab5b9b635acce7e938a803001884393
2015-02-26 14:41:04 -08:00