Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ <h3>Publish Message to topic: {{this.topic?.name}}</h3>
<button mat-stroked-button color="accent" (click)="editAttributes()">
Edit Attributes ({{this.attributeCount}})
</button>
<div class="form-check mb-2">
<input
class="form-check-input"
type="checkbox"
id="keepContentCheck"
[(ngModel)]="keepContent">
<label class="form-check-label" for="keepContentCheck">
Keep text after publishing
</label>
</div>
<button mat-raised-button color="primary" [disabled]="this.inputField.invalid" (click)="this.publishMessage()">
Publish Message!
<mat-icon>send</mat-icon>
Expand All @@ -11,4 +21,4 @@ <h3>Publish Message to topic: {{this.topic?.name}}</h3>

<mat-form-field appearance="outline" class="text-field">
<textarea matInput [cdkTextareaAutosize]="true" cdkAutosizeMinRows="15" [formControl]="this.inputField"></textarea>
</mat-form-field>
</mat-form-field>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class TopicDetailsComponent implements OnInit {

_dialog = inject(MatDialog)
public inputField = new UntypedFormControl('', Validators.required)
public keepContent = false;
attributes: { [key: string]: string } = {}
attributeCount = 0
constructor() { }
Expand All @@ -45,7 +46,9 @@ export class TopicDetailsComponent implements OnInit {
console.log("this value was found", this.inputField.value)

this.onMessagePublish.emit({ topic: this.topic!, message: this.inputField.value, attributes: this.attributes })
this.inputField.reset()
if (!this.keepContent) {
this.inputField.reset();
}
this.attributes = {}
this.attributeCount = 0
}
Expand Down