Commit Graph

49 Commits

Author SHA1 Message Date
Timur Sufiev d6e2842979 Remove 'type' attribute from <typed-field>
... because it's excessive and can be calculated from 'value' attribute.

Change-Id: Id56024027ee455518619f1ee846d0b0735d5210d
2015-08-05 10:12:42 +00:00
Timur Sufiev c25b7d8507 Use standard modelMixin instead of fields.wildcard
Call it fields.generic in exports - it has the same meaning for merlin
code (any field that Merlin provides), less code the better.

Change-Id: Id2eb8fbfa477c014f6e6eebdd9fb0e4298bb029c
2015-08-05 10:12:31 +00:00
Timur Sufiev b9e6ccb3ea Initial import of data schema from Rackspace HotBuilder
Change-Id: I9375ded596250634a139a11291ef2be1190904d6
2015-08-05 10:12:11 +00:00
Timur Sufiev 7fc50585be Start developing HOT Builder on Merlin
Create basic file structure and use common Django template for both
views. Also rework forms/YAML/Graph divs layout to make it more flexible.

Create draft version of 'Add Resource' panel for HotBuilder - with
resources filtering and a list of all available resources obtained
from server-side Heat API.

Change-Id: Ia2e4f8a63d85d8d5dd7cdd731cc4878836176070
2015-08-05 10:12:03 +00:00
Jenkins 5ee471c930 Merge "Add patched version of angular-ui bootstrap lib" 2015-07-31 14:51:31 +00:00
Paul Karikh 56b360126a Add patched version of angular-ui bootstrap lib
This patch adds patched version of angular-ui/bootstrap lib.
We need to patch it because of typeahead - one of bootstrap
components. This component does not support
ngModelOptions="{getterSetter: true}", which we need for
barricade.js integration.
Angular-ui/bootstrap upstream bug:
https://github.com/angular-ui/bootstrap/issues/3823
Until this bug is not fixed in upstream version,
we need to use this patched version of library.

Change-Id: I30a5d52d3a638fa2d7ca110d8824682c3d205611
2015-07-31 15:44:26 +03:00
Timur Sufiev 7021718ab2 Rewrite <labeled> directive to render editable labels
Common part of <labeled>, <panel> and <collapsible-group> is moved to
a separate <editable-title> directive.

Implements blueprint: composable-templates

Change-Id: If5f8da39aad0f4f3195e9af18e384de9f3ed2d75
2015-07-30 12:06:01 +03:00
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 e17565a708 Change location of symlink to bower_components
Do so in order to use both js and css assets fetched with bower.

Change-Id: Id4a8fa8dc3cd0915b33ead24421c14155897939e
2015-07-22 12:51:52 +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 a4e2892dc0 Rename unit-test files from *Spec.js to *.spec.js
Change-Id: I6cc067733cd2d7ee5e6a66f5a74cc207513be620
2015-06-26 20:26:27 +03:00
Timur Sufiev a5c1c308cf Decouple @enum and drop-down widget
Provide a convenience fields.linkedcollection model to handle common
use-case of using @ref in a Mistral WB. Cover it with unit-tests as
well all scenarios of using fields.linkedcollection in MIstral WB.

Change-Id: I97a61262db4cc521b5c230667a49b99701318f3f
Closes-Bug: #1467514
2015-06-26 20:23:13 +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
Vlad Okhrimenko 9a65264c27 Field 'version' has to be string
Now 'version'-field is string

Change-Id: I3c1088cdd014e7ab531bbc0da47c51ab03757bec
Closes-bug: #1436396
2015-06-25 12:30:19 +03:00
Timur Sufiev bcc69f218d Restrict existing Action/Workflow to the existing ones
Pull the list of existing Workflows or Actions using the @ref facility
of Barricade.

Closes-bug: #1446228
Change-Id: I0d2dbbe2735104e86cc22507c5f66793294c5b0b
2015-06-16 17:17:47 +00:00
Timur Sufiev 30c615bf9b Remove explicit type from Task snippet in the YAML template
Change-Id: I467f505605e86de908915bf583a87269bbf528f6
Closes-Bug: #1449463
2015-06-12 10:39:07 -07:00
Timur Sufiev 2079195f7b Provide 'validatable-with' directive
Make it work together with validation machinery in Barricade and both
interact with standard classes in Angular. If the value is invalid
according to @constraints check, it's not propagated into the YAML
(still not true for the requred fields, has to be fixed on Barricade
side).

Change-Id: I22efce07b75aa2b55b65d3bfaab0d033fa1f0096
2015-06-03 20:00:39 +03: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 f219a63e21 Enable removing Tasks from a Workflow
Add .remove() method to every Task instance in a Workbook, what it
actually does is sending a messages to the parent container which does
the actual deletion.

Change-Id: I0ac70bef4c2c9f241b15eff9a94f3909b733b2ff
Closes-Bug: #1436387
2015-04-28 20:14:46 +03:00
Timur Sufiev 0efc6355f7 Rewrite <editable> directive
Instead of showing popup for the value being edited it now allows
editing the same value in-place, accompanied with 2 buttons - confirm
& reject the edit. Only when one of 2 these buttons is pressed (or
equivalend Enter/Esc keys are pressed) the value will be applied. The
<editable> directive could be used both for changing Action/Workflow
entity names, for changing dictionary and varlist keys.

Change-Id: I4e7e1c0fcaed71aa649b1c9925a9b53005ff9a2d
Closes-Bug: #1411649
2015-04-28 17:05:18 +03:00
Timur Sufiev 6fa8b92891 Refactor third-party libraries usage and clean up karma config
* handle js-yaml and underscore libraries with bower (use libraries
  downloaded with bower by sym-linking bower_components to libs dir in
  static);
* get rid of no longer used angular-filter;
* move libraries without official releases to custom-libs
* simplify file requirements in karma config.

Change-Id: Ie3d1d90c6f2ccc89c7cf91fe0d9dae4b2b88442f
2015-04-25 19:18:52 +00:00
Timur Sufiev e9e750ef4c Add unit-tests for merlin directives
To simplify templates serving the plugin karma-ng-html2js-preprocessor
has been added to Karma and project dependencies.

Change-Id: If947acd2e9d7e64838c31e406d04fa9c1c67c770
Implements: blueprint merlin-unittests
2015-04-25 11:00:39 -07: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 05f4f22b9e Implement auto-completion field in Merlin
Also provide first approach to changing dependent field on field
change according to schema received by $http AJAX call.

This commit includes updated angular-bootstrap code is well for the
typeahead plugin to work with ng-model-options="{getterSetter: true}"
option. The ideal solution here would be to create a pull-request to the
angular-bootstrap plugin repo at github, make it merged and then make
the new version to be used in Horizon (and eliminate the need to use the
customized version of angular-bootstrap plugin in Merlin).

Implements: blueprint angular-fields-dependencies
Change-Id: I2be49de07beb09f430a8a4ffe5a19552fbaeb81e
2015-04-22 16:49:52 +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 d231eabe2b Fix indentation in javascripts
Change-Id: I0cae945a302a4c3b0fa3aea74f46e27f0525afd9
2015-04-21 11:10:03 +00:00
Timur Sufiev 4bc01fe872 Fix the bug with asynchronous template loading
Due to each field template being loaded asynchronously it was possible
that some templates hadn't been put to the $templateCache by the time
they were requested from it for rendering a field directive. This lead
to some random field shown in the initial document not being rendered
at all. Fix this problem by using promises, effectively delaying the
field rendering until the moment the template is finally loaded. Using
promises also allows to not use $templateCache at all - the
templateContents are passed as resolve() method argument.

Also add 'ng-cloak' directive to the toplevel Workbook div to prevent
raw Angular template flickering during initial load.

Change-Id: I8a52b9730b52d4dd20400460137576713c081867
Closes-Bug: #1428730
2015-04-21 13:49:23 +03:00
Timur Sufiev c00a281adb Fix the Workbook schema to conform the one expected by Mistral
Override toJSON() method for some classes inside Workbook since it
makes things simpler.

Change-Id: Ia92597b3739e2e58e2e7d15c01bd143336c49e72
Closes-Bug: #1428768
2015-03-31 14:53:36 +00: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 f9bb5fa11a Remove outdated views, forms and urls from Mistral
Change-Id: I2bf9073e0bfcadc6cf2f309dfd8eaa4c1dcc01fb
2015-03-16 12:58:57 +03: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
Timur Sufiev 389af84bb4 Fix excessive 'plus' buttons for some group directives
The used approach is crude, but it works.

Change-Id: I19ffa2610f3f19a0b49b65892f940560b394c9d0
2015-01-28 17:39:23 +03:00
Timur Sufiev b922fad15b Move an entire workbook to schema
This is a preparation for integrating with Barricade.js

Change-Id: Iba9424ddc8337497d5bb8431c114b1b07902f6b8
2015-01-21 15:54:10 +03:00
Timur Sufiev b408d89815 Load angularjs dynamic templates in run() section
Change-Id: Ib0ae4618541a250941b4018cb0b9ffc966527a40
2015-01-09 04:59:07 -08:00
Timur Sufiev 06d312a8c1 Tie the Action layout to the actual data
Now the amount of each Action fields being rendered is decided both on
schema and actual action data.

Change-Id: Iabfb6c852a2e1f3f2dda139bf65cd5d7ecdc4f9d
2015-01-08 11:55:30 -08:00
Timur Sufiev 405b15f6f0 Get rid of idGenerator service
Use built-in $id value instead.

Change-Id: Ifed0b3a145a83d95bb129c335751d7fb954f98ea
2015-01-08 10:47:31 -08:00
Timur Sufiev 5b8f8dff14 Implement schema-driven Action layout rendering
Make use of repeat-ng `track by` clause to avoid unnecessary DOM
redraw by ng-repeat each time the scope changes.

Change-Id: I8e2513c5aeabd8ec4bbf72ed025bd3d5da08f94d
2015-01-08 09:59:17 -08:00
Timur Sufiev bd9220ac5a Make use of SASS mixins
Rewrite existing css rules for Merlin/Mistral, clear low-level layout
info from html (move it into mixins).

Change-Id: I573763c2f31de98214f15f43fc53086ac994479e
2014-12-29 16:45:43 -08:00
Timur Sufiev add6df5ef7 Replace collapsible groups boilerplate html with angular directive
Change-Id: Id47d0ea3dfc466187a14b7da423004f24795826d
2014-12-29 10:07:10 -08:00
Timur Sufiev eb55cfaf87 Replace collapsible panels with angular directive
Change-Id: Ib27adf29574260666421461ff45959d65cabe901
2014-12-29 09:01:05 -08:00
Timur Sufiev 525477601b Replace combined field (YF + AF) with angular directive
Change-Id: Ie8ba632c1bb6a9a47c427c92aa620b7dd7c28485
2014-12-29 07:31:08 -08:00
Timur Sufiev b5cecf04b6 Rewrite edit popup as angular directive
Change-Id: Ie554889f757741c33f5e8d5ef80cfdaa613f360a
2014-12-29 06:43:10 -08:00
Timur Sufiev 00e5cb0036 Change how the YAQL fields are displayed
Change-Id: I2c311bd0822232ce237f7bf9e052786d955de269
2014-12-23 16:18:39 -08:00
Timur Sufiev caa4d0d2c0 Prepare layout snippets for Workflows section
Change-Id: I89a607b5a1730c6f860fdb2929cdd60165e9030b
2014-12-23 14:14:26 -08:00
Timur Sufiev eef5d1c4e4 Prepare layout snippets for Actions section
Change-Id: I6e8a94ca80300b1553a735004eebb1840977edbd
2014-12-23 11:34:34 -08:00
Timur Sufiev 4801a01b93 Improve Add Workbook Horizon UX
Show table with all created workbooks (currently stored in memory
stub), add 'Add Workbook', 'Edit Workbook' and 'Delete Workbook'
actions. Creating/ editing workbook is implemented as modal form (with
Workbook Builder inside).

Change-Id: I26139f674f7c7f3df2d45a0cd714e53b1d28538c
2014-10-17 20:47:12 +04:00
Timur Sufiev 83d579872a Rewrite Merlin as a collection of Django apps for Horizon integration
Now a running Horizon instance is required to run Mistral Workbook
builder. Instructions on integrating Merlin and its extensions (the
first of which is Workbook Builder) are provided in README.md.

Change-Id: I599ac46c9fd5369e42722b8d7a01d60c9f3323b8
2014-10-16 19:32:50 +04:00