diff options
Diffstat (limited to 'cds-ui')
17 files changed, 52 insertions, 344 deletions
diff --git a/cds-ui/client/package.json b/cds-ui/client/package.json index 8963be367..04dd30861 100644 --- a/cds-ui/client/package.json +++ b/cds-ui/client/package.json @@ -28,11 +28,13 @@ "@ngrx/store": "^6.1.2", "@ngrx/store-devtools": "^6.1.2", "@types/d3": "^5.7.0", + "ang-jsoneditor": "1.6.1", "core-js": "^2.5.4", "d3": "^5.9.1", "file-saver": "^2.0.1", "font-awesome": "^4.7.0", "hammerjs": "^2.0.8", + "jsoneditor": "^5.31.1", "jszip": "^3.2.0", "material-design-icons": "^3.0.1", "ng2-ace-editor": "^0.3.9", diff --git a/cds-ui/client/src/app/common/shared/pipes/search.pipe.ts b/cds-ui/client/src/app/common/shared/pipes/search.pipe.ts index 092531ee3..b0d37c3d1 100644 --- a/cds-ui/client/src/app/common/shared/pipes/search.pipe.ts +++ b/cds-ui/client/src/app/common/shared/pipes/search.pipe.ts @@ -26,11 +26,12 @@ import { Pipe, PipeTransform } from '@angular/core'; export class SearchPipe implements PipeTransform{ - transform(item: any, searchText: any): any { - if(searchText == null) return item; - - return item.filter(function(search){ - return search.type.toLowerCase().indexOf(searchText.toLowerCase()) > -1; - }) - } + transform(items: any[], searchText: string): any[] { + if(!items) return []; + if(!searchText) return items; + searchText = searchText.toLowerCase(); + return items.filter( it => { + return it.toLowerCase().includes(searchText); + }); + } }
\ No newline at end of file diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/browse-file/browse-file.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/browse-file/browse-file.component.html deleted file mode 100644 index f85a2e49f..000000000 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/browse-file/browse-file.component.html +++ /dev/null @@ -1,24 +0,0 @@ -<!--/* -* ============LICENSE_START======================================================= -* ONAP : CDS -* ================================================================================ -* Copyright 2019 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========================================================= -*/--> - - -<p> - browse-file works! -</p> diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/browse-file/browse-file.component.scss b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/browse-file/browse-file.component.scss deleted file mode 100644 index cafd2bf8f..000000000 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/browse-file/browse-file.component.scss +++ /dev/null @@ -1,19 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : CDS -* ================================================================================ -* Copyright 2019 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/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/browse-file/browse-file.component.spec.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/browse-file/browse-file.component.spec.ts deleted file mode 100644 index df67a6024..000000000 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/browse-file/browse-file.component.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : CDS -* ================================================================================ -* Copyright 2019 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 { BrowseFileComponent } from './browse-file.component'; - -describe('BrowseFileComponent', () => { - let component: BrowseFileComponent; - let fixture: ComponentFixture<BrowseFileComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ BrowseFileComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(BrowseFileComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/browse-file/browse-file.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/browse-file/browse-file.component.ts deleted file mode 100644 index 5c00aa0e4..000000000 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/browse-file/browse-file.component.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : CDS -* ================================================================================ -* Copyright 2019 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-browse-file', - templateUrl: './browse-file.component.html', - styleUrls: ['./browse-file.component.scss'] -}) -export class BrowseFileComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.module.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.module.ts index c618e2748..0e056530d 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.module.ts +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.module.ts @@ -24,7 +24,6 @@ import { CommonModule } from '@angular/common'; import { ResourceDefinitionRoutingModule } from './resource-definition-routing.module'; import { ResourceDefinitionComponent } from './resource-definition.component'; import { SharedModule } from '../../../app/common/shared/shared.module'; -import { SaveResourceModule } from './save-resource/save-resource.module'; import { ResourceCreationModule } from './resource-creation/resource-creation.module'; import { ResourceEditModule } from './resource-edit/resource-edit.module'; @@ -39,7 +38,6 @@ import { MatIconModule } from '@angular/material/icon'; CommonModule, ResourceDefinitionRoutingModule, SharedModule, - SaveResourceModule, ResourceCreationModule, ResourceEditModule, MatToolbarModule, diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts index 8f28021c8..2b25ae339 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts @@ -29,6 +29,7 @@ import { SharedModule } from '../../../../app/common/shared/shared.module'; import { SourcesTemplateComponent } from './sources-template/sources-template.component'; import { ResourceMetadataComponent } from './resource-metadata/resource-metadata.component'; import { DragDropModule } from '@angular/cdk/drag-drop'; +import { NgJsonEditorModule } from 'ang-jsoneditor'; @NgModule({ declarations: [ ResourceEditComponent,SourcesTemplateComponent,ResourceMetadataComponent ], @@ -38,8 +39,8 @@ import { DragDropModule } from '@angular/cdk/drag-drop'; SharedModule, FormsModule,ReactiveFormsModule, DragDropModule, - MatExpansionModule,MatToolbarModule,MatIconModule, MatButtonModule, MatSidenavModule, MatCheckboxModule, MatListModule, MatGridListModule, MatCardModule, MatMenuModule, MatTableModule, MatPaginatorModule, MatSortModule, MatInputModule, MatSelectModule, MatRadioModule, MatFormFieldModule, MatStepperModule - + MatExpansionModule,MatToolbarModule,MatIconModule, MatButtonModule, MatSidenavModule, MatCheckboxModule, MatListModule, MatGridListModule, MatCardModule, MatMenuModule, MatTableModule, MatPaginatorModule, MatSortModule, MatInputModule, MatSelectModule, MatRadioModule, MatFormFieldModule, MatStepperModule, + NgJsonEditorModule ], exports: [ ResourceEditComponent,SharedModule ] }) diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html index 123594a50..903c6d319 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html @@ -21,17 +21,17 @@ <div class="sources-container"> <div cdkDropList - [cdkDropListData]="todo" + [cdkDropListData]="sourcesOptions" class="sources-list" (cdkDropListDropped)="drop($event)"> - <div class="sources-box" *ngFor="let item of todo" cdkDrag> + <div class="sources-box" *ngFor="let item of sourcesOptions" cdkDrag> <mat-expansion-panel class="expansion-panel"> <mat-expansion-panel-header> <mat-panel-title> - {{item.type}} + {{item}} </mat-panel-title> </mat-expansion-panel-header> - {{item}} + <json-editor [options]="options" [data]="selected(item)" on-change="onChange()"></json-editor> </mat-expansion-panel> </div> </div> @@ -47,10 +47,10 @@ <br><br> <div cdkDropList - [cdkDropListData]="sourcesOptions" + [cdkDropListData]="option" class="options-list" (cdkDropListDropped)="drop($event)"> - <div class="options-box" *ngFor="let item of sourcesOptions | search : searchText" cdkDrag>{{item.type}}</div> + <div class="options-box" *ngFor="let item of option | search :searchText" cdkDrag>{{item}}</div> </div> </div> </div>
\ No newline at end of file diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts index 8c6d99ca7..c43d1debd 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ViewChild } from '@angular/core'; import { CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop'; import { IResources } from 'src/app/common/core/store/models/resources.model'; import { IResourcesState } from 'src/app/common/core/store/models/resourcesState.model'; @@ -28,6 +28,7 @@ import { IAppState } from '../../../../common/core/store/state/app.state'; import { A11yModule } from '@angular/cdk/a11y'; import { LoadResourcesSuccess } from 'src/app/common/core/store/actions/resources.action'; import { ISourcesData } from 'src/app/common/core/store/models/sourcesData.model'; +import { JsonEditorComponent, JsonEditorOptions } from 'ang-jsoneditor'; @Component({ selector: 'app-sources-template', @@ -35,14 +36,29 @@ import { ISourcesData } from 'src/app/common/core/store/models/sourcesData.model styleUrls: ['./sources-template.component.scss'] }) export class SourcesTemplateComponent implements OnInit { +// rdState: Observable<IResourcesState>; +// resources: IResources; +// todo = []; +// sources:ISourcesData; +// sourcesOptions = []; + + @ViewChild(JsonEditorComponent) editor: JsonEditorComponent; + options = new JsonEditorOptions(); + rdState: Observable<IResourcesState>; resources: IResources; - todo = []; + option = ['mdsal','default']; sources:ISourcesData; sourcesOptions = []; - + sourcesData = []; + constructor(private store: Store<IAppState>) { - this.rdState = this.store.select('resources'); + this.rdState = this.store.select('resources'); + this.options.mode = 'text'; + this.options.modes = [ 'text', 'tree', 'view']; + this.options.statusBar = false; + this.options.onChange = () => console.log(this.editor.get()); + } ngOnInit() { @@ -51,14 +67,22 @@ export class SourcesTemplateComponent implements OnInit { var resourcesState: IResourcesState = { resources: resourcesdata.resources, isLoadSuccess: resourcesdata.isLoadSuccess, isSaveSuccess: resourcesdata.isSaveSuccess, isUpdateSuccess: resourcesdata.isUpdateSuccess }; this.sources = resourcesState.resources.sources; for (let key in this.sources) { - if (this.sources.hasOwnProperty(key)) { - this.sourcesOptions.push(this.sources[key]); - } + this.sourcesOptions.push(key); } - console.log(this.sourcesOptions); + //console.log(this.sourcesOptions); }) } + onChange() { + console.log(this.editor.get()) + }; + + selected(value){ + console.log(value); + this.sourcesData=this.sources[value]; + return this.sourcesData; + } + drop(event: CdkDragDrop<string[]>) { if (event.previousContainer === event.container) { moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource-routing.module.ts b/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource-routing.module.ts deleted file mode 100644 index c0346ca7e..000000000 --- a/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource-routing.module.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : CDS -* ================================================================================ -* Copyright 2019 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 { SaveResourceComponent } from './save-resource.component'; - -const routes: Routes = [ - { - path: '', - component: SaveResourceComponent - } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class SaveResourceRoutingModule { } diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.component.html deleted file mode 100644 index 2ecb4a041..000000000 --- a/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.component.html +++ /dev/null @@ -1,25 +0,0 @@ -<!--/* -* ============LICENSE_START======================================================= -* ONAP : CDS -* ================================================================================ -* Copyright 2019 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========================================================= -*/--> - - -<p> - save-resource works! -</p> -<router-outlet></router-outlet>
\ No newline at end of file diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.component.scss b/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.component.scss deleted file mode 100644 index cafd2bf8f..000000000 --- a/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.component.scss +++ /dev/null @@ -1,19 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : CDS -* ================================================================================ -* Copyright 2019 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/client/src/app/feature-modules/resource-definition/save-resource/save-resource.component.spec.ts b/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.component.spec.ts deleted file mode 100644 index 6a3299940..000000000 --- a/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.component.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : CDS -* ================================================================================ -* Copyright 2019 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 { SaveResourceComponent } from './save-resource.component'; - -describe('SaveResourceComponent', () => { - let component: SaveResourceComponent; - let fixture: ComponentFixture<SaveResourceComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SaveResourceComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SaveResourceComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.component.ts deleted file mode 100644 index f4a046b55..000000000 --- a/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.component.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : CDS -* ================================================================================ -* Copyright 2019 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-save-resource', - templateUrl: './save-resource.component.html', - styleUrls: ['./save-resource.component.scss'] -}) -export class SaveResourceComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.module.ts b/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.module.ts deleted file mode 100644 index d87cfe31b..000000000 --- a/cds-ui/client/src/app/feature-modules/resource-definition/save-resource/save-resource.module.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : CDS -* ================================================================================ -* Copyright 2019 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 { SaveResourceComponent } from './save-resource.component'; -import { SaveResourceRoutingModule } from './save-resource-routing.module'; - -@NgModule({ - declarations: [SaveResourceComponent], - exports: [ SaveResourceComponent ], - imports: [ - CommonModule, - SaveResourceRoutingModule - ] -}) -export class SaveResourceModule { } diff --git a/cds-ui/client/src/styles.scss b/cds-ui/client/src/styles.scss index 10d55776d..54eb74689 100644 --- a/cds-ui/client/src/styles.scss +++ b/cds-ui/client/src/styles.scss @@ -20,7 +20,7 @@ limitations under the License. */ /* You can add global styles to this file, and also import other style files */ - +@import "~jsoneditor/dist/jsoneditor.min.css"; .mat-card:not([class*=mat-elevation-z]) { box-shadow: none !important; } |