summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2022-09-23 12:31:12 +0100
committerMichael Morris <michael.morris@est.tech>2022-10-05 08:18:25 +0000
commit6ed5592ccb3b2bdb61403f1d1d41d93088cb0709 (patch)
tree1978737dc736d000dbb34a9ddc50a7e2008ab573 /catalog-ui/src/app/ng2/services
parent404bfc9c50e95df1e75dbf8325fae41bfd96871a (diff)
Add data type view/workspace
Implements a data type workspace, based on the Service/VF workspace, where it is possible to view a data type information. Issue-ID: SDC-4193 Signed-off-by: André Schmid <andre.schmid@est.tech> Change-Id: Ica341efa43e70b4ac85d42d22a1397e0ab6e2794
Diffstat (limited to 'catalog-ui/src/app/ng2/services')
-rw-r--r--catalog-ui/src/app/ng2/services/cookie.service.ts5
-rw-r--r--catalog-ui/src/app/ng2/services/data-type.service.ts18
2 files changed, 18 insertions, 5 deletions
diff --git a/catalog-ui/src/app/ng2/services/cookie.service.ts b/catalog-ui/src/app/ng2/services/cookie.service.ts
index 61d13186fa..22c1dd310f 100644
--- a/catalog-ui/src/app/ng2/services/cookie.service.ts
+++ b/catalog-ui/src/app/ng2/services/cookie.service.ts
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-import {Injectable, Inject} from '@angular/core';
+import {Inject, Injectable} from '@angular/core';
import {ICookie} from "../../models/app-config";
-import {SdcConfigToken, ISdcConfig} from "../config/sdc-config.config";
+import {ISdcConfig, SdcConfigToken} from "../config/sdc-config.config";
@Injectable()
export class Cookie2Service {
@@ -36,7 +36,6 @@ export class Cookie2Service {
if ((junctionName !== null) && (junctionName !== '')) {
this.cookiePrefix = this.cookie.prefix + junctionName + '!';
}
- console.log("junctionName:" + junctionName);
}
private getCookieByName = (cookieName:string):string => {
diff --git a/catalog-ui/src/app/ng2/services/data-type.service.ts b/catalog-ui/src/app/ng2/services/data-type.service.ts
index 70555a5efd..bf500ec16e 100644
--- a/catalog-ui/src/app/ng2/services/data-type.service.ts
+++ b/catalog-ui/src/app/ng2/services/data-type.service.ts
@@ -19,11 +19,15 @@
*/
import * as _ from "lodash";
-import { Injectable } from '@angular/core';
+import {Inject, Injectable} from '@angular/core';
import { DataTypeModel, DataTypesMap, PropertyFEModel, DerivedFEProperty} from "app/models";
import { DataTypesService } from "app/services/data-types-service";
import { PROPERTY_DATA } from "app/utils";
import {DerivedFEAttribute} from "../../models/attributes-outputs/derived-fe-attribute";
+import {ISdcConfig} from "../config/sdc-config.config.factory";
+import {SdcConfigToken} from "../config/sdc-config.config";
+import {HttpClient} from "@angular/common/http";
+import {Observable} from "rxjs/Observable";
/** This is a new service for NG2, to eventually replace app/services/data-types-service.ts
*
@@ -34,11 +38,16 @@ import {DerivedFEAttribute} from "../../models/attributes-outputs/derived-fe-att
@Injectable()
export class DataTypeService {
public dataTypes: DataTypesMap;
+ private readonly baseUrl: string;
+ private readonly dataTypeUrl: string;
- constructor(private dataTypeService: DataTypesService) {
+ constructor(private dataTypeService: DataTypesService, private httpClient: HttpClient, @Inject(SdcConfigToken) sdcConfig: ISdcConfig) {
this.dataTypes = dataTypeService.getAllDataTypes(); //This should eventually be replaced by an NG2 call to the backend instead of utilizing Angular1 downgraded component.
+ this.baseUrl = sdcConfig.api.root + sdcConfig.api.component_api_root;
+ this.dataTypeUrl = `${this.baseUrl}data-types`
}
+
public getDataTypeByModelAndTypeName(modelName: string, typeName: string): DataTypeModel {
this.dataTypes = this.dataTypeService.getAllDataTypesFromModel(modelName);
let dataTypeFound = this.dataTypes[typeName];
@@ -64,6 +73,11 @@ export class DataTypeService {
return this.dataTypeService.findAllDataTypesByModel(modelName);
}
+ public findById(id: string): Observable<DataTypeModel> {
+ const url = `${this.dataTypeUrl}/${id}`
+ return this.httpClient.get<DataTypeModel>(url);
+ }
+
public getConstraintsByParentTypeAndUniqueID(rootPropertyType, propertyName){
// const property = this.dataTypes[rootPropertyType].properties.filter(property =>
// property.name == propertyName);