[CORD-1652] Fixed links to related models in table visualization

Change-Id: Ibb5cb3b433e690d2752f188d51a734ddc5f1cfd0
diff --git a/src/app/core/services/helpers/config.helpers.ts b/src/app/core/services/helpers/config.helpers.ts
index 85039fe..2dc8e46 100644
--- a/src/app/core/services/helpers/config.helpers.ts
+++ b/src/app/core/services/helpers/config.helpers.ts
@@ -36,6 +36,7 @@
   toLabels(string: string[], pluralize?: boolean): string[];
   stateFromCoreModel(name: string): string;
   stateWithParams(name: string, model: any): string;
+  relatedStateWithParams(name: string, id: string): string;
   stateWithParamsForJs(name: string, model: any): any;
 }
 
@@ -175,9 +176,7 @@
           this.populateRelated(item, item[f.name], f);
           return item[f.name];
         };
-        col.link = item => {
-          return this.stateWithParams(f.relation.model, item);
-        };
+        col.link = item => this.relatedStateWithParams(f.relation.model, item[col.prop]);
       }
 
       if (f.name === 'backend_status' || f.name === 'policy_status') {
@@ -220,8 +219,12 @@
     return `${state}({id: ${model['id']}})`;
   }
 
+  public relatedStateWithParams(name: string, id: string): string {
+    const state = this.stateFromCoreModel(name);
+    return `${state}({id: ${id}})`;
+  }
+
   public stateWithParamsForJs(name: string, model: any): any {
-    // TODO test and interface
     const state = this.stateFromCoreModel(name);
     return {name: state, params: {id: model.id}};
   }