@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
131 lines (130 loc) • 3.36 kB
TypeScript
import { AppContextService } from '../../service/app-context.service';
import * as i0 from "@angular/core";
/**
* The typed interface for an alert.
*/
export interface Alert {
/**
* The links to include on the alert.
*/
links?: AlertLink[];
/**
* The message of the alert.
*/
message: string;
/**
* The severity of the alert.
*/
severity: AlertSeverity;
/**
* The title of the alert.
*/
title?: string;
/**
* true if the alert message is expanded
*/
isExpanded?: boolean;
/**
* True if message content exceeds the specified number of lines
*/
needsClamp?: boolean;
/**
* the formatted timestamp string
*/
timestamp?: string;
/**
* the name of the node
*/
nodeName?: string;
/**
* the id of the alert
*/
id?: string;
/**
* setTimeout dismiss object.
*/
setTimeout?: any;
}
/**
* The levels of severity that are able to be portrayed by an alert.
*/
export declare enum AlertSeverity {
Informational = 0,
Warning = 1,
Error = 2,
Success = 3,
InProgress = 4
}
/**
* The typed interface of an alert link.
*/
export interface AlertLink {
/**
* The display text of the link
*/
displayText: string;
/**
* The event to invoke when the link is clicked.
* If an event is added uri will not be used
*/
event?: (() => void);
/**
* The uri to navigate to when the link is clicked
*/
uri?: string;
/**
* If a link is being used, specifies if it is an external link
* if true, link will open in a new tab, otherwise will route internally
*/
isExternalLink?: boolean;
}
export interface AlertInfo {
/**
* The @Alert Object.
*/
alert: Alert;
/**
* Ref count of how many times the show() was invoked for the alert.
*/
refCount: number;
}
export interface AlertBar {
show(alert: Alert): void;
}
export declare class AlertBarService {
private appContextService;
private componentMap;
constructor(appContextService: AppContextService);
/**
* Registers an alert bar with the service.
*
* @param component The alert bar component.
* @param [id] The unique identifier of the alert bar.
*/
register(component: AlertBar, id?: string): void;
/**
* Unregisters an alert bar with the service.
*
* @param [id] The unique identifier of the alert bar.
*/
unregister(id?: string): void;
/**
* Shows an alert.
*
* @param alert The alert to show.
* @param [id] The unique identifier of the alert bar to show the alert in.
*/
showAlert(item: Alert, id?: string): void;
/**
* @deprecated
* Shows an alert.
*
* Use ClientNotificationInstance class or appContextService.notification.notify() instead.
*
* @param alert The alert to show.
* @param [id] The unique identifier of the alert bar to show the alert in.
*/
show(item: Alert, id?: string): void;
static ɵfac: i0.ɵɵFactoryDeclaration<AlertBarService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<AlertBarService>;
}