feat(UI/notifications): add "in-app-only" action visibility

Actions with visibility "in-app-only" are shown in the UI but skipped
when displaying system-level notifications (Tauri/OS). Updates Go,
TypeScript/Angular and Rust projects accordingly.
This commit is contained in:
Alexandr Stelnykovych
2026-03-10 00:12:02 +02:00
parent 939010a6ef
commit 1465fe49af
5 changed files with 13 additions and 1 deletions
+2
View File
@@ -136,6 +136,8 @@ const (
// Visible only in extended view
// (when user clicks on notification to read full message)
ActionVisibilityDetailed ActionVisibility = "detailed"
// Visible only in the UI app, never on the system level (if ShowOnSystem is true).
ActionVisibilityInAppOnly ActionVisibility = "in-app-only"
)
// ActionType defines a specific type of action.
@@ -19,6 +19,7 @@ export interface BaseAction {
// Possible values are:
// - "": Action is always visible.
// - "detailed": Action is only visible in the detailed view of a notification.
// - "in-app-only": Visible only in the UI app, never on the system level (if ShowOnSystem is true).
Visibility: string;
}
@@ -16,7 +16,7 @@
</span>
<div class="buttons">
<ng-container *ngFor="let action of notif!.AvailableActions">
<button *ngIf="action.Visibility !== 'detailed'" (click)="execute(notif!, action, $event)">
<button *ngIf="!action.Visibility || action.Visibility === 'in-app-only'" (click)="execute(notif!, action, $event)">
{{action.Text}}
</button>
</ng-container>
@@ -51,6 +51,9 @@ pub struct Action {
#[serde(rename = "Payload")]
pub payload: serde_json::Value,
#[serde(rename = "Visibility")]
pub visibility: String, // "" - default, "detailed" - only show if the notification is expanded
}
#[derive(Serialize, Deserialize, Debug, PartialEq)]
@@ -57,6 +57,9 @@ pub async fn show_notification(cli: &PortAPI, key: String, n: Notification) {
notif.icon("portmaster");
for action in n.actions {
if !action.visibility.is_empty() {
continue
}
notif.action(&action.id, &action.text);
}
@@ -113,6 +116,9 @@ pub async fn show_notification(cli: &PortAPI, key: String, n: Notification) {
.duration(Duration::Long);
for action in n.actions {
if !action.visibility.is_empty() {
continue
}
toast = toast.add_button(&action.text, &action.id);
}
{