Exporting Tosca from UI

Change-Id: Ie7e58ac5bd51a56d028daa1c1e2577e7723a8297
diff --git a/views/ngXosViews/serviceGrid/src/js/site_encode.service.js b/views/ngXosViews/serviceGrid/src/js/site_encode.service.js
new file mode 100644
index 0000000..6bb1d99
--- /dev/null
+++ b/views/ngXosViews/serviceGrid/src/js/site_encode.service.js
@@ -0,0 +1,39 @@
+/**
+ * © OpenCORD
+ *
+ * Visit http://guide.xosproject.org/devguide/addview/ for more information
+ *
+ * Created by teone on 6/22/16.
+ */
+
+(function () {
+  'use strict';
+
+  /**
+   * @ngdoc service
+   * @name xos.SiteEncoder.serviceGrid
+   **/
+
+  angular.module('xos.serviceGrid')
+    .service('SiteEncoder', function($q, Sites){
+
+      this.buildTosca = (siteId, toscaSpec) => {
+        const d = $q.defer();
+
+        Sites.get({id: siteId}).$promise
+        .then(site => {
+          const toscaObj = {};
+          toscaObj[`${site.name}`] = {
+            type: 'tosca.nodes.Site'
+          };
+          angular.extend(toscaSpec.topology_template.node_templates, toscaObj);
+          d.resolve([toscaSpec, site]);
+        })
+        .catch(d.reject);
+
+
+        return d.promise;
+      };
+    });
+})();
+