Refactor hardcoded column config

Move hardcoded GAB columns configuration to configuration.yaml file

Change-Id: Ie70a1d44c9a04a37c3ba0d3b5f64ad2989b11166
Issue-ID: SDC-2225
Signed-off-by: Piotr Darosz <piotr.darosz@nokia.com>
diff --git a/catalog-ui/src/app/models/gab-config.ts b/catalog-ui/src/app/models/gab-config.ts
new file mode 100644
index 0000000..8554718
--- /dev/null
+++ b/catalog-ui/src/app/models/gab-config.ts
@@ -0,0 +1,7 @@
+import {PathsAndNamesDefinition} from "./paths-and-names";
+
+export class GabConfig {
+  constructor(public artifactType: string, public pathsAndNamesDefinitions: PathsAndNamesDefinition[]) {
+
+  }
+}
\ No newline at end of file
diff --git a/catalog-ui/src/app/models/paths-and-names.ts b/catalog-ui/src/app/models/paths-and-names.ts
index afab4d0..4313637 100644
--- a/catalog-ui/src/app/models/paths-and-names.ts
+++ b/catalog-ui/src/app/models/paths-and-names.ts
@@ -19,5 +19,5 @@
  */
 
 export class PathsAndNamesDefinition {
-  constructor(public path: string, public friendlyName: string) {}
+  constructor(public path: string, public friendlyName: string, public searchable: boolean) {}
 }
\ No newline at end of file
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/deployment-artifacts/deployment-artifacts-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/deployment-artifacts/deployment-artifacts-view-model.ts
index 73273e0..5e78301 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/deployment-artifacts/deployment-artifacts-view-model.ts
+++ b/catalog-ui/src/app/view-models/workspace/tabs/deployment-artifacts/deployment-artifacts-view-model.ts
@@ -31,6 +31,8 @@
 import {PathsAndNamesDefinition} from "../../../../models/paths-and-names";
 import {ModalService as ModalServiceSdcUI} from "sdc-ui/lib/angular/modals/modal.service";
 import {IModalConfig} from "sdc-ui/lib/angular/modals/models/modal-config";
+import {CacheService} from "../../../../services/cache-service";
+import {GabConfig} from "../../../../models/gab-config";
 
 interface IDeploymentArtifactsViewModelScope extends IWorkspaceViewModelScope {
     tableHeadersList:Array<any>;
@@ -66,6 +68,7 @@
         '$scope',
         '$templateCache',
         '$filter',
+        'Sdc.Services.CacheService',
         'ValidationUtils',
         'ArtifactsUtils',
         'ModalsHandler',
@@ -76,6 +79,7 @@
     constructor(private $scope:IDeploymentArtifactsViewModelScope,
                 private $templateCache:ng.ITemplateCacheService,
                 private $filter:ng.IFilterService,
+                private cacheService:CacheService,
                 private validationUtils:ValidationUtils,
                 private artifactsUtils:ArtifactsUtils,
                 private ModalsHandler:ModalsHandler,
@@ -278,9 +282,11 @@
         };
 
         this.$scope.openGenericArtifactBrowserModal = (artifact:ArtifactModel):void => {
+            let self = this;
+            const title = 'Generic Artifact Browser';
             let modalConfig: IModalConfig = {
                 size: 'xl',
-                title: 'Generic Artifact Browser',
+                title: title,
                 type: 'custom',
                 buttons: [{
                         id: 'okButton',
@@ -291,13 +297,28 @@
                     {text: "Cancel", size: "'x-small'", closeModal: true}]
             };
 
-            let pathsandnames: PathsAndNamesDefinition[] = [
-                {friendlyName: 'Action', path: 'event.action[2]'},
-                {friendlyName: 'Comment', path: 'event.comment'},
-                {friendlyName: 'Alarm Additional Information',
-                    path: 'event.structure.faultFields.structure.alarmAdditionalInformation.comment'}];
+            const uiConfiguration: any = this.cacheService.get('UIConfiguration');
+            let noConfig: boolean = false;
+            let pathsandnames: PathsAndNamesDefinition[] = [];
 
-            let modalInputs = {
+            if(typeof uiConfiguration.gab === 'undefined') {
+                noConfig = true
+            } else {
+                const gabConfig: GabConfig = uiConfiguration.gab
+                    .find(config => config.artifactType === artifact.artifactType);
+                if(typeof gabConfig === 'undefined') {
+                    noConfig = true;
+                } else {
+                    pathsandnames = gabConfig.pathsAndNamesDefinitions;
+                }
+            }
+
+            if(noConfig) {
+                const msg = self.$filter('translate')("DEPLOYMENT_ARTIFACT_GAB_NO_CONFIG");
+                this.ModalServiceSdcUI.openAlertModal(title, msg);
+            }
+
+            const modalInputs = {
                 pathsandnames: pathsandnames,
                 artifactid: artifact.esId,
                 resourceid: this.$scope.component.uniqueId
diff --git a/catalog-ui/src/assets/languages/en_US.json b/catalog-ui/src/assets/languages/en_US.json
index b430217..72f320d 100644
--- a/catalog-ui/src/assets/languages/en_US.json
+++ b/catalog-ui/src/assets/languages/en_US.json
@@ -387,7 +387,8 @@
     "DEPLOYMENT_ARTIFACT_BUTTON_ADD_BASE_HEAT": "Add Base HEAT Artifact",
     "DEPLOYMENT_ARTIFACT_BUTTON_ADD_NETWORK_HEAT": "Add Network HEAT Artifact",
     "DEPLOYMENT_ARTIFACT_BUTTON_ADD_VOLUME_HEAT": "Add Volume HEAT Artifact",
-    "DEPLOYMENT_ARTIFACT_BUTTON_ADD_OTHER": "Add Other Artifact"
+    "DEPLOYMENT_ARTIFACT_BUTTON_ADD_OTHER": "Add Other Artifact",
+    "DEPLOYMENT_ARTIFACT_GAB_NO_CONFIG": "Generic Artifact Browser has no columns configured"
 
 ,"=========== IMPORT VF ===========": "",
     "IMPORT_VF_MESSAGE_CREATE_TAKES_LONG_TIME_TITLE": "Create VF",