diff options
Diffstat (limited to 'dcaedftool/src')
33 files changed, 2245 insertions, 0 deletions
diff --git a/dcaedftool/src/app/app.component.spec.ts b/dcaedftool/src/app/app.component.spec.ts new file mode 100644 index 0000000..8c62c7e --- /dev/null +++ b/dcaedftool/src/app/app.component.spec.ts @@ -0,0 +1,91 @@ +// org.onap.dcae +// ============LICENSE_START==================================================== +// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +// ============================================================================= +// 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====================================================== +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import {HttpModule} from '@angular/http'; // for future +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; // for future +import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; // for future +import { MaterialModule } from '@angular/material'; +import { FlexLayoutModule } from '@angular/flex-layout'; +import { RouterModule, Routes } from '@angular/router'; +import { APP_BASE_HREF } from '@angular/common'; + + + +import { AppComponent } from './app.component'; +import { DFSchemaComponent } from './df-schema.component'; +import { DFJSONInputComponent } from './df-jsoninput.component'; +import { DFControlComponent } from './df-control.component'; +import {ValidateMetaSchemaService} from './validate-metaschema.service'; +import {ValidateJSONService} from './validate-json.service'; +import {MetaSchemaService} from './metaschema.service'; + +const dfroutes: Routes = [ + { path: '', redirectTo: 'schemaval', pathMatch: 'full' }, + { path: 'schemaval', component: DFSchemaComponent }, + { path: 'jsoninput', component: DFJSONInputComponent }, + +]; + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { DebugElement } from '@angular/core'; + +describe('AppComponent', function () { + let de: DebugElement; + let comp: AppComponent; + let fixture: ComponentFixture<AppComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [ BrowserModule, + BrowserAnimationsModule, + FormsModule, + HttpModule, + ReactiveFormsModule, + FlexLayoutModule, + MaterialModule, + RouterModule.forRoot(dfroutes), + ], + providers: [{provide: APP_BASE_HREF, useValue: '/'}], + declarations: [ AppComponent, + DFSchemaComponent, + DFJSONInputComponent, + DFControlComponent, + + ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AppComponent); + comp = fixture.componentInstance; + //de = fixture.debugElement.query(By.css('h1')); + }); + + it('should create component', () => expect(comp).toBeDefined() ); + +/* it('should have expected <h1> text', () => { + fixture.detectChanges(); + const h1 = de.nativeElement; + expect(h1.innerText).toMatch(/angular/i, + '<h1> should say something about "Angular"'); + }); */ +}); diff --git a/dcaedftool/src/app/app.component.ts b/dcaedftool/src/app/app.component.ts new file mode 100644 index 0000000..76f21ff --- /dev/null +++ b/dcaedftool/src/app/app.component.ts @@ -0,0 +1,25 @@ +// org.onap.dcae +// ============LICENSE_START==================================================== +// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +// ============================================================================= +// 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====================================================== +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-df', + template: '<app-df-control></app-df-control>' +}) +export class AppComponent { name = 'Data Format Processing'; } diff --git a/dcaedftool/src/app/app.module.ts b/dcaedftool/src/app/app.module.ts new file mode 100644 index 0000000..7f91574 --- /dev/null +++ b/dcaedftool/src/app/app.module.ts @@ -0,0 +1,67 @@ +// org.onap.dcae +// ============LICENSE_START==================================================== +// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +// ============================================================================= +// 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====================================================== +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import {HttpModule} from '@angular/http'; // for future +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; // for future +import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; // for future +import { MaterialModule } from '@angular/material'; +import { FlexLayoutModule } from '@angular/flex-layout'; +import { RouterModule, Routes } from '@angular/router'; + +import 'ajv'; +import 'hammerjs'; + +import { AppComponent } from './app.component'; +import { DFSchemaComponent } from './df-schema.component'; +import { DFJSONInputComponent } from './df-jsoninput.component'; +import { DFControlComponent } from './df-control.component'; +import {ValidateMetaSchemaService} from './validate-metaschema.service'; +import {ValidateJSONService} from './validate-json.service'; +import {MetaSchemaService} from './metaschema.service'; + +const dfroutes: Routes = [ + { path: '', redirectTo: 'schemaval', pathMatch: 'full' }, + { path: 'schemaval', component: DFSchemaComponent }, + { path: 'jsoninput', component: DFJSONInputComponent }, + +]; +@NgModule({ + imports: [ BrowserModule, + BrowserAnimationsModule, + FormsModule, + HttpModule, + ReactiveFormsModule, + FlexLayoutModule, + RouterModule.forRoot(dfroutes), + MaterialModule, + ], + declarations: [ AppComponent, + DFSchemaComponent, + DFJSONInputComponent, + DFControlComponent + ], + providers: [ + ValidateMetaSchemaService, + ValidateJSONService, + MetaSchemaService +], + bootstrap: [ AppComponent ] +}) +export class AppModule { } diff --git a/dcaedftool/src/app/df-control.component.css b/dcaedftool/src/app/df-control.component.css new file mode 100644 index 0000000..4cc85d1 --- /dev/null +++ b/dcaedftool/src/app/df-control.component.css @@ -0,0 +1,85 @@ +/*
+ org.onap.dcae
+ ============LICENSE_START====================================================
+ Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ =============================================================================
+ 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======================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+*/
+md-sidenav-container {
+
+}
+
+md-card {
+ color: #3f51b5;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 150%;
+ text-align:center;
+ margin-left: 100px;
+ padding-left: 10px;
+ background-color: #f2f2f2;
+}
+.app-title {
+ color: white;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 150%;
+ background-color: #3f51b5;
+}
+.app-menu-button {
+ color: white;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 150%;
+ background-color: #3f51b5;
+}
+.schema-version {
+ color: #3f51b5;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 50%;
+ background-color: #f2f2f2;
+}
+.nav-title {
+ color: #3f51b5;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 150%;
+ padding-left: 16px;
+ margin-left: 100px;
+ background-color: #f2f2f2;
+}
+.active-nav {
+ color: #3f51b5;
+ min-width: 520px;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 100%;
+ padding-left: 16px;
+ min-width: 520px;
+ background-color: #f2f2f2;
+}
+.nav-button {
+ min-width: 520px;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 100%;
+ padding-left: 16px;
+ background-color: #f2f2f2;
+}
+
+md-sidenav {
+ background-color: #f2f2f2;
+ padding: 10px;
+ min-width: 100px;
+}
+md-toolbar {
+ padding: 6px;
+
+}
diff --git a/dcaedftool/src/app/df-control.component.html b/dcaedftool/src/app/df-control.component.html new file mode 100644 index 0000000..37e97d8 --- /dev/null +++ b/dcaedftool/src/app/df-control.component.html @@ -0,0 +1,66 @@ +<!--
+ org.onap.dcae
+ ============LICENSE_START====================================================
+ Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ =============================================================================
+ 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======================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+-->
+
+ <md-sidenav-container>
+
+ <!-- over doesn't seem to work correctly? -->
+ <md-sidenav #sidenav mode="side" color="primary">
+ <md-list class="select-button">
+ <md-list-item>
+ <button md-raised-button class="nav-button" [routerLink] = " ['schemaval']" [routerLinkActive] = "'active-nav'" >
+ VERIFY DATA FORMAT SCHEMA
+ </button>
+ </md-list-item>
+ <md-list-item>
+ <button md-raised-button class="nav-button" [routerLink] = " ['jsoninput']" [routerLinkActive] = "'active-nav'">
+ VERIFY JSON DATA FORMAT SCHEMA AND TEST JSON INPUT
+ </button>
+ </md-list-item>
+ <md-list-item>
+ <button md-raised-button class="nav-button">
+ GENERATE JSON DATA FORMAT SCHEMA FROM JSON INPUT
+ </button>
+ </md-list-item>
+ <md-list-item>
+ <button md-raised-button class="nav-button">
+ VERIFY DELIMITED DATA FORMAT SCHEMA AND TEST INPUT
+ </button>
+ </md-list-item>
+ <md-list-item>
+ <button md-raised-button class="nav-button">
+ VERIFY XML DATA FORMAT SCHEMA AND TEST INPUT
+ </button>
+ </md-list-item>
+ </md-list>
+
+
+
+ </md-sidenav>
+
+ <md-toolbar color="primary">
+
+ <button md-button class="app-menu-button" (click)="sidenav.toggle() ">
+ <i class="material-icons">menu</i>
+ </button>
+ <span class="app-title">DCAE Data Format Schema Tool</span>
+ </md-toolbar>
+ <router-outlet></router-outlet>
+</md-sidenav-container>
diff --git a/dcaedftool/src/app/df-control.component.spec.ts b/dcaedftool/src/app/df-control.component.spec.ts new file mode 100644 index 0000000..3cdf314 --- /dev/null +++ b/dcaedftool/src/app/df-control.component.spec.ts @@ -0,0 +1,86 @@ +// org.onap.dcae
+// ============LICENSE_START====================================================
+// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+// =============================================================================
+// 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======================================================
+//
+// ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import { NgModule } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+import {HttpModule} from '@angular/http'; // for future
+import {FormsModule, ReactiveFormsModule} from '@angular/forms'; // for future
+import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; // for future
+import { MaterialModule } from '@angular/material';
+import { FlexLayoutModule } from '@angular/flex-layout';
+import { APP_BASE_HREF } from '@angular/common';
+
+import {ValidateMetaSchemaService} from './validate-metaschema.service';
+import {ValidateJSONService} from './validate-json.service';
+import {MetaSchemaService} from './metaschema.service';
+import {DFJSONInputComponent} from './df-jsoninput.component';
+import {DFSchemaComponent} from './df-schema.component';
+import {DFControlComponent} from './df-control.component';
+import { RouterModule, Routes } from '@angular/router';
+
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { By } from '@angular/platform-browser';
+import { DebugElement } from '@angular/core';
+
+describe('DFControlComponent Tests', function () {
+ let de: DebugElement;
+ let comp: DFControlComponent;
+ let fixture: ComponentFixture<DFControlComponent>;
+ const dfroutes: Routes = [
+ { path: '', redirectTo: 'schemaval', pathMatch: 'full' },
+ { path: 'schemaval', component: DFSchemaComponent },
+ { path: 'jsoninput', component: DFJSONInputComponent },
+
+ ];
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [ BrowserModule,
+ BrowserAnimationsModule,
+ FormsModule,
+ HttpModule,
+ ReactiveFormsModule,
+ FlexLayoutModule,
+ RouterModule.forRoot(dfroutes),
+ MaterialModule,
+
+ ],
+ providers: [{provide: APP_BASE_HREF, useValue: '/'},
+ ValidateMetaSchemaService,
+ ValidateJSONService,
+ MetaSchemaService
+ ],
+ declarations: [
+ DFJSONInputComponent,
+ DFControlComponent,
+ DFSchemaComponent,
+
+ ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(DFControlComponent);
+ comp = fixture.componentInstance;
+ //de = fixture.debugElement.query(By.css('h1'));
+ });
+
+ it('should create component', () => expect(comp).toBeDefined() );
+
+});
diff --git a/dcaedftool/src/app/df-control.component.ts b/dcaedftool/src/app/df-control.component.ts new file mode 100644 index 0000000..d8d2686 --- /dev/null +++ b/dcaedftool/src/app/df-control.component.ts @@ -0,0 +1,29 @@ +// org.onap.dcae
+// ============LICENSE_START====================================================
+// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+// =============================================================================
+// 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======================================================
+//
+// ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import { Component } from '@angular/core';
+import { MdToolbarModule, MdToolbarRow, MdSidenav, MdButton, MdList, MdListItem} from '@angular/material';
+
+@Component({
+ selector: 'app-df-control',
+ templateUrl: './df-control.component.html',
+ styleUrls: [ './df-control.component.css']
+})
+export class DFControlComponent {
+
+}
diff --git a/dcaedftool/src/app/df-jsoninput.component.css b/dcaedftool/src/app/df-jsoninput.component.css new file mode 100644 index 0000000..94050bd --- /dev/null +++ b/dcaedftool/src/app/df-jsoninput.component.css @@ -0,0 +1,179 @@ +/*
+ org.onap.dcae
+ ============LICENSE_START====================================================
+ Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ =============================================================================
+ 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======================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+*/
+.scenario-toolbar {
+ color: #f2f2f2;
+ min-width: 520px;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 100%;
+ /*padding-left: 16px;
+ min-width: 520px; */
+ text-align: center;
+ background-color: #f2f2f2
+}
+.scenario-title {
+ color: #3f51bf;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 120%;
+ text-align: center;
+ background-color: #f2f2f2
+}
+.metaschema-title {
+ color: #3f51bf;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 50%;
+ font-weight: bold;
+ text-align: left;
+ background-color: #f2f2f2
+}
+.metaschema-card {
+ margin: 0px;
+}
+
+.metaschema-text {
+ padding: 0px;
+ margin: 0px;
+ width: 100%;
+ font-size: 50%;
+ background-color: #f2f2f2;
+ white-space: pre-wrap;
+}
+.schema-input-container {
+ margin: 5px;
+}
+.schemainput-title {
+ color: #3f51bf;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 50%;
+ font-weight: bold;
+ text-align: left;
+ margin: 5px;
+ background-color: #f2f2f2
+}
+.schema-input-textarea {
+ padding: 10px;
+ width: 100%;
+ height: 600px;
+ font-size: 100%;
+ background-color: #f2f2f2
+}
+
+.schema-input {
+ padding: 30px;
+ width: 95%;
+/* height: 400px; */
+ padding-left: 20px;
+ padding-right: 20px;
+ padding-top: 20px;
+ background-color: #f2f2f2
+}
+.schema-msgs {
+ color: #3f51bf;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 100%;
+ background-color: #ffffff
+}
+.schema-error {
+ color: black;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 100%;
+ background-color: #ffffff
+}
+
+.json-input-container {
+ margin: 5px;
+}
+.json-container {
+ margin: 5px;
+}
+.jsoninput-title {
+ color: #3f51bf;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 50%;
+ font-weight: bold;
+ text-align: left;
+ margin: 5px;
+ background-color: #f2f2f2
+}
+.json-input-textarea {
+ padding: 10px;
+ width: 100%;
+ height: 600px;
+ font-size: 100%;
+ background-color: #f2f2f2
+}
+.json-input {
+ padding: 30px;
+ width: 95%;
+/* height: 400px; */
+ padding-left: 20px;
+ padding-right: 20px;
+ padding-top: 20px;
+ background-color: #f2f2f2
+}
+.json-msgs {
+ color: #3f51bf;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 100%;
+ background-color: #ffffff
+}
+.json-error {
+ color: black;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 100%;
+ background-color: #ffffff
+}
+.schema-version {
+ color: #3f51bf;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 75%;
+ text-align: center;
+ padding: 10px;
+ background-color: #f2f2f2
+}
+.schema-version md-content {
+ background: #f2f2f2;
+ color: #3f51bf;
+}
+
+.schema-version md-option:hover {
+ background: #f2f2f2;
+ color: #3f51bf;
+}
+.meta-version-button {
+ color: #3f51bf;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 120%;
+ text-align: center;
+ text-indent: 200px;
+ padding: 30px;
+ background-color: #f2f2f2
+}
+.meta-display-button {
+ color: #3f51bf;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size:80%;
+ font-weight: bold;
+ padding-bottom: 2px;
+ text-align: center ;
+ white-space: wrap;
+ overflow:hidden;
+ background-color: #f2f2f2
+}
diff --git a/dcaedftool/src/app/df-jsoninput.component.html b/dcaedftool/src/app/df-jsoninput.component.html new file mode 100644 index 0000000..df8e04c --- /dev/null +++ b/dcaedftool/src/app/df-jsoninput.component.html @@ -0,0 +1,94 @@ +<!--
+ org.onap.dcae
+ ============LICENSE_START====================================================
+ Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ =============================================================================
+ 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======================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+-->
+<md-toolbar class="scenario-toolbar">
+ <div fxLayout="row" fxFill>
+ <div fxLayout="row" fxFlex fxFill >
+ <div class="one" fxFlex="15" fxHide="true" fxLayoutAlign="center center">
+ <md-select class="schema-version" placeholder="MetaSchema Version" >
+ <md-option class="schema-version" >
+ 1.0.0
+ </md-option>
+ <br>
+ </md-select>
+ </div>
+ <div fxFlex="15" fxLayoutAlign="center center">
+ <button md-raised-button class="meta-display-button" (click)=toggleMetaSchema() >
+ {{metaButton}}
+ </button>
+ </div>
+ <div fxFlex="75" fxLayoutAlign="center center">
+ <h1 class="scenario-title" text-align:center > Verify JSON Schema and Test Input</h1>
+ </div>
+ </div>
+ </div>
+
+</md-toolbar>
+
+<div fxLayout="row" fxFill flexLayoutGap=10px>
+ <div fxLayout="row" fxFlex fxFill flexLayoutGap=10px>
+ <div class="metaschema" fxFlex="100" fxFill fxShow={{metaDisplay}} flex="grow" fxLayoutAlign="center center">
+ <md-card class="metaschema-card">
+ <md-card-title class="metaschema-title">
+ Data Format MetaSchema
+ </md-card-title>
+ <md-card-content class="metaschema-text">
+ {{dfmetaschema}}
+ </md-card-content>
+ </md-card>
+ </div>
+ <div class="schema-container" fxLayout="column" fxFlex="100" fxFill flex="grow" fxLayoutAlign="center center">
+ <md-card class="schema-input-title" fxFlex="100" fxFill flex="grow" fxLayoutAlign="center center">
+ <md-card-title class="schemainput-title" fxFlex="100" fxFill flex="grow" fxLayoutAlign="left left">
+ Application Schema
+ </md-card-title>
+ </md-card>
+ <textarea mdInput class="schema-input-textarea" placeholder="Enter your Application Schema Definition Here" [ngModel]="dfschema" (keyup)="doDFSchemaChange($event)" fxLayoutAlign="center center" autofocus="">
+ </textarea>
+ <md-card class="schema-msgs" fxLayout="column" fxFlex="100" fxFill flex="grow" fxLayoutAlign="left left" >
+ <h4>Schema Verification Messages</h4>
+ <span style="color:black">{{schemaMsg}}</span>
+ <ul class="schema-error" *ngFor="let msg of schemaErrMsgs">
+ <li class="schema-error" >
+ {{msg}}
+ </li>
+ </ul>
+ </md-card>
+ </div>
+ <div class="json-container" fxLayout="column" fxFlex="100" fxFill flex="grow" fxLayoutAlign="center center">
+ <md-card class="json-input-title" fxFlex="100" fxFill flex="grow" fxLayoutAlign="center center">
+ <md-card-title class="jsoninput-title" fxFlex="100" fxFill flex="grow" fxLayoutAlign="left left">
+ JSON Input
+ </md-card-title>
+ </md-card>
+ <textarea mdInput class="json-input-textarea" placeholder="Enter JSON Input Here" [ngModel]="dfjson" (keyup)="doDFJSONChange($event)" fxLayoutAlign="center center" autofocus="">
+ </textarea>
+ <md-card class="json-msgs" fxLayout="column" fxFlex="100" fxFill flex="grow" fxLayoutAlign="left left">
+ <h4>JSON Input Messages</h4>
+ <span style="color:black">{{jsonMsg}}</span>
+ <ul class="json-error" *ngFor="let msg of jsonErrMsgs">
+ <li class="json-error" >
+ {{msg}}
+ </li>
+ </ul>
+ </md-card>
+ </div>
+ </div>
+</div>
diff --git a/dcaedftool/src/app/df-jsoninput.component.spec.ts b/dcaedftool/src/app/df-jsoninput.component.spec.ts new file mode 100644 index 0000000..a5f8406 --- /dev/null +++ b/dcaedftool/src/app/df-jsoninput.component.spec.ts @@ -0,0 +1,153 @@ +// org.onap.dcae
+// ============LICENSE_START====================================================
+// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+// =============================================================================
+// 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======================================================
+//
+// ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import { NgModule } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+import {HttpModule} from '@angular/http'; // for future
+import {FormsModule, ReactiveFormsModule} from '@angular/forms'; // for future
+import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; // for future
+import { MaterialModule } from '@angular/material';
+import { FlexLayoutModule } from '@angular/flex-layout';
+import { RouterModule, Routes } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
+
+import {ValidateMetaSchemaService} from './validate-metaschema.service';
+import {ValidateJSONService} from './validate-json.service';
+import {MetaSchemaService} from './metaschema.service';
+import {DFJSONInputComponent} from './df-jsoninput.component';
+
+
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { By } from '@angular/platform-browser';
+import { DebugElement } from '@angular/core';
+
+describe('DFSJSONInputComponent Tests', function () {
+ let de: DebugElement;
+ let comp: DFJSONInputComponent;
+ let fixture: ComponentFixture<DFJSONInputComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [ BrowserModule,
+ BrowserAnimationsModule,
+ FormsModule,
+ HttpModule,
+ ReactiveFormsModule,
+ FlexLayoutModule,
+ MaterialModule,
+
+ ],
+ providers: [{provide: APP_BASE_HREF, useValue: '/'},
+ ValidateMetaSchemaService,
+ ValidateJSONService,
+ MetaSchemaService
+ ],
+ declarations: [
+ DFJSONInputComponent,
+
+ ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(DFJSONInputComponent);
+ comp = fixture.componentInstance;
+ //de = fixture.debugElement.query(By.css('h1'));
+ });
+
+ it('should create component', () => expect(comp).toBeDefined() );
+
+ it('should have no metaschema display as default', () => {
+ expect(comp.metaButton).toMatch('Display MetaSchema');
+ });
+ it('should metaschema display after toggle', () => {
+ comp.toggleMetaSchema();
+ expect(comp.metaButton).toMatch('Hide MetaSchema');
+ });
+ it('should validate valid schema', () => {
+ let ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"},"dataformatversion": "1.0.0", "jsonschema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ expect(comp.schemaMsg).toMatch("Valid Data Format Schema") ;
+ });
+ it('should not validate an invalid schema', () => {
+ let ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"}, "jsonschema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ expect(comp.schemaMsg).toMatch("Invalid Data Format Schema") ;
+ });
+ it('schema must have JSON schema ', () => {
+ let ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"}, "json1schema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ expect(comp.schemaMsg).toMatch("Invalid Schema - must specify jsonschema") ;
+ });
+ it('JSON schema must be 04', () => {
+ let ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"},"dataformatversion": "1.0.0", "jsonschema": { "$schema": "http://json-schema.org/draft-05/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ expect(comp.schemaMsg).toMatch(/Invalid JSON Schema Data Format - jsonschema\$schema version must be 04/) ;
+ });
+ it('should fail if JSON input and no schema', () => {
+ let ev = {target: {name: "test", value: '{}'}};
+ comp.doDFJSONChange(ev);
+ expect(comp.jsonMsg).toMatch("Enter a Valid Schema") ;
+ });
+ it('should validate if JSON input and match valid schema', () => {
+ let ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"},"dataformatversion": "1.0.0", "jsonschema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ let jev = {target: {name: "test", value: '{"raw-text": "test"}'}};
+ comp.doDFJSONChange(jev);
+ expect(comp.jsonMsg).toMatch("JSON Input Validated") ;
+ });
+ it('should not validate if JSON input does not match valid schema', () => {
+ let ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"},"dataformatversion": "1.0.0", "jsonschema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ let jev = {target: {name: "test", value: '{"badraw-text": "test"}'}};
+ comp.doDFJSONChange(jev);
+ expect(comp.jsonMsg).toMatch("JSON Input does not match Schema") ;
+ });
+ it('should recover if schema becomes valid', () => {
+ let ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"}, "jsonschema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ expect(comp.schemaMsg).toMatch("Invalid Data Format Schema") ;
+ let jev = {target: {name: "test", value: '{"raw-text": "test"}'}};
+ comp.doDFJSONChange(jev);
+ let ev2 = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"},"dataformatversion": "1.0.0", "jsonschema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev2);
+ expect(comp.jsonMsg).toMatch("JSON Input Validated") ;
+ expect(comp.schemaMsg).toMatch("Valid Data Format Schema") ;
+ });
+ it('should fail if schema becomes invalid', () => {
+ let ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"},"dataformatversion": "1.0.0", "jsonschema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ let jev = {target: {name: "test", value: '{"raw-text": "test"}'}};
+ comp.doDFJSONChange(jev);
+ ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"},"dataformatversion": "1.0.0", "json1schema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ expect(comp.jsonMsg).toMatch("Enter a valid Schema") ;
+ });
+ it('should validate if JSON input is fixed to match valid schema', () => {
+ let ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"},"dataformatversion": "1.0.0", "jsonschema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ let jev = {target: {name: "test", value: '{"badraw-text": "test"}'}};
+ comp.doDFJSONChange(jev);
+ expect(comp.jsonMsg).toMatch("JSON Input does not match Schema") ;
+ jev = {target: {name: "test", value: '{"raw-text": "test"}'}};
+ comp.doDFJSONChange(jev);
+ expect(comp.jsonMsg).toMatch("JSON Input Validated") ;
+ });
+});
diff --git a/dcaedftool/src/app/df-jsoninput.component.ts b/dcaedftool/src/app/df-jsoninput.component.ts new file mode 100644 index 0000000..0006d5f --- /dev/null +++ b/dcaedftool/src/app/df-jsoninput.component.ts @@ -0,0 +1,246 @@ +// org.onap.dcae
+// ============LICENSE_START====================================================
+// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+// =============================================================================
+// 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======================================================
+//
+// ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import { Component, Input, OnInit, OnChanges} from '@angular/core';
+import { MdToolbarModule, MdButton, MdInputModule, MdSelectModule} from '@angular/material';
+import {ValidateMetaSchemaService} from './validate-metaschema.service';
+import {ValidateJSONService} from './validate-json.service';
+import {MetaSchemaService} from './metaschema.service';
+import * as Ajv from 'ajv';
+
+@Component({
+ selector: 'app-df-jsoninput',
+ templateUrl: './df-jsoninput.component.html',
+ styleUrls: [ './df-jsoninput.component.css']
+})
+export class DFJSONInputComponent implements OnInit /*, OnChanges */ {
+
+ public dfschema = '';
+ private jsonTestObject: any;
+ private validJSON = false;
+ public metaDisplay = false;
+ public metaButton = 'Display MetaSchema';
+ public schemaMsg: string;
+ public schemaErrMsgs: string[] = [];
+ private ajvService: any;
+ private hideMeta = 'Hide MetaSchema';
+ private displayMeta = 'Display Metaschema';
+ private schemaValidate: Object;
+ private validateMetaSchema: ValidateMetaSchemaService;
+ private jsonValidate: ValidateJSONService;
+ private metaSchema: MetaSchemaService;
+ private validSchema = false;
+ public dfmetaschema: string;
+ public dfjson: string;
+ public jsonMsg: string;
+ public jsonErrMsgs: string[] = [];
+
+ constructor (validateMetaSchemaService: ValidateMetaSchemaService, validateJSONService: ValidateJSONService, metaSchemaService: MetaSchemaService) {
+ this.validateMetaSchema = validateMetaSchemaService;
+ this.metaSchema = metaSchemaService;
+ this.dfmetaschema = this.metaSchema.currentMetaSchemaFormatted();
+ this.jsonValidate = validateJSONService;
+ }
+
+
+ ngOnInit(): void {
+ }
+
+ toggleMetaSchema(): void {
+ this.metaDisplay = !this.metaDisplay;
+ if (this.metaDisplay === true) {
+ this.metaButton = this.hideMeta;
+ } else {
+ this.metaButton = this.displayMeta;
+ }
+ }
+ doDFSchemaChange(ev: any) {
+ this.schemaMsg = '';
+ this.schemaErrMsgs = [];
+ this.validSchema = false;
+ this.dfschema = ev.target.value;
+ if (this.dfschema.length == 0) {
+ if (this.validJSON) {
+ this.jsonMsg = 'Enter a Valid Schema';
+ this.jsonErrMsgs = [];
+ }
+ return;
+ }
+ if (this.jsonValidate.validate(this.dfschema) === false) {
+ // assumes simple message - TBD???
+ this.schemaMsg = this.jsonValidate.validateMsgs();
+ if (this.validJSON) {
+ this.jsonMsg = 'Enter a valid Schema';
+ this.jsonErrMsgs = [];
+ }
+ return;
+ }
+ const pschema = JSON.parse(this.dfschema);
+ if (!pschema.hasOwnProperty('jsonschema')) {
+ this.schemaMsg = 'Invalid Schema - must specify jsonschema';
+ if (this.validJSON) {
+ this.jsonMsg = 'Enter a valid Schema';
+ this.jsonErrMsgs = [];
+ }
+ return;
+ }
+ const jsonSchema = pschema.jsonschema;
+ if (jsonSchema.hasOwnProperty('$schema')) {
+ try {
+ if (!(jsonSchema.$schema === 'http://json-schema.org/draft-04/schema#') ) {
+ this.schemaMsg = 'Invalid JSON Schema Data Format - jsonschema$schema version must be 04';
+ if (this.validJSON) {
+ this.jsonMsg = 'Enter a Valid Schema';
+ this.jsonErrMsgs = [];
+ }
+ return;
+ }
+ } catch(schemaVersionErr) {
+ this.schemaMsg = 'Invalid JSON Schema Data Format - jsonschema$schema version must be 04';
+ if (this.validJSON) {
+ this.jsonMsg = 'Enter a Valid Schema';
+ this.jsonErrMsgs = [];
+ }
+ return;
+ }
+ } else {
+ this.schemaMsg = 'Invalid JSON Schema Data Format - jsonschema$schema must specified';
+ if (this.validJSON) {
+ this.jsonMsg = 'Enter a Valid Schema';
+ this.jsonErrMsgs = [];
+ }
+ return;
+ }
+ if (this.validateMetaSchema.validate(this.dfschema) === false) {
+ this.schemaMsg = 'Invalid Data Format Schema';
+ this.schemaErrMsgs = this.validateMetaSchema.validateMsgs();
+ if (this.validJSON) {
+ this.jsonMsg = 'Enter a valid Schema';
+ this.jsonErrMsgs = [];
+ }
+ } else {
+ this.schemaMsg = 'Valid Data Format Schema';
+ this.validSchema = true;
+ if (this.validJSON ) {
+ this.validateJSON();
+ }
+ }
+ }
+
+ // no reuse - so no service
+ validateJSON() {
+ this.jsonErrMsgs = [];
+ this.jsonMsg = '';
+ this.validJSON = false;
+ if (this.dfjson.length == 0) {
+ return;
+ }
+ if (this.jsonValidate.validate(this.dfjson) === false) {
+ this.jsonMsg = this.jsonValidate.validateMsgs();
+ this.jsonErrMsgs = [];
+ return;
+ }
+ this.validJSON = true;
+ if (!this.validSchema) {
+ this.jsonMsg = 'Enter a Valid Schema';
+ this.jsonErrMsgs = [];
+ return;
+ }
+ // check for jsonschema in Schema file and validate based on version
+ const valpschema = JSON.parse(this.dfschema);
+ const valjsonSchema = valpschema.jsonschema;
+ const schemaVersion = valjsonSchema.$schema;
+
+ try {
+ if (schemaVersion === 'http://json-schema.org/draft-04/schema#') {
+ this.ajvService = new Ajv({
+ meta: false, // optional, to prevent adding draft-06 meta-schema
+ extendRefs: true, // optional, current default is to 'fail', spec behaviour is to 'ignore'
+ allErrors: true,
+ unknownFormats: 'ignore' // optional, current default is true (fail)
+ });
+ // change this to http get at some point TBD
+ const schemav4: any = { 'id': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#', 'description': 'Core schema meta-schema', 'definitions': { 'schemaArray': { 'type': 'array', 'minItems': 1, 'items': { '$ref': '#' } }, 'positiveInteger': { 'type': 'integer', 'minimum': 0 }, 'positiveIntegerDefault0': { 'allOf': [ { '$ref': '#/definitions/positiveInteger' }, { 'default': 0 } ] }, 'simpleTypes': { 'enum': [ 'array', 'boolean', 'integer', 'null', 'number', 'object', 'string' ] }, 'stringArray': { 'type': 'array', 'items': { 'type': 'string' }, 'minItems': 1, 'uniqueItems': true } }, 'type': 'object', 'properties': { 'id': { 'type': 'string', 'format': 'uri' }, '$schema': { 'type': 'string', 'format': 'uri' }, 'title': { 'type': 'string' }, 'description': { 'type': 'string' }, 'default': {}, 'multipleOf': { 'type': 'number', 'minimum': 0, 'exclusiveMinimum': true }, 'maximum': { 'type': 'number' }, 'exclusiveMaximum': { 'type': 'boolean', 'default': false }, 'minimum': { 'type': 'number' }, 'exclusiveMinimum': { 'type': 'boolean', 'default': false }, 'maxLength': { '$ref': '#/definitions/positiveInteger' }, 'minLength': { '$ref': '#/definitions/positiveIntegerDefault0' }, 'pattern': { 'type': 'string', 'format': 'regex' }, 'additionalItems': { 'anyOf': [ { 'type': 'boolean' }, { '$ref': '#' } ], 'default': {} }, 'items': { 'anyOf': [ { '$ref': '#' }, { '$ref': '#/definitions/schemaArray' } ], 'default': {} }, 'maxItems': { '$ref': '#/definitions/positiveInteger' }, 'minItems': { '$ref': '#/definitions/positiveIntegerDefault0' }, 'uniqueItems': { 'type': 'boolean', 'default': false }, 'maxProperties': { '$ref': '#/definitions/positiveInteger' }, 'minProperties': { '$ref': '#/definitions/positiveIntegerDefault0' }, 'required': { '$ref': '#/definitions/stringArray' }, 'additionalProperties': { 'anyOf': [ { 'type': 'boolean' }, { '$ref': '#' } ], 'default': {} }, 'definitions': { 'type': 'object', 'additionalProperties': { '$ref': '#' }, 'default': {} }, 'properties': { 'type': 'object', 'additionalProperties': { '$ref': '#' }, 'default': {} }, 'patternProperties': { 'type': 'object', 'additionalProperties': { '$ref': '#' }, 'default': {} }, 'dependencies': { 'type': 'object', 'additionalProperties': { 'anyOf': [ { '$ref': '#' }, { '$ref': '#/definitions/stringArray' } ] } }, 'enum': { 'type': 'array', 'minItems': 1, 'uniqueItems': true }, 'type': { 'anyOf': [ { '$ref': '#/definitions/simpleTypes' }, { 'type': 'array', 'items': { '$ref': '#/definitions/simpleTypes' }, 'minItems': 1, 'uniqueItems': true } ] }, 'allOf': { '$ref': '#/definitions/schemaArray' }, 'anyOf': { '$ref': '#/definitions/schemaArray' }, 'oneOf': { '$ref': '#/definitions/schemaArray' }, 'not': { '$ref': '#' } }, 'dependencies': { 'exclusiveMaximum': [ 'maximum' ], 'exclusiveMinimum': [ 'minimum' ] }, 'default': {}}
+
+ const metaSchema = schemav4;
+
+ this.ajvService.addMetaSchema(metaSchema);
+ this.ajvService._opts.defaultMeta = metaSchema.id;
+
+ // Optionally you can also disable keywords defined in draft-06
+ this.ajvService.removeKeyword('propertyNames');
+ this.ajvService.removeKeyword('contains');
+ this.ajvService.removeKeyword('const');
+
+ } else {
+ this.jsonMsg = 'Invalid JSON Schema Data Format - jsonschema$schema version must be 04';
+ this.jsonErrMsgs = [];
+ return;
+ }
+ } catch (ajvErrMsg) {
+
+ this.jsonMsg = 'Failed - Schema checking initialization: ' + ajvErrMsg;
+ this.jsonErrMsgs = [];
+ return;
+ }
+
+
+ try {
+ const pschema = JSON.parse(this.dfschema);
+ const jsonSchema = pschema.jsonschema;
+
+ const sValidate = this.ajvService.compile(jsonSchema);
+ const result = sValidate(JSON.parse(this.dfjson));
+
+ let j = 0;
+ if (result === false) {
+ for ( const errMsg of Object.keys(sValidate.errors)) {
+ let msg = sValidate.errors[errMsg].message;
+ if (sValidate.errors[errMsg].hasOwnProperty('params')) {
+ if (sValidate.errors[errMsg].params.hasOwnProperty('additionalProperty')) {
+ msg = msg + ' - ';
+ msg = msg + sValidate.errors[errMsg].params.additionalProperty;
+ }
+ }
+ let dupMsg = false;
+ for (const k in this.jsonErrMsgs) {
+ if ( this.jsonErrMsgs[k] === msg) {
+ dupMsg = true;
+ }
+ }
+ if (dupMsg === false) {
+ this.jsonErrMsgs[j] = msg;
+ j = j + 1;
+ }
+ }
+ this.jsonMsg = 'JSON Input does not match Schema:';
+ return;
+ }
+ } catch (schemaError) {
+ this.jsonMsg = 'Unexpected Schema Validation Error' + schemaError;
+ return;
+ }
+ this.jsonMsg = 'JSON Input Validated';
+ this.jsonErrMsgs = [];
+ }
+
+ doDFJSONChange(ev: any) {
+ this.dfjson = ev.target.value;
+ this.validateJSON();
+ }
+}
diff --git a/dcaedftool/src/app/df-schema.component.css b/dcaedftool/src/app/df-schema.component.css new file mode 100644 index 0000000..304fc89 --- /dev/null +++ b/dcaedftool/src/app/df-schema.component.css @@ -0,0 +1,149 @@ +/*
+ org.onap.dcae
+ ============LICENSE_START====================================================
+ Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ =============================================================================
+ 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======================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+*/
+.scenario-toolbar {
+ color: #f2f2f2;
+ min-width: 520px;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 100%;
+ /*padding-left: 16px;
+ min-width: 520px; */
+ text-align: center;
+ background-color: #f2f2f2
+}
+.scenario-title {
+ color: #3f51b5;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 120%;
+ text-align: center;
+ background-color: #f2f2f2
+}
+.metaschema-title {
+ color: #3f51b5;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 50%;
+ font-weight: bold;
+ text-align: left;
+ background-color: #f2f2f2
+}
+
+.metaschema-text {
+ padding: 0px;
+ margin: 0px;
+ width: 100%;
+ font-size: 50%;
+ background-color: #f2f2f2;
+ white-space: pre-wrap;
+}
+.metaschema {
+ margin: 0px;
+}
+.metaschema-card {
+ margin: 0px;
+}
+.schema-container {
+ margin: 5px;
+}
+.schema-input-card {
+ margin: 5px;
+}
+
+.schema-container {
+ margin: 5px;
+}
+.schemainput-title {
+ color: #3f51b5;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 50%;
+ font-weight: bold;
+ text-align: left;
+ margin: 5px;
+ background-color: #f2f2f2
+}
+
+.schema-input-textarea {
+ padding: 10px;
+ width: 100%;
+ height: 600px;
+ font-size: 100%;
+ background-color: #f2f2f2
+}
+.schema-input {
+ padding: 30px;
+ width: 95%;
+/* height: 400px; */
+ padding-left: 20px;
+ padding-right: 20px;
+ padding-top: 20px;
+ background-color: #f2f2f2
+}
+.schema-msgs {
+ color: #3f51b5;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 100%;
+ background-color: #ffffff
+}
+.schema-version {
+ color: #3f51b5;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 75%;
+ text-align: center;
+ padding: 10px;
+ background-color: #f2f2f2
+}
+.schema-version md-content {
+ background: #f2f2f2;
+ color: #3f51b5;
+}
+.schema-error {
+ color: black;
+
+}
+
+.schema-version md-option:hover {
+ background: #f2f2f2;
+ color: #3f51b5;
+}
+.meta-version-button {
+ color: #3f51b5;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 120%;
+ text-align: center;
+ text-indent: 200px;
+ padding: 30px;
+ background-color: #f2f2f2
+}
+.meta-display-button {
+ color: #3f51b5;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 80%;
+ font-weight: bold;
+/* height: 25px; */
+ padding-bottom: 2px;
+ text-align: center ;
+ white-space: wrap;
+ overflow:hidden;
+
+
+ background-color: #f2f2f2
+}
+.schema-container {
+ margin: 5px;
+}
diff --git a/dcaedftool/src/app/df-schema.component.html b/dcaedftool/src/app/df-schema.component.html new file mode 100644 index 0000000..2a90e97 --- /dev/null +++ b/dcaedftool/src/app/df-schema.component.html @@ -0,0 +1,75 @@ +<!--
+ org.onap.dcae
+ ============LICENSE_START====================================================
+ Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ =============================================================================
+ 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======================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+-->
+<md-toolbar class="scenario-toolbar">
+ <div fxLayout="row" fxFill>
+ <div fxLayout="row" fxFlex fxFill >
+ <div class="one" fxFlex="15" fxHide="true" fxLayoutAlign="center center">
+ <md-select class="schema-version" placeholder="MetaSchema Version" >
+ <md-option class="schema-version" >
+ 1.0.0
+ </md-option>
+ <br>
+ </md-select>
+ </div>
+ <div fxFlex="15" fxLayoutAlign="center center">
+ <button md-raised-button class="meta-display-button" (click)=toggleMetaSchema() >
+ {{metaButton}}
+ </button>
+ </div>
+ <div fxFlex="75" fxLayoutAlign="center center">
+ <h1 class="scenario-title" text-align:center >Data Format Schema Verification</h1>
+ </div>
+ </div>
+ </div>
+</md-toolbar>
+
+<div fxLayout="row" fxFill flexLayoutGap=10px>
+ <div fxLayout="row" fxFlex fxFill flexLayoutGap=10px>
+ <div class="metaschema" fxFlex="100" fxFill fxShow={{metaDisplay}} flex="grow" fxLayoutAlign="center center">
+ <md-card class="metaschema-card">
+ <md-card-title class="metaschema-title">
+ Data Format MetaSchema
+ </md-card-title>
+ <md-card-content class="metaschema-text">
+ {{dfmetaschema}}
+ </md-card-content>
+ </md-card>
+ </div>
+ <div class="schema-container" fxLayout="column" fxFlex="100" fxFill flex="grow" fxLayoutAlign="center center">
+ <md-card class="schema-input-title" fxFlex="100" fxFill flex="grow" fxLayoutAlign="center center">
+ <md-card-title class="schemainput-title" fxFlex="100" fxFill flex="grow" fxLayoutAlign="left left">
+ Application Schema
+ </md-card-title>
+ </md-card>
+ <textarea mdInput class="schema-input-textarea" placeholder="Enter your Application Schema Definition Here" [ngModel]="dfschema" (keyup)="doDFSchemaChange($event)" flex="grow" fxLayoutAlign="center center" autofocus="">
+ </textarea>
+ <md-card class="schema-msgs" fxLayout="column" fxFlex="100" fxFill flex="grow" fxLayoutAlign="left left">
+ <h4>Schema Verification Messages</h4>
+ <span style="color:black">{{schemaMsg}}</span>
+ <ul class="schema-error" *ngFor="let msg of schemaErrMsgs">
+ <li class="schema-error" >
+ {{msg}}
+ </li>
+ </ul>
+ </md-card>
+ </div>
+ </div>
+</div>
diff --git a/dcaedftool/src/app/df-schema.component.spec.ts b/dcaedftool/src/app/df-schema.component.spec.ts new file mode 100644 index 0000000..dac20f2 --- /dev/null +++ b/dcaedftool/src/app/df-schema.component.spec.ts @@ -0,0 +1,99 @@ +// org.onap.dcae
+// ============LICENSE_START====================================================
+// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+// =============================================================================
+// 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======================================================
+//
+// ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import { NgModule } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+import {HttpModule} from '@angular/http'; // for future
+import {FormsModule, ReactiveFormsModule} from '@angular/forms'; // for future
+import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; // for future
+import { MaterialModule } from '@angular/material';
+import { FlexLayoutModule } from '@angular/flex-layout';
+import { RouterModule, Routes } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
+
+import {ValidateMetaSchemaService} from './validate-metaschema.service';
+import {ValidateJSONService} from './validate-json.service';
+import {MetaSchemaService} from './metaschema.service';
+import {DFSchemaComponent} from './df-schema.component';
+
+
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { By } from '@angular/platform-browser';
+import { DebugElement } from '@angular/core';
+
+describe('DFSchemaComponent Tests', function () {
+ let de: DebugElement;
+ let comp: DFSchemaComponent;
+ let fixture: ComponentFixture<DFSchemaComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [ BrowserModule,
+ BrowserAnimationsModule,
+ FormsModule,
+ HttpModule,
+ ReactiveFormsModule,
+ FlexLayoutModule,
+ MaterialModule,
+
+ ],
+ providers: [{provide: APP_BASE_HREF, useValue: '/'},
+ ValidateMetaSchemaService,
+ ValidateJSONService,
+ MetaSchemaService
+ ],
+ declarations: [
+ DFSchemaComponent,
+
+ ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(DFSchemaComponent);
+ comp = fixture.componentInstance;
+ //de = fixture.debugElement.query(By.css('h1'));
+ });
+
+ it('should create component', () => expect(comp).toBeDefined() );
+
+ it('should have no metaschema display as default', () => {
+ expect(comp.metaButton).toMatch('Display MetaSchema');
+ });
+ it('should metaschema display after toggle', () => {
+ comp.toggleMetaSchema();
+ expect(comp.metaButton).toMatch('Hide MetaSchema');
+ });
+ it('should validate valid schema', () => {
+ let ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"},"dataformatversion": "1.0.0", "jsonschema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ expect(comp.schemaMsg).toMatch("Valid Data Format Schema") ;
+ });
+ it('should not validate an invalid schema', () => {
+ let ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"}, "jsonschema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ expect(comp.schemaMsg).toMatch("Invalid Data Format Schema:") ;
+ });
+ it('jsonschema must be 04 or 06 schema', () => {
+ let ev = {target: {name: "test", value: '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"}, "jsonschema": { "$schema": "http://json-schema.org/draft-05/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'}};
+ comp.doDFSchemaChange(ev);
+ expect(comp.schemaMsg).toMatch(/Invalid JSON Schema Data Format - jsonschema\$schema version must be 04 or 06/) ;
+ });
+});
diff --git a/dcaedftool/src/app/df-schema.component.ts b/dcaedftool/src/app/df-schema.component.ts new file mode 100644 index 0000000..8075c79 --- /dev/null +++ b/dcaedftool/src/app/df-schema.component.ts @@ -0,0 +1,109 @@ +// org.onap.dcae
+// ============LICENSE_START====================================================
+// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+// =============================================================================
+// 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======================================================
+//
+// ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import { Component, Input, OnInit, OnChanges} from '@angular/core';
+import { MdToolbarModule, MdButton, MdInputModule, MdSelectModule} from '@angular/material';
+import {ValidateMetaSchemaService} from './validate-metaschema.service';
+import {MetaSchemaService} from './metaschema.service';
+
+@Component({
+ selector: 'app-df-schema',
+ templateUrl: './df-schema.component.html',
+ styleUrls: [ './df-schema.component.css']
+})
+export class DFSchemaComponent implements OnInit /*, OnChanges */ {
+ public dfschema = '';
+ private jsonTestObject: any;
+ private validJSON: boolean;
+ public metaDisplay = false;
+ public schemaMsg: string;
+ public schemaErrMsgs: string[] = [];
+ private schemaMsgColor: string;
+ private schemaPassColor = '#00ff00';
+ private schemaFailColor = '#ff0000';
+ public metaButton = 'Display MetaSchema';
+ private hideMeta = 'Hide MetaSchema';
+ private displayMeta = 'Display Metaschema';
+ private schemaValidate: Object;
+ private validateMetaSchema: ValidateMetaSchemaService;
+ private metaSchema: MetaSchemaService;
+
+
+ // inline for now - TBD
+ public dfmetaschema: string;
+ private dfjson: string;
+
+ constructor (validateMetaSchemaService: ValidateMetaSchemaService, metaSchemaService: MetaSchemaService) {
+ this.validateMetaSchema = validateMetaSchemaService;
+ this.metaSchema = metaSchemaService;
+ this.dfmetaschema = this.metaSchema.currentMetaSchemaFormatted();
+ }
+
+ ngOnInit(): void {
+ this.schemaMsgColor=this.schemaPassColor;
+ }
+
+ toggleMetaSchema(): void {
+ this.metaDisplay = !this.metaDisplay;
+ if (this.metaDisplay === true) {
+ this.metaButton = this.hideMeta;
+ } else {
+ this.metaButton = this.displayMeta;
+ }
+ }
+
+ doDFSchemaChange(ev: any) {
+ this.schemaErrMsgs = [];
+ this.schemaMsg = '';
+ this.dfschema = ev.target.value;
+ if (this.dfschema.length == 0) {
+ return;
+ }
+ try {
+ // check for JSON validity
+ this.jsonTestObject = JSON.parse(this.dfschema);
+ this.validJSON = true;
+ this.schemaMsg = 'Valid JSON';
+ } catch (jsonErrMsg) {
+ this.schemaMsg = 'Invalid JSON: ' + jsonErrMsg;
+ return;
+ }
+ if (this.jsonTestObject.hasOwnProperty('jsonschema')) {
+ if (this.jsonTestObject.jsonschema.hasOwnProperty('$schema')){
+ try {
+ if (!(this.jsonTestObject.jsonschema.$schema === 'http://json-schema.org/draft-04/schema#' || this.jsonTestObject.jsonschema.$schema === 'http://json-schema.org/draft-06/schema#')) {
+ this.schemaMsg = 'Invalid JSON Schema Data Format - jsonschema$schema version must be 04 or 06';
+ return;
+ }
+ } catch(schemaVersionErr) {
+ this.schemaMsg = 'Invalid JSON Schema Data Format - jsonschema$schema version must be 04 or 06';
+ return;
+ }
+ } else {
+ this.schemaMsg = 'Invalid JSON Schema Data Format - jsonschema$schema must be specified';
+ return;
+ }
+ }
+ if (this.validateMetaSchema.validate(this.dfschema) === false) {
+ this.schemaMsg = 'Invalid Data Format Schema:';
+ this.schemaErrMsgs = this.validateMetaSchema.validateMsgs();
+ } else {
+ this.schemaMsg = 'Valid Data Format Schema';
+ }
+ }
+ }
diff --git a/dcaedftool/src/app/metaschema.service.spec.ts b/dcaedftool/src/app/metaschema.service.spec.ts new file mode 100644 index 0000000..3edb058 --- /dev/null +++ b/dcaedftool/src/app/metaschema.service.spec.ts @@ -0,0 +1,38 @@ +// org.onap.dcae +// ============LICENSE_START==================================================== +// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +// ============================================================================= +// 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====================================================== +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +import { Injectable } from '@angular/core'; +import {MetaSchemaService} from './metaschema.service'; + + +describe('MetaSchemaService test suite', function () { + let service: MetaSchemaService; + + beforeEach(() => { + service = new MetaSchemaService; + }); + + it('should create service', () => expect(service).toBeDefined() ); + + it('should have have a formatted schema', () => { + expect(service.currentMetaSchemaFormatted()).toMatch('/.*schema.*/') ; + }); + it('should have have a json schema', () => { + expect(service.currentMetaSchema().$schema).toMatch('/.*json-schema.org.*draft.*'); + }); +}); diff --git a/dcaedftool/src/app/metaschema.service.ts b/dcaedftool/src/app/metaschema.service.ts new file mode 100644 index 0000000..93959fe --- /dev/null +++ b/dcaedftool/src/app/metaschema.service.ts @@ -0,0 +1,55 @@ +// org.onap.dcae
+// ============LICENSE_START====================================================
+// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+// =============================================================================
+// 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======================================================
+//
+// ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class MetaSchemaService {
+
+ private metaschemaVersions: string [] = ['1.0','1.1 test only'];
+ private metaschemaVersion: string;
+
+ // Get it from a external URL? Note version 6 now.
+ private metaschema1_obj: any ={'$schema': 'http://json-schema.org/draft-04/schema#','title':'Data format specification schema Version 1.0','type':'object','oneOf':[{'properties':{'self':{'$ref':'#/definitions/self'},'dataformatversion':{'$ref':'#/definitions/dataformatversion'},'reference':{'type':'object','description':'A reference to an external schema','properties':{'name':{'$ref':'#/definitions/name'},'version':{'$ref':'#/definitions/version'},'format':{'$ref':'#/definitions/format'}},'required':['name','version','format'],'additionalProperties':false}},'required':['self','dataformatversion','reference'],'additionalProperties':false},{'properties':{'self':{'$ref':'#/definitions/self'},'dataformatversion':{'$ref':'#/definitions/dataformatversion'},'jsonschema':{'$schema':'http://json-schema.org/draft-04/schema#','description':'The JSON schema for this data format'}},'required':['self','dataformatversion','jsonschema'],'additionalProperties':false},{'properties':{'self':{'$ref':'#/definitions/self'},'dataformatversion':{'$ref':'#/definitions/dataformatversion'},'delimitedschema':{'type':'object','description':'A JSON schema for delimited files','properties':{'delimiter':{'enum':[',','|','\t']},'fields':{'type':'array','description':'Array of field descriptions','items':{'$ref':'#/definitions/field'}}},'additionalProperties':false}},'required':['self','dataformatversion','delimitedschema'],'additionalProperties':false},{'properties':{'self':{'$ref':'#/definitions/self'},'dataformatversion':{'$ref':'#/definitions/dataformatversion'},'unstructured':{'type':'object','description':'A JSON schema for unstructured text','properties':{'encoding':{'type':'string','enum':['ASCII','UTF-8','UTF-16','UTF-32']}},'additionalProperties':false}},'required':['self','dataformatversion','unstructured'],'additionalProperties':false}],'definitions':{'name':{'type':'string'},'version':{'type':'string','pattern':'^(\\d+\\.)(\\d+\\.)(\\*|\\d+)$'},'self':{'description':'Identifying Information','type':'object','properties':{'name':{'$ref':'#/definitions/name'},'version':{'$ref':'#/definitions/version'},'description':{'type':'string'}},'required':['name','version'],'additionalProperties':false},'format':{'description':'Referenceschematype','type':'string','enum':['JSON','DelimitedFormat','XML','Unstructured']},'field':{'description':'Afielddefinitionforthedelimitedschema','type':'object','properties':{'name':{'type':'string'},'description':{'type':'string'},'fieldtype':{'description':'the field type; XML schema types','type':'string','enum':['string','boolean','decimal','float','double','duration','dateTime','time','date','gYearMonth','gYear','gMonthDay','gDay','gMonth','hexBinary','base64Binary','anyURI','QName','NOTATION','normalizedString','token','language','IDREFS','ENTITIES','NMTOKEN','NMTOKENS','Name','NCName','ID','IDREF','ENTITY','integer','nonPositiveInteger','negativeInteger','long','int','short','byte','nonNegativeInteger','unsignedLong','unsignedInt','unsignedShort','unsignedByte','positiveInteger']},'fieldPattern':{'description':'Regular expression','type':'integer'},'fieldMaxLength':{'description':'The maximum length','type':'integer'},'fieldMinLength':{'description':'The minimum length','type':'integer'},'fieldMinimum':{'description':'The minimum numeric value','type':'integer'},'fieldMaximum':{'description':'The maximum numeric value','type':'integer'}},'additionalProperties':false},'dataformatversion':{'type':'string','enum':['1.0.0']}}};
+
+ private currentMetaSchemaVersion = '1.0';
+
+ constructor() {
+ }
+
+ currentMetaSchema(): any {
+ return this.metaschema1_obj;
+ }
+ currentMetaSchemaFormatted(): string {
+ return JSON.stringify(this.metaschema1_obj, undefined, '\t');
+ }
+
+ metaSchemaVersion(): string {
+ return this.currentMetaSchemaVersion;
+ }
+
+ setMetaSchemaVersion(newVersion: string): boolean {
+ this.currentMetaSchemaVersion = newVersion;
+ return true;
+ }
+
+ metaSchemaVersions(): any {
+ return this.metaschemaVersions;
+ }
+
+}
diff --git a/dcaedftool/src/app/validate-json.service.spec.ts b/dcaedftool/src/app/validate-json.service.spec.ts new file mode 100644 index 0000000..b9f0dc0 --- /dev/null +++ b/dcaedftool/src/app/validate-json.service.spec.ts @@ -0,0 +1,42 @@ +// org.onap.dcae +// ============LICENSE_START==================================================== +// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +// ============================================================================= +// 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====================================================== +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +import { Injectable } from '@angular/core'; +import {ValidateJSONService} from './validate-json.service'; + + +describe('ValidateJSONService test suite', function () { + let service: ValidateJSONService; + + beforeEach(() => { + service = new ValidateJSONService; + }); + + it('should create service', () => expect(service).toBeDefined() ); + + it('should validate valid json', () => { + var jsonString = '{"testjson": "teststring"}' + expect(service.validate(jsonString)).toBe(true) ; + expect(service.validateMsgs()).toMatch('Valid JSON') ; + }); + it('should fail to validate invalid json', () => { + var jsonString = '"testjson": "teststring"}' + expect(service.validate(jsonString)).toBe(false) ; + expect(service.validateMsgs()).toMatch('Invalid JSON/*') ; + }); +}); diff --git a/dcaedftool/src/app/validate-json.service.ts b/dcaedftool/src/app/validate-json.service.ts new file mode 100644 index 0000000..e85d664 --- /dev/null +++ b/dcaedftool/src/app/validate-json.service.ts @@ -0,0 +1,49 @@ +// org.onap.dcae
+// ============LICENSE_START====================================================
+// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+// =============================================================================
+// 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======================================================
+//
+// ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import { Injectable } from '@angular/core';
+
+
+@Injectable()
+export class ValidateJSONService {
+
+ private lastErrors: string;
+
+
+ constructor() {
+
+ }
+
+ validate( jsonString: string): boolean {
+ try {
+ // check for JSON validity
+ const jsonTestObject = JSON.parse(jsonString);
+ this.lastErrors = 'Valid JSON';
+ return true;
+ } catch (jsonErrMsg) {
+ this.lastErrors = 'Invalid JSON: ' + jsonErrMsg;
+ return false;
+ }
+
+ }
+ validateMsgs(): string {
+ return this.lastErrors;
+ }
+
+
+}
diff --git a/dcaedftool/src/app/validate-metaschema.service.spec.ts b/dcaedftool/src/app/validate-metaschema.service.spec.ts new file mode 100644 index 0000000..bdc28a3 --- /dev/null +++ b/dcaedftool/src/app/validate-metaschema.service.spec.ts @@ -0,0 +1,66 @@ +// org.onap.dcae
+// ============LICENSE_START====================================================
+// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+// =============================================================================
+// 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======================================================
+//
+// ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import { Injectable } from '@angular/core';
+import {ValidateMetaSchemaService} from './validate-metaschema.service';
+import {MetaSchemaService} from './metaschema.service';
+import {ValidateJSONService} from './validate-json.service';
+
+describe('ValidateMetaSchemaService test suite', function () {
+ let service: ValidateMetaSchemaService;
+
+ beforeEach(() => {
+ let jsonservice = new ValidateJSONService;
+ let metaservice = new MetaSchemaService;
+ service = new ValidateMetaSchemaService(metaservice, jsonservice);
+ });
+
+ it('should create service', () => expect(service).toBeDefined() );
+
+
+ it('should fail to validate invalid json', () => {
+ var jsonString = '"testjson": "teststring"}'
+ expect(service.validate(jsonString)).toBe(false) ;
+ expect(service.validateMsgs()).toMatch("Invalid JSON.*");
+ });
+ it('should validate valid JSON schema', () => {
+ var jsonString = '{"self": { "name": "CUDA Simple JSON Example","version": "1.0.0","description": "An example of unnested JSON schema for CUDA Input and output"},"dataformatversion": "1.0.0", "jsonschema": { "$schema": "http://json-schema.org/draft-04/schema#","type": "object", "properties": {"raw-text": {"type": "string" } }, "required": ["raw-text"], "additionalProperties": false }}'
+ expect(service.validate(jsonString)).toBe(true) ;
+ });
+
+ it('should validate valid reference schema', () => {
+ var jsonString ='{ "self": { "name": "Common Event Format Definition", "version": "25.0.0", "description": "Common Event Format Definition"}, "dataformatversion": "1.0.0", "reference": { "name": "Common Event Format", "format": "JSON", "version": "25.0.0" }}';
+ expect(service.validate(jsonString)).toBe(true) ;
+ });
+
+ it('should validate valid delimited schema', () => {
+ var jsonString ='{"self": {"name": "Delimited Format Example", "version": "1.0.0", "description": "Delimited format example just for testing" }, "dataformatversion": "1.0.0", "delimitedschema": { "delimiter": "|", "fields": [{ "name": "field1", "description": "test field1", "fieldtype": "string" }, { "name": "field2", "description": "test field2", "fieldtype": "boolean" }] } }'
+ expect(service.validate(jsonString)).toBe(true) ;
+ });
+
+ it('should validate valid unstructured schema', () => {
+ var jsonString ='{ "self": { "name": "CUDA Unstructured Text Example","version": "25.0.0", "description": "An example of a unstructured text used for both input and output for CUDA"}, "dataformatversion": "1.0.0","unstructured": { "encoding": "UTF-8"}}';
+ expect(service.validate(jsonString)).toBe(true) ;
+ });
+
+ it('should fail to validate invalid schema', () => {
+ var jsonString = '{"testjson": "teststring"}'
+ expect(service.validate(jsonString)).toBe(false) ;
+ });
+
+});
diff --git a/dcaedftool/src/app/validate-metaschema.service.ts b/dcaedftool/src/app/validate-metaschema.service.ts new file mode 100644 index 0000000..6a61f0b --- /dev/null +++ b/dcaedftool/src/app/validate-metaschema.service.ts @@ -0,0 +1,99 @@ +// org.onap.dcae
+// ============LICENSE_START====================================================
+// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+// =============================================================================
+// 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======================================================
+//
+// ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import { Injectable } from '@angular/core';
+import {MetaSchemaService} from './metaschema.service';
+import {ValidateJSONService} from './validate-json.service';
+import * as Ajv from 'ajv';
+
+@Injectable()
+export class ValidateMetaSchemaService {
+
+ private ajv: any;
+ private schemaValidate: any;
+ private metaSchema: MetaSchemaService;
+ private jsonValidate: ValidateJSONService;
+ private lastErrors:string[] = [];
+
+ constructor(metaSchemaService: MetaSchemaService, jsonValidateService: ValidateJSONService) {
+ this.metaSchema = metaSchemaService;
+ this.jsonValidate = jsonValidateService;
+ }
+
+ validate(schema: string): boolean {
+ // check JSON
+ if (this.jsonValidate.validate(schema) === false) {
+ // assumes simple message - TBD???
+ this.lastErrors[0] = this.jsonValidate.validateMsgs();
+ return false;
+ }
+ // Schema is assumed to be V4 for now (jsonschema does not support V6 yet so we must wait since this is used by the CLI)
+ try {
+ this.ajv = new Ajv({
+ meta: false, // optional, to prevent adding draft-06 meta-schema
+ extendRefs: true, // optional, current default is to 'fail', spec behaviour is to 'ignore'
+ allErrors: true,
+ unknownFormats: 'ignore' // optional, current default is true (fail)
+ });
+ // change this to http get at some point TBD
+ const schemav4: any = { 'id': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#', 'description': 'Core schema meta-schema', 'definitions': { 'schemaArray': { 'type': 'array', 'minItems': 1, 'items': { '$ref': '#' } }, 'positiveInteger': { 'type': 'integer', 'minimum': 0 }, 'positiveIntegerDefault0': { 'allOf': [ { '$ref': '#/definitions/positiveInteger' }, { 'default': 0 } ] }, 'simpleTypes': { 'enum': [ 'array', 'boolean', 'integer', 'null', 'number', 'object', 'string' ] }, 'stringArray': { 'type': 'array', 'items': { 'type': 'string' }, 'minItems': 1, 'uniqueItems': true } }, 'type': 'object', 'properties': { 'id': { 'type': 'string', 'format': 'uri' }, '$schema': { 'type': 'string', 'format': 'uri' }, 'title': { 'type': 'string' }, 'description': { 'type': 'string' }, 'default': {}, 'multipleOf': { 'type': 'number', 'minimum': 0, 'exclusiveMinimum': true }, 'maximum': { 'type': 'number' }, 'exclusiveMaximum': { 'type': 'boolean', 'default': false }, 'minimum': { 'type': 'number' }, 'exclusiveMinimum': { 'type': 'boolean', 'default': false }, 'maxLength': { '$ref': '#/definitions/positiveInteger' }, 'minLength': { '$ref': '#/definitions/positiveIntegerDefault0' }, 'pattern': { 'type': 'string', 'format': 'regex' }, 'additionalItems': { 'anyOf': [ { 'type': 'boolean' }, { '$ref': '#' } ], 'default': {} }, 'items': { 'anyOf': [ { '$ref': '#' }, { '$ref': '#/definitions/schemaArray' } ], 'default': {} }, 'maxItems': { '$ref': '#/definitions/positiveInteger' }, 'minItems': { '$ref': '#/definitions/positiveIntegerDefault0' }, 'uniqueItems': { 'type': 'boolean', 'default': false }, 'maxProperties': { '$ref': '#/definitions/positiveInteger' }, 'minProperties': { '$ref': '#/definitions/positiveIntegerDefault0' }, 'required': { '$ref': '#/definitions/stringArray' }, 'additionalProperties': { 'anyOf': [ { 'type': 'boolean' }, { '$ref': '#' } ], 'default': {} }, 'definitions': { 'type': 'object', 'additionalProperties': { '$ref': '#' }, 'default': {} }, 'properties': { 'type': 'object', 'additionalProperties': { '$ref': '#' }, 'default': {} }, 'patternProperties': { 'type': 'object', 'additionalProperties': { '$ref': '#' }, 'default': {} }, 'dependencies': { 'type': 'object', 'additionalProperties': { 'anyOf': [ { '$ref': '#' }, { '$ref': '#/definitions/stringArray' } ] } }, 'enum': { 'type': 'array', 'minItems': 1, 'uniqueItems': true }, 'type': { 'anyOf': [ { '$ref': '#/definitions/simpleTypes' }, { 'type': 'array', 'items': { '$ref': '#/definitions/simpleTypes' }, 'minItems': 1, 'uniqueItems': true } ] }, 'allOf': { '$ref': '#/definitions/schemaArray' }, 'anyOf': { '$ref': '#/definitions/schemaArray' }, 'oneOf': { '$ref': '#/definitions/schemaArray' }, 'not': { '$ref': '#' } }, 'dependencies': { 'exclusiveMaximum': [ 'maximum' ], 'exclusiveMinimum': [ 'minimum' ] }, 'default': {}}
+
+ const metaSchema = schemav4;
+
+ this.ajv.addMetaSchema(metaSchema);
+ this.ajv._opts.defaultMeta = metaSchema.id;
+
+ // Optionally you can also disable keywords defined in draft-06
+ this.ajv.removeKeyword('propertyNames');
+ this.ajv.removeKeyword('contains');
+ this.ajv.removeKeyword('const');
+
+ const sValidate = this.ajv.compile(this.metaSchema.currentMetaSchema());
+ const result = sValidate(JSON.parse(schema));
+ let j = 0;
+ if (result === false) {
+ for ( const errMsg of Object.keys(sValidate.errors)) {
+ let msg = sValidate.errors[errMsg].message;
+ if (sValidate.errors[errMsg].hasOwnProperty('params')) {
+ if (sValidate.errors[errMsg].params.hasOwnProperty('additionalProperty')) {
+ msg = msg + ' - ';
+ msg = msg + sValidate.errors[errMsg].params.additionalProperty;
+ }
+ }
+ let dupMsg = false;
+ for (const k in this.lastErrors) {
+ if ( this.lastErrors[k] === msg) {
+ dupMsg = true;
+ }
+ }
+ if (dupMsg === false) {
+ this.lastErrors[j] = msg;
+ j = j + 1;
+ }
+ }
+ }
+ return result;
+ } catch(ajvError){
+ this.lastErrors[0] = ajvError;
+ }
+ }
+
+ validateMsgs(): string[] {
+ return this.lastErrors;
+ }
+}
diff --git a/dcaedftool/src/assets/.gitkeep b/dcaedftool/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/dcaedftool/src/assets/.gitkeep diff --git a/dcaedftool/src/environments/environment.prod.ts b/dcaedftool/src/environments/environment.prod.ts new file mode 100644 index 0000000..287841f --- /dev/null +++ b/dcaedftool/src/environments/environment.prod.ts @@ -0,0 +1,21 @@ +// org.onap.dcae +// ============LICENSE_START==================================================== +// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +// ============================================================================= +// 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====================================================== +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +export const environment = { + production: true +}; diff --git a/dcaedftool/src/environments/environment.ts b/dcaedftool/src/environments/environment.ts new file mode 100644 index 0000000..6d60047 --- /dev/null +++ b/dcaedftool/src/environments/environment.ts @@ -0,0 +1,26 @@ +// org.onap.dcae +// ============LICENSE_START==================================================== +// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +// ============================================================================= +// 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====================================================== +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +// The file contents for the current environment will overwrite these during build. +// The build system defaults to the dev environment which uses `environment.ts`, but if you do +// `ng build --env=prod` then `environment.prod.ts` will be used instead. +// The list of which env maps to which file can be found in `.angular-cli.json`. + +export const environment = { + production: false +}; diff --git a/dcaedftool/src/favicon.ico b/dcaedftool/src/favicon.ico Binary files differnew file mode 100755 index 0000000..ba72777 --- /dev/null +++ b/dcaedftool/src/favicon.ico diff --git a/dcaedftool/src/index.html b/dcaedftool/src/index.html new file mode 100644 index 0000000..b0e97de --- /dev/null +++ b/dcaedftool/src/index.html @@ -0,0 +1,34 @@ +<!-- + org.onap.dcae + ============LICENSE_START==================================================== + Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + ============================================================================= + 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====================================================== + + ECOMP is a trademark and service mark of AT&T Intellectual Property. +--> +<!DOCTYPE html> +<html> + <head> + <title>DCAE Data Format Tool</title> + <base href="/"> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> + </head> + + <body> + <app-df>Loading AppComponent content here ...</app-df> + </body> +</html> diff --git a/dcaedftool/src/main.ts b/dcaedftool/src/main.ts new file mode 100644 index 0000000..5b0eea6 --- /dev/null +++ b/dcaedftool/src/main.ts @@ -0,0 +1,29 @@ +// org.onap.dcae +// ============LICENSE_START==================================================== +// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +// ============================================================================= +// 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====================================================== +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. + +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { enableProdMode } from '@angular/core'; + +// Enable production mode unless running locally +if (!/localhost/.test(document.location.host)) { + enableProdMode(); +} +platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/dcaedftool/src/polyfills.ts b/dcaedftool/src/polyfills.ts new file mode 100644 index 0000000..54dde20 --- /dev/null +++ b/dcaedftool/src/polyfills.ts @@ -0,0 +1,91 @@ +// org.onap.dcae +// ============LICENSE_START==================================================== +// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +// ============================================================================= +// 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====================================================== +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE9, IE10 and IE11 requires all of the following polyfills. **/ + import 'core-js/es6/symbol'; + import 'core-js/es6/object'; + import 'core-js/es6/function'; + import 'core-js/es6/parse-int'; + import 'core-js/es6/parse-float'; + import 'core-js/es6/number'; + import 'core-js/es6/math'; + import 'core-js/es6/string'; + import 'core-js/es6/date'; + import 'core-js/es6/array'; + import 'core-js/es6/regexp'; + import 'core-js/es6/map'; + import 'core-js/es6/weak-map'; + import 'core-js/es6/set'; + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ + import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** IE10 and IE11 requires the following to support `@angular/animation`. */ + import 'web-animations-js'; // Run `npm install --save web-animations-js`. + + +/** Evergreen browsers require these. **/ +import 'core-js/es6/reflect'; +import 'core-js/es7/reflect'; + + +/** ALL Firefox browsers require the following to support `@angular/animation`. **/ + import 'web-animations-js'; // Run `npm install --save web-animations-js`. + + + +/*************************************************************************************************** + * Zone JS is required by Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ + +/** + * Date, currency, decimal and percent pipes. + * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 + */ + import 'intl'; // Run `npm install --save intl`. +/** + * Need to import at least one locale-data with intl. + */ + import 'intl/locale-data/jsonp/en'; diff --git a/dcaedftool/src/styles.css b/dcaedftool/src/styles.css new file mode 100644 index 0000000..8000872 --- /dev/null +++ b/dcaedftool/src/styles.css @@ -0,0 +1,36 @@ +/* + org.onap.dcae + ============LICENSE_START==================================================== + Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + ============================================================================= + 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====================================================== + + ECOMP is a trademark and service mark of AT&T Intellectual Property. +*/ + +md-card { + color: #3f51b5; + font-family: Arial, Helvetica, sans-serif; + font-size: 200%; + +} + +md-sidenav { + background-color: #f2f2f2 +} +md-toolbar { + + +} +.mat-elevation-z0{box-shadow:0 0 0 0 rgba(0,0,0,.2),0 0 0 0 rgba(0,0,0,.14),0 0 0 0 rgba(0,0,0,.12)}.mat-elevation-z1{box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12)}.mat-elevation-z2{box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)}.mat-elevation-z3{box-shadow:0 3px 3px -2px rgba(0,0,0,.2),0 3px 4px 0 rgba(0,0,0,.14),0 1px 8px 0 rgba(0,0,0,.12)}.mat-elevation-z4{box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)}.mat-elevation-z5{box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 5px 8px 0 rgba(0,0,0,.14),0 1px 14px 0 rgba(0,0,0,.12)}.mat-elevation-z6{box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12)}.mat-elevation-z7{box-shadow:0 4px 5px -2px rgba(0,0,0,.2),0 7px 10px 1px rgba(0,0,0,.14),0 2px 16px 1px rgba(0,0,0,.12)}.mat-elevation-z8{box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12)}.mat-elevation-z9{box-shadow:0 5px 6px -3px rgba(0,0,0,.2),0 9px 12px 1px rgba(0,0,0,.14),0 3px 16px 2px rgba(0,0,0,.12)}.mat-elevation-z10{box-shadow:0 6px 6px -3px rgba(0,0,0,.2),0 10px 14px 1px rgba(0,0,0,.14),0 4px 18px 3px rgba(0,0,0,.12)}.mat-elevation-z11{box-shadow:0 6px 7px -4px rgba(0,0,0,.2),0 11px 15px 1px rgba(0,0,0,.14),0 4px 20px 3px rgba(0,0,0,.12)}.mat-elevation-z12{box-shadow:0 7px 8px -4px rgba(0,0,0,.2),0 12px 17px 2px rgba(0,0,0,.14),0 5px 22px 4px rgba(0,0,0,.12)}.mat-elevation-z13{box-shadow:0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12)}.mat-elevation-z14{box-shadow:0 7px 9px -4px rgba(0,0,0,.2),0 14px 21px 2px rgba(0,0,0,.14),0 5px 26px 4px rgba(0,0,0,.12)}.mat-elevation-z15{box-shadow:0 8px 9px -5px rgba(0,0,0,.2),0 15px 22px 2px rgba(0,0,0,.14),0 6px 28px 5px rgba(0,0,0,.12)}.mat-elevation-z16{box-shadow:0 8px 10px -5px rgba(0,0,0,.2),0 16px 24px 2px rgba(0,0,0,.14),0 6px 30px 5px rgba(0,0,0,.12)}.mat-elevation-z17{box-shadow:0 8px 11px -5px rgba(0,0,0,.2),0 17px 26px 2px rgba(0,0,0,.14),0 6px 32px 5px rgba(0,0,0,.12)}.mat-elevation-z18{box-shadow:0 9px 11px -5px rgba(0,0,0,.2),0 18px 28px 2px rgba(0,0,0,.14),0 7px 34px 6px rgba(0,0,0,.12)}.mat-elevation-z19{box-shadow:0 9px 12px -6px rgba(0,0,0,.2),0 19px 29px 2px rgba(0,0,0,.14),0 7px 36px 6px rgba(0,0,0,.12)}.mat-elevation-z20{box-shadow:0 10px 13px -6px rgba(0,0,0,.2),0 20px 31px 3px rgba(0,0,0,.14),0 8px 38px 7px rgba(0,0,0,.12)}.mat-elevation-z21{box-shadow:0 10px 13px -6px rgba(0,0,0,.2),0 21px 33px 3px rgba(0,0,0,.14),0 8px 40px 7px rgba(0,0,0,.12)}.mat-elevation-z22{box-shadow:0 10px 14px -6px rgba(0,0,0,.2),0 22px 35px 3px rgba(0,0,0,.14),0 8px 42px 7px rgba(0,0,0,.12)}.mat-elevation-z23{box-shadow:0 11px 14px -7px rgba(0,0,0,.2),0 23px 36px 3px rgba(0,0,0,.14),0 9px 44px 8px rgba(0,0,0,.12)}.mat-elevation-z24{box-shadow:0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14),0 9px 46px 8px rgba(0,0,0,.12)}.mat-ripple{overflow:hidden}.mat-ripple.mat-ripple-unbounded{overflow:visible}.mat-ripple-element{position:absolute;border-radius:50%;pointer-events:none;transition:opacity,transform 0s cubic-bezier(0,0,.2,1);transform:scale(0)}.mat-option{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:48px;height:48px;padding:0 16px;font-size:16px;font-family:Roboto,"Helvetica Neue",sans-serif;text-align:left;text-decoration:none;position:relative;cursor:pointer;outline:0}.mat-option[disabled]{cursor:default}[dir=rtl] .mat-option{text-align:right}.mat-option .mat-icon{margin-right:16px}[dir=rtl] .mat-option .mat-icon{margin-left:16px}.mat-option[aria-disabled=true]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.mat-option-ripple{position:absolute;top:0;left:0;bottom:0;right:0}@media screen and (-ms-high-contrast:active){.mat-option-ripple{opacity:.5}}.mat-option-pseudo-checkbox{margin-right:8px}[dir=rtl] .mat-option-pseudo-checkbox{margin-left:8px;margin-right:0}.cdk-visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;text-transform:none;width:1px}.cdk-global-overlay-wrapper,.cdk-overlay-container{pointer-events:none;top:0;left:0;height:100%;width:100%}.cdk-overlay-container{position:fixed;z-index:1000}.cdk-global-overlay-wrapper{display:flex;position:absolute;z-index:1000}.cdk-overlay-pane{position:absolute;pointer-events:auto;box-sizing:border-box;z-index:1000}.cdk-overlay-backdrop{position:absolute;top:0;bottom:0;left:0;right:0;z-index:1000;pointer-events:auto;transition:opacity .4s cubic-bezier(.25,.8,.25,1);opacity:0}.cdk-overlay-backdrop.cdk-overlay-backdrop-showing{opacity:.48}.cdk-overlay-dark-backdrop{background:rgba(0,0,0,.6)}.cdk-overlay-transparent-backdrop{background:0 0}.mat-ripple-element{background-color:rgba(0,0,0,.1)}.mat-option:focus:not(.mat-option-disabled),.mat-option:hover:not(.mat-option-disabled){background:rgba(0,0,0,.04)}.mat-option.mat-selected{color:#3f51b5}.mat-option.mat-selected:not(.mat-option-multiple){background:rgba(0,0,0,.04)}.mat-option.mat-active{background:rgba(0,0,0,.04);color:rgba(0,0,0,.87)}.mat-option.mat-option-disabled{color:rgba(0,0,0,.38)}.mat-pseudo-checkbox{color:rgba(0,0,0,.54)}.mat-pseudo-checkbox::after{color:#fafafa}.mat-pseudo-checkbox-checked.mat-primary,.mat-pseudo-checkbox-indeterminate.mat-primary{background:#3f51b5}.mat-pseudo-checkbox-checked.mat-accent,.mat-pseudo-checkbox-indeterminate.mat-accent{background:#e91e63}.mat-pseudo-checkbox-checked.mat-warn,.mat-pseudo-checkbox-indeterminate.mat-warn{background:#f44336}.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled,.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled{background:#b0b0b0}.mat-app-background{background-color:#fafafa}.mat-theme-loaded-marker{display:none}.mat-autocomplete-panel{background:#fff;color:rgba(0,0,0,.87)}.mat-autocomplete-panel .mat-option.mat-selected:not(.mat-active){background:#fff;color:rgba(0,0,0,.87)}.mat-button.mat-primary .mat-button-focus-overlay,.mat-fab.mat-primary .mat-button-focus-overlay,.mat-icon-button.mat-primary .mat-button-focus-overlay,.mat-mini-fab.mat-primary .mat-button-focus-overlay,.mat-raised-button.mat-primary .mat-button-focus-overlay{background-color:rgba(63,81,181,.12)}.mat-button.mat-accent .mat-button-focus-overlay,.mat-fab.mat-accent .mat-button-focus-overlay,.mat-icon-button.mat-accent .mat-button-focus-overlay,.mat-mini-fab.mat-accent .mat-button-focus-overlay,.mat-raised-button.mat-accent .mat-button-focus-overlay{background-color:rgba(255,64,129,.12)}.mat-button.mat-warn .mat-button-focus-overlay,.mat-fab.mat-warn .mat-button-focus-overlay,.mat-icon-button.mat-warn .mat-button-focus-overlay,.mat-mini-fab.mat-warn .mat-button-focus-overlay,.mat-raised-button.mat-warn .mat-button-focus-overlay{background-color:rgba(232,78,64,.12)}.mat-button[disabled] .mat-button-focus-overlay,.mat-fab[disabled] .mat-button-focus-overlay,.mat-icon-button[disabled] .mat-button-focus-overlay,.mat-mini-fab[disabled] .mat-button-focus-overlay,.mat-raised-button[disabled] .mat-button-focus-overlay{background-color:transparent}.mat-button,.mat-icon-button{background:0 0}.mat-button.mat-primary,.mat-icon-button.mat-primary{color:#3f51b5}.mat-button.mat-accent,.mat-icon-button.mat-accent{color:#ff4081}.mat-button.mat-warn,.mat-icon-button.mat-warn{color:#f44336}.mat-button.mat-accent[disabled],.mat-button.mat-primary[disabled],.mat-button.mat-warn[disabled],.mat-button[disabled][disabled],.mat-icon-button.mat-accent[disabled],.mat-icon-button.mat-primary[disabled],.mat-icon-button.mat-warn[disabled],.mat-icon-button[disabled][disabled]{color:rgba(0,0,0,.38)}.mat-icon-button.mat-primary .mat-ripple-element{background-color:rgba(63,81,181,.26)}.mat-icon-button.mat-accent .mat-ripple-element{background-color:rgba(255,64,129,.26)}.mat-icon-button.mat-warn .mat-ripple-element{background-color:rgba(232,78,64,.26)}.mat-fab,.mat-mini-fab,.mat-raised-button{color:rgba(0,0,0,.87);background-color:#fff}.mat-fab.mat-primary,.mat-mini-fab.mat-primary,.mat-raised-button.mat-primary{color:rgba(255,255,255,.87)}.mat-fab.mat-accent,.mat-mini-fab.mat-accent,.mat-raised-button.mat-accent{color:#fff}.mat-fab.mat-warn,.mat-mini-fab.mat-warn,.mat-raised-button.mat-warn{color:#fff}.mat-fab.mat-accent[disabled],.mat-fab.mat-primary[disabled],.mat-fab.mat-warn[disabled],.mat-fab[disabled][disabled],.mat-mini-fab.mat-accent[disabled],.mat-mini-fab.mat-primary[disabled],.mat-mini-fab.mat-warn[disabled],.mat-mini-fab[disabled][disabled],.mat-raised-button.mat-accent[disabled],.mat-raised-button.mat-primary[disabled],.mat-raised-button.mat-warn[disabled],.mat-raised-button[disabled][disabled]{color:rgba(0,0,0,.38)}.mat-fab.mat-primary,.mat-mini-fab.mat-primary,.mat-raised-button.mat-primary{background-color:#3f51b5}.mat-fab.mat-accent,.mat-mini-fab.mat-accent,.mat-raised-button.mat-accent{background-color:#ff4081}.mat-fab.mat-warn,.mat-mini-fab.mat-warn,.mat-raised-button.mat-warn{background-color:#f44336}.mat-fab.mat-accent[disabled],.mat-fab.mat-primary[disabled],.mat-fab.mat-warn[disabled],.mat-fab[disabled][disabled],.mat-mini-fab.mat-accent[disabled],.mat-mini-fab.mat-primary[disabled],.mat-mini-fab.mat-warn[disabled],.mat-mini-fab[disabled][disabled],.mat-raised-button.mat-accent[disabled],.mat-raised-button.mat-primary[disabled],.mat-raised-button.mat-warn[disabled],.mat-raised-button[disabled][disabled]{background-color:rgba(0,0,0,.12)}.mat-fab,.mat-mini-fab{background-color:#ff4081;color:#fff}.mat-button-toggle{color:rgba(0,0,0,.38)}.mat-button-toggle.cdk-focused .mat-button-toggle-focus-overlay{background-color:rgba(0,0,0,.06)}.mat-button-toggle-checked{background-color:#e0e0e0;color:#000}.mat-button-toggle-disabled{background-color:#eee;color:rgba(0,0,0,.38)}.mat-button-toggle-disabled.mat-button-toggle-checked{background-color:#bdbdbd}.mat-card{background:#fff;color:#000}.mat-card-subtitle{color:rgba(0,0,0,.54)}.mat-checkbox-frame{border-color:rgba(0,0,0,.54)}.mat-checkbox-checkmark{fill:#fafafa}.mat-checkbox-checkmark-path{stroke:#fafafa!important}.mat-checkbox-mixedmark{background-color:#fafafa}.mat-checkbox-checked.mat-primary .mat-checkbox-background,.mat-checkbox-indeterminate.mat-primary .mat-checkbox-background{background-color:#3f51b5}.mat-checkbox-checked.mat-accent .mat-checkbox-background,.mat-checkbox-indeterminate.mat-accent .mat-checkbox-background{background-color:#e91e63}.mat-checkbox-checked.mat-warn .mat-checkbox-background,.mat-checkbox-indeterminate.mat-warn .mat-checkbox-background{background-color:#f44336}.mat-checkbox-disabled.mat-checkbox-checked .mat-checkbox-background,.mat-checkbox-disabled.mat-checkbox-indeterminate .mat-checkbox-background{background-color:#b0b0b0}.mat-checkbox-disabled:not(.mat-checkbox-checked) .mat-checkbox-frame{border-color:#b0b0b0}.mat-checkbox:not(.mat-checkbox-disabled).mat-primary .mat-checkbox-ripple .mat-ripple-element{background-color:rgba(63,81,181,.26)}.mat-checkbox:not(.mat-checkbox-disabled).mat-accent .mat-checkbox-ripple .mat-ripple-element{background-color:rgba(255,64,129,.26)}.mat-checkbox:not(.mat-checkbox-disabled).mat-warn .mat-checkbox-ripple .mat-ripple-element{background-color:rgba(232,78,64,.26)}.mat-chip:not(.mat-basic-chip){background-color:#e0e0e0;color:rgba(0,0,0,.87)}.mat-chip.mat-chip-selected:not(.mat-basic-chip){background-color:grey;color:rgba(255,255,255,.87)}.mat-chip.mat-chip-selected:not(.mat-basic-chip).mat-primary{background-color:#3f51b5;color:rgba(255,255,255,.87)}.mat-chip.mat-chip-selected:not(.mat-basic-chip).mat-accent{background-color:#e91e63;color:#fff}.mat-chip.mat-chip-selected:not(.mat-basic-chip).mat-warn{background-color:#f44336;color:#fff}.mat-dialog-container{background:#fff}.mat-icon.mat-primary{color:#3f51b5}.mat-icon.mat-accent{color:#ff4081}.mat-icon.mat-warn{color:#f44336}.mat-input-placeholder{color:rgba(0,0,0,.38)}.mat-focused .mat-input-placeholder{color:#3f51b5}.mat-focused .mat-input-placeholder.mat-accent{color:#ff4081}.mat-focused .mat-input-placeholder.mat-warn{color:#f44336}.mat-input-element:disabled{color:rgba(0,0,0,.38)}.mat-focused .mat-input-placeholder.mat-float .mat-placeholder-required,input.mat-input-element:-webkit-autofill+.mat-input-placeholder .mat-placeholder-required{color:#ff4081}.mat-input-underline{border-color:rgba(0,0,0,.12)}.mat-input-underline .mat-input-ripple{background-color:#f2f2f2}.mat-input-underline .mat-input-ripple.mat-accent{background-color:#ff4081}.mat-input-underline .mat-input-ripple.mat-warn{background-color:#f44336}.mat-input-invalid .mat-input-placeholder,.mat-input-invalid .mat-placeholder-required{color:#f44336}.mat-input-invalid .mat-input-underline{border-color:#f44336}.mat-input-invalid .mat-input-ripple{background-color:#f44336}.mat-input-error{color:#f44336}.mat-list .mat-list-item,.mat-nav-list .mat-list-item{color:#000}.mat-list .mat-subheader,.mat-nav-list .mat-subheader{color:rgba(0,0,0,.54)}.mat-divider{border-top-color:rgba(0,0,0,.12)}.mat-nav-list .mat-list-item-content.mat-list-item-focus,.mat-nav-list .mat-list-item-content:hover{background:rgba(0,0,0,.04)}.mat-menu-content{background:#fff}.mat-menu-item{background:0 0;color:rgba(0,0,0,.87)}.mat-menu-item[disabled]{color:rgba(0,0,0,.38)}.mat-menu-item .mat-icon{color:rgba(0,0,0,.54);vertical-align:middle}.mat-menu-item:focus:not([disabled]),.mat-menu-item:hover:not([disabled]){background:rgba(0,0,0,.04)}.mat-progress-bar-background{background:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%271.1%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20xmlns%3Axlink%3D%27http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%27%20x%3D%270px%27%20y%3D%270px%27%20enable-background%3D%27new%200%200%205%202%27%20xml%3Aspace%3D%27preserve%27%20viewBox%3D%270%200%205%202%27%20preserveAspectRatio%3D%27none%20slice%27%3E%3Ccircle%20cx%3D%271%27%20cy%3D%271%27%20r%3D%271%27%20fill%3D%27%23c5cae9%27%2F%3E%3C%2Fsvg%3E")}.mat-progress-bar-buffer{background-color:#c5cae9}.mat-progress-bar-fill::after{background-color:#3949ab}.mat-progress-bar.mat-accent .mat-progress-bar-background{background:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%271.1%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20xmlns%3Axlink%3D%27http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%27%20x%3D%270px%27%20y%3D%270px%27%20enable-background%3D%27new%200%200%205%202%27%20xml%3Aspace%3D%27preserve%27%20viewBox%3D%270%200%205%202%27%20preserveAspectRatio%3D%27none%20slice%27%3E%3Ccircle%20cx%3D%271%27%20cy%3D%271%27%20r%3D%271%27%20fill%3D%27%23f8bbd0%27%2F%3E%3C%2Fsvg%3E")}.mat-progress-bar.mat-accent .mat-progress-bar-buffer{background-color:#f8bbd0}.mat-progress-bar.mat-accent .mat-progress-bar-fill::after{background-color:#d81b60}.mat-progress-bar.mat-warn .mat-progress-bar-background{background:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%271.1%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20xmlns%3Axlink%3D%27http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%27%20x%3D%270px%27%20y%3D%270px%27%20enable-background%3D%27new%200%200%205%202%27%20xml%3Aspace%3D%27preserve%27%20viewBox%3D%270%200%205%202%27%20preserveAspectRatio%3D%27none%20slice%27%3E%3Ccircle%20cx%3D%271%27%20cy%3D%271%27%20r%3D%271%27%20fill%3D%27%23ffcdd2%27%2F%3E%3C%2Fsvg%3E")}.mat-progress-bar.mat-warn .mat-progress-bar-buffer{background-color:#ffcdd2}.mat-progress-bar.mat-warn .mat-progress-bar-fill::after{background-color:#e53935}.mat-progress-spinner path,.mat-spinner path{stroke:#3949ab}.mat-progress-spinner.mat-accent path,.mat-spinner.mat-accent path{stroke:#d81b60}.mat-progress-spinner.mat-warn path,.mat-spinner.mat-warn path{stroke:#e53935}.mat-radio-outer-circle{border-color:rgba(0,0,0,.54)}.mat-radio-checked .mat-radio-outer-circle{border-color:#ff4081}.mat-radio-disabled .mat-radio-outer-circle{border-color:rgba(0,0,0,.38)}.mat-radio-inner-circle{background-color:#ff4081}.mat-radio-disabled .mat-radio-inner-circle{background-color:rgba(0,0,0,.38)}.mat-radio-ripple .mat-ripple-element{background-color:rgba(255,64,129,.26)}.mat-radio-disabled .mat-radio-ripple .mat-ripple-element{background-color:rgba(0,0,0,.38)}.mat-select-trigger{color:rgba(0,0,0,.38)}.mat-select:focus:not(.mat-select-disabled) .mat-select-trigger{color:#3f51b5}.mat-select:not(:focus).ng-invalid.ng-touched:not(.mat-select-disabled) .mat-select-trigger{color:#f44336}.mat-select-underline{background-color:rgba(0,0,0,.12)}.mat-select:focus:not(.mat-select-disabled) .mat-select-underline{background-color:#3f51b5}.mat-select:not(:focus).ng-invalid.ng-touched:not(.mat-select-disabled) .mat-select-underline{background-color:#f44336}.mat-select-arrow{color:rgba(0,0,0,.38)}.mat-select:focus:not(.mat-select-disabled) .mat-select-arrow{color:#3f51b5}.mat-select:not(:focus).ng-invalid.ng-touched:not(.mat-select-disabled) .mat-select-arrow{color:#f44336}.mat-select-content,.mat-select-panel-done-animating{background:#fff}.mat-select-value{color:rgba(232,78,64,.87)}.mat-select-disabled .mat-select-value{color:rgba(0,0,0,.38)}.mat-sidenav-container{background-color:#fafafa;color:rgba(0,0,0,.87)}.mat-sidenav{background-color:#fff;color:rgba(0,0,0,.87)}.mat-sidenav.mat-sidenav-push{background-color:#fff}.mat-sidenav-backdrop.mat-sidenav-shown{background-color:rgba(0,0,0,.6)}.mat-slide-toggle.mat-checked:not(.mat-disabled) .mat-slide-toggle-thumb{background-color:#e91e63}.mat-slide-toggle.mat-checked:not(.mat-disabled) .mat-slide-toggle-bar{background-color:rgba(233,30,99,.5)}.mat-slide-toggle:not(.mat-checked) .mat-ripple-element{background-color:rgba(0,0,0,.06)}.mat-slide-toggle .mat-ripple-element{background-color:rgba(233,30,99,.12)}.mat-slide-toggle.mat-primary.mat-checked:not(.mat-disabled) .mat-slide-toggle-thumb{background-color:#3f51b5}.mat-slide-toggle.mat-primary.mat-checked:not(.mat-disabled) .mat-slide-toggle-bar{background-color:rgba(63,81,181,.5)}.mat-slide-toggle.mat-primary:not(.mat-checked) .mat-ripple-element{background-color:rgba(0,0,0,.06)}.mat-slide-toggle.mat-primary .mat-ripple-element{background-color:rgba(63,81,181,.12)}.mat-slide-toggle.mat-warn.mat-checked:not(.mat-disabled) .mat-slide-toggle-thumb{background-color:#f44336}.mat-slide-toggle.mat-warn.mat-checked:not(.mat-disabled) .mat-slide-toggle-bar{background-color:rgba(232,78,64,.5)}.mat-slide-toggle.mat-warn:not(.mat-checked) .mat-ripple-element{background-color:rgba(0,0,0,.06)}.mat-slide-toggle.mat-warn .mat-ripple-element{background-color:rgba(232,78,64,.12)}.mat-disabled .mat-slide-toggle-thumb{background-color:#bdbdbd}.mat-disabled .mat-slide-toggle-bar{background-color:rgba(0,0,0,.1)}.mat-slide-toggle-thumb{background-color:#fafafa}.mat-slide-toggle-bar{background-color:rgba(0,0,0,.38)}.mat-slider-track-background{background-color:rgba(0,0,0,.26)}.mat-primary .mat-slider-thumb,.mat-primary .mat-slider-thumb-label,.mat-primary .mat-slider-track-fill{background-color:#3f51b5}.mat-accent .mat-slider-thumb,.mat-accent .mat-slider-thumb-label,.mat-accent .mat-slider-track-fill{background-color:#ff4081}.mat-warn .mat-slider-thumb,.mat-warn .mat-slider-thumb-label,.mat-warn .mat-slider-track-fill{background-color:#f44336}.mat-slider-focus-ring{background-color:rgba(255,64,129,.2)}.mat-primary .mat-slider-thumb-label-text{color:rgba(255,255,255,.87)}.mat-accent .mat-slider-thumb-label-text{color:#fff}.mat-warn .mat-slider-thumb-label-text{color:#fff}.cdk-focused .mat-slider-track-background,.mat-slider:hover .mat-slider-track-background{background-color:rgba(0,0,0,.38)}.mat-slider-disabled .mat-slider-thumb,.mat-slider-disabled .mat-slider-track-background,.mat-slider-disabled .mat-slider-track-fill{background-color:rgba(0,0,0,.26)}.mat-slider-disabled:hover .mat-slider-track-background{background-color:rgba(0,0,0,.26)}.mat-slider-min-value .mat-slider-focus-ring{background-color:rgba(0,0,0,.12)}.mat-slider-min-value.mat-slider-thumb-label-showing .mat-slider-thumb,.mat-slider-min-value.mat-slider-thumb-label-showing .mat-slider-thumb-label{background-color:#000}.mat-slider-min-value.mat-slider-thumb-label-showing.cdk-focused .mat-slider-thumb,.mat-slider-min-value.mat-slider-thumb-label-showing.cdk-focused .mat-slider-thumb-label{background-color:rgba(0,0,0,.26)}.mat-slider-min-value:not(.mat-slider-thumb-label-showing) .mat-slider-thumb{border-color:rgba(0,0,0,.26);background-color:transparent}.mat-slider-min-value:not(.mat-slider-thumb-label-showing).cdk-focused .mat-slider-thumb,.mat-slider-min-value:not(.mat-slider-thumb-label-showing):hover .mat-slider-thumb{border-color:rgba(0,0,0,.38)}.mat-slider-min-value:not(.mat-slider-thumb-label-showing).cdk-focused.mat-slider-disabled .mat-slider-thumb,.mat-slider-min-value:not(.mat-slider-thumb-label-showing):hover.mat-slider-disabled .mat-slider-thumb{border-color:rgba(0,0,0,.26)}.mat-tab-header,.mat-tab-nav-bar{border-bottom:1px solid #e0e0e0}.mat-tab-group-inverted-header .mat-tab-header,.mat-tab-group-inverted-header .mat-tab-nav-bar{border-top:1px solid #e0e0e0;border-bottom:none}.mat-tab-label:focus{background-color:rgba(197,202,233,.3)}.mat-ink-bar{background-color:#3f51b5}.mat-tab-label,.mat-tab-link{color:currentColor}.mat-tab-label.mat-tab-disabled,.mat-tab-link.mat-tab-disabled{color:rgba(0,0,0,.38)}.mat-toolbar{background:#f5f5f5;color:rgba(0,0,0,.87)}.mat-toolbar.mat-primary{background:#3f51b5;color:rgba(255,255,255,.87)}.mat-toolbar.mat-accent{background:#ff4081;color:#fff}.mat-toolbar.mat-warn{background:#f44336;color:#fff}.mat-tooltip{background:rgba(97,97,97,.9)} diff --git a/dcaedftool/src/test.ts b/dcaedftool/src/test.ts new file mode 100644 index 0000000..a468413 --- /dev/null +++ b/dcaedftool/src/test.ts @@ -0,0 +1,50 @@ +// org.onap.dcae +// ============LICENSE_START==================================================== +// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +// ============================================================================= +// 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====================================================== +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/dist/long-stack-trace-zone'; +import 'zone.js/dist/proxy.js'; +import 'zone.js/dist/sync-test'; +import 'zone.js/dist/jasmine-patch'; +import 'zone.js/dist/async-test'; +import 'zone.js/dist/fake-async-test'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. +declare const __karma__: any; +declare const require: any; + +// Prevent Karma from running prematurely. +__karma__.loaded = function () {}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() +); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); +// Finally, start Karma to run the tests. +__karma__.start(); diff --git a/dcaedftool/src/tsconfig.app.json b/dcaedftool/src/tsconfig.app.json new file mode 100644 index 0000000..5e2507d --- /dev/null +++ b/dcaedftool/src/tsconfig.app.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/app", + "module": "es2015", + "baseUrl": "", + "types": [] + }, + "exclude": [ + "test.ts", + "**/*.spec.ts" + ] +} diff --git a/dcaedftool/src/tsconfig.spec.json b/dcaedftool/src/tsconfig.spec.json new file mode 100644 index 0000000..510e3f1 --- /dev/null +++ b/dcaedftool/src/tsconfig.spec.json @@ -0,0 +1,20 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/spec", + "module": "commonjs", + "target": "es5", + "baseUrl": "", + "types": [ + "jasmine", + "node" + ] + }, + "files": [ + "test.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +} diff --git a/dcaedftool/src/typings.d.ts b/dcaedftool/src/typings.d.ts new file mode 100644 index 0000000..b4725be --- /dev/null +++ b/dcaedftool/src/typings.d.ts @@ -0,0 +1,23 @@ +// org.onap.dcae +// ============LICENSE_START==================================================== +// Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +// ============================================================================= +// 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====================================================== +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +/* SystemJS module definition */ +declare var module: NodeModule; +interface NodeModule { + id: string; +} |