import { PanelBase } from '../../libappbase/panelbase';
|
import { ButtonSOP } from '../../libappsop/buttonsop';
|
import { CheckboxSOP } from '../../libappsop/checkboxsop';
|
import { DialogSOP } from '../../libappsop/dialogsop';
|
import { DropDownListSOP } from '../../libappsop/dropdownlistsop';
|
import { RadioButtonSOP } from '../../libappsop/radiobuttonsop';
|
|
export interface DialogSmartPlanFields {
|
BtnSavePreferencesEnabled?: string;
|
BtnRestoreDefaultEnabled?: string;
|
Strategy?: string;
|
OverrideLockedPlan?: string;
|
LimitUnits?: string;
|
OnlyPlanOneStepUpstream?: string;
|
SmartPlanDirection?: string;
|
}
|
|
export class DialogSmartPlan extends DialogSOP<DialogSmartPlanFields> {
|
public static readonly title = 'Smart Plan';
|
public static readonly btnSavePreferences = 'Save my preferences';
|
public static readonly btnRestoreDafault = 'Restore default';
|
public pnlAdvanced = new PanelBase('PanelAdvaned');
|
public btnSavePreferences = new ButtonSOP('btnSavePreferences');
|
public btnRestoreDefault = new ButtonSOP('btnRestoreDefault');
|
public ddlStrategy = new DropDownListSOP('DropDownListStrategy');
|
public cbOverrideLockedPlan = new CheckboxSOP('CheckboxOverrideManual');
|
public cbLimitUnits = new CheckboxSOP('CheckboxIsSelectedUnits');
|
public cbOnlyPlanOneStepUpstream = new CheckboxSOP('CheckboxOnlyPlanOneStepUpstream');
|
public rbSmartPlanDirection = new RadioButtonSOP('RadioButtonGroupSmartPlanDirection');
|
|
public constructor() {
|
super('DialogSmartPlan', 'btnOK', 'btnCancel');
|
|
// Set UI element mapping to pair the UI name to the UI element for use in DialogSOP to find the UI object to set value or verify value
|
// This prevents each new Dialog to duplicate code just to set/verify UI element value
|
this._uiMap.set('BtnSavePreferencesEnabled', this.btnSavePreferences);
|
this._uiMap.set('BtnRestoreDefaultEnabled', this.btnRestoreDefault);
|
this._uiMap.set('Strategy', this.ddlStrategy);
|
this._uiMap.set('OverrideLockedPlan', this.cbOverrideLockedPlan);
|
this._uiMap.set('LimitUnits', this.cbLimitUnits);
|
this._uiMap.set('SmartPlanDirection', this.rbSmartPlanDirection);
|
this._uiMap.set('OnlyPlanOneStepUpstream', this.cbOnlyPlanOneStepUpstream);
|
}
|
|
/**
|
* Open Advanced panel, select Smart Plan direction and click Ok button
|
*
|
* @param smartPlanDirection Smart Plan direction value to be selected
|
*/
|
public async selectSmartPlanDirection(smartPlanDirection: string): Promise<void> {
|
await this.pnlAdvanced.switchTo();
|
await this.rbSmartPlanDirection.checkOnRadioButton(smartPlanDirection);
|
await this.clickOK();
|
}
|
}
|
|
export enum DialogSmartPlanDirectionRadioButton {
|
Upstream = 'Upstream',
|
Downstream = 'Downstream',
|
MiddleOut = 'Middle-out',
|
}
|