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
This commit is contained in:
parent
f9bb5fa11a
commit
1454a2792d
@ -10,5 +10,7 @@ ADD_INSTALLED_APPS = ['merlin', 'mistral']
|
|||||||
# Python panel class of the PANEL to be added.
|
# Python panel class of the PANEL to be added.
|
||||||
ADD_PANEL = 'mistral.panel.MistralPanel'
|
ADD_PANEL = 'mistral.panel.MistralPanel'
|
||||||
|
|
||||||
ADD_ANGULAR_MODULES = ['angular.filter']
|
ADD_ANGULAR_MODULES = ['angular.filter', 'merlin', 'mistral']
|
||||||
ADD_JS_FILES = ['merlin/lib/angular-filter.js']
|
ADD_JS_FILES = ['merlin/js/lib/angular-filter.js',
|
||||||
|
'merlin/js/merlin.init.js',
|
||||||
|
'mistral/js/mistral.init.js']
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
/* Copyright (c) 2014 Mirantis, Inc.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
not use this file except in compliance with the License. You may obtain
|
|
||||||
a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
License for the specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.expandable:before {
|
|
||||||
content: '+';
|
|
||||||
}
|
|
||||||
.expandable.expanded:before {
|
|
||||||
content: '-';
|
|
||||||
}
|
|
||||||
.container-action {
|
|
||||||
padding-left: 5px;
|
|
||||||
}
|
|
||||||
.inner-node {
|
|
||||||
padding-left: 5px;
|
|
||||||
border-left: 1px solid green;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#create-workbook {
|
|
||||||
padding-left: 15px;
|
|
||||||
padding-right: 15px;
|
|
||||||
}
|
|
||||||
|
|
@ -2,8 +2,9 @@
|
|||||||
* Created by tsufiev on 2/24/15.
|
* Created by tsufiev on 2/24/15.
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function() {
|
||||||
angular.module('hz')
|
'use strict';
|
||||||
|
|
||||||
|
var mistralApp = angular.module('mistral', ['merlin'])
|
||||||
.run(function($http, $templateCache) {
|
.run(function($http, $templateCache) {
|
||||||
var fields = ['varlist', 'yaqllist'];
|
var fields = ['varlist', 'yaqllist'];
|
||||||
fields.forEach(function(field) {
|
fields.forEach(function(field) {
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
* Created by tsufiev on 2/24/15.
|
* Created by tsufiev on 2/24/15.
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function() {
|
||||||
angular.module('hz')
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('mistral')
|
||||||
.controller('workbookCtrl',
|
.controller('workbookCtrl',
|
||||||
['$scope', 'mistral.workbook.models', function($scope, models) {
|
['$scope', 'mistral.workbook.models', function($scope, models) {
|
||||||
var workbook = models.Workbook.create({name: 'My Workbook'});
|
var workbook = models.Workbook.create({name: 'My Workbook'});
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
/**
|
/**
|
||||||
* Created by tsufiev on 2/24/15.
|
* Created by tsufiev on 2/24/15.
|
||||||
*/
|
*/
|
||||||
(function(){
|
(function() {
|
||||||
angular.module('hz')
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('mistral')
|
||||||
.factory('mistral.workbook.models',
|
.factory('mistral.workbook.models',
|
||||||
['merlin.field.models', 'merlin.panel.models', function(fields, panel) {
|
['merlin.field.models', 'merlin.panel.models', function(fields, panel) {
|
||||||
var models = {};
|
var models = {};
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
{% extends "horizon/common/_modal_form.html" %}
|
|
||||||
{% load i18n %}
|
|
||||||
{% load url from future %}
|
|
||||||
|
|
||||||
{% block form_id %}create_workbook{% endblock %}
|
|
||||||
{% block form_action %}
|
|
||||||
{% if form.initial.workbook_id %}
|
|
||||||
{% url 'horizon:project:mistral:edit' form.initial.workbook_id %}
|
|
||||||
{% else %}
|
|
||||||
{% url 'horizon:project:mistral:create' %}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block modal-header %}
|
|
||||||
{% if form.initial.workbook_id %}
|
|
||||||
{% trans "Edit Workbook" %}
|
|
||||||
{% else %}
|
|
||||||
{% trans "Create Workbook" %}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
{% block modal_id %}create_workbook_modal{% endblock %}
|
|
||||||
|
|
||||||
{% block modal-body %}
|
|
||||||
<div class="left">
|
|
||||||
<div id="toolbar">
|
|
||||||
<button id="create-workbook">Reset Workbook</button>
|
|
||||||
<button id="save-workbook">Update YAML presentation</button>
|
|
||||||
<div id="controls"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="right">
|
|
||||||
<pre></pre>
|
|
||||||
<input name="workbook" id="json-output" type="hidden" value="{{ form.initial.workbook }}"/>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block modal-footer %}
|
|
||||||
<input class="btn btn-primary pull-right" type="submit"
|
|
||||||
value="{% if form.initial.workbook_id %}{% trans "Edit" %}{% else %}{% trans "Create" %}{% endif %}" />
|
|
||||||
<a href="{% url 'horizon:project:mistral:index' %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block modal-js %}
|
|
||||||
<script src="{{ STATIC_URL }}mistral/js/schema.js"></script>
|
|
||||||
<script src="{{ STATIC_URL }}mistral/js/workbook.js"></script>
|
|
||||||
{% endblock %}
|
|
@ -13,9 +13,9 @@
|
|||||||
{% include "horizon/_scripts.html" %}
|
{% include "horizon/_scripts.html" %}
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/lib/barricade.js"></script>
|
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/lib/barricade.js"></script>
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/lib/js-yaml.js"></script>
|
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/lib/js-yaml.js"></script>
|
||||||
|
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/merlin.init.js"></script>
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/merlin.directives.js"></script>
|
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/merlin.directives.js"></script>
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/merlin.field.models.js"></script>
|
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/merlin.field.models.js"></script>
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/merlin.init.js"></script>
|
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/merlin.panel.models.js"></script>
|
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/merlin.panel.models.js"></script>
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/merlin.utils.js"></script>
|
<script type="text/javascript" src="{{ STATIC_URL }}merlin/js/merlin.utils.js"></script>
|
||||||
|
|
||||||
@ -28,8 +28,7 @@
|
|||||||
{% block css %}
|
{% block css %}
|
||||||
{% include "_stylesheets.html" %}
|
{% include "_stylesheets.html" %}
|
||||||
{% compress css %}
|
{% compress css %}
|
||||||
<link rel="stylesheet" href="{{ STATIC_URL }}mistral/css/mistral.css">
|
<link href='{{ STATIC_URL }}merlin/scss/merlin.scss' type='text/scss' media='screen' rel='stylesheet' />
|
||||||
<link href='{{ STATIC_URL }}mistral/css/mistral.scss' type='text/scss' media='screen' rel='stylesheet' />
|
|
||||||
{% endcompress %}
|
{% endcompress %}
|
||||||
{% block merlin-css %}{% endblock %}
|
{% block merlin-css %}{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends 'merlin/base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% block title %}{% trans "Workbooks" %}{% endblock %}
|
{% block title %}{% trans "Workbooks" %}{% endblock %}
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
* Created by tsufiev on 2/24/15.
|
* Created by tsufiev on 2/24/15.
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
function disableClickDefaultBehaviour(element) {
|
function disableClickDefaultBehaviour(element) {
|
||||||
element.find('a[data-toggle="collapse"]')
|
element.find('a[data-toggle="collapse"]')
|
||||||
.on('click', function(e) {
|
.on('click', function(e) {
|
||||||
@ -10,8 +12,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
angular.module('hz')
|
angular.module('merlin')
|
||||||
|
|
||||||
.directive('editable', function() {
|
.directive('editable', function() {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
@ -30,7 +31,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
.directive('panel', function($parse) {
|
.directive('panel', function($parse) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
@ -46,7 +46,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.directive('collapsibleGroup', function() {
|
.directive('collapsibleGroup', function() {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
@ -68,7 +67,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.directive('typedField', function($http, $templateCache, $compile) {
|
.directive('typedField', function($http, $templateCache, $compile) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
angular.module('hz')
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('merlin')
|
||||||
.factory('merlin.field.models',
|
.factory('merlin.field.models',
|
||||||
['merlin.utils', 'merlin.panel.models', function(utils, panels) {
|
['merlin.utils', 'merlin.panel.models', function(utils, panels) {
|
||||||
|
|
||||||
@ -195,4 +196,5 @@
|
|||||||
wildcard: wildcardMixin // use for most general type-checks
|
wildcard: wildcardMixin // use for most general type-checks
|
||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
})();
|
})();
|
@ -2,8 +2,9 @@
|
|||||||
* Created by tsufiev on 2/24/15.
|
* Created by tsufiev on 2/24/15.
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function() {
|
||||||
angular.module('hz')
|
'use strict';
|
||||||
|
|
||||||
|
var merlinApp = angular.module('merlin', [])
|
||||||
.run(function($http, $templateCache) {
|
.run(function($http, $templateCache) {
|
||||||
var fields = ['dictionary', 'frozendict', 'list', 'string',
|
var fields = ['dictionary', 'frozendict', 'list', 'string',
|
||||||
'text', 'group', 'number', 'choices'
|
'text', 'group', 'number', 'choices'
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
/**
|
/**
|
||||||
* Created by tsufiev on 2/24/15.
|
* Created by tsufiev on 2/24/15.
|
||||||
*/
|
*/
|
||||||
(function(){
|
(function() {
|
||||||
angular.module('hz')
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('merlin')
|
||||||
.factory('merlin.panel.models', ['merlin.utils', function(utils) {
|
.factory('merlin.panel.models', ['merlin.utils', function(utils) {
|
||||||
var rowProto = {
|
var rowProto = {
|
||||||
create: function(items) {
|
create: function(items) {
|
||||||
@ -148,4 +149,5 @@
|
|||||||
rowmixin: rowMixin
|
rowmixin: rowMixin
|
||||||
}
|
}
|
||||||
}])
|
}])
|
||||||
|
|
||||||
})();
|
})();
|
@ -1,9 +1,10 @@
|
|||||||
/**
|
/**
|
||||||
* Created by tsufiev on 2/24/15.
|
* Created by tsufiev on 2/24/15.
|
||||||
*/
|
*/
|
||||||
(function(){
|
(function() {
|
||||||
angular.module('hz')
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('merlin')
|
||||||
.factory('merlin.utils', function() {
|
.factory('merlin.utils', function() {
|
||||||
Array.prototype.condense = function() {
|
Array.prototype.condense = function() {
|
||||||
return this.filter(function(el) {
|
return this.filter(function(el) {
|
||||||
@ -80,4 +81,5 @@
|
|||||||
enhanceItemWithID: enhanceItemWithID
|
enhanceItemWithID: enhanceItemWithID
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
})();
|
})();
|
@ -1 +0,0 @@
|
|||||||
{% extends "horizon/common/_modal_form.html" %}
|
|
@ -1,13 +0,0 @@
|
|||||||
{% extends "base.html" %}
|
|
||||||
|
|
||||||
{% block js %}
|
|
||||||
{% include "horizon/_scripts.html" %}
|
|
||||||
<script src="{{ STATIC_URL }}merlin/lib/barricade.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="{{ STATIC_URL }}merlin/lib/js-yaml.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
{% block merlin-js-scripts %}{% endblock %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block css %}
|
|
||||||
{% include "_stylesheets.html" %}
|
|
||||||
{% block merlin-css %}{% endblock %}
|
|
||||||
{% endblock %}
|
|
Loading…
x
Reference in New Issue
Block a user