mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-10-31 15:57:30 +03:00 
			
		
		
		
	Update Method list to work with new menu structure
This commit is contained in:
		
							parent
							
								
									ac0681c8a9
								
							
						
					
					
						commit
						398aa60a46
					
				|  | @ -1,10 +1,11 @@ | ||||||
| <div class="methods"> | <div class="methods"> | ||||||
|   <div class="tag" *ngFor="let tag of tags;let catIdx = index; trackBy:trackByTagName"> |   <div class="tag" *ngFor="let tag of tags; trackBy:trackByTagName" [attr.section]="tag.id"> | ||||||
|     <div class="tag-info" [attr.section]="tag.id" *ngIf="!tag.headless"> |     <div class="tag-info" *ngIf="tag.name"> | ||||||
|       <h1 class="sharable-header"> <a class="share-link" href="#{{tag.id}}"></a>{{tag.name}} </h1> |       <h1 class="sharable-header"> <a class="share-link" href="#{{tag.id}}"></a>{{tag.name}} </h1> | ||||||
|       <p *ngIf="tag.description" [innerHtml]="tag.description | marked"> </p> |       <p *ngIf="tag.description" [innerHtml]="tag.description | marked"> </p> | ||||||
|     </div> |     </div> | ||||||
|     <method *lazyFor="let method of tag.methods;let show = show;" [hidden]="!show" [pointer]="method.pointer" [attr.pointer]="method.pointer" |     <method *lazyFor="let method of tag.items; let show = show;" [hidden]="!show" | ||||||
|     [attr.section]="method.tag" [tag]="method.tag" [attr.operation-id]="method.operationId"></method> |     [pointer]="method.metadata.pointer" [attr.section]="method.id" | ||||||
|  |     [attr.operation-id]="method.metadata.operationId"></method> | ||||||
|   </div> |   </div> | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  | @ -19,15 +19,23 @@ export class MethodsList extends BaseComponent implements OnInit { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   init() { |   init() { | ||||||
|     let tags = SchemaHelper.buildMenuTree(this.specMgr.schema); |     let flatMenuItems = SchemaHelper.flatMenu(SchemaHelper.buildMenuTree(this.specMgr.schema)); | ||||||
|     this.tags = tags.filter(tagInfo => !tagInfo.virtual); |     this.tags = []; | ||||||
|     this.tags.forEach(tagInfo => { |     let emptyTag = { | ||||||
|       // inject tag name into method info
 |       name: '', | ||||||
|       tagInfo.methods = tagInfo.methods || []; |       items: [] | ||||||
|       tagInfo.methods.forEach(method => { |     } | ||||||
|         method.tag = tagInfo.id; |     flatMenuItems.forEach(menuItem => { | ||||||
|       }); |       if (!menuItem.metadata) return; | ||||||
|  | 
 | ||||||
|  |       if (menuItem.metadata.type === 'tag') { | ||||||
|  |         this.tags.push(menuItem); | ||||||
|  |       } | ||||||
|  |       if (menuItem.metadata.type === 'method' && !menuItem.parent) { | ||||||
|  |         emptyTag.items.push(menuItem); | ||||||
|  |       } | ||||||
|     }); |     }); | ||||||
|  |     if (emptyTag.items.length) this.tags.push(emptyTag); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   trackByTagName(_, el) { |   trackByTagName(_, el) { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user