Merge "Secure Kafka Authentication"
authorDan Timoney <dtimoney@att.com>
Fri, 24 Apr 2020 13:05:11 +0000 (13:05 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 24 Apr 2020 13:05:11 +0000 (13:05 +0000)
60 files changed:
cds-ui/designer-client/src/app/app-routing.module.ts
cds-ui/designer-client/src/app/app.module.ts
cds-ui/designer-client/src/app/common/constants/app-constants.ts
cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html
cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/dsl-definitions-tab/dsl-definitions-tab.component.html
cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/package-creation.component.html
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/dictionary-api.service.spec.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/dictionary-api.service.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/dictionary.store.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/definition.model.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/dictionary-dashboard.state.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/dictionary.model.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/metaData.model.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/sources.model.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-header/dictionary-header.component.css [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-header/dictionary-header.component.html [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-header/dictionary-header.component.spec.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-header/dictionary-header.component.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-list/dictionary-list.component.css [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-list/dictionary-list.component.html [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-list/dictionary-list.component.spec.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-list/dictionary-list.component.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component.css [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component.html [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component.spec.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/filterby-tags/filterby-tags.component.css [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/filterby-tags/filterby-tags.component.html [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/filterby-tags/filterby-tags.component.spec.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/filterby-tags/filterby-tags.component.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/resource-dictionary-dashboard.component.css [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/resource-dictionary-dashboard.component.html [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/resource-dictionary-dashboard.component.spec.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/resource-dictionary-dashboard.component.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/search-dictionary/search-dictionary.component.css [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/search-dictionary/search-dictionary.component.html [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/search-dictionary/search-dictionary.component.spec.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/search-dictionary/search-dictionary.component.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component.css [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component.html [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component.spec.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-routing.module.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary.module.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.html
cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.ts
cds-ui/designer-client/src/app/modules/shared-modules/shared-modules.module.ts
cds-ui/designer-client/src/styles.css
ms/blueprintsprocessor/application/src/main/docker/Dockerfile
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt
ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
ms/command-executor/src/main/docker/Dockerfile
ms/command-executor/src/main/python/command_executor_handler.py
ms/py-executor/docker/Dockerfile
ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDtoTest.java [new file with mode: 0644]
ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerExceptionTest.java [new file with mode: 0644]
ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/util/FileUtilTest.java [new file with mode: 0644]
ms/sdclistener/distribution/src/main/docker/Dockerfile

index c6e42cb..2610dc5 100644 (file)
@@ -23,7 +23,10 @@ import {NgModule} from '@angular/core';
 import {Routes, RouterModule} from '@angular/router';
 
 const routes: Routes = [
-    {path: 'packages', loadChildren: './modules/feature-modules/packages/packages.module#PackagesModule'},
+    {path: 'packages',
+     loadChildren: './modules/feature-modules/packages/packages.module#PackagesModule'},
+    {path: 'resource-dictionary',
+     loadChildren: './modules/feature-modules/resource-dictionary/resource-dictionary.module#ResourceDictionaryModule'},
     // { path: '', component: MainAppComponent },
     {
         path: '',
index 9817edf..d6e9b36 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
 ============LICENSE_START==========================================
 ===================================================================
@@ -31,9 +30,10 @@ import {MatTabsModule} from '@angular/material/tabs';
 import {ApiService} from './common/core/services/api.service';
 import {HttpClientModule} from '@angular/common/http';
 import {PackagesModule} from './modules/feature-modules/packages/packages.module';
-import { SidebarModule } from 'ng-sidebar';
+import {SidebarModule} from 'ng-sidebar';
 import {SharedModulesModule} from './modules/shared-modules/shared-modules.module';
-import { NgxFileDropModule } from 'ngx-file-drop';
+import {NgxFileDropModule} from 'ngx-file-drop';
+import {ResourceDictionaryModule} from './modules/feature-modules/resource-dictionary/resource-dictionary.module';
 
 @NgModule({
     declarations: [
@@ -50,6 +50,8 @@ import { NgxFileDropModule } from 'ngx-file-drop';
         PackagesModule,
         SharedModulesModule,
         NgxFileDropModule,
+        ResourceDictionaryModule,
+        SidebarModule
     ],
 
     providers: [ApiService],
index 14cb001..e297485 100644 (file)
@@ -109,7 +109,10 @@ export const ResourceDictionaryURLs = {
     searchResourceDictionaryByNames: '/resourcedictionary/search/by-names',
     getSources: '/resourcedictionary/source-mapping',
     getModelType: '/resourcedictionary/model-type',
-    getResourceDictionary: '/resourcedictionary/model-type/by-definition'
+    getResourceDictionary: '/resourcedictionary/model-type/by-definition',
+    getMetaDatePageable: '/resourcedictionary/metadata/paged',
+    getDictionaryByName: '/resourcedictionary/by-name/',
+    getPagedDictionary: '/resourcedictionary/paged',
 };
 
 export const ControllerCatalogURLs = {
index 7305255..1ff03b2 100644 (file)
                             <a class="nav-item nav-link" id="nav-scripts-tab" data-toggle="tab" href="#nav-scripts"
                                 role="tab" aria-controls="nav-scripts" aria-selected="false">SCRIPTS</a>
                             <a class="nav-item nav-link" id="nav-imports-tab" data-toggle="tab" href="#nav-imports"
-                                role="tab" aria-controls="nav-imports" aria-selected="false">IMPORTS</a>
+                                role="tab" aria-controls="nav-imports" aria-selected="false">DEFINITIONS</a>
                             <a class="nav-item nav-link" id="nav-authentication-tab" data-toggle="tab"
                                 href="#nav-authentication" role="tab" aria-controls="nav-authentication"
                                 aria-selected="false">EXTERNAL SYSTEM AUTHENTICATION PROPERTIES</a>
index a67d12b..2c0400a 100644 (file)
@@ -1,3 +1,8 @@
+<ul class="defintionsNote">
+    <li><b>To add new property: </b></li>
+    <li>1. Use Copy and paste option or</li>
+    <li>2. Write them manually </li>
+</ul>
 <ace-editor [(text)]="dslDefinition.content" [mode]="'javascript'" [autoUpdateContent]="true"
     [durationBeforeCallback]="1000" (textChanged)="textChanged($event)" [theme]="'tomorrow_night_bright'" #editor style="height:300px;">
 </ace-editor>
index 3bb8b56..1253dc1 100644 (file)
@@ -64,7 +64,7 @@
                             <a class="nav-item nav-link" id="nav-scripts-tab" data-toggle="tab" href="#nav-scripts"
                                 role="tab" aria-controls="nav-scripts" aria-selected="false">SCRIPTS</a>
                             <a class="nav-item nav-link" id="nav-imports-tab" data-toggle="tab" href="#nav-imports"
-                                role="tab" aria-controls="nav-imports" aria-selected="false">IMPORTS</a>
+                                role="tab" aria-controls="nav-imports" aria-selected="false">DEFINITIONS</a>
                             <a class="nav-item nav-link" id="nav-authentication-tab" data-toggle="tab"
                                 href="#nav-authentication" role="tab" aria-controls="nav-authentication"
                                 aria-selected="false">EXTERNAL SYSTEM AUTHENTICATION PROPERTIES</a>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/dictionary-api.service.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/dictionary-api.service.spec.ts
new file mode 100644 (file)
index 0000000..0bf40e4
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { TestBed } from '@angular/core/testing';
+
+import { DictionaryApiService } from './dictionary-api.service';
+
+describe('DictionaryApiService', () => {
+  beforeEach(() => TestBed.configureTestingModule({}));
+
+  it('should be created', () => {
+    const service: DictionaryApiService = TestBed.get(DictionaryApiService);
+    expect(service).toBeTruthy();
+  });
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/dictionary-api.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/dictionary-api.service.ts
new file mode 100644 (file)
index 0000000..c253842
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { Injectable } from '@angular/core';
+import { DictionaryPage } from './model/dictionary.model';
+import { ApiService } from 'src/app/common/core/services/api.service';
+import { ResourceDictionaryURLs } from 'src/app/common/constants/app-constants';
+import { Observable } from 'rxjs';
+
+@Injectable({
+  providedIn: 'root'
+})
+export class DictionaryApiService {
+
+  constructor(private api: ApiService) { }
+
+  getPagedDictionary(pageNumber: number, pageSize: number, sortBy: string) {
+    return this.api.get(ResourceDictionaryURLs.getPagedDictionary, {
+      offset: pageNumber,
+      limit: pageSize,
+      sort: sortBy
+    });
+  }
+  getPagedDictionaryByKeyWord(keyWord: string, pageNumber: number, pageSize: number, sortBy: string) {
+    return this.api.get(ResourceDictionaryURLs.getMetaDatePageable + '/' + keyWord, {
+        offset: pageNumber,
+        limit: pageSize,
+        sort: sortBy
+    });
+  }
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/dictionary.store.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/dictionary.store.ts
new file mode 100644 (file)
index 0000000..a932327
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { Injectable } from '@angular/core';
+import { Store } from '../../../common/core/stores/Store';
+import { Observable, of } from 'rxjs';
+import { DictionaryDashboardState } from './model/dictionary-dashboard.state';
+import { DictionaryPage } from './model/dictionary.model';
+import { DictionaryApiService } from './dictionary-api.service';
+
+@Injectable({
+    providedIn: 'root'
+})
+export class DictionaryStore extends Store<DictionaryDashboardState> {
+    // TDOD fixed for now as there is no requirement to change it from UI
+    public pageSize = 5;
+    private dictionaryContent: DictionaryPage = new DictionaryPage();
+
+    constructor(private dictionaryServiceList: DictionaryApiService) {
+        super(new DictionaryDashboardState());
+    }
+
+    public search(command: string) {
+        if (command) {
+            this.searchPagedDictionary(command, 0, this.pageSize);
+        } else {
+            this.getPagedDictionary(0, this.pageSize);
+        }
+    }
+
+    public getAll() {
+        console.log('getting all packages...');
+        this.getPagedDictionary(0, this.pageSize);
+    }
+
+    public getPage(pageNumber: number, pageSize: number) {
+        if (this.isCommandExist()) {
+            this.searchPagedDictionary(this.state.command, pageNumber, pageSize);
+        } else {
+            this.getPagedDictionary(pageNumber, pageSize);
+        }
+    }
+
+    public sortPagedDictionary(sortBy: string) {
+        if (this.isCommandExist()) {
+            this.searchPagedDictionary(this.state.command, this.state.currentPage, this.pageSize, sortBy);
+        } else {
+            this.getPagedDictionary(this.state.currentPage, this.pageSize, sortBy);
+        }
+}
+
+    public filterByTags(tags: string[]) {
+        console.log(this.state.currentPage);
+        this.getPagedDictionaryByTags(this.state.command, this.state.currentPage,
+            this.pageSize, this.state.sortBy, tags);
+
+    }
+
+    protected getPagedDictionary(pageNumber: number, pageSize: number, sortBy: string = this.state.sortBy) {
+
+        this.dictionaryServiceList.getPagedDictionary(pageNumber, pageSize, sortBy)
+            .subscribe((pages: DictionaryPage) => {
+                console.log(pages);
+                this.setState({
+                    ...this.state,
+                    page: pages,
+                    filteredPackages: pages,
+                    command: '',
+                    totalPackages: pages.totalElements,
+                    currentPage: pageNumber,
+                    // this param is set only in get all as it represents the total number of pacakges in the server
+                    totalDictionariesWithoutSearchorFilters: pages.totalElements,
+                    tags: [],
+                    sortBy
+                });
+            });
+    }
+
+    private searchPagedDictionary(keyWord: string, pageNumber: number, pageSize: number, sortBy: string = this.state.sortBy) {
+        this.dictionaryServiceList.getPagedDictionaryByKeyWord(keyWord, pageNumber, pageSize, sortBy)
+            .subscribe((pages: DictionaryPage) => {
+                console.log(pages);
+                this.setState({
+                    ...this.state,
+                    page: pages,
+                    filteredPackages: pages,
+                    command: keyWord,
+                    totalPackages: pages.totalElements,
+                    currentPage: pageNumber,
+                    tags: [],
+                    sortBy
+                });
+            });
+    }
+
+    private isCommandExist() {
+        return this.state.command;
+    }
+
+    private getPagedDictionaryByTags(keyWord: string, currentPage1: number, pageSize: number, sortBy1: string, tagsSearchable: string[]) {
+        this.getPagedDictionaryByKeyWordFilteredByTags(tagsSearchable)
+            .subscribe((pages: DictionaryPage) => {
+                this.setState({
+                    ...this.state,
+                    page: this.state.page,
+                    filteredPackages: pages,
+                    command: keyWord,
+                    tags: tagsSearchable,
+                    currentPage: currentPage1,
+                    sortBy: sortBy1,
+                    totalPackages: this.state.page.totalElements,
+                });
+            });
+    }
+
+    private getPagedDictionaryByKeyWordFilteredByTags(tagsSearchable: string[]): Observable<any> {
+        this.dictionaryContent.content = [];
+        if (tagsSearchable && tagsSearchable.length !== 0 && !tagsSearchable.includes('All')) {
+            tagsSearchable.forEach(tag => {
+                if (tag) {
+                    this.state.page.content.forEach(dictionaryModel => {
+                        if (tag.endsWith(',')) {
+                            tag = tag.replace(',', '');
+                        }
+                        dictionaryModel.tags.split(',').forEach(dictionaryModelTag => {
+                            if (dictionaryModelTag === tag) {
+                                this.dictionaryContent.content.push(dictionaryModel);
+                            }
+                        });
+                    });
+                } else {
+                    this.getPagedDictionary(this.state.currentPage, this.pageSize);
+                    return of(this.state.page);
+                }
+            });
+            this.dictionaryContent.content = this.dictionaryContent.content.filter((value, index, self) => self.indexOf(value) === index);
+            console.log('the lenght is ' + this.dictionaryContent.content.length);
+            return of(this.dictionaryContent);
+        } else {
+            this.getPagedDictionary(this.state.currentPage, this.pageSize);
+            return of(this.state.page);
+        }
+    }
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/definition.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/definition.model.ts
new file mode 100644 (file)
index 0000000..96d188a
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { Sources } from './sources.model';
+
+export class Definition {
+    tag: string;
+    name: string;
+    property: string;
+    updatedBy: string;
+    sources: Sources[];
+
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/dictionary-dashboard.state.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/dictionary-dashboard.state.ts
new file mode 100644 (file)
index 0000000..d0a0be1
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { DictionaryPage } from './dictionary.model';
+
+export class DictionaryDashboardState {
+
+    page: DictionaryPage;
+    filteredPackages: DictionaryPage;
+    command: string;
+    currentPage = 0;
+    totalPackages: number;
+    tags: string[];
+    sortBy = 'DATE';
+    totalDictionariesWithoutSearchorFilters: number;
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/dictionary.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/dictionary.model.ts
new file mode 100644 (file)
index 0000000..0f54f4a
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { Page } from 'src/app/common/model/page';
+
+export class DictionaryModel {
+
+    public name: string;
+    public tags: string;
+    public dataType: string;
+    public description: string;
+    public entrySchema: string;
+    public updatedBy: string;
+    public createdDate: string;
+    public definition: object;
+}
+
+export class DictionaryPage extends Page<DictionaryModel> {
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/metaData.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/metaData.model.ts
new file mode 100644 (file)
index 0000000..e4b9be7
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+export class MetaData {
+    public name: string;
+    public tags: string;
+    public dataType: string;
+    public description: string;
+    public entrySchema: string;
+    public updatedBy: string;
+    public createdDate: string;
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/sources.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/model/sources.model.ts
new file mode 100644 (file)
index 0000000..4074e51
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+export class Sources {
+    sources: [];
+
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-header/dictionary-header.component.css b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-header/dictionary-header.component.css
new file mode 100644 (file)
index 0000000..f263c00
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
\ No newline at end of file
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-header/dictionary-header.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-header/dictionary-header.component.html
new file mode 100644 (file)
index 0000000..fc08ebe
--- /dev/null
@@ -0,0 +1,30 @@
+<!-- /*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/ -->
+
+<header class="page-title">
+    <div class="row">
+        <h2 class="col m-0">Resource Dictionary
+            <span id="numberOfPackages">({{numberOfDD}} DD)</span>
+        </h2>
+        <div class="col">
+        </div>
+    </div>
+</header>
+
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-header/dictionary-header.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-header/dictionary-header.component.spec.ts
new file mode 100644 (file)
index 0000000..46888ef
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { DictionaryHeaderComponent } from './dictionary-header.component';
+
+describe('DictionaryHeaderComponent', () => {
+  let component: DictionaryHeaderComponent;
+  let fixture: ComponentFixture<DictionaryHeaderComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ DictionaryHeaderComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(DictionaryHeaderComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-header/dictionary-header.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-header/dictionary-header.component.ts
new file mode 100644 (file)
index 0000000..364c71f
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { Component, OnInit } from '@angular/core';
+import { DictionaryStore } from '../../dictionary.store';
+
+@Component({
+  selector: 'app-dictionary-header',
+  templateUrl: './dictionary-header.component.html',
+  styleUrls: ['./dictionary-header.component.css']
+})
+export class DictionaryHeaderComponent implements OnInit {
+
+  numberOfDD: number;
+
+  constructor(private dictionaryStore: DictionaryStore) {
+    this.dictionaryStore.state$
+      .subscribe(state => {
+        this.numberOfDD = state.totalDictionariesWithoutSearchorFilters;
+      });
+   }
+  ngOnInit() {
+  }
+
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-list/dictionary-list.component.css b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-list/dictionary-list.component.css
new file mode 100644 (file)
index 0000000..f263c00
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
\ No newline at end of file
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-list/dictionary-list.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-list/dictionary-list.component.html
new file mode 100644 (file)
index 0000000..1cedeeb
--- /dev/null
@@ -0,0 +1,90 @@
+<!-- /*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/ -->
+
+<div class="row packages-card">
+    <div class="col-lg-3 col-md-6 d-flex">
+        <!--Add Package Card-->
+        <div class="card addPaackage-card">
+            <div class="card-body text-center">
+                <img src="/assets/img/icon-addPackage.svg" width="40%">
+            </div>
+            <div class="card-footer row">
+                <div class="col text-center">
+                    <a routerLink="/resource-dictionary/createDictionary" role="button" aria-pressed="true"
+                        class="btn-create-package float"><i class="icon-create-white" aria-hidden="true"></i>Create Package
+                    </a>
+                    <br/>
+                    <a href="#" role="button" aria-pressed="true" class="btn-import-package float mb-3"><i class="icon-import-blue" aria-hidden="true"></i>Import Package
+                    </a> 
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="col-lg-3 col-md-6 d-flex" *ngFor="let dictionary of viewedDictionary">
+        <!--Card 1-->
+        <div>
+            <div class="card">
+                <div class="card-body">
+                    <div class="row">
+                        <div class="col-9 pr-0">
+                            <a class="card-title" [routerLink]="['/dictionary/dictionaryByName', dictionary.name]"
+                                (click)="testDispatch(dictionary)">
+                                <!-- <img class="icon-deployed" src="/assets/img/icon-deploy.svg"> -->
+                                {{dictionary.name}}
+                            </a>
+                        </div>
+                        <div class="col-3">
+
+                            <div class="dropdown">
+                                <input class="dropdown-toggle" type="text">
+                                <div class="dropdown-text">
+                                    <!-- <img src="/assets/img/icon-menuDots.svg" title="Actions"> -->
+                                    <i class="icon-menuDots" aria-hidden="true"></i>
+                                </div>
+                                <ul class="dropdown-content">
+                                    <li class="action-clone">
+                                        <a href="#">
+                                            <i class="icon-clone-sm" aria-hidden="true"></i>
+                                            Clone
+                                        </a>
+                                    </li>
+                                    <li class="action-delete">
+                                        <a href="#">
+                                            <i class="icon-delete-sm" aria-hidden="true"></i>
+                                            Delete
+                                        </a>
+                                    </li>
+                                </ul>
+                            </div>
+
+                        </div>
+                    </div>
+                    <div class="row">
+                        <div class="col">
+                            <p class="mb-0">Last modified {{ dictionary.createdDate | date:'short' }}
+                            </p>
+                            <p class="mb-2">By {{dictionary.updatedBy}}</p>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-list/dictionary-list.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-list/dictionary-list.component.spec.ts
new file mode 100644 (file)
index 0000000..18b5f2b
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { DictionaryListComponent } from './dictionary-list.component';
+
+describe('DictionaryListComponent', () => {
+  let component: DictionaryListComponent;
+  let fixture: ComponentFixture<DictionaryListComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ DictionaryListComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(DictionaryListComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-list/dictionary-list.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-list/dictionary-list.component.ts
new file mode 100644 (file)
index 0000000..7c4c991
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { Component, OnInit } from '@angular/core';
+import { DictionaryModel } from '../../model/dictionary.model';
+import { DictionaryStore } from '../../dictionary.store';
+
+@Component({
+  selector: 'app-dictionary-list',
+  templateUrl: './dictionary-list.component.html',
+  styleUrls: ['./dictionary-list.component.css']
+})
+export class DictionaryListComponent implements OnInit {
+  viewedDictionary: DictionaryModel[] = [];
+
+  constructor(private dictionaryStore: DictionaryStore) {
+      console.log('DictionaryListComponent');
+      this.dictionaryStore.state$.subscribe(state => {
+          console.log(state);
+          if (state.filteredPackages) {
+              this.viewedDictionary = state.filteredPackages.content;
+          }
+      });
+  }
+
+  ngOnInit() {
+      this.dictionaryStore.getAll();
+  }
+
+  testDispatch(dictionary: DictionaryModel) {
+      console.log(dictionary.name);
+  }
+
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component.css b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component.css
new file mode 100644 (file)
index 0000000..f263c00
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
\ No newline at end of file
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component.html
new file mode 100644 (file)
index 0000000..8909ef4
--- /dev/null
@@ -0,0 +1,25 @@
+<!-- /*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/ -->
+
+<div class="col package-paginator pr-0">
+    <ngb-pagination [collectionSize]="totalCount" [(page)]="pageNumber" [pageSize]="pageSize" class="float-right"
+        (pageChange)="getPageFromService($event)">
+    </ngb-pagination>
+</div>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component.spec.ts
new file mode 100644 (file)
index 0000000..e9a95ff
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { DictionaryPaginationComponent } from './dictionary-pagination.component';
+
+describe('DictionaryPaginationComponent', () => {
+  let component: DictionaryPaginationComponent;
+  let fixture: ComponentFixture<DictionaryPaginationComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ DictionaryPaginationComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(DictionaryPaginationComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component.ts
new file mode 100644 (file)
index 0000000..1cd4e2e
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { Component, OnInit } from '@angular/core';
+import { DictionaryStore } from '../../dictionary.store';
+
+@Component({
+  selector: 'app-dictionary-pagination',
+  templateUrl: './dictionary-pagination.component.html',
+  styleUrls: ['./dictionary-pagination.component.css']
+})
+export class DictionaryPaginationComponent implements OnInit {
+
+  pageNumber: number;
+  totalCount: number;
+  pageSize: number;
+  previousPage: number;
+
+  constructor(private dictionaryStore: DictionaryStore) {
+      this.pageSize = dictionaryStore.pageSize;
+
+      this.dictionaryStore.state$
+          .subscribe(state => {
+              this.pageNumber = state.currentPage;
+              this.totalCount = state.totalPackages;
+          });
+  }
+
+  ngOnInit() {
+  }
+
+  public getPageFromService(page) {
+      console.log('getPageFromService', page);
+      if (isNaN(page)) {
+          page = 1;
+          console.log('page change to first...', page);
+      }
+      if (this.previousPage !== page) {
+          this.dictionaryStore.getPage(page - 1, this.dictionaryStore.pageSize);
+          this.previousPage = page;
+      }
+  }
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/filterby-tags/filterby-tags.component.css b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/filterby-tags/filterby-tags.component.css
new file mode 100644 (file)
index 0000000..f263c00
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
\ No newline at end of file
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/filterby-tags/filterby-tags.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/filterby-tags/filterby-tags.component.html
new file mode 100644 (file)
index 0000000..f8f3784
--- /dev/null
@@ -0,0 +1,38 @@
+<!-- /*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/ -->
+
+<div class="dropdown packagesFilter w-100">
+    <input class="dropdown-toggle" type="text">
+    <div class="dropdown-text">{{checkBoxTages.substr(0,checkBoxTages.length-1)}}</div>
+    <ul class="dropdown-content w-100">
+        <li>
+            <div class="form-group">
+                <input type="text" (input)="reloadChanges($event)" class="form-control" placeholder="Search By Tag" autofocus>
+            </div>
+        </li>
+        <li *ngFor="let tag of viewedTags">
+            <div class="custom-control custom-checkbox">
+                <input type="checkbox" (click)="reloadDictionary($event)" class="custom-control-input" id={{tag}}>
+                <label class="custom-control-label" for={{tag}}>{{tag}}</label>
+            </div>
+        </li>
+        <li class="reset-filter"><a href="">Reset filter</a></li>
+    </ul>
+</div>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/filterby-tags/filterby-tags.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/filterby-tags/filterby-tags.component.spec.ts
new file mode 100644 (file)
index 0000000..f83470f
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { FilterbyTagsComponent } from './filterby-tags.component';
+
+describe('FilterbyTagsComponent', () => {
+  let component: FilterbyTagsComponent;
+  let fixture: ComponentFixture<FilterbyTagsComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ FilterbyTagsComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(FilterbyTagsComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/filterby-tags/filterby-tags.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/filterby-tags/filterby-tags.component.ts
new file mode 100644 (file)
index 0000000..bdf6bd1
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { Component, OnInit } from '@angular/core';
+import { DictionaryModel, DictionaryPage } from '../../model/dictionary.model';
+import { DictionaryStore } from '../../dictionary.store';
+
+@Component({
+  selector: 'app-filterby-tags',
+  templateUrl: './filterby-tags.component.html',
+  styleUrls: ['./filterby-tags.component.css']
+})
+export class FilterbyTagsComponent implements OnInit {
+  page: DictionaryPage;
+  tags: string[] = [];
+  viewedTags: string[] = [];
+  searchTag = '';
+  viewedDictionary: DictionaryModel[] = [];
+  private checkBoxTages = '';
+  currentPage = 0;
+
+  constructor(private dictionaryStore: DictionaryStore) {
+      this.dictionaryStore.state$.subscribe(state => {
+          console.log(state);
+          if (state.page) {
+              this.viewedDictionary = state.page.content;
+              this.tags = [];
+              if (state.currentPage !== this.currentPage) {
+                  this.checkBoxTages = '';
+                  this.currentPage = state.currentPage;
+              }
+              this.viewedDictionary.forEach(element => {
+                  element.tags.split(',').forEach(tag => {
+                      this.tags.push(tag.trim());
+                  });
+                  this.tags.push('All');
+                  this.tags = this.tags.filter((value, index, self) => self.indexOf(value) === index);
+                  this.assignTags();
+              });
+          }
+      });
+  }
+
+  ngOnInit() {
+
+  }
+
+  reloadChanges(event: any) {
+      this.searchTag = event.target.value;
+      this.filterItem(this.searchTag);
+  }
+
+  private assignTags() {
+      this.viewedTags = this.tags;
+  }
+
+  private filterItem(value) {
+      if (!value) {
+          this.assignTags();
+      }
+      this.viewedTags = this.tags.filter(
+          item => item.toLowerCase().indexOf(value.toLowerCase()) > -1
+      );
+  }
+
+  reloadDictionary(event: any) {
+      if (!event.target.checked) {
+          this.checkBoxTages = this.checkBoxTages.replace(event.target.id + ',', '')
+              .replace(event.target.id, '');
+      } else {
+          this.checkBoxTages += event.target.id.trim() + ',';
+      }
+      const tagsSelected = this.checkBoxTages.split(',').filter(item => {
+          if (item) {
+              return true;
+          }
+      }).map((item) => {
+          return item.trim();
+      });
+      this.dictionaryStore.filterByTags(tagsSelected);
+  }
+
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/resource-dictionary-dashboard.component.css b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/resource-dictionary-dashboard.component.css
new file mode 100644 (file)
index 0000000..f263c00
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
\ No newline at end of file
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/resource-dictionary-dashboard.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/resource-dictionary-dashboard.component.html
new file mode 100644 (file)
index 0000000..1d435db
--- /dev/null
@@ -0,0 +1,59 @@
+<!-- /*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/ -->
+
+<app-header>
+</app-header>
+<div class="new-wrapper">
+    <div class="container-fluid main-container">
+        <app-dictionary-header></app-dictionary-header>
+        <div class="container-fluid body-container">
+            <nav class="row">
+                <!--Nav Tabs-->
+                <div class="col pr-0">
+                    <div class="nav nav-tabs " id="nav-tab" role="tablist">
+                        <a class="nav-item nav-link active" id="nav-home-tab" data-toggle="tab" href="#nav-home"
+                           role="tab" aria-controls="nav-home"
+                           aria-selected="true">All</a>
+                        <a class="nav-item nav-link" id="nav-profile-tab" data-toggle="tab" href="#nav-profile"
+                           role="tab" aria-controls="nav-profile"
+                           aria-selected="false">ATT</a>
+                        <a class="nav-item nav-link" id="nav-contact-tab" data-toggle="tab" href="#nav-contact"
+                           role="tab" aria-controls="nav-contact"
+                           aria-selected="false">OPEN CONFIG</a>
+                    </div>
+                </div>
+                <!--Nav Search & Filter-->
+                <div class="col search-filter-col">
+                    <div class="row">
+                        <div class="col-7">
+                            <app-search-dictionary></app-search-dictionary>
+                        </div>
+                        <div class="col-5 pl-2">
+                            <app-filterby-tags class="w-100"></app-filterby-tags> 
+                        </div>
+
+                    </div>
+                </div>
+            </nav>
+            <app-sort-dictionary></app-sort-dictionary>
+        </div>
+    </div>
+</div>
+
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/resource-dictionary-dashboard.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/resource-dictionary-dashboard.component.spec.ts
new file mode 100644 (file)
index 0000000..bb821f3
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ResourceDictionaryDashboardComponent } from './resource-dictionary-dashboard.component';
+
+describe('ResourceDictionaryDashboardComponent', () => {
+  let component: ResourceDictionaryDashboardComponent;
+  let fixture: ComponentFixture<ResourceDictionaryDashboardComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ ResourceDictionaryDashboardComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(ResourceDictionaryDashboardComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/resource-dictionary-dashboard.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/resource-dictionary-dashboard.component.ts
new file mode 100644 (file)
index 0000000..8a64b92
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+  selector: 'app-resource-dictionary-dashboard',
+  templateUrl: './resource-dictionary-dashboard.component.html',
+  styleUrls: ['./resource-dictionary-dashboard.component.css']
+})
+export class ResourceDictionaryDashboardComponent implements OnInit {
+
+  constructor() { }
+
+  ngOnInit() {
+    console.log('ResourceDictionaryDashboardComponent');
+  }
+
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/search-dictionary/search-dictionary.component.css b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/search-dictionary/search-dictionary.component.css
new file mode 100644 (file)
index 0000000..f263c00
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
\ No newline at end of file
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/search-dictionary/search-dictionary.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/search-dictionary/search-dictionary.component.html
new file mode 100644 (file)
index 0000000..80f980b
--- /dev/null
@@ -0,0 +1,24 @@
+<!-- /*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/ -->
+
+<div class="searchBox">
+    <input class="searchInput" [ngClass]="{'searchBox-expanded': searchQuery}" (input)="searchDictionary($event)" type="text" name="" placeholder="Search Dictionary">
+    <button class="searchButton" href="#"></button>
+</div>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/search-dictionary/search-dictionary.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/search-dictionary/search-dictionary.component.spec.ts
new file mode 100644 (file)
index 0000000..7096404
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SearchDictionaryComponent } from './search-dictionary.component';
+
+describe('SearchDictionaryComponent', () => {
+  let component: SearchDictionaryComponent;
+  let fixture: ComponentFixture<SearchDictionaryComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ SearchDictionaryComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(SearchDictionaryComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/search-dictionary/search-dictionary.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/search-dictionary/search-dictionary.component.ts
new file mode 100644 (file)
index 0000000..76e40cf
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { Component, OnInit } from '@angular/core';
+import { DictionaryStore } from '../../dictionary.store';
+
+@Component({
+  selector: 'app-search-dictionary',
+  templateUrl: './search-dictionary.component.html',
+  styleUrls: ['./search-dictionary.component.css']
+})
+export class SearchDictionaryComponent implements OnInit {
+  private searchQuery = '';
+  constructor(private dictionaryStore: DictionaryStore) {
+  }
+
+  ngOnInit() {
+  }
+  searchDictionary(event: any) {
+      this.searchQuery = event.target.value;
+      this.searchQuery = this.searchQuery.trim();
+      this.dictionaryStore.search(this.searchQuery);
+  }
+
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component.css b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component.css
new file mode 100644 (file)
index 0000000..f263c00
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
\ No newline at end of file
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component.html
new file mode 100644 (file)
index 0000000..cc55f6c
--- /dev/null
@@ -0,0 +1,52 @@
+<!-- /*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/ -->
+
+<div class="row mt-4">
+    <div class="col">
+        <div class="tab-content" id="nav-tabContent">
+            <div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab">
+                <div class="row">
+                    <!--Dictionary Sort-->
+                    <div class="col sort-packages">
+                        Sort by:
+                        <div class="dropdown">
+                            <input class="dropdown-toggle" type="text">
+                            <div class="dropdown-text">{{selected}}</div>
+                            <ul class="dropdown-content">
+                                <li  *ngFor="let sortType of sortTypes">
+                                    <a (click)="sortDictionary($event)" name={{sortType}}>{{sortType}}</a>
+                                </li>
+                                
+                            </ul>
+                        </div>
+                    </div>
+                    <!--Dictionary Paginator-->
+                    <app-dictionary-pagination></app-dictionary-pagination>
+                </div>
+                <app-dictionary-list></app-dictionary-list>
+
+            </div>
+            <div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab">...</div>
+            <div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-contact-tab">...</div>
+        </div>
+    </div>
+</div>
+
+
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component.spec.ts
new file mode 100644 (file)
index 0000000..54b1038
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SortDictionaryComponent } from './sort-dictionary.component';
+
+describe('SortDictionaryComponent', () => {
+  let component: SortDictionaryComponent;
+  let fixture: ComponentFixture<SortDictionaryComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ SortDictionaryComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(SortDictionaryComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component.ts
new file mode 100644 (file)
index 0000000..61c334a
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { Component, OnInit } from '@angular/core';
+import { DictionaryStore } from '../../dictionary.store';
+
+@Component({
+  selector: 'app-sort-dictionary',
+  templateUrl: './sort-dictionary.component.html',
+  styleUrls: ['./sort-dictionary.component.css']
+})
+export class SortDictionaryComponent implements OnInit {
+  sortTypes: string[];
+  selected: string;
+
+  constructor(private dictionaryStore: DictionaryStore) {
+      this.sortTypes = Object.keys(SortByToServerValue);
+      this.selected = 'Recent';
+  }
+
+  ngOnInit() {
+  }
+
+  sortDictionary(event: any) {
+      const key = event.target.name;
+      console.log(key);
+      this.selected = key;
+      this.dictionaryStore.sortPagedDictionary(SortByToServerValue[key]);
+  }
+
+}
+
+enum SortByToServerValue {
+    Recent = 'DATE',
+    Name = 'NAME',
+
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-routing.module.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary-routing.module.ts
new file mode 100644 (file)
index 0000000..eb29c4c
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+import { ResourceDictionaryDashboardComponent } from './resource-dictionary-dashboard/resource-dictionary-dashboard.component';
+
+const routes: Routes = [
+  {
+    path: '',
+    component: ResourceDictionaryDashboardComponent
+  }
+];
+
+@NgModule({
+  imports: [RouterModule.forChild(routes)],
+  exports: [RouterModule]
+})
+export class ResourceDictionaryRoutingModule { }
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary.module.ts b/cds-ui/designer-client/src/app/modules/feature-modules/resource-dictionary/resource-dictionary.module.ts
new file mode 100644 (file)
index 0000000..5bd6710
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright (C) 2020 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/
+
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { NgbPaginationModule } from '@ng-bootstrap/ng-bootstrap';
+import { SidebarModule } from 'ng-sidebar';
+import { FormsModule } from '@angular/forms';
+import { NgxFileDropModule } from 'ngx-file-drop';
+import { AceEditorModule } from 'ng2-ace-editor';
+import { DataTablesModule } from 'angular-datatables';
+
+import { ResourceDictionaryRoutingModule } from './resource-dictionary-routing.module';
+import { ResourceDictionaryDashboardComponent } from './resource-dictionary-dashboard/resource-dictionary-dashboard.component';
+import { DictionaryHeaderComponent } from './resource-dictionary-dashboard/dictionary-header/dictionary-header.component';
+import { SearchDictionaryComponent } from './resource-dictionary-dashboard/search-dictionary/search-dictionary.component';
+import { FilterbyTagsComponent } from './resource-dictionary-dashboard/filterby-tags/filterby-tags.component';
+import { SortDictionaryComponent } from './resource-dictionary-dashboard/sort-dictionary/sort-dictionary.component';
+import { DictionaryPaginationComponent } from './resource-dictionary-dashboard/dictionary-pagination/dictionary-pagination.component';
+import { SharedModulesModule } from '../../shared-modules/shared-modules.module';
+import { DictionaryListComponent } from './resource-dictionary-dashboard/dictionary-list/dictionary-list.component';
+
+@NgModule({
+  declarations: [
+    ResourceDictionaryDashboardComponent,
+    DictionaryHeaderComponent,
+    SearchDictionaryComponent,
+    FilterbyTagsComponent,
+    SortDictionaryComponent,
+    DictionaryPaginationComponent,
+    DictionaryListComponent,
+  ],
+  imports: [
+    CommonModule,
+    ResourceDictionaryRoutingModule,
+    NgbPaginationModule,
+    SharedModulesModule,
+    SidebarModule.forRoot(),
+    FormsModule,
+    NgxFileDropModule,
+    AceEditorModule,
+    DataTablesModule,
+  ]
+})
+export class ResourceDictionaryModule { }
index 4b1c17e..bfccac7 100644 (file)
@@ -5,17 +5,18 @@
     <div class="overflow-container">
       <ul class="menu-dropdown">
         <li class="active">
-          <a (click)="redirect()" routerLink="/packages">Packages</a>
+          <a routerLink="/packages">Packages</a>
           <span class="icon">
             <!-- <i class="fa fa-dashboard"></i> -->
             <i class="icon-nav-packages"></i>
           </span>
         </li>
-        <li class="menu-hasdropdown">
-          <a >Data Dictionary</a>
+        <li>
+          <a routerLink="/resource-dictionary">Resource Dictionary</a>
           <span class="icon">
             <i class="icon-nav-dictionary"></i>
           </span>
+        </li>
           <!-- <label title="toggle menu" for="settings">
             <span class="downarrow">
               <i class="fa fa-caret-down"></i>
index db87f8f..38e3685 100644 (file)
@@ -13,8 +13,7 @@ export class HeaderComponent implements OnInit {
   ngOnInit() {
   }
 
-  redirect() {
-    this.router.navigate(['/packages']);
-  }
-
+  // redirect() {
+  //   this.router.navigate(['/packages']);
+  // }
 }
index 6b6d396..7229891 100644 (file)
@@ -1,13 +1,14 @@
 import { NgModule } from '@angular/core';
 import { CommonModule } from '@angular/common';
 import { HeaderComponent } from './header/header.component';
-
-
+import { RouterModule } from '@angular/router';
 
 @NgModule({
   declarations: [HeaderComponent],
   imports: [
-    CommonModule
-  ], exports : [HeaderComponent]
+    CommonModule,
+    RouterModule,
+  ],
+  exports : [HeaderComponent]
 })
 export class SharedModulesModule { }
index b70264b..b44a362 100644 (file)
@@ -1247,11 +1247,14 @@ ul.package-contributers{
   background: transparent !important;
   border-top-color: #F7F6F6 !important;
 }
+.packages-card .card-footer .col{
+  text-align: center;
+}
 .packages-card .card-footer .col:first-child{
   border-right: solid 1px #F7F6F6;
 }
 .packages-card .card-footer .btn{
-  padding: 10px 5px 10px 0 !important;
+  padding: 10px 0 10px 0 !important;
   background-color: transparent !important;
   color: #1B3E6F !important;
   border: 0;
@@ -2422,6 +2425,14 @@ margin-right: 5px;
   font-size: 20px;
   /* margin-right: 20px; */
 }
+.defintionsNote{
+  padding-left: 0;
+}
+.defintionsNote li{
+  line-height: 24px;
+  list-style: none;
+  font-size: 13px;
+}
 .package-name-container{
   width: calc(100% - 60px);
   display: inline-block;
index 1035915..042041e 100755 (executable)
@@ -9,9 +9,14 @@ FROM omahoco1/alpine-java-python
 
 # add entrypoint
 COPY startService.sh /startService.sh
+RUN addgroup -S onap && adduser -S onap -G onap
+RUN chown onap:onap /startService.sh
 RUN chmod 777 /startService.sh && dos2unix /startService.sh
 
 # add application
 COPY --from=extractor /opt /opt
+RUN mkdir /opt/app/onap/blueprints
+RUN chown onap:onap /opt -R
+USER onap
 
 ENTRYPOINT [ "/startService.sh" ]
index a0fa97b..2640b5b 100644 (file)
@@ -107,7 +107,7 @@ open class DatabaseResourceAssignmentProcessor(
             "DatabaseResource ($dSource) dictionary information: " +
                     "Query:($sql), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
         )
-        val jdbcTemplate = blueprintDBLibService(sourceProperties)
+        val jdbcTemplate = blueprintDBLibService(sourceProperties, dSource)
 
         val rows = jdbcTemplate.query(sql, populateNamedParameter(inputKeyMapping))
         if (rows.isNullOrEmpty()) {
@@ -117,12 +117,12 @@ open class DatabaseResourceAssignmentProcessor(
         }
     }
 
-    private fun blueprintDBLibService(sourceProperties: DatabaseResourceSource): BluePrintDBLibGenericService {
+    private fun blueprintDBLibService(sourceProperties: DatabaseResourceSource, selector: String): BluePrintDBLibGenericService {
         return if (isNotEmpty(sourceProperties.endpointSelector)) {
             val dbPropertiesJson = raRuntimeService.resolveDSLExpression(sourceProperties.endpointSelector!!)
             bluePrintDBLibPropertyService.JdbcTemplate(dbPropertiesJson)
         } else {
-            primaryDBLibGenericService
+            bluePrintDBLibPropertyService.JdbcTemplate(selector)
         }
     }
 
index 0d737f4..6370319 100644 (file)
@@ -66,7 +66,7 @@ class DBLibConstants {
 
         // list of database
         const val MARIA_DB: String = "maria-db"
-        const val PRIMARY_DB: String = "processor-db"
+        const val PROCESSOR_DB: String = "processor-db"
         const val MYSQL_DB: String = "mysql-db"
         const val ORACLE_DB: String = "oracle-db"
         const val POSTGRES_DB: String = "postgres-db"
index 35baf93..e686e83 100644 (file)
@@ -20,10 +20,11 @@ import com.fasterxml.jackson.databind.JsonNode
 import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
 import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibGenericService
 import org.onap.ccsdk.cds.blueprintsprocessor.db.DBDataSourceProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.db.DBLibConstants
+import org.onap.ccsdk.cds.blueprintsprocessor.db.DBLibConstants.Companion.MARIA_DB
+import org.onap.ccsdk.cds.blueprintsprocessor.db.DBLibConstants.Companion.MYSQL_DB
+import org.onap.ccsdk.cds.blueprintsprocessor.db.DBLibConstants.Companion.PROCESSOR_DB
 import org.onap.ccsdk.cds.blueprintsprocessor.db.MariaDataSourceProperties
 import org.onap.ccsdk.cds.blueprintsprocessor.db.MySqlDataSourceProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
 import org.springframework.stereotype.Service
@@ -31,79 +32,45 @@ import org.springframework.stereotype.Service
 @Service
 class BluePrintDBLibPropertyService(private var bluePrintPropertiesService: BluePrintPropertiesService) {
 
-    fun JdbcTemplate(jsonNode: JsonNode): BluePrintDBLibGenericService {
-        val dBConnetionProperties = dBDataSourceProperties(jsonNode)
-        return blueprintDBDataSourceService(dBConnetionProperties)
-    }
+    fun JdbcTemplate(jsonNode: JsonNode): BluePrintDBLibGenericService =
+            blueprintDBDataSourceService(dBDataSourceProperties(jsonNode))
 
-    fun JdbcTemplate(selector: String): BluePrintDBLibGenericService {
-        val prefix = "blueprintsprocessor.db.$selector"
-        val dBConnetionProperties = dBDataSourceProperties(prefix)
-        return blueprintDBDataSourceService(dBConnetionProperties)
-    }
+    fun JdbcTemplate(selector: String): BluePrintDBLibGenericService =
+            blueprintDBDataSourceService(dBDataSourceProperties("blueprintsprocessor.db.$selector"))
 
-    private fun dBDataSourceProperties(jsonNode: JsonNode): DBDataSourceProperties {
-        val type = jsonNode.get("type").textValue()
-        return when (type) {
-            DBLibConstants.MYSQL_DB -> {
-                JacksonUtils.readValue(jsonNode, MySqlDataSourceProperties::class.java)!!
-            }
-            DBLibConstants.MARIA_DB -> {
-                JacksonUtils.readValue(jsonNode, MariaDataSourceProperties::class.java)!!
-            }
-            else -> {
-                throw BluePrintProcessorException("Rest adaptor($type) is not supported")
-            }
-        }
-    }
+    private fun dBDataSourceProperties(jsonNode: JsonNode): DBDataSourceProperties =
+            when (val type = jsonNode.get("type").textValue()) {
+                MYSQL_DB -> JacksonUtils.readValue(jsonNode, MySqlDataSourceProperties::class.java)
+                MARIA_DB -> JacksonUtils.readValue(jsonNode, MariaDataSourceProperties::class.java)
+                else -> {
+                    throw BluePrintProcessorException(
+                            "DB type ($type) is not supported. Valid types: $MARIA_DB, $MYSQL_DB")
+                }
+            }!!
 
-    private fun dBDataSourceProperties(prefix: String): DBDataSourceProperties {
-        val type = bluePrintPropertiesService.propertyBeanType("$prefix.type", String::class.java)
-        return when (type) {
-            DBLibConstants.MARIA_DB -> {
-                mariaDBConnectionProperties(prefix)
-            }
-            DBLibConstants.MYSQL_DB -> {
-                mySqlDBConnectionProperties(prefix)
-            }
-            DBLibConstants.ORACLE_DB -> {
-                TODO("not implemented")
-            }
-            DBLibConstants.POSTGRES_DB -> {
-                TODO("not implemented")
+    private fun dBDataSourceProperties(prefix: String): DBDataSourceProperties =
+            bluePrintPropertiesService.propertyBeanType("$prefix.type", String::class.java).let {
+                return when (it) {
+                    MARIA_DB, PROCESSOR_DB -> mariaDBConnectionProperties(prefix)
+                    MYSQL_DB -> mySqlDBConnectionProperties(prefix)
+                    else -> {
+                        throw BluePrintProcessorException(
+                                "DB type ($it) is not supported. Valid types: $MARIA_DB, $MYSQL_DB, $PROCESSOR_DB")
+                    }
+                }
             }
-            DBLibConstants.PRIMARY_DB -> {
-                primaryDBConnectionProperties(prefix)
-            }
-            else -> {
-                throw BluePrintProcessorException("Rest adaptor($type) is not supported")
-            }
-        }
-    }
 
-    private fun blueprintDBDataSourceService(dBConnetionProperties: DBDataSourceProperties): BluePrintDBLibGenericService {
-        when (dBConnetionProperties) {
-            is MariaDataSourceProperties -> {
-                return MariaDatabaseConfiguration(dBConnetionProperties)
-            }
-            is MySqlDataSourceProperties -> {
-                return MySqlDatabaseConfiguration(dBConnetionProperties)
+    private fun blueprintDBDataSourceService(dBConnetionProperties: DBDataSourceProperties): BluePrintDBLibGenericService =
+            when (dBConnetionProperties) {
+                is MariaDataSourceProperties -> MariaDatabaseConfiguration(dBConnetionProperties)
+                is MySqlDataSourceProperties -> MySqlDatabaseConfiguration(dBConnetionProperties)
+                else -> throw BluePrintProcessorException(
+                        "Failed to create db configuration for ${dBConnetionProperties.url}")
             }
-            else -> {
-                throw BluePrintProcessorException("couldn't get rest service for")
-            }
-        }
-    }
-
-    private fun mySqlDBConnectionProperties(prefix: String): MySqlDataSourceProperties {
-        return bluePrintPropertiesService.propertyBeanType(prefix, MySqlDataSourceProperties::class.java)
-    }
 
-    private fun mariaDBConnectionProperties(prefix: String): MariaDataSourceProperties {
-        return bluePrintPropertiesService.propertyBeanType(prefix, MariaDataSourceProperties::class.java)
-    }
+    private fun mySqlDBConnectionProperties(prefix: String): MySqlDataSourceProperties =
+            bluePrintPropertiesService.propertyBeanType(prefix, MySqlDataSourceProperties::class.java)
 
-    private fun primaryDBConnectionProperties(prefix: String): PrimaryDataSourceProperties {
-        return bluePrintPropertiesService.propertyBeanType(prefix, PrimaryDataSourceProperties::class.java)
-    }
+    private fun mariaDBConnectionProperties(prefix: String): MariaDataSourceProperties =
+            bluePrintPropertiesService.propertyBeanType(prefix, MariaDataSourceProperties::class.java)
 }
index f55fee0..48ca912 100644 (file)
@@ -42,6 +42,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
 import org.onap.ccsdk.cds.controllerblueprints.core.deleteNBDir
 import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
 import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService
 import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache
@@ -121,17 +122,29 @@ open class BluePrintModelHandler(
         workFlowData.inputs = workFlow.inputs
         workFlowData.outputs = workFlow.outputs
 
-        for ((k, v) in workFlow.inputs!!) {
-            addDataType(v.type, blueprintContext, wfRes)
+        if (workFlow.inputs != null) {
+            for ((k, v) in workFlow.inputs!!) {
+                addPropertyInfo(v, blueprintContext, wfRes)
+            }
         }
 
-        for ((k, v) in workFlow.outputs!!) {
-            addDataType(v.type, blueprintContext, wfRes)
+        if (workFlow.outputs != null) {
+            for ((k, v) in workFlow.outputs!!) {
+                addPropertyInfo(v, blueprintContext, wfRes)
+            }
         }
+
         wfRes.workFlowData = workFlowData
         return wfRes
     }
 
+    private fun addPropertyInfo(prop: PropertyDefinition, ctx: BluePrintContext, res: WorkFlowSpecResponse) {
+        addDataType(prop.type, ctx, res)
+        if (prop.entrySchema != null && prop.entrySchema!!.type != null) {
+            addDataType(prop.entrySchema!!.type, ctx, res)
+        }
+    }
+
     private fun addDataType(name: String, ctx: BluePrintContext, res: WorkFlowSpecResponse) {
         var data = ctx.dataTypeByName(name)
         if (data != null) {
@@ -141,8 +154,10 @@ open class BluePrintModelHandler(
     }
 
     private fun addParentDataType(data: DataType, ctx: BluePrintContext, res: WorkFlowSpecResponse) {
-        for ((k, v) in data.properties!!) {
-            addDataType(v.type, ctx, res)
+        if (data.properties != null) {
+            for ((k, v) in data.properties!!) {
+                addPropertyInfo(v, ctx, res)
+            }
         }
     }
 
index 70cf943..c381260 100644 (file)
@@ -5,10 +5,13 @@ RUN python -m pip install --upgrade pip
 RUN pip install grpcio==${GRPC_PYTHON_VERSION} grpcio-tools==${GRPC_PYTHON_VERSION}
 RUN pip install virtualenv==16.7.9
 
+RUN groupadd -r onap && useradd -r -g onap onap
+
 COPY start.sh /opt/app/onap/start.sh
 RUN chmod u+x /opt/app/onap/start.sh
 
 RUN mkdir -p /opt/app/onap/logs/ && touch /opt/app/onap/logs/application.log
+RUN chown onap:onap /opt -R
 
 COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz
 RUN tar -xzf /source.tar.gz -C /tmp \
@@ -17,5 +20,5 @@ RUN tar -xzf /source.tar.gz -C /tmp \
  && rm -rf /tmp/@project.build.finalName@
 
 VOLUME /opt/app/onap/blueprints/deploy/
-
+USER onap
 ENTRYPOINT /opt/app/onap/start.sh
index 9d41b2c..1e6f03b 100644 (file)
@@ -31,7 +31,7 @@ import json
 REQUIREMENTS_TXT = "requirements.txt"
 
 
-class CommandExecutorHandler:
+class CommandExecutorHandler():
 
     def __init__(self, request):
         self.request = request
@@ -58,12 +58,12 @@ class CommandExecutorHandler:
                 return utils.build_ret_data(False, err_msg)
             try:
                 with open(self.installed, "w+") as f:
-                   if not self.install_packages(request, CommandExecutor_pb2.pip, f, results):
-                       return utils.build_ret_data(False, "ERROR: failed to prepare environment for request {} during pip package install.".format(self.blueprint_id))
-                   f.write("\r\n") # TODO: is \r needed?
-                   results.append("\n")
-                   if not self.install_packages(request, CommandExecutor_pb2.ansible_galaxy, f, results):
-                       return utils.build_ret_data(False, "ERROR: failed to prepare environment for request {} during Ansible install.".format(self.blueprint_id))
+                    if not self.install_packages(request, CommandExecutor_pb2.pip, f, results):
+                        return utils.build_ret_data(False, "ERROR: failed to prepare environment for request {} during pip package install.".format(self.blueprint_id))
+                    f.write("\r\n") # TODO: is \r needed?
+                    results.append("\n")
+                    if not self.install_packages(request, CommandExecutor_pb2.ansible_galaxy, f, results):
+                        return utils.build_ret_data(False, "ERROR: failed to prepare environment for request {} during Ansible install.".format(self.blueprint_id))
             except Exception as ex:
                 err_msg = "ERROR: failed to prepare environment for request {} during installing packages. Exception: {}".format(self.blueprint_id, ex)
                 self.logger.error(err_msg)
@@ -71,7 +71,7 @@ class CommandExecutorHandler:
         else:
             try:
                 with open(self.installed, "r") as f:
-                  results.append(f.read())
+                    results.append(f.read())
             except Exception as ex:
                 return utils.build_ret_data(False, "ERROR: failed to prepare environment during reading 'installed' file {}. Exception: {}".format(self.installed, ex))
 
@@ -108,15 +108,14 @@ class CommandExecutorHandler:
             payload_section = []
             is_payload_section = False
 
-        ### extract the original header request into sys-env variables
-        ### RequestID
-        request_id = request.requestId
-        ### Sub-requestID
-        subrequest_id = request.correlationId
-        request_id_map = {'CDS_REQUEST_ID':request_id, 'CDS_CORRELATION_ID':subrequest_id}
-        updated_env =  { **os.environ, **request_id_map }
+            ### extract the original header request into sys-env variables
+            ### RequestID
+            request_id = request.requestId
+            ### Sub-requestID
+            subrequest_id = request.correlationId
+            request_id_map = {'CDS_REQUEST_ID':request_id, 'CDS_CORRELATION_ID':subrequest_id}
+            updated_env =  { **os.environ, **request_id_map }
 
-        try:
             with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                                   shell=True, bufsize=1, universal_newlines=True, env=updated_env) as newProcess:
                 while True:
@@ -190,9 +189,11 @@ class CommandExecutorHandler:
         try:
             results.append(subprocess.run(command, check=True, stdout=PIPE, stderr=PIPE, env=env).stdout.decode())
             results.append("\n")
+            self.logger.info("install_python_packages {} succeeded".format(package))
             return True
         except CalledProcessError as e:
             results.append(e.stderr.decode())
+            self.logger.error("install_python_packages {} failed".format(package))
             return False
 
     def install_ansible_packages(self, package, results):
@@ -224,6 +225,7 @@ class CommandExecutorHandler:
             # venv doesn't populate the activate_this.py script, hence we use from virtualenv
             venv.create(self.venv_home, with_pip=True, system_site_packages=True)
             virtualenv.writefile(os.path.join(bin_dir, "activate_this.py"), virtualenv.ACTIVATE_THIS)
+            self.logger.info("{} - Creation of Python Virtual Environment finished.".format(self.blueprint_id))
             return utils.build_ret_data(True, "")
         except Exception as err:
             err_msg = "{} - Failed to provision Python Virtual Environment. Error: {}".format(self.blueprint_id, err)
@@ -243,7 +245,7 @@ class CommandExecutorHandler:
         path = "%s/bin/activate_this.py" % self.venv_home
         try:
             with open(path) as activate_this_script:
-              exec (activate_this_script.read(), {'__file__': path})
+                exec (activate_this_script.read(), {'__file__': path})
             exec (fixpathenvvar)
             self.logger.info("Running with PATH : {}".format(os.environ['PATH']))
             return utils.build_ret_data(True, "")
index 043e15d..bb1b0f7 100644 (file)
@@ -1,5 +1,7 @@
 FROM python:3.7-slim
 
+RUN groupadd -r onap && useradd -r -g onap onap
+
 RUN mkdir -p /opt/app/onap/logs/ && touch /opt/app/onap/logs/application.log
 
 COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz
@@ -10,6 +12,8 @@ RUN tar -xzf /source.tar.gz -C /tmp \
 
 RUN pip install --no-cache-dir -r /opt/app/onap/python/requirements/docker.txt
 
-VOLUME /opt/app/onap/blueprints/deploy/
+RUN chown onap:onap /opt -R
 
+VOLUME /opt/app/onap/blueprints/deploy/
+USER onap
 ENTRYPOINT /opt/app/onap/python/start.sh
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDtoTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDtoTest.java
new file mode 100644 (file)
index 0000000..1f4ba81
--- /dev/null
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2020 IBM Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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============================================
+ *
+ *
+ */
+package org.onap.ccsdk.cds.sdclistener.dto;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(SpringRunner.class)
+@EnableConfigurationProperties({SdcListenerDto.class,SdcListenerAuthClientInterceptor.class})
+@SpringBootTest(classes = {SdcListenerDtoTest.class})
+public class SdcListenerDtoTest {
+
+    @Autowired
+    private SdcListenerDto listenerConfiguration;
+
+    @Test
+    public void testCdsSdcListenerDto() {
+        listenerConfiguration.setDistributionId("1234");
+        listenerConfiguration.setArtifactUrl("/sdc/v1/artifact/");
+        assertEquals(listenerConfiguration.getDistributionId(), "1234");
+        assertEquals(listenerConfiguration.getArtifactUrl(), "/sdc/v1/artifact/");
+    }
+
+
+}
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerExceptionTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerExceptionTest.java
new file mode 100644 (file)
index 0000000..72f0ef2
--- /dev/null
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START============================================
+ * ONAP Portal
+ * =====================================================================
+ * Copyright (C) 2020 IBM Intellectual Property. All rights reserved.
+ * =====================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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================================================
+ *
+ *
+ */
+package org.onap.ccsdk.cds.sdclistener.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+public class SdcListenerExceptionTest {
+
+    @Test
+    public void testConstructor() {
+        final String s1="Exception occured";
+        SdcListenerException sle=new SdcListenerException(s1);
+        assertEquals(sle.getMessage(),"Exception occured");
+    }
+}
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/util/FileUtilTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/util/FileUtilTest.java
new file mode 100644 (file)
index 0000000..a43e8c0
--- /dev/null
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2020 IBM Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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============================================
+ *
+ *
+ */
+package org.onap.ccsdk.cds.sdclistener.util;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import java.io.File;
+import java.io.IOException;
+import static org.hamcrest.MatcherAssert.assertThat;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import org.hamcrest.collection.IsEmptyCollection;
+
+import java.util.ArrayList;
+import java.util.List;
+import static org.hamcrest.CoreMatchers.*;
+
+import static org.junit.Assert.*;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {FileUtilTest.class})
+public class FileUtilTest {
+
+   FileUtil fs;
+
+    @Test
+    public void testDeleteFile() throws IOException {
+        File tempFile = File.createTempFile("tempFile", ".txt");
+//        System.out.println(tempFile.getRoot());
+        fs.deleteFile(tempFile,tempFile.getAbsolutePath());
+        assertFalse(tempFile.exists());
+
+    }
+
+    @Test
+    public void testGetFilesFromDisk() throws IOException{
+
+        Path resourceDirectory = Paths.get("src","test","resources");
+        int totalfile=resourceDirectory.getNameCount();
+        List fileList=fs.getFilesFromDisk(resourceDirectory);
+        assertNotNull(fileList);
+        assertEquals(fileList.size(),totalfile);
+    }
+
+
+}
index 34f6443..5168dd9 100755 (executable)
@@ -1,7 +1,9 @@
 FROM openjdk:8-jdk-alpine
 
+RUN addgroup -S onap && adduser -S onap -G onap
 # add entrypoint
 COPY startService.sh /startService.sh
+RUN chown onap:onap /startService.sh
 RUN chmod 751 /startService.sh
 # add application
 COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz
@@ -10,4 +12,7 @@ RUN tar -xzf /source.tar.gz -C /tmp \
  && rm -rf /source.tar.gz \
  && rm -rf /tmp/@project.build.finalName@
 
+RUN mkdir /opt/app/onap/cds-sdc-listener
+RUN chown onap:onap /opt -R
+USER onap
 ENTRYPOINT /startService.sh