| import { Form } from '../../e2elib/lib/src/pageobjects/form.component'; | 
| import { PanelBase } from '../../libappbase/panelbase'; | 
| import { ListSOP } from '../../libappsop/listsop'; | 
| import { DialogDummy } from '../dialogs/dialog.dummy'; | 
| import { GaugeSOP } from '../../libappsop/gaugesop'; | 
| import { browser } from '../../e2elib/node_modules/protractor'; | 
|   | 
| export class FormKPI extends Form { | 
|   public static readonly title = 'KPI Dashboard'; | 
|   | 
|   public panelKPIDashboard = new PanelKPIDashboard(); | 
|   public panelKPISelection = new PanelKPISelection(); | 
|   | 
|   public constructor() { | 
|     super('FormKPI'); | 
|   } | 
|   | 
|   public async openKPIDashboardPanel(): Promise<void> { | 
|     await this.panelKPIDashboard.switchTo(); | 
|   } | 
|   | 
|   public async openKPISelectionPanel(): Promise<void> { | 
|     await this.panelKPISelection.switchTo(); | 
|   } | 
| } | 
|   | 
| export class PanelKPIDashboard extends PanelBase { | 
|   public static readonly title = 'KPI Dashboard'; | 
|   public gaugeKPIDashboard = new GaugeKPIDashboard(); | 
|   | 
|   public constructor() { | 
|     super('PanelKPIDashboard'); | 
|   } | 
|   | 
|   /** | 
|    * @override | 
|    */ | 
|   public async switchTo(): Promise<void> { | 
|     await super.switchTo(); | 
|     await this.gaugeKPIDashboard.waitUntilPresent(); | 
|   } | 
| } | 
|   | 
| export class PanelKPISelection extends PanelBase { | 
|   public static readonly title = 'KPI Selection'; | 
|   public lstKPISelection = new ListKPISelection(); | 
|   | 
|   public constructor() { | 
|     super('PanelKPISelection'); | 
|   } | 
|   | 
|   /** | 
|    * @override | 
|    */ | 
|   public async switchTo(): Promise<void> { | 
|     await super.switchTo(); | 
|     await this.lstKPISelection.waitUntilPresent(); | 
|   } | 
| } | 
|   | 
| export class ListKPISelection extends ListSOP<DialogDummy, ListKPISelectionColumn> { | 
|   public static readonly title = 'KPI Selection'; | 
|   public constructor() { | 
|     super('ListKPISelection', new DialogDummy()); | 
|   } | 
|   | 
|   /** | 
|    * Deselect all KPI selection in the list | 
|    */ | 
|   public async deselectAllKPI(): Promise<void> { | 
|     await this.selectAllAndSelectContextMenu(listKPISelectionContextMenuItem.Deselect); | 
|   | 
|     // Select first row just to cancel out all rows selection (else subsequent test will not work) | 
|     const firstRow = await this.getRowByIndex(0); | 
|     await firstRow.leftClick(); | 
|   } | 
|   | 
|   /** | 
|    * Selects the gauges that are inputted. Optionally define wait time upon selection to allow changes to be persisted to the back-end view. | 
|    * | 
|    * @param gaugeNames Gauges names that needs to be toggled | 
|    * @param waitPersistInViewInMilliseconds (Optional) If test require to wait after selecting KPI, example to allow changs to be persisted to view | 
|    */ | 
|   public async selectKPI(gaugeNames: string[], waitPersistInViewInMilliseconds?: number): Promise<void> { | 
|     for (const gaugeName of gaugeNames) { | 
|       const row = await this.getRow({ Name: gaugeName }); | 
|       await this.toggleRowCheckbox(row, true); | 
|     } | 
|   | 
|     if (waitPersistInViewInMilliseconds) { | 
|       await browser.sleep(waitPersistInViewInMilliseconds); | 
|     } | 
|   } | 
| } | 
|   | 
| export class GaugeKPIDashboard extends GaugeSOP { | 
|   public static readonly title = 'KPI Dashboard'; | 
|   | 
|   public constructor() { | 
|     super('GaugeKPIDashboard'); | 
|   } | 
| } | 
|   | 
| // Interface for KPI-Value map | 
| export interface GaugeIDValueMap { | 
|   gaugeName: string; | 
|   value: string; | 
| } | 
|   | 
| // List KPI selection columns | 
| export interface ListKPISelectionColumn { | 
|   Name: string; | 
| } | 
|   | 
| // List KPI selection context menu items | 
| const listKPISelectionContextMenuItem = { | 
|   Deselect: { ContextMenu: 'listContextMenuKPI', Name: 'MenuDeselect', Label: 'Deselect' }, | 
|   Select: { ContextMenu: 'listContextMenuKPI', Name: 'MenuSelect', Label: 'Select' }, | 
| }; | 
|   | 
| export { listKPISelectionContextMenuItem as ListKPISelectionContextMenuItem }; | 
|   | 
| const stepFormKPI = { | 
|   deselectAllKPI: (): string => `In the List "${ListKPISelection.title}", deselect all rows.`, | 
|   selectKPI: (gaugeNames: string[]): string => `In the List "${ListKPISelection.title}", select row "${gaugeNames}".`, | 
| }; | 
|   | 
| export { stepFormKPI as StepFormKPI }; |