@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
155 lines (154 loc) • 5.69 kB
TypeScript
import { ActivatedRoute, ActivatedRouteSnapshot, Params, Router } from '@angular/router';
import { SelectablePath } from '@microsoft/windows-admin-center-sdk/core/rpc/report/rpc-report-model';
import { RpcShellNavigate } from '@microsoft/windows-admin-center-sdk/core/rpc/shell-navigate/rpc-shell-navigate-model';
import { Connection } from '@microsoft/windows-admin-center-sdk/core/security/connection';
import { Observable } from 'rxjs';
import { AppContextService } from './app-context.service';
/**
* The navigation data extra for holding fragement parameter and queryParams for module url.
*/
export interface NavigationDataExtras {
/**
* The fragment string for module if any.
*/
fragment?: string;
/**
* The query parameters for module if any.
*/
queryParams?: {
[key: string]: string;
};
}
/**
* The navigation data to navigate inside of module.
*/
export interface NavigationData {
/**
* The navigation commands (path segments).
*/
commands: string[];
/**
* The navigation data extras for module.
*/
options: NavigationDataExtras;
}
/**
* Static function name for the navigation title function in a component class
*/
export declare const navigationTitleFunctionName = "navigationTitle";
/**
* Navigation Title Function Return type
*/
export declare type NavigationTitle = string | SelectablePath[] | Observable<SelectablePath[]>;
/**
* Navigation class to provide set of static helper functions.
*/
export declare class Navigation {
/**
* The url options for gateway and connection.
*/
static gatewayUrl: string;
/**
* The url options for version of static content.
*/
static staticVersion: string;
private static pushStateBackup;
/**
* Turn off browser history push.
* - instead sending all path change to the Shell to create history.
*/
static turnOffHistory(): void;
/**
* Turn on browser history push.
*/
static turnOnHistory(): void;
/**
* Compare two urls by removing leading and trailing slashes.
*
* @param url1 the url to compare.
* @param url2 the url to compare.
* @return boolean true if matches. null url returns false.
*/
static areEqualUrl(url1: string, url2: string): boolean;
/**
* Compare two urls for number of segments.
*
* @param url1 the url to compare.
* @param url2 the url to compare.
* @param count the number of segments to compare.
* @return boolean true if matches for number of segments.
*/
static areEqualSegments(url1: string, url2: string, count: number): boolean;
/**
* Trim leading and trailing slashes.
*
* @param url the url to trim leading and trailing slashes.
* @returns the updated url.
*/
private static trimSlash;
/**
* Get url segments combined module name and path of entry point.
*
* @param moduleName the module name.
* @param entryPointName the name of entry point.
* @return the url segments.
*/
static getModuleEntryPointUrlSegment(moduleName: string, entryPointName?: string): string;
/**
* Builds selectable paths from the given route.
*
* @param appContextService The application context service object.
* @param route The route to extract the breadcrumb for
* @param pathPrefix The prefix to prepend to the route path
* @return SelectablePath[] the selectable paths.
*/
static buildSelectablePathsForRoute(appContextService: AppContextService, route: ActivatedRouteSnapshot, pathPrefix?: string): Observable<SelectablePath[]>;
/**
* Navigate to the connection.
*
* @param router the router.
* @param connection the connection object.
*/
static navigateConnection(router: Router, connection: Connection): Promise<boolean>;
/**
* Get navigation URL by solution/name, module/name, connection/name and connection/type.
*
* (ex.
* - /
* - /msft.sme.server-manager!servers
* - /msft.sme.server-manager!servers/tools/msft.sme.server-manager!overview
* - /msft.sme.server-manager!servers +
* /connections/msft.sme.connection-type.server/sme-full1.redmond.corp.microsoft.com +
* /tools/msft.sme.server-manager!overview)
* @param data the RPC shell navigate data.
* @return string the url to navigate to the tool.
*/
static getNavigationUrlForToolEntryPoint(data: RpcShellNavigate): string;
/**
* Get navigation extra data from current activated route on shell.
*
* @param route the activated route.
*/
static getUrlNavigationDataExtras(route: ActivatedRoute): NavigationDataExtras;
/**
* Get the navigation data from the path on module.
*
* @param router the Router object.
* @param path The path URI with module.
*/
static getUrlNavigationData(router: Router, path: string): NavigationData;
/**
* Get the navigation queryParams on shell/module.
*
* @param dataExtras The navigation data extras object.
* @returns the params data for router navigation call.
*/
static getUrlQueryParams(dataExtras: NavigationDataExtras): Params;
/**
* Get serialized the data extras object into url string.
*
* @param options the navigation data extras object.
* @returns the URL string.
*/
static getUrlSerializedDataExtras(options: NavigationDataExtras): string;
}