Skip to content

Commit

Permalink
feat(ui): show channel bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
timonback committed Aug 28, 2024
1 parent 610a7fa commit 6b54112
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ <h2>Channels</h2>
@for (channel of channels; track channel) {
<article appNavigationTarget [id]="channel.anchorIdentifier">
<h3>{{ channel.name }}</h3>

<div class="row" *ngIf="isShowBindings">
<div class="width-6/12 width-12/12-s">
<h6>Channel Binding</h6>
</div>
<div class="width-6/12 width-12/12-s">
<div *ngIf="channel.bindings">
<app-prism-editor
code="{{ JSON.stringify(channel.bindings, null, 2) }}"
language="json"
readonly="true"
/>
</div>
</div>
</div>

@for (channelOperation of channel.operations; track channelOperation) {
<mat-card
appearance="outlined"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Component, OnInit } from "@angular/core";
import { AsyncApiService } from "../../../service/asyncapi/asyncapi.service";
import { Channel } from "../../../models/channel.model";
import { UiService } from "../../../service/ui.service";

@Component({
selector: "app-channels-new",
Expand All @@ -10,12 +11,21 @@ import { Channel } from "../../../models/channel.model";
})
export class ChannelsNewComponent implements OnInit {
channels: Channel[] = [];
isShowBindings: boolean = UiService.DEFAULT_SHOW_BINDINGS;
JSON = JSON;

constructor(private asyncApiService: AsyncApiService) {}
constructor(
private asyncApiService: AsyncApiService,
private uiService: UiService
) {}

ngOnInit(): void {
this.asyncApiService.getAsyncApi().subscribe((asyncapi) => {
this.channels = asyncapi.channels;
});

this.uiService.isShowBindings$.subscribe(
(value) => (this.isShowBindings = value)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export class AsyncApiMapperService {
"message of channel " + channelName,
() => {
const messageId = this.resolveRefId(operationMessage.$ref);
const channelMessage = channel.messages[messageId];
const channelMessage = channel.messages!![messageId];
const channelMessageId = this.resolveRefId(channelMessage.$ref);
const message = messages[channelMessageId];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface ServerChannels {
export interface ServerChannel {
address: string;
description?: string;
messages: {
messages?: {
[key: string]: {
$ref: string;
};
Expand Down

0 comments on commit 6b54112

Please sign in to comment.