/*-
* ============LICENSE_START=======================================================
- * ECOMP Policy Engine
+ * ONAP Policy Engine
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-app.controller('baseConfigController', function ($scope, PolicyAppService, modalService, $modal, Notification) {
+app.controller('baseConfigController', ['$scope', 'PolicyAppService', 'policyNavigator', 'modalService', '$modal', 'Notification', function ($scope, PolicyAppService, PolicyNavigator, modalService, $modal, Notification) {
$("#dialog").hide();
+
+ $scope.policyNavigator;
$scope.savebutton = true;
-
- PolicyAppService.getData('getDictionary/get_EcompNameDataByName').then(function (data) {
+ $scope.refreshCheck = false;
+
+ if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
+ $scope.temp.policy = {
+ policyType : "Config",
+ configPolicyType : "Base"
+ }
+ };
+
+ $scope.refresh = function(){
+ if($scope.refreshCheck){
+ $scope.policyNavigator.refresh();
+ }
+ $scope.modal('createNewPolicy', true);
+ $scope.temp.policy = "";
+ };
+
+ $scope.modal = function(id, hide) {
+ return $('#' + id).modal(hide ? 'hide' : 'show');
+ };
+
+ $('#ttlDate').datepicker({
+ dateFormat: 'dd/mm/yy',
+ changeMonth: true,
+ changeYear: true,
+ onSelect: function(date) {
+ angular.element($('#ttlDate')).triggerHandler('input');
+ }
+ });
+
+ PolicyAppService.getData('getDictionary/get_OnapNameDataByName').then(function (data) {
var j = data;
$scope.data = JSON.parse(j.data);
console.log($scope.data);
- $scope.ecompNameDictionaryDatas = JSON.parse($scope.data.ecompNameDictionaryDatas);
- console.log($scope.ecompNameDictionaryDatas);
+ $scope.onapNameDictionaryDatas = JSON.parse($scope.data.onapNameDictionaryDatas);
+ console.log($scope.onapNameDictionaryDatas);
}, function (error) {
console.log("failed");
});
}, function (error) {
console.log("failed");
});
-
-
- function extend(obj, src) {
- for (var key in src) {
- if (src.hasOwnProperty(key)) obj[key] = src[key];
- }
- return obj;
- }
$scope.savePolicy = function(policy){
+ if(policy.itemContent != undefined){
+ $scope.refreshCheck = true;
+ $scope.policyNavigator = policy.itemContent;
+ policy.itemContent = "";
+ }
$scope.savebutton = false;
- console.log(policy);
var uuu = "policycreation/save_policy";
var postData={policyData: policy};
$.ajax({
$scope.validatePolicy = function(policy){
- console.log(policy);
+ $scope.scope = policy.domain;
document.getElementById("validate").innerHTML = "";
var uuu = "policyController/validate_policy.htm";
var postData={policyData: policy};
var lastItem = $scope.temp.policy.attributes.length-1;
$scope.temp.policy.attributes.splice(lastItem);
};
-
-});
\ No newline at end of file
+}]);
\ No newline at end of file