diff --git a/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset-blue.svg b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset-blue.svg new file mode 100644 index 00000000..a914eba6 --- /dev/null +++ b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset-blue.svg @@ -0,0 +1,3 @@ + +Layer 1 +Layer 1DNSRECORD \ No newline at end of file diff --git a/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset-gray.svg b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset-gray.svg new file mode 100644 index 00000000..d4ea588d --- /dev/null +++ b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset-gray.svg @@ -0,0 +1,3 @@ + +Layer 1 +Layer 1DNSRECORD \ No newline at end of file diff --git a/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset-green.svg b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset-green.svg new file mode 100644 index 00000000..543850d9 --- /dev/null +++ b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset-green.svg @@ -0,0 +1,3 @@ + +Layer 1 +Layer 1DNSRECORD \ No newline at end of file diff --git a/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset-red.svg b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset-red.svg new file mode 100644 index 00000000..2b7141e6 --- /dev/null +++ b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset-red.svg @@ -0,0 +1,3 @@ + +Layer 1 +Layer 1DNSRECORD \ No newline at end of file diff --git a/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset.html b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset.html new file mode 100644 index 00000000..908ea7a1 --- /dev/null +++ b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset.html @@ -0,0 +1,76 @@ + + + + + + +
+
You must supply a name.
+
That doesn't look like a valid name. +
+
+ Too long name. +
+
+
+ + + + +
+
You must supply a zone.
+
That doesn't look like a valid id of zone. +
+
+
+ + + + + + {$ type.name $} + + + + + + + +
+
At least one record is required.
+
+
+
+ + + {$ 'Show More Properties' | translate $} + +
+ + + + + + + + + + + + +
+
+ Too long description. +
+
+
+ +
+
+ + + + + + +
diff --git a/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset.js b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset.js new file mode 100644 index 00000000..73a875cd --- /dev/null +++ b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset.js @@ -0,0 +1,113 @@ +(function(angular) { + 'use strict'; + + // OS::Designate::RecordSet + angular.module('horizon.dashboard.project.heat_dashboard.template_generator').value('osDesignateRecordsetSettings', + { + resource_key: "OS__Designate__RecordSet", + admin: false, + icon: { + class: 'fa-key ', + name: 'OS::Designate::RecordSet', + code: '\uf084', + color: '#483dff' + }, + label: 'name', + modal_component: '', + edge_settings: { + 'OS__Designate__Zone': { + 'type': 'property', + 'property': 'zone', + 'limit': 1, + }, + }, + necessary_properties: { + 'name': null, + 'zone': ['OS__Designate__Zone'], + 'type': null, + 'records': null, + }, + } + ); + + angular.module('horizon.dashboard.project.heat_dashboard.template_generator') + .run(['osDesignateRecordsetSettings', 'hotgenGlobals', function( osDesignateRecordsetSettings, hotgenGlobals){ + hotgenGlobals.update_resource_icons( + osDesignateRecordsetSettings.resource_key, + osDesignateRecordsetSettings.icon); + + hotgenGlobals.update_resource_components( + osDesignateRecordsetSettings.resource_key, + osDesignateRecordsetSettings.modal_component); + + hotgenGlobals.update_edge_directions( + osDesignateRecordsetSettings.resource_key, + osDesignateRecordsetSettings.edge_settings); + + hotgenGlobals.update_node_labels( + osDesignateRecordsetSettings.resource_key, + osDesignateRecordsetSettings.label); + }]); + + + function osDesignateRecordsetController($scope, hotgenGlobals, validationRules){ + $scope.options = hotgenGlobals.get_resource_options(); + + $scope.options.types = [ + {'id': 'A', 'name': 'A'}, + {'id': 'AAAA', 'name': 'AAAA'}, + {'id': 'MX', 'name': 'MX'}, + {'id': 'CNAME', 'name': 'CNAME'}, + {'id': 'TXT', 'name': 'TXT'}, + {'id': 'SRV', 'name': 'SRV'}, + {'id': 'NS', 'name': 'NS'}, + {'id': 'PTR', 'name': 'PTR'}, + {'id': 'SPF', 'name': 'SPF'}, + {'id': 'SSHFP', 'name': 'SSHFP'}, + ]; + + $scope.admin = $scope.options.auth.admin; + this.$onInit = function(){ + if (typeof this.recordset.records === 'undefined'){ + this.recordset.records = []; + } + + if (typeof this.connectedoptions === 'undefined'){ + $scope.connected_options = [] + } else{ + $scope.connected_options = this.connectedoptions; + } + + this.disable = {'zone': false} + + if ( $scope.connected_options.zone && $scope.connected_options.zone.length > 0){ + this.recordset.zone = $scope.connected_options.zone[0].value + this.disable.zone = true + } + $scope.dependson = this.dependson; + } + + $scope.validate_name = validationRules['name']; + } + + osDesignateRecordsetController.$inject = ['$scope', 'hotgenGlobals', + 'horizon.dashboard.project.heat_dashboard.template_generator.validationRules', + ]; + osDesignateRecordsetPath.$inject = ['horizon.dashboard.project.heat_dashboard.template_generator.basePath']; + + function osDesignateRecordsetPath(basePath){ + return basePath + 'js/resources/os__designate__recordset/os__designate__recordset.html'; + } + + angular.module('horizon.dashboard.project.heat_dashboard.template_generator').component('osDesignateRecordset', { + templateUrl: osDesignateRecordsetPath, + controller: osDesignateRecordsetController, + bindings:{ + 'recordset': '=', + 'dependson': '=', + 'connectedoptions': '<', + 'formReference': '<', + } + }); + +})(window.angular); diff --git a/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset.spec.js b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset.spec.js new file mode 100644 index 00000000..c0d227c1 --- /dev/null +++ b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset.spec.js @@ -0,0 +1,49 @@ +(function() { + 'use strict'; + + describe('component os-designate-recordset', function(){ + + beforeEach(module('horizon.dashboard.project.heat_dashboard.template_generator')); + + beforeEach(module('appTemplates')); + + var $scope, $isolateScope, $compile; + var element; + + beforeEach(inject(function($injector) { + $scope = $injector.get('$rootScope').$new(); + $compile = $injector.get('$compile'); + + $scope.resource = {}; + $scope.dependson = []; + $scope.connectedoptions = []; + $scope.resourceForm = {}; + + // element will enable you to test your directive's element on the DOM + element = $compile(angular.element(''))($scope); + + // Digest needs to be called to set any values on the directive's scope + $scope.$digest(); + + $isolateScope = element.isolateScope(); + })); + + it('find tab title Properties', function() { + expect(element.find('span').html()).toContain("Properties"); + }); + + it('find tab title Properties with resource properties set', function() { + $scope.resource = { masters: [], attributes: []}; + element = $compile(angular.element(''+ + ''))($scope); + + $scope.$digest(); + + expect(element.find('span').html()).toContain("Properties"); + }); + }); + +})(); diff --git a/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset.svg b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset.svg new file mode 100644 index 00000000..7b0f8367 --- /dev/null +++ b/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/resources/os__designate__recordset/os__designate__recordset.svg @@ -0,0 +1,3 @@ + +Layer 1 +Layer 1DNSRECORD \ No newline at end of file