redoc/lib/components/MethodsList/methods-list.ts

44 lines
985 B
TypeScript
Raw Normal View History

2015-10-08 23:21:51 +03:00
'use strict';
2016-08-28 21:46:10 +03:00
import { Component, Input, OnInit } from '@angular/core';
2016-08-22 12:12:13 +03:00
import { BaseComponent, SpecManager } from '../base';
import { SchemaHelper } from '../../services/index';
2015-10-08 23:21:51 +03:00
2016-08-22 12:12:13 +03:00
@Component({
2015-10-08 23:21:51 +03:00
selector: 'methods-list',
templateUrl: './methods-list.html',
2016-08-22 12:12:13 +03:00
styleUrls: ['./methods-list.css']
2015-10-08 23:21:51 +03:00
})
2016-08-28 21:46:10 +03:00
export class MethodsList extends BaseComponent implements OnInit {
2016-08-22 12:12:13 +03:00
@Input() pointer:string;
tags:Array<any> = [];
2016-08-22 12:12:13 +03:00
constructor(specMgr:SpecManager) {
super(specMgr);
2015-10-08 23:21:51 +03:00
}
init() {
let tags = SchemaHelper.buildMenuTree(this.specMgr.schema);
this.tags = tags.filter(tagInfo => !tagInfo.virtual);
this.tags.forEach(tagInfo => {
// inject tag name into method info
tagInfo.methods = tagInfo.methods || [];
tagInfo.methods.forEach(method => {
2016-07-26 12:03:15 +03:00
method.tag = tagInfo.id;
});
});
2015-10-08 23:21:51 +03:00
}
2016-06-30 16:42:36 +03:00
trackByPointer(idx, el) {
return el.pointer;
}
2016-07-01 16:30:35 +03:00
trackByTagName(idx, el) {
return el.name;
}
2016-08-28 21:46:10 +03:00
ngOnInit() {
this.preinit();
}
2015-10-08 23:21:51 +03:00
}