PM_Dictionary Support in GAB
[sdc.git] / catalog-ui / src / app / models / artifacts.ts
index 63e4b59..e290dc6 100644 (file)
@@ -1,5 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
 'use strict';
 
+import * as _ from "lodash";
 import {ArtifactType} from './../utils';
 import {HeatParameterModel} from "./heat-parameters";
 
@@ -47,11 +69,13 @@ export class ArtifactModel {
     apiUrl:string;
     heatParameters:Array<HeatParameterModel>;
     generatedFromId:string;
+    isFromCsar: boolean;
 
     //custom properties
     selected:boolean;
     originalDescription:string;
     envArtifact:ArtifactModel;
+    allowDeleteAndUpdate: boolean;
 
     constructor(artifact?:ArtifactModel) {
         if (artifact) {
@@ -75,10 +99,11 @@ export class ArtifactModel {
             this["Content-MD5"] = artifact["Content-MD5"];
             this.artifactChecksum = artifact.artifactChecksum;
             this.apiUrl = artifact.apiUrl;
-            this.heatParameters = _.sortBy(artifact.heatParameters, 'name');
+            this.heatParameters = _.sortBy(_.cloneDeep(artifact.heatParameters), 'name');
             this.generatedFromId = artifact.generatedFromId;
             this.selected = artifact.selected ? artifact.selected : false;
             this.originalDescription = artifact.description;
+            this.isFromCsar = artifact.isFromCsar;
         }
     }
 
@@ -90,10 +115,15 @@ export class ArtifactModel {
         return _.has(ArtifactType.THIRD_PARTY_RESERVED_TYPES, this.artifactType);
     };
 
+    public isGenericBrowseable = ():boolean => {
+        return this.artifactType === ArtifactType.VES_EVENTS || this.artifactType === ArtifactType.PM_DICTIONARY;
+    };
+
     public toJSON = ():any => {
         this.selected = undefined;
         this.originalDescription = undefined;
         this.envArtifact = undefined;
+        this.allowDeleteAndUpdate = undefined;
         return this;
     };
 }