github.com/hernad/nomad@v1.6.112/ui/tests/pages/components/task-groups.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import { collection, clickable, text } from 'ember-cli-page-object';
     7  import { singularize } from 'ember-inflector';
     8  
     9  export default function (
    10    selector = '[data-test-task-group]',
    11    propKey = 'taskGroups'
    12  ) {
    13    const lookupKey = `${singularize(propKey)}For`;
    14  
    15    return {
    16      [propKey]: collection(selector, {
    17        name: text('[data-test-task-group-name]'),
    18        count: text('[data-test-task-group-count]'),
    19        volume: text('[data-test-task-group-volume]'),
    20        cpu: text('[data-test-task-group-cpu]'),
    21        mem: text('[data-test-task-group-mem]'),
    22        disk: text('[data-test-task-group-disk]'),
    23        visit: clickable('[data-test-task-group-name] a'),
    24        visitRow: clickable(),
    25      }),
    26  
    27      [lookupKey]: function (name) {
    28        return this[propKey].toArray().find((tg) => tg.name === name);
    29      },
    30    };
    31  }