示例#1
0
class DisksTable(VanillaTable):
    """Table to add and remove Disks (in VM Reconfigure form)
    """
    BASELOC = "//div/table[./../h3[normalize-space(text())={}]//button]"
    add_disk_btn = DisksButton('contains', 'Add Disk', classes=[Button.PRIMARY])
    cancel_add_btn = DisksButton('contains', 'Cancel Add', classes=[Button.DEFAULT])
    column_widgets = {
        'Type': BootstrapSelect(id='hdType'),
        'Mode': BootstrapSelect(id='hdMode'),
        'Size': Input(id='dvcSize'),
        4: BootstrapSelect(id='hdUnit'),
        'Dependent': BootstrapSwitch(name='cb_dependent'),
        'Delete Backing': BootstrapSwitch(name='cb_deletebacking'),
        'Actions': Button()
    }

    def __init__(self, parent, *args, **kwargs):
        kwargs['column_widgets'] = self.column_widgets
        VanillaTable.__init__(self, parent, self.BASELOC.format(quote('Disks')), *args, **kwargs)

    def click_add_disk(self):
        """Clicks the Add Disk button attached to the table and returns the new editable row
        """
        self.add_disk_btn.click()
        return self[0]

    def click_cancel_add(self):
        """Clicks the Cancel Add button to cancel adding a new row
        """
        self.cancel_add_btn.click()
示例#2
0
class DisksTable(VanillaTable):
    """Table to add and remove Disks (in VM Reconfigure form)"""

    BASELOC = "//div/table[./../h3[normalize-space(text())={}]//button]"
    add_disk_btn = DisksButton("contains", "Add Disk", classes=[Button.PRIMARY])
    cancel_add_btn = DisksButton("contains", "Cancel Add", classes=[Button.DEFAULT])
    column_widgets = {
        "Type": BootstrapSelect(id="hdType"),
        "Mode": BootstrapSelect(id="hdMode"),
        "Size": Input(id="dvcSize"),
        "ControllerType": BootstrapSelect(id="Controller"),
        "Unit": BootstrapSelect(id="hdUnit"),
        "Dependent": BootstrapSwitch(name="vm.cb_dependent"),
        "Delete Backing": BootstrapSwitch(name="cb_deletebacking"),
        "Actions": Button(),
        # second action button, 'Cancel Add' or 'Delete' depending on context of row
        # https://github.com/RedHatQE/widgetastic.core/issues/95
        9: Button(),
    }

    def __init__(self, parent, *args, **kwargs):
        kwargs["column_widgets"] = self.column_widgets
        VanillaTable.__init__(self, parent, self.BASELOC.format(quote("Disks")), *args, **kwargs)

    def click_add_disk(self):
        """Clicks the Add Disk button attached to the table and returns the new editable row"""
        self.add_disk_btn.click()
        return self[0]

    def click_cancel_add(self):
        """Clicks the Cancel Add button to cancel adding a new row"""
        self.cancel_add_btn.click()
示例#3
0
class TimeProfileForm(View):
    description = Input(id='description')
    scope = BootstrapSelect('profile_type')
    timezone = BootstrapSelect('profile_tz')
    days = BootstrapSwitch(name='all_days')
    hours = BootstrapSwitch(name='all_hours')
    cancel = Button('Cancel')
    help_block = Text('//span[contains(@class, "help-block")]')
class AddDeploymentForm(View):
    """Entities on the Add Deployment widget"""
    title = Text('//div[@id="ds_add_div"]//h4')
    file_select = FileInput("upload[file]")
    enable_deployment = BootstrapSwitch(id="enable_deployment_cb")
    runtime_name = TextInput(id="runtime_name_input")
    force_deployment = BootstrapSwitch(id="force_deployment_cb")
    deploy_button = Button(title="Deploy")
    cancel_button = Button(title="Cancel")
示例#5
0
class CloudNetworkEditView(BaseLoggedInPage):
    """ Represents Edit view of cloud network """
    title = Text('//div[@id="main-content"]//h1')
    network_name = TextInput(name='name')
    ext_router = BootstrapSwitch(id='cloud_network_external_facing')
    administrative_state = BootstrapSwitch(id='cloud_network_enabled')
    shared = BootstrapSwitch(id='cloud_network_shared')
    save = Button('Save')

    is_displayed = displayed_not_implemented
示例#6
0
class TimeProfileAddForm(View):
    description = Input(id='description')
    scope = BootstrapSelect('profile_type')
    timezone = BootstrapSelect('profile_tz')
    days = BootstrapSwitch(name='all_days')
    hours = BootstrapSwitch(name='all_hours')
    save_button = Button(VersionPick({Version.lowest(): 'Add', '5.8': 'Save'}))
    configuration = Dropdown('Configuration')
    table = Table("//div[@id='main_div']//table")
    save_edit_button = Button('Save')
    cancel_button = Button('Cancel')
示例#7
0
class CANDUCollectionView(RegionView):
    """C and U View"""
    all_clusters_cb = BootstrapSwitch(id='all_clusters')
    all_datastores_cb = BootstrapSwitch(id='all_storages')

    save_button = Button('Save')
    reset_button = Button('Reset')

    @property
    def is_displayed(self):
        return (self.candu_collection.is_active()
                and self.all_clusters_cb.is_displayed)
示例#8
0
class CloudNetworkEditView(BaseLoggedInPage):
    """ Represents Edit view of cloud network """
    title = Text('//div[@id="main-content"]//h1')
    network_name = TextInput(name='name')
    ext_router = BootstrapSwitch(id='cloud_network_external_facing')
    administrative_state = BootstrapSwitch(id='cloud_network_enabled')
    shared = BootstrapSwitch(id='cloud_network_shared')
    save = Button('Save')

    @property
    def is_displayed(self):
        raise NotImplementedError(
            "This view has no unique markers for is_displayed check")
示例#9
0
class CloudNetworkAddView(BaseLoggedInPage):
    """ Represents Add view of cloud network """
    title = Text('//div[@id="main-content"]//h1')
    network_manager = Select(id='ems_id')
    cloud_tenant = Select(name='cloud_tenant_id')
    network_type = Select(name='provider_network_type')
    network_name = TextInput(name='name')
    ext_router = BootstrapSwitch(id='cloud_network_external_facing')
    administrative_state = BootstrapSwitch(id='cloud_network_enabled')
    shared = BootstrapSwitch(id='cloud_network_shared')
    add = Button('Add')

    is_displayed = displayed_not_implemented
示例#10
0
class CompanyCategoriesAddView(CompanyCategoriesAllView):
    """ Add Company Categories View"""
    name = Input(id='name')
    display_name = Input(id='description')
    long_description = Input(id='example_text')
    show_in_console = BootstrapSwitch(id='show')
    single_value = BootstrapSwitch(id='single_value')
    capture_candu = BootstrapSwitch(id='perf_by_tag')

    cancel_button = Button('Cancel')

    @property
    def is_displayed(self):
        return (self.company_categories.is_active() and self.name.is_displayed)
示例#11
0
class CloudNetworkEditView(BaseLoggedInPage):
    """ Represents Edit view of cloud network """
    title = Text('//div[@id="main-content"]//h1')
    flash = FlashMessages(
        './/div[@id="flash_msg_div"]/div[@id="flash_text_div" or '
        'contains(@class, "flash_text_div")]')
    network_name = TextInput(name='name')
    ext_router = BootstrapSwitch(id='cloud_network_external_facing')
    administrative_state = BootstrapSwitch(id='cloud_network_enabled')
    shared = BootstrapSwitch(id='cloud_network_shared')
    save = Button('Save')

    @property
    def is_displayed(self):
        return False
示例#12
0
class TenantQuotaView(ConfigurationView):
    """ Tenant Quota View """
    cpu_cb = BootstrapSwitch(id='cpu_allocated')
    memory_cb = BootstrapSwitch(id='mem_allocated')
    storage_cb = BootstrapSwitch(id='storage_allocated')
    vm_cb = BootstrapSwitch(id='vms_allocated')
    template_cb = BootstrapSwitch(id='templates_allocated')
    cpu_txt = Input(id='id_cpu_allocated')
    memory_txt = Input(id='id_mem_allocated')
    storage_txt = Input(id='id_storage_allocated')
    vm_txt = Input(id='id_vms_allocated')
    template_txt = Input(id='id_templates_allocated')

    save_button = Button('Save')
    reset_button = Button('Reset')
    cancel_button = Button('Cancel')
class AnsibleCatalogItemForm(ServicesCatalogView):
    title = Text(".//span[@id='explorer_title_text']")
    name = Input("name")
    description = Input("description")
    display_in_catalog = BootstrapSwitch(name="display")
    catalog = BootstrapSelect("catalog_id")

    @View.nested
    class provisioning(Tab):  # noqa
        repository = BootstrapSelect("provisioning_repository_id")
        playbook = BootstrapSelect("provisioning_playbook_id")
        machine_credential = BootstrapSelect("provisioning_machine_credential_id")
        cloud_type = BootstrapSelect("provisioning_cloud_type")
        hosts = Input("provisioning_inventory")
        escalate_privilege = BootstrapSwitch("provisioning_become_enabled")
        verbosity = BootstrapSelect("provisioning_verbosity")
        use_exisiting = Checkbox(locator=".//label[normalize-space(.)='Use Existing']/input")
        create_new = Checkbox(locator=".//label[normalize-space(.)='Create New']/input")
        provisioning_dialog_id = BootstrapSelect("provisioning_dialog_id")
        provisioning_dialog_name = Input(name="vm.provisioning_dialog_name")

    @View.nested
    class retirement(Tab):  # noqa
        # TODO Somehow need to handle a modal window
        copy_from_provisioning = Button("Copy from provisioning")
        repository = BootstrapSelect("retirement_repository_id")
        playbook = BootstrapSelect("provisioning_playbook_id")
        machine_credential = BootstrapSelect("provisioning_machine_credential_id")
        cloud_type = BootstrapSelect("provisioning_cloud_type")
        hosts = Input("retirement_inventory")
        escalate_privilege = BootstrapSwitch(name="provisioning_become_enabled")
        verbosity = BootstrapSelect("retirement_verbosity")
        remove_resources = BootstrapSelect("vm.catalogItemModel.retirement_remove_resources")

    cancel = Button("Cancel")
示例#14
0
class MethodAddView(AutomateExplorerView):
    title = Text('#explorer_title_text')

    location = BootstrapSelect('cls_method_location', can_hide_on_select=True)

    inline_name = Input(name='cls_method_name')
    inline_display_name = Input(name='cls_method_display_name')
    script = ScriptBox()
    data = Input(name='cls_method_data')
    validate_button = Button('Validate')
    # TODO: inline input parameters

    playbook_name = Input(name='name')
    playbook_display_name = Input(name='display_name')
    repository = PlaybookBootstrapSelect('provisioning_repository_id')
    playbook = PlaybookBootstrapSelect('provisioning_playbook_id')
    machine_credential = PlaybookBootstrapSelect(
        'provisioning_machine_credential_id')
    hosts = Input('provisioning_inventory')
    max_ttl = Input('provisioning_execution_ttl')
    escalate_privilege = BootstrapSwitch('provisioning_become_enabled')
    verbosity = PlaybookBootstrapSelect('provisioning_verbosity')
    playbook_input_parameters = PlaybookInputParameters()

    add_button = Button('Add')
    cancel_button = Button('Cancel')

    @property
    def is_displayed(self):
        return (self.in_explorer and self.datastore.is_opened
                and self.title.text == 'Adding a new Automate Method'
                and check_tree_path(self.datastore.tree.currently_selected,
                                    self.context['object'].tree_path))
class AddDatasourceForm(View):
    """Entities on the Add Datasource widget"""
    title = Text('//div[@id="ds_add_div"]//h4')
    ds_type = Select("//select[@id='chooose_datasource_input']")
    xa_ds = BootstrapSwitch(id="xa_ds_cb")
    ds_name = TextInput("ds_name_input")
    jndi_name = TextInput("jndi_name_input")
    driver_name = TextInput("jdbc_ds_driver_name_input")
    driver_module_name = TextInput("jdbc_modoule_name_input")
    driver_class = TextInput("jdbc_ds_driver_input")
    existing_driver = Select("//select[@id='existing_jdbc_driver_input']")
    ds_url = TextInput("connection_url_input")
    username = TextInput("user_name_input")
    password = TextInput("password_input")
    sec_domain = TextInput(id="security_domain_input")
    next_button = Button(title='Next')
    back_button = Button(title='Back')
    finish_button = Button(title='Finish')
    cancel_button = Button(title='Cancel')

    @View.nested
    class tab_specify_driver(Tab):  # noqa
        TAB_NAME = 'Specify Driver'

    @View.nested
    class tab_existing_driver(Tab):  # noqa
        TAB_NAME = 'Existing Driver'
示例#16
0
class CloudNetworkAddView(BaseLoggedInPage):
    """ Represents Add view of cloud network """
    title = Text('//div[@id="main-content"]//h1')
    network_manager = Select(id='ems_id')
    cloud_tenant = Select(name='cloud_tenant_id')
    network_type = Select(name='provider_network_type')
    network_name = TextInput(name='name')
    ext_router = BootstrapSwitch(id='cloud_network_external_facing')
    administrative_state = BootstrapSwitch(id='cloud_network_enabled')
    shared = BootstrapSwitch(id='cloud_network_shared')
    add = Button('Add')

    @property
    def is_displayed(self):
        raise NotImplementedError(
            "This view has no unique markers for is_displayed check")
示例#17
0
class NetworkRouterEditView(BaseLoggedInPage):
    """ Represents Edit NetworkRouters page """
    router_name = TextInput(name='name')
    ext_gateway = BootstrapSwitch(name='external_gateway')
    network_name = Select(name='cloud_network_id')
    subnet_name = Select(name='cloud_subnet_id')
    save = Button('Save')

    is_displayed = displayed_not_implemented
    class element_information(WaitTab):  # noqa
        TAB_NAME = 'Field Information'
        element_tree = ManageIQTree('dialog_edit_treebox')
        dynamic_tree = ManageIQTree('automate_treebox')
        bt_tree = ManageIQTree('automate_treebox')

        ele_label = Input(name='label')
        ele_name = Input(name="name")
        ele_desc = Input(name="description")
        dynamic_chkbox = BootstrapSwitch(label='Dynamic')
示例#19
0
class NetworkRouterAddView(BaseLoggedInPage):
    """ Represents Add NetworkRouters page """
    network_manager = Select(id='ems_id')
    router_name = TextInput(name='name')
    ext_gateway = BootstrapSwitch(name='external_gateway')
    network_name = Select(name='cloud_network_id')
    subnet_name = Select(name='cloud_subnet_id')
    cloud_tenant = Select(name='cloud_tenant_id')
    add = Button('Add')

    is_displayed = displayed_not_implemented
 class retirement(Tab):  # noqa
     # TODO Somehow need to handle a modal window
     copy_from_provisioning = Button("Copy from provisioning")
     repository = BootstrapSelect("retirement_repository_id")
     playbook = BootstrapSelect("provisioning_playbook_id")
     machine_credential = BootstrapSelect("provisioning_machine_credential_id")
     cloud_type = BootstrapSelect("provisioning_cloud_type")
     hosts = Input("retirement_inventory")
     escalate_privilege = BootstrapSwitch(name="provisioning_become_enabled")
     verbosity = BootstrapSelect("retirement_verbosity")
     remove_resources = BootstrapSelect("vm.catalogItemModel.retirement_remove_resources")
示例#21
0
class MethodEditView(AutomateExplorerView):
    title = Text('#explorer_title_text')

    # inline
    inline_name = Input(name='method_name')
    inline_display_name = Input(name='method_display_name')
    script = ScriptBox()
    data = Input(name='method_data')
    validate_button = Button('Validate')
    inputs = View.nested(Inputs)

    # playbook
    playbook_name = Input(name='name')
    playbook_display_name = Input(name='display_name')
    repository = PlaybookBootstrapSelect('provisioning_repository_id')
    playbook = PlaybookBootstrapSelect('provisioning_playbook_id')
    machine_credential = PlaybookBootstrapSelect('provisioning_machine_credential_id')
    hosts = Input('provisioning_inventory')
    max_ttl = Input('provisioning_execution_ttl')
    logging_output = PlaybookBootstrapSelect('provisioning_log_output')
    escalate_privilege = BootstrapSwitch('provisioning_become_enabled')
    verbosity = PlaybookBootstrapSelect('provisioning_verbosity')
    playbook_input_parameters = PlaybookInputParameters()

    # Edit embedded method
    embedded_method_table = Table('//*[@id="embedded_methods_div"]/table')
    embedded_method = EntryPoint(locator='//*[@id="automate-inline-method-select"]//button',
                                 tree_id="treeview-entrypoint_selection")

    save_button = Button('Save')
    reset_button = Button('Reset')
    cancel_button = Button('Cancel')

    def before_fill(self, values):
        location = self.context['object'].location.lower()
        if 'display_name' in values and location in ['inline', 'playbook']:
            values['{}_display_name'.format(location)] = values['display_name']
            del values['display_name']
        elif 'name' in values and location in ['inline', 'playbook']:
            values['{}_name'.format(location)] = values['name']
            del values['name']

    @property
    def is_displayed(self):
        return (
            self.in_explorer
            and self.datastore.is_opened
            and (f'Editing Automate Method "{self.context["object"].name}"' in self.title.text)
            and check_tree_path(
                self.datastore.tree.currently_selected,
                self.context["object"].tree_path,
                partial=True,
            )
        )
示例#22
0
class NetworkRouterEditView(BaseLoggedInPage):
    """ Represents Edit NetworkRouters page """
    router_name = TextInput(name='name')
    ext_gateway = BootstrapSwitch(name='external_gateway')
    network_name = Select(name='cloud_network_id')
    subnet_name = Select(name='cloud_subnet_id')
    save = Button('Save')

    @property
    def is_displayed(self):
        return False
示例#23
0
class FlavorAddForm(View):
    """ Represents Add Flavor page """
    provider = Select(name='ems_id')
    flavor_name = TextInput(name='name')
    ram_size = TextInput(name='ram')
    vcpus = TextInput(name='vcpus')
    disk_size = TextInput(name='disk')
    swap_size = TextInput(name='swap')
    rxtx_factor = TextInput(name='rxtx_factor')
    public = BootstrapSwitch(name='is_public')
    add = Button('Add')
    cancel = Button('Cancel')
 class provisioning(Tab):  # noqa
     repository = BootstrapSelect("provisioning_repository_id")
     playbook = BootstrapSelect("provisioning_playbook_id")
     machine_credential = BootstrapSelect("provisioning_machine_credential_id")
     cloud_type = BootstrapSelect("provisioning_cloud_type")
     hosts = Input("provisioning_inventory")
     escalate_privilege = BootstrapSwitch("provisioning_become_enabled")
     verbosity = BootstrapSelect("provisioning_verbosity")
     use_exisiting = Checkbox(locator=".//label[normalize-space(.)='Use Existing']/input")
     create_new = Checkbox(locator=".//label[normalize-space(.)='Create New']/input")
     provisioning_dialog_id = BootstrapSelect("provisioning_dialog_id")
     provisioning_dialog_name = Input(name="vm.provisioning_dialog_name")
示例#25
0
class NetworkRouterEditView(BaseLoggedInPage):
    """ Represents Edit NetworkRouters page """
    router_name = TextInput(name='name')
    ext_gateway = BootstrapSwitch(name='external_gateway')
    network_name = Select(name='cloud_network_id')
    subnet_name = Select(name='cloud_subnet_id')
    save = Button('Save')

    @property
    def is_displayed(self):
        raise NotImplementedError(
            "This view has no unique markers for is_displayed check")
class InfraVmReconfigureView(BaseLoggedInPage):
    title = Text('#explorer_title_text')

    memory = BootstrapSwitch(name='cb_memory')
    # memory set to True unlocks the following (order matters - first type then value!):
    mem_size_unit = BootstrapSelect(id='mem_type')
    mem_size = WInput(id='memory_value')

    cpu = BootstrapSwitch(name='cb_cpu')
    # cpu set to True unlocks the following:
    sockets = BootstrapSelect(id='socket_count')
    cores_per_socket = BootstrapSelect(id='cores_per_socket_count')
    cpu_total = WInput()  # read-only, TODO widgetastic

    disks_table = DisksTable()

    submit_button = Button('Submit', classes=[Button.PRIMARY])
    cancel_button = Button('Cancel', classes=[Button.DEFAULT])

    # The page doesn't contain enough info to ensure that it's the right VM -> always navigate
    is_displayed = False
class DisksTable(VanillaTable):
    """Table to add and remove Disks (in VM Reconfigure form)
    """

    BASELOC = "//div/table[./../h3[normalize-space(text())={}]//button]"
    add_disk_btn = DisksButton("contains", "Add Disk", classes=[Button.PRIMARY])
    cancel_add_btn = DisksButton("contains", "Cancel Add", classes=[Button.DEFAULT])
    column_widgets = {
        "Type": BootstrapSelect(id="hdType"),
        "Mode": BootstrapSelect(id="hdMode"),
        "Size": Input(id="dvcSize"),
        "ControllerType": BootstrapSelect(id="Controller"),
        # TODO: Workaround necessary until BZ 1524960 is resolved
        5: BootstrapSelect(id="hdUnit"),  # for VMware in 5.9
        4: BootstrapSelect(id="hdUnit"),  # for VMware in 5.8
        3: BootstrapSelect(id="hdUnit"),  # for RHEVM in 5.9
        "Dependent": VersionPick(
            {
                Version.lowest(): BootstrapSwitch(name="cb_dependent"),
                "5.9": BootstrapSwitch(name="vm.cb_dependent"),
            }
        ),
        "Delete Backing": BootstrapSwitch(name="cb_deletebacking"),
        "Actions": Button(),
    }

    def __init__(self, parent, *args, **kwargs):
        kwargs["column_widgets"] = self.column_widgets
        VanillaTable.__init__(self, parent, self.BASELOC.format(quote("Disks")), *args, **kwargs)

    def click_add_disk(self):
        """Clicks the Add Disk button attached to the table and returns the new editable row
        """
        self.add_disk_btn.click()
        return self[0]

    def click_cancel_add(self):
        """Clicks the Cancel Add button to cancel adding a new row
        """
        self.cancel_add_btn.click()
示例#28
0
class NetworkRouterAddView(BaseLoggedInPage):
    """ Represents Add NetworkRouters page """
    network_manager = Select(id='ems_id')
    router_name = TextInput(name='name')
    ext_gateway = BootstrapSwitch(id='network_router_external_gateway')
    network_name = Select(name='cloud_network_id')
    subnet_name = Select(name='cloud_subnet_id')
    cloud_tenant = Select(name='cloud_tenant_id')
    add = Button('Add')

    @property
    def is_displayed(self):
        return False
示例#29
0
 class grid_tile_icons(View):  # noqa
     infra_provider_quad = BootstrapSwitch('quadicons_ems')
     cloud_provider_quad = BootstrapSwitch('quadicons_ems_cloud')
     host_quad = BootstrapSwitch('quadicons_host')
     datastore_quad = BootstrapSwitch('quadicons_storage')
     vm_quad = BootstrapSwitch('quadicons_vm')
     template_quad = BootstrapSwitch('quadicons_miq_template')
     long_text = BootstrapSelect('quad_truncate')
示例#30
0
 class visualquadicons(View):  # noqa
     infra_provider = BootstrapSwitch("quadicons_ems")
     cloud_provider_quad = BootstrapSwitch("quadicons_ems_cloud")
     host_quad = BootstrapSwitch("quadicons_host")
     datastore_quad = BootstrapSwitch("quadicons_storage")
     vm_quad = BootstrapSwitch("quadicons_vm")
     template_quad = BootstrapSwitch("quadicons_miq_template")
     long_text = BootstrapSelect("quad_truncate")