From 973ee9056995d1c9e7a533d9999329a70f0d2b2d Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Wed, 15 Oct 2014 07:49:46 +0000
Subject: [PATCH] #2021 config - Added pack and LicenseType Metadata management

---
 securis/src/main/resources/static/js/admin.js |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/securis/src/main/resources/static/js/admin.js b/securis/src/main/resources/static/js/admin.js
index a433436..53f9a70 100644
--- a/securis/src/main/resources/static/js/admin.js
+++ b/securis/src/main/resources/static/js/admin.js
@@ -66,7 +66,7 @@
 				$scope.edit = function(data) {
 					$scope.showForm = true;
 					$scope.isNew = false;
-					// Next line is a wirkaround due to some issues with values with ID == 0
+					// Next line is a workaround due to some issues with values with ID == 0
 					$('select').val(null);
 					$scope.formu = {}
 					var fields = Catalogs.getMetadata().fields;
@@ -130,6 +130,10 @@
 					$scope.$parent.showForm = true;
 					$('select').val(null);
 					$scope.$parent.formu = {};
+					
+					console.log("Refs:");
+					console.log($scope.refs);
+					
 					setTimeout(function() {
 						$('#'+Catalogs.getFFF()).focus();
 					}, 0);
@@ -165,6 +169,11 @@
 					}
 				}
 				
+				$scope.selectFieldChanged = function(onchangehandler) {
+					if (onchangehandler) {
+						$scope[onchangehandler]();
+					}
+				}
 				// Metadata management
 				
 				$scope.createMetadataRow = function() {
@@ -176,6 +185,14 @@
 				$scope.removeMetadataKey = function(row_md) {
 					$scope.formu.metadata.splice( $scope.formu.metadata.indexOf(row_md), 1 );
 				}
+				$scope.updateMetadata = function() {
+					// Called when Application ID change in current field
+					var newAppId = $scope.formu['application_id'];
+					console.log('Ready to get metadata from application: ' + newAppId);
+					Catalogs.getResource('application').get({appId: newAppId}).$promise.then(function(app) {
+						$scope.formu.metadata = app.metadata;
+					});
+				}
 				
 			} ]);
 

--
Gitblit v1.3.2