Tied schema dropdown to request/response schema samples

This commit is contained in:
Craig Larrabee 2017-08-29 11:25:46 -06:00
parent 06f372d1a8
commit be9df91273
2 changed files with 7 additions and 5 deletions

View File

@ -39,7 +39,7 @@ export class SchemaSample extends BaseComponent implements OnInit {
super(specMgr);
this.element = elementRef.nativeElement;
this._normalizer = new SchemaNormalizer(specMgr);
this.subscription = this._schemaChanger.selectedDescendantChanged$.subscribe(
this.subscription = this._schemaChanger.selectedDescendantChanged().subscribe(
descendantInfo => {
this.selectDescendant(descendantInfo.idx, descendantInfo.name, descendantInfo.isRequestSchema, descendantInfo.responseCode);
_cdRef.detectChanges();

View File

@ -1,7 +1,5 @@
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
import {DescendantInfo} from "../utils/spec-manager";
@Injectable()
export class SchemaChangerService {
@ -10,11 +8,15 @@ export class SchemaChangerService {
private selectedDescendantSource = new Subject<any>();
// Observable descendant streams
selectedDescendantChanged$ = this.selectedDescendantSource.asObservable();
private selectedDescendantChanged$ = this.selectedDescendantSource.asObservable();
selectedDescendantChanged() {
return this.selectedDescendantChanged$;
}
// Service message commands
announceDescendantChange(idx: string, descendantName: string, isRequestSchema: boolean, responseCode: string) {
this.selectedDescendantSource.next({idx:idx, name:descendantName, isRequestSchema:isRequestSchema, responseCode:responseCode});
}
}
}