limj
2023-10-24 93652435728de839582440eefd5122c281181d35
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Form } from '../../e2elib/lib/src/pageobjects/form.component';
import { DialogStrategy } from '../dialogs/dialog.strategy';
import { ListSOP } from '../../libappsop/listsop';
 
export class FormOptimizerStrategies extends Form {
  public listStrategy = new ListStrategy();
 
  public constructor() {
    super('FormOptimizerStrategiesSlideIn');
  }
}
 
export class ListStrategy extends ListSOP<DialogStrategy, ListStrategyColumn> {
  public static readonly title = 'Optimizer Strategies';
 
  public constructor() {
    super('ListOptimizerStrategiesSlideIn', new DialogStrategy());
  }
 
  /**
   * Returns the copied strategy name by appending Copy and running number.
   * Prevents spec files hardcoding the copied format so that future changes to the logic can be change here.
   *
   * @param originalName Strategy name to copy
   * @param suffixRunningNumber [Optional] Number to append in case original strategy has been copied before to prevent duplicate name
   * @returns The new copied strategy name.
   * @example Default_Copy, Default_Copy 1, Default_Copy 2 (with a space before number)
   */
  public getCopiedStrategyName(originalName: string, suffixRunningNumber?: number): string {
    const suffix = suffixRunningNumber ? suffixRunningNumber.toString() : '';
    return `${originalName}_Copy${suffix}`;
  }
}
 
export interface ListStrategyColumn {
  Name?: string;
  ImgIsValid?: string;
}
 
const listStrategyContextMenuItem = {
  Create: { ContextMenu: 'listContextMenuOptimizerStrategiesSlideIn', Name: 'MenuCreate', Label: 'Create' },
  Edit: { ContextMenu: 'listContextMenuOptimizerStrategiesSlideIn', Name: 'MenuEdit', Label: 'Edit' },
  Delete: { ContextMenu: 'listContextMenuOptimizerStrategiesSlideIn', Name: 'MenuDelete', Label: 'Delete' },
  Copy: { ContextMenu: 'listContextMenuOptimizerStrategiesSlideIn', Name: 'MenuCopy', Label: 'Copy' },
};
 
export { listStrategyContextMenuItem as ListStrategyContextMenuItem };