Replace collapsible panels with angular directive

Change-Id: Ib27adf29574260666421461ff45959d65cabe901
This commit is contained in:
Timur Sufiev 2014-12-29 09:01:05 -08:00
parent 525477601b
commit eb55cfaf87
5 changed files with 604 additions and 501 deletions

View File

@ -0,0 +1,11 @@
<div class="panel panel-default merlin-panel">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-target="#{$ panelId $}" href="#">{$ panelTitle $}</a>
<i ng-show="removable" class="fa fa-times-circle pull-right"></i></h4>
</div>
<div id="{$ panelId $}" class="panel-collapse collapse in">
<div class="panel-body" ng-transclude>
</div>
</div>
</div>

View File

@ -0,0 +1,71 @@
/**
* Created by tsufiev on 12/29/14.
*/
(function() {
angular.module('hz')
.controller('actionsCtrl', function($scope) {
$scope.actions = [
[{
name: 'Name',
type: 'string',
value: 'Action1'
}, {
name: 'Base',
type: 'string',
value: 'nova.create_server'
}, {
name: 'Base Input',
type: 'fixedlist'
}, {
name: 'Input',
type: 'list',
value: [{
type: 'string',
value: ''
}]
}, {
name: 'Output',
type: 'varlist',
value: [{
type: 'string',
value: ''
}, {
type: 'dictionary',
value: [{
name: 'key1',
type: 'string',
value: ''
}, {
name: 'key2',
type: 'string',
value: ''
}]
}, {
type: 'list',
value: [{
type: 'string',
value: ''
}, {
type: 'string',
value: ''
}]
}]
}]];
$scope.baseTypes = {
'nova.create_server': [{
name: 'Flavor Id',
type: 'string'
}, {
name: 'Image Id',
type: 'string'
}]
}
})
.controller('workflowsCtrl', function() {
});
})();

View File

@ -52,4 +52,26 @@
}
})
.directive('action', function() {
return {
restrict: 'E',
scope: {}
}
})
.directive('collapsiblePanel', function($parse, idGenerator) {
return {
restrict: 'E',
templateUrl: '/static/mistral/js/angular-templates/collapsible-panel.html',
transclude: true,
scope: {
panelTitle: '@',
removable: '='
},
link: function(scope) {
scope.panelId = idGenerator();
}
}
})
})();

View File

@ -0,0 +1,14 @@
/**
* Created by tsufiev on 12/29/14.
*/
(function() {
angular.module('hz')
.factory('idGenerator', function() {
var id = 0;
return function() {
id++;
return 'elem-id-'+id;
};
})
})();

File diff suppressed because it is too large Load Diff