summaryrefslogtreecommitdiffstats
path: root/cds-ui
diff options
context:
space:
mode:
authorBrinda Santh Muthuramalingam <brindasanth@in.ibm.com>2019-09-10 00:26:08 +0000
committerGerrit Code Review <gerrit@onap.org>2019-09-10 00:26:08 +0000
commit85f7fb219f6e1f4227ac1463290f6a6aafc2b84f (patch)
tree5ad10124076ce5fd5210075dd20046a3b7d78031 /cds-ui
parent98a00a5e3fac8b2ea7a23b8265fb5d70a8b9d35f (diff)
parent7918513759a4a6fd5ae90640c6b654a1a61f46b8 (diff)
Merge "Resource Dictionary: fecthing data-type list"
Diffstat (limited to 'cds-ui')
-rw-r--r--cds-ui/client/src/app/common/constants/app-constants.ts3
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts4
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html5
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts22
-rw-r--r--cds-ui/server/src/controllers/data-dictionary.controller.ts11
-rw-r--r--cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts17
-rw-r--r--cds-ui/server/src/services/resource-dictionary.service.ts1
7 files changed, 57 insertions, 6 deletions
diff --git a/cds-ui/client/src/app/common/constants/app-constants.ts b/cds-ui/client/src/app/common/constants/app-constants.ts
index 5ebde91e3..78fefd803 100644
--- a/cds-ui/client/src/app/common/constants/app-constants.ts
+++ b/cds-ui/client/src/app/common/constants/app-constants.ts
@@ -108,5 +108,6 @@ export const ResourceDictionaryURLs = {
searchResourceDictionaryByTags: '/resourcedictionary/search',
searchResourceDictionaryByName: '',
getSources: '/resourcedictionary/source-mapping',
- getModelType: '/resourcedictionary/model-type'
+ getModelType: '/resourcedictionary/model-type',
+ getDataType: '/resourcedictionary/model-type/by-definition/data_type'
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts
index ed1ef6f37..f66a1c9c9 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts
@@ -44,4 +44,8 @@ export class ResourceEditService {
getModelType(name) {
return this.api.get(ResourceDictionaryURLs.getModelType + '/' + name);
}
+
+ getDataTypes() {
+ return this.api.get(ResourceDictionaryURLs.getDataType);
+ }
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html
index d40dbd957..24bee2720 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html
@@ -28,8 +28,9 @@
</mat-form-field>
<mat-form-field class="form-field">
<mat-select matInput placeholder="Data Type" formControlName="_type">
- <mat-option value="string">string</mat-option>
- <mat-option value="list">list</mat-option>
+ <!-- <mat-option value="string">string</mat-option> -->
+ <!-- <mat-option value="list">list</mat-option> -->
+ <mat-option value="string" *ngFor="let item of dataTypeList">{{item.modelName}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="form-field" >
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts
index e155ec100..473b20038 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts
@@ -24,13 +24,15 @@ import { Component, OnInit, EventEmitter, Output } from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import { IResources } from 'src/app/common/core/store/models/resources.model';
import { IResourcesState } from 'src/app/common/core/store/models/resourcesState.model';
-import { Observable } from 'rxjs';
+import { Observable, from } from 'rxjs';
import { Store } from '@ngrx/store';
import { IAppState } from '../../../../common/core/store/state/app.state';
import { A11yModule } from '@angular/cdk/a11y';
+
import { LoadResourcesSuccess } from 'src/app/common/core/store/actions/resources.action';
import { IPropertyData } from 'src/app/common/core/store/models/propertyData.model';
import { IEntrySchema } from 'src/app/common/core/store/models/entrySchema.model';
+import { ResourceEditService } from '../resource-edit.service';
@Component({
selector: 'app-resource-metadata',
@@ -48,8 +50,13 @@ export class ResourceMetadataComponent implements OnInit {
propertyValues = [];
property = [];
@Output() resourcesData = new EventEmitter();
+ dataTypeList: any[] = [
+ {modelName: 'String'}, {modelName: 'Boolean'}, {modelName: 'Integer'}, {modelName: 'Float'}, {modelName: 'Double'}
+ ];
- constructor(private formBuilder: FormBuilder, private store: Store<IAppState>) {
+ constructor(private formBuilder: FormBuilder,
+ private store: Store<IAppState>,
+ private resourceEditService: ResourceEditService) {
this.rdState = this.store.select('resources');
this.ResourceMetadata = this.formBuilder.group({
Resource_Name: ['', Validators.required],
@@ -62,6 +69,17 @@ export class ResourceMetadataComponent implements OnInit {
}
ngOnInit() {
+ this.resourceEditService.getDataTypes()
+ .subscribe(data=>{
+ console.log(data);
+ if(data) {
+ data.forEach(element => {
+ this.dataTypeList.push(element);
+ });
+ }
+ }, (error)=>{
+ console.log("There is an error");
+ });
this.rdState.subscribe(
resourcesdata => {
var resourcesState: IResourcesState = { resources: resourcesdata.resources, isLoadSuccess: resourcesdata.isLoadSuccess, isSaveSuccess: resourcesdata.isSaveSuccess, isUpdateSuccess: resourcesdata.isUpdateSuccess };
diff --git a/cds-ui/server/src/controllers/data-dictionary.controller.ts b/cds-ui/server/src/controllers/data-dictionary.controller.ts
index 63587e6b3..eab0bc50c 100644
--- a/cds-ui/server/src/controllers/data-dictionary.controller.ts
+++ b/cds-ui/server/src/controllers/data-dictionary.controller.ts
@@ -95,4 +95,15 @@ export class DataDictionaryController {
async getmodelType(@param.path.string('source') source: string) {
return await this.rdservice.getModelType(source);
}
+
+ @get('/resourcedictionary/model-type/by-definition/data_type', {
+ responses: {
+ '200': {
+ content: { 'application/json': {} },
+ },
+ },
+ })
+ async getDataTypes() {
+ return await this.rdservice.getDataTypes();
+ }
}
diff --git a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
index af96aca04..9f9d754d1 100644
--- a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
+++ b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
@@ -88,7 +88,6 @@ export default {
}
},
- ,
{
"template": {
"method": "GET",
@@ -104,6 +103,22 @@ export default {
"getModelType": ["source"]
}
+ },
+ {
+ "template": {
+ "method": "GET",
+ "url": controllerApiConfig.http.url + "/model-type/by-definition/data_type",
+ "headers": {
+ "accepts": "application/json",
+ "content-type": "application/json",
+ "authorization": controllerApiConfig.http.authToken
+ },
+ "responsePath": "$.*"
+ },
+ "functions": {
+ "getDataTypes": []
+
+ }
}
]
}; \ No newline at end of file
diff --git a/cds-ui/server/src/services/resource-dictionary.service.ts b/cds-ui/server/src/services/resource-dictionary.service.ts
index 9a781d6b8..8df22085c 100644
--- a/cds-ui/server/src/services/resource-dictionary.service.ts
+++ b/cds-ui/server/src/services/resource-dictionary.service.ts
@@ -9,6 +9,7 @@ export interface ResourceDictionaryService {
save(resourceDictionary: JSON): Promise<JSON>;
searchbyNames(resourceDictionaryList: JSON): Promise<JSON>;
getModelType(source: string): Promise<JSON>;
+ getDataTypes(): Promise<JSON>;
}
export class ResourceDictionaryServiceProvider implements Provider<ResourceDictionaryService> {