redoc/lib/components/Method/method.js

37 lines
888 B
JavaScript
Raw Normal View History

2015-10-08 23:21:51 +03:00
'use strict';
import {Component, View, OnInit, CORE_DIRECTIVES} from 'angular2/angular2';
import {SchemaManager} from '../../utils/SchemaManager';
import {JsonPointer} from '../../utils/JsonPointer';
@Component({
selector: 'method',
properties: ['pointer'],
lifecycle: [OnInit]
})
@View({
templateUrl: './lib/components/Method/method.html',
directives: [CORE_DIRECTIVES]
})
export class Method {
constructor(schemaMgr) {
this.data = null;
this.schemaMgr = schemaMgr;
}
onInit() {
this.extractData();
}
extractData() {
this.data = {};
var methodInfo = this.schemaMgr.byPointer(this.pointer);
this.data.method = JsonPointer.baseName(this.pointer);
this.data.path = JsonPointer.baseName(this.pointer, 2);
2015-10-08 23:21:51 +03:00
this.data.methodInfo = methodInfo;
//TODO: check and apply hooks to modify data
}
}
Method.parameters = [[SchemaManager]];