2015-10-08 23:21:51 +03:00
|
|
|
'use strict';
|
2016-08-30 17:07:54 +03:00
|
|
|
import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
|
2016-08-22 12:12:13 +03:00
|
|
|
import { BaseComponent, SpecManager } from '../base';
|
2016-07-01 17:24:59 +03:00
|
|
|
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',
|
2016-05-25 18:34:31 +03:00
|
|
|
templateUrl: './methods-list.html',
|
2016-08-30 17:07:54 +03:00
|
|
|
styleUrls: ['./methods-list.css'],
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
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;
|
|
|
|
|
2016-07-21 13:35:27 +03:00
|
|
|
tags:Array<any> = [];
|
2016-08-22 12:12:13 +03:00
|
|
|
|
2016-06-23 17:36:38 +03:00
|
|
|
constructor(specMgr:SpecManager) {
|
|
|
|
super(specMgr);
|
2015-10-08 23:21:51 +03:00
|
|
|
}
|
|
|
|
|
2016-07-20 11:07:08 +03:00
|
|
|
init() {
|
2016-07-01 17:24:59 +03:00
|
|
|
let tags = SchemaHelper.buildMenuTree(this.specMgr.schema);
|
2016-07-21 13:35:27 +03:00
|
|
|
this.tags = tags.filter(tagInfo => !tagInfo.virtual);
|
|
|
|
this.tags.forEach(tagInfo => {
|
2016-07-01 17:24:59 +03:00
|
|
|
// 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-29 00:22:12 +03:00
|
|
|
});
|
2016-07-01 17:24:59 +03:00
|
|
|
});
|
2015-10-08 23:21:51 +03:00
|
|
|
}
|
2016-06-30 16:42:36 +03:00
|
|
|
|
2016-12-02 12:59:29 +03:00
|
|
|
trackByTagName(_, el) {
|
2016-07-01 16:30:35 +03:00
|
|
|
return el.name;
|
|
|
|
}
|
2016-08-28 21:46:10 +03:00
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.preinit();
|
|
|
|
}
|
2015-10-08 23:21:51 +03:00
|
|
|
}
|