Skip to content

Commit

Permalink
Show more metadata infos Ref dapr#264
Browse files Browse the repository at this point in the history
  • Loading branch information
Uwe Merkle committed Nov 3, 2023
1 parent 298a16a commit d2dddc6
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 4 deletions.
27 changes: 24 additions & 3 deletions pkg/instances/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,34 @@ type StatusOutput struct {

// MetadataOutput represents a metadata api call response
type MetadataOutput struct {
ID string `json:"id"`
Actors []MetadataActiveActorsCount `json:"actors"`
Extended map[string]interface{} `json:"extended"`
ID string `json:"id"`
RuntimeVersion string `json:"runtimeVersion"`
EnabledFeatures []string `json:"enabledFeatures"`
Actors []MetadataActiveActorsCount `json:"actors"`
Components []MetadataComponents `json:"components"`
Subscriptions []MetadataSubscriptions `json:"subscriptions"`
Extended map[string]interface{} `json:"extended"`
}

// MetadataActiveActorsCount represents actor metadata: type and count
type MetadataActiveActorsCount struct {
Type string `json:"type"`
Count int `json:"count"`
}

// MetadataComponents represents component metadata: name, type, version an capabilities
type MetadataComponents struct {
Name string `json:"name"`
Type string `json:"type"`
Version string `json:"version"`
Capabilities []string `json:"capabilities"`
}

// MetadataSubscriptions represents subscriptions
type MetadataSubscriptions struct {
PubsubName string `json:"pubsubname"`
Topic string `json:"topic"`
DeadLetterTopic string `json:"deadLetterTopic"`
Metadata map[string]interface{} `json:"metadata"`
Rules []map[string]interface{} `json:"rules"`
}
83 changes: 82 additions & 1 deletion web/src/app/pages/dashboard/detail/detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,88 @@ <h2 class="page-header-left" *ngIf="loadedInstance">Application: {{ instance.app
</mat-card-content>
</mat-card>
</mat-tab>
<mat-tab label="Components">
<mat-card class="card-large mat-elevation-z8">
<mat-card-header>
<mat-card-title>Components</mat-card-title>
</mat-card-header>
<mat-card-content>
<table *ngIf="metadata && metadata.components && metadata.components.length > 0; else noComponents">
<thead>
<th>Name</th>
<th>Type</th>
<th>Version</th>
<th>Capabilities</th>
</thead>
<tbody>
<tr *ngFor="let item of metadata.components">
<td class="table-label">{{ item.name }}</td>
<td class="table-data">{{ item.type }}</td>
<td class="table-data">{{ item.version }}</td>
<td class="table-data">
<span *ngFor="let capability of item.capabilities">{{ capability }}<br /></span>
</td>
</tr>
</tbody>
</table>
<ng-template #noComponents>
<p class="page-text">No registered Dapr Components</p>
</ng-template>
</mat-card-content>
</mat-card>
</mat-tab>
<mat-tab label="Subscriptions">
<mat-card class="card-large mat-elevation-z8">
<mat-card-header>
<mat-card-title>Subscriptions</mat-card-title>
</mat-card-header>
<mat-card-content>
<table *ngIf="metadata && metadata.subscriptions && metadata.subscriptions.length > 0; else noSubscriptions">
<thead>
<th>Pubsubname</th>
<th>Topic</th>
<th>Dead letter topic</th>
<th>Metadata</th>
</thead>
<tbody>
<tr *ngFor="let item of metadata.subscriptions">
<td class="table-label">{{ item.pubsubName }}</td>
<td class="table-data">{{ item.topic }}</td>
<td class="table-data">{{ item.deadLetterTopic }}</td>
<td class="table-data">
<table *ngIf="item.metadata">
<tbody>
<tr *ngFor="let metaItem of item.metadata | keyvalue">
<td class="table-label">{{ metaItem.key }}</td>
<td class="table-data">{{ metaItem.value }}</td>
</tr>
</tbody>
</table>
</td>
<td class="table-data">
<table *ngIf="item.rules">
<thead>
<th>Match</th>
<th>Path</th>
</thead>
<tbody>
<tr *ngFor="let rule of item.rules">
<td class="table-data">{{rule.match}}</td>
<td class="table-data">{{rule.path}}</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<ng-template #noSubscriptions>
<p class="page-text">No registered Dapr Subscriptions</p>
</ng-template>
</mat-card-content>
</mat-card>
</mat-tab>
<mat-tab *ngIf="platform === 'kubernetes'" label="Logs">
<app-logs></app-logs>
</mat-tab>
</mat-tab-group>
</mat-tab-group>
21 changes: 21 additions & 0 deletions web/src/app/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ export interface Status {
// Metadata represents metadata from dapr sidecar.
export interface Metadata {
id: string;
runtimeVersion: string;
enabledFeatures: string[];
actors: MetadataActors[];
components: MetadataComponents[];
subscriptions: MetadataSubscriptions[];
extended: {[key: string]: any};
}

Expand All @@ -44,6 +48,23 @@ export interface MetadataActors {
count: number;
}

// MetadataComponents represents component metadata: name, type, version an capabilities
export interface MetadataComponents {
name: string;
type: string;
version: string;
capabilities: string[];
}

// MetadataSubscriptions represents subscriptions
export interface MetadataSubscriptions {
pubsubName: string;
topic: string;
deadLetterTopic: string;
metadata: {[key: string]: any};
rules: {[key: string]: any}[];
}

// Log represents a log object supporting log metadata
export interface Log {
level: string;
Expand Down

0 comments on commit d2dddc6

Please sign in to comment.