@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
96 lines (95 loc) • 4.5 kB
TypeScript
import { NotificationConnection } from './notification-connection';
import { NotificationLinkType } from './notification-link-type';
export interface ClientNotificationLink {
/**
* The success link to navigate to the object view. (optional)
* At default, it brings to the home page of the module.
* The path is relative to from the manifest opened point unless linkType is specified
*/
link: string;
/**
* The text to show up on the notification link text ex: "Go to <linkText> on sme-xyz.domain.com"
* By default the text will be the auto detected source name like "Files"
*/
linkText?: string;
/**
* the type of notification link. Default behavior is RelativeToTool
*/
linkType?: NotificationLinkType;
}
/**
* Utility class to manage client notification
*/
export declare class ClientNotificationInstance {
private notificationConnection;
private nodeName;
private notification;
/**
* Creates a new ClientNotificationInstance
* @param notificationConnection reference to NotificationConnection, can be found at AppContextService.notification
* @param nodeName the node name for the notification
*/
constructor(notificationConnection: NotificationConnection, nodeName: string);
/**
* Gets the notification ID to recycle.
* Sets this ID to the Work Item ID to share the notification.
*/
get id(): string;
/**
* Shows an in progress notification
* This should be used for all started, submitted, in progress, or status update notifications
* @param title localized title for the notification. Should be like "Executing some action"
* @param message localized message for the notification. Should be natural language like "Executing some action on target 'name'"
* @param link optional custom link for notification
*/
showInProgress(title: string, message: string, link?: ClientNotificationLink): void;
/**
* Shows a critical notification
* @param title localized title for the notification.
* @param message localized message for the notification
* @param link optional custom link for notification
* @param solutionMessage optional solution message to address error
*/
showCritical(title: string, message: string, link?: ClientNotificationLink, solutionMessage?: string): void;
/**
* Shows an error notification
* @param title localized title for the notification. Should be like "Failed to execute some action"
* @param message localized message for the notification.
* Should be natural language like "Failed to execute some action on target 'name'. Error: <error message>"
* @param link optional custom link for notification
* @param solutionMessage optional solution message to address error
*/
showError(title: string, message: string, link?: ClientNotificationLink, solutionMessage?: string): void;
/**
* Shows a warning notification
* @param title localized title for the notification.
* @param message localized message for the notification
* @param link optional custom link for notification
*/
showWarning(title: string, message: string, link?: ClientNotificationLink): void;
/**
* Shows a success notification
* @param title localized title for the notification. Should be like "Successfully executed some action"
* @param message localized message for the notification.
* Should be natural language like "Successfully executed some action on target 'name'"
* @param link optional custom link for notification
*/
showSuccess(title: string, message: string, link?: ClientNotificationLink): void;
/**
* Shows an informational notification
* If the information is relative to an action currently in progress or already started, use showInProgressNotification
* @param title localized title for the notification.
* @param message localized message for the notification
* @param link optional custom link for notification
*/
showInformation(title: string, message: string, link?: ClientNotificationLink): void;
/**
* show notification of given state
* @param title the localized title
* @param message the localized message
* @param link the link
* @param state the state
* @param solutionMessage optional solution message for error or critical notification
*/
private showNotification;
}