Exemplo n.º 1
0
class ManagePoliciesView(BaseLoggedInPage):
    """
    Manage policies page
    """
    policy_profiles = CheckableBootstrapTreeview(tree_id='protectbox')
    breadcrumb = BreadCrumb()  # some views have breadcrumb, some not
    entities = View.nested(BaseNonInteractiveEntitiesView)
    save = Button('Save')
    reset = Button('Reset')
    cancel = Button('Cancel')

    @property
    def is_displayed(self):
        return False
class DeploymentRoleAllForProviderView(DeploymentRoleView):
    """The Deployment Role for Provider page"""
    breadcrumb = BreadCrumb()
    toolbar = View.nested(DeploymentRoleToolbar)
    sidebar = View.nested(DeploymentRoleDetailsAccordion)
    including_entities = View.include(DeploymentRoleEntitiesView, use_parent=True)

    @property
    def is_displayed(self):
        """Is this page currently being displayed"""
        expected_title = '{} (All Deployment Roles)'.format(self.context['object'].provider.name)

        return (
            self.logged_in_as_current_user and
            self.breadcrumb.active_location == expected_title)
Exemplo n.º 3
0
class ProviderTimelinesView(TimelinesView, BaseLoggedInPage):
    """
     represents Timelines page
    """
    breadcrumb = BreadCrumb()

    @property
    def is_displayed(self):
        expected_name = self.context['object'].name
        return (
            self.logged_in_as_current_user and
            self.navigation.currently_selected == ['Compute', 'Infrastructure', 'Providers'] and
            ('{} (Summary)'.format(expected_name) in self.breadcrumb.locations or
                '{} (Dashboard)'.format(expected_name) in self.breadcrumb.locations) and
            self.is_timelines)
class AvailabilityZoneEditTagsView(AvailabilityZoneView):
    breadcrumb = BreadCrumb()
    title = Text('//div[@id="main-content"]//h3')
    # TODO Add tag table support when rowspan is supported in SummaryTable
    # TODO Add quadicon area
    save = Button('Save')
    reset = Button('Reset')
    cancel = Button('Cancel')

    @property
    def is_displayed(self):
        return (
            self.in_availability_zones and
            self.title.text == 'Tag Assignment' and
            '{} (Summary)'.format(self.context['object'].name) in self.breadcrumb.locations)
Exemplo n.º 5
0
class DeploymentRoleEditTagsView(DeploymentRoleView):
    """The edit tags of Deployment Role"""
    breadcrumb = BreadCrumb()
    title = Text('#explorer_title_text')
    select_tag = BootstrapSelect('tag_cat')
    select_value = BootstrapSelect('tag_add')
    save_button = Button('Save')
    reset_button = Button('Reset')
    cancel = Button('Cancel')

    @property
    def is_displayed(self):
        """Is this page currently being displayed"""
        return (self.in_dep_role
                and self.breadcrumb.active_location == 'Tag Assignment')
Exemplo n.º 6
0
class ProviderDetailsView(BaseLoggedInPage):
    """
     main Details page
    """
    title = Text('//div[@id="main-content"]//h1')
    breadcrumb = BreadCrumb(locator='//ol[@class="breadcrumb"]')
    toolbar = View.nested(ProviderDetailsToolBar)

    @View.nested
    class contents(View):  # NOQA
        # this is switchable view that gets replaced with concrete view.
        # it gets changed according to currently chosen view type  every time
        # when it is accessed
        # it is provided provided by __getattribute__
        pass

    def __getattribute__(self, item):
        # todo: to replace this code with switchable views asap
        if item == 'contents':
            if self.context['object'].appliance.version >= '5.7':
                view_type = self.toolbar.view_selector.selected
                if view_type == 'Summary View':
                    return ProviderDetailsSummaryView(parent=self)

                elif view_type == 'Dashboard View':
                    return ProviderDetailsDashboardView(parent=self)

                else:
                    raise Exception('The content view type "{v}" for provider "{p}" doesnt '
                                    'exist'.format(v=view_type, p=self.context['object'].name))
            else:
                return ProviderDetailsSummaryView(parent=self)  # 5.6 has only only Summary view

        else:
            return super(ProviderDetailsView, self).__getattribute__(item)

    @property
    def is_displayed(self):
        if self.context['object'].appliance.version >= '5.7':
            subtitle = 'Summary' if self.toolbar.view_selector.selected == 'Summary View' \
                else 'Dashboard'
        else:
            subtitle = 'Summary'  # 5.6 has only only Summary view
        title = '{name} ({subtitle})'.format(name=self.context['object'].name, subtitle=subtitle)

        return self.logged_in_as_current_user and \
            self.navigation.currently_selected == ['Compute', 'Infrastructure', 'Providers'] and \
            self.breadcrumb.active_location == title
Exemplo n.º 7
0
class DeploymentRoleManagePoliciesView(DeploymentRoleView):
    """Deployment role Manage Policies view."""
    breadcrumb = BreadCrumb()
    policies = BootstrapTreeview("protectbox")
    save_button = Button("Save")
    reset_button = Button("Reset")
    cancel_button = Button("Cancel")

    @property
    def is_displayed(self):
        """Is this page currently displayed"""
        return (self.in_dep_role
                and (self.breadcrumb.active_location
                     == "'Cluster / Deployment Role' Policy Assignment"
                     or self.breadcrumb.active_location
                     == "'Deployment Role' Policy Assignment"))
Exemplo n.º 8
0
class HostDetailsView(ComputeInfrastructureHostsView):
    """Main Host details page."""
    breadcrumb = BreadCrumb(locator='.//ol[@class="breadcrumb"]')
    toolbar = View.nested(HostDetailsToolbar)
    entities = View.nested(HostDetailsEntities)

    @View.nested
    class security_accordion(Accordion):  # noqa
        ACCORDION_NAME = "Security"

        navigation = BootstrapNav('.//div/ul')

    @property
    def is_displayed(self):
        title = "{name} (Summary)".format(name=self.context["object"].name)
        return self.in_compute_infrastructure_hosts and self.breadcrumb.active_location == title
Exemplo n.º 9
0
class ProviderDetailsView(BaseLoggedInPage):
    """
     main Details page
    """
    title = Text('//div[@id="main-content"]//h1')
    breadcrumb = BreadCrumb(locator='//ol[@class="breadcrumb"]')
    flash = FlashMessages(
        './/div[@id="flash_msg_div"]/div[@id="flash_text_div" or '
        'contains(@class, "flash_text_div")]')
    toolbar = View.nested(ProviderDetailsToolBar)

    entities = ConditionalSwitchableView(reference='toolbar.view_selector',
                                         ignore_bad_reference=True)

    @entities.register('Summary View', default=True)
    class ProviderDetailsSummaryView(View):
        """
        represents Details page when it is switched to Summary aka Tables view
        """
        properties = SummaryTable(title="Properties")
        status = SummaryTable(title="Status")
        relationships = SummaryTable(title="Relationships")
        overview = SummaryTable(title="Overview")
        smart_management = SummaryTable(title="Smart Management")
        custom_attributes = SummaryTable(title='Custom Attributes')

    @entities.register('Dashboard View')
    class ProviderDetailsDashboardView(View):
        """
         represents Details page when it is switched to Dashboard aka Widgets view
        """
        # todo: need to develop this page
        pass

    @property
    def is_displayed(self):
        if (not self.toolbar.view_selector.is_displayed
                or self.toolbar.view_selector.selected == 'Summary View'):
            subtitle = 'Summary'
        else:
            subtitle = 'Dashboard'

        title = '{name} ({subtitle})'.format(name=self.context['object'].name,
                                             subtitle=subtitle)
        return (self.logged_in_as_current_user and self.breadcrumb.is_displayed
                and self.breadcrumb.active_location == title)
Exemplo n.º 10
0
class ProvisionView(BaseLoggedInPage):
    """
    The provisioning view, with nested ProvisioningForm as `form` attribute.
    Handles template selection before Provisioning form with `before_fill` method
    """
    title = Text('#explorer_title_text')
    breadcrumb = BreadCrumb()

    @View.nested
    class form(BasicProvisionFormView):  # noqa
        """First page of provision form is image selection
        Second page of form is tabbed with nested views
        """
        image_table = Table('//div[@id="pre_prov_div"]//table')
        continue_button = Button(
            'Continue')  # Continue button on 1st page, image selection
        submit_button = Button('Submit')  # Submit for 2nd page, tabular form
        cancel_button = Button('Cancel')

        def before_fill(self, values):
            # Provision from image is a two part form,
            # this completes the image selection before the tabular parent form is filled
            template_name = values.get(
                'template_name',
                self.parent_view.context['object'].template_name)
            provider_name = self.parent_view.context['object'].provider.name
            try:
                row = self.image_table.row(name=template_name,
                                           provider=provider_name)
            except IndexError:
                raise TemplateNotFound(
                    'Cannot find template "{}" for provider "{}"'.format(
                        template_name, provider_name))
            row.click()
            self.continue_button.click()
            # TODO timing, wait_displayed is timing out and can't get it to stop in is_displayed
            sleep(3)
            self.flush_widget_cache()

    @property
    def is_displayed(self):
        return False
Exemplo n.º 11
0
class ProviderDetailsView(BaseLoggedInPage):
    """
     main Details page
    """
    title = Text('//div[@id="main-content"]//h1')
    breadcrumb = BreadCrumb(locator='//ol[@class="breadcrumb"]')
    toolbar = View.nested(ProviderDetailsToolBar)

    entities = ConditionalSwitchableView(reference='toolbar.view_selector',
                                         ignore_bad_reference=True)

    @entities.register('Summary View', default=True)
    class ProviderDetailsSummaryView(View):
        """
        represents Details page when it is switched to Summary aka Tables view
        """
        summary = ParametrizedSummaryTable()

    @entities.register('Dashboard View')
    class ProviderDetailsDashboardView(View):
        """
         represents Details page when it is switched to Dashboard aka Widgets view
        """
        # todo: need to develop this page
        pass

    @property
    def is_displayed(self):
        if (not self.toolbar.view_selector.is_displayed or
                self.toolbar.view_selector.selected == 'Summary View'):
            subtitle = 'Summary'
        else:
            subtitle = 'Dashboard'

        title = '{name} ({subtitle})'.format(name=self.context['object'].name,
                                             subtitle=subtitle)
        return (self.logged_in_as_current_user and
                self.breadcrumb.is_displayed and
                self.breadcrumb.active_location == title)
Exemplo n.º 12
0
class ContainerObjectDetailsBaseView(BaseLoggedInPage, LoggingableView):

    title = Text('//div[@id="main-content"]//h1')
    breadcrumb = BreadCrumb(locator='//ol[@class="breadcrumb"]')
    toolbar = View.nested(ProviderDetailsToolBar)
    entities = View.nested(ContainerObjectDetailsEntities)
    containers = StatusBox('Containers')
    services = StatusBox('Services')
    images = StatusBox('Images')
    pods = ContainerSummaryTable(title='Pods')
    SUMMARY_TEXT = None

    @View.nested
    class sidebar(ProviderSideBar):  # noqa
        @View.nested
        class properties(Accordion):  # noqa
            tree = ManageIQTree()

        @View.nested
        class relationships(Accordion):  # noqa
            tree = ManageIQTree()

    @property
    def is_displayed(self):
        return (
            self.title.is_displayed and self.breadcrumb.is_displayed and
            # We use 'in' for this condition because when we use search the
            # text will include include (Names with "...")
            '{} (Summary)'.format(self.context['object'].name
                                  ) in self.breadcrumb.active_location)

    @property
    def summary_text(self):
        if isinstance(self.SUMMARY_TEXT, (string_types, type(None))):
            return self.SUMMARY_TEXT
        else:
            return self.SUMMARY_TEXT.pick(
                self.context['object'].appliance.version)
Exemplo n.º 13
0
class AvailabilityZoneDetailsEntities(View):
    """View containing the widgets for the main content pane on the details page"""
    breadcrumb = BreadCrumb()
    title = Text('//div[@id="main-content"]//h1')
    relationships = SummaryTable(title='Relationships')
    smart_management = SummaryTable(title='Smart Management')
Exemplo n.º 14
0
class FlavorDetailsEntities(View):
    breadcrumb = BreadCrumb()
    title = Text('//div[@id="main-content"]//h1')
    properties = SummaryTable(title='Properties')
    relationships = SummaryTable(title='Relationships')
    smart_management = SummaryTable(title='Smart Management')
Exemplo n.º 15
0
class SecurityGroupAddEntities(View):
    breadcrumb = BreadCrumb()
    title = Text('//div[@id="main-content"]//h1')
Exemplo n.º 16
0
class TenantEditTagEntities(View):
    """The entities on the edit tags page"""
    breadcrumb = BreadCrumb()
    title = Text('#explorer_title_text')
Exemplo n.º 17
0
class VolumeAddEntities(View):
    breadcrumb = BreadCrumb()
    title = Text('//div[@id="main-content"]//h1')
Exemplo n.º 18
0
class TenantEditTagEntities(View):
    """The entities on the edit tags page"""
    breadcrumb = BreadCrumb()
    title = Text('#explorer_title_text')
    included_widgets = View.include(BaseNonInteractiveEntitiesView,
                                    use_parent=True)
Exemplo n.º 19
0
class StackParametersEntities(View):
    """The entities of the resources page"""
    breadcrumb = BreadCrumb()
    title = Text('//div[@id="main-content"]//h1')
    parameters = Table('//div[@id="list_grid"]//table')
Exemplo n.º 20
0
class TenantEditEntities(View):
    """The entities on the add/edit page"""
    breadcrumb = BreadCrumb()
    title = Text('//div[@id="main-content"]//h1')
Exemplo n.º 21
0
class MySettingsEntities(View):
    table = Table('//div[@id="main_div"]//table')
    breadcrumb = BreadCrumb()
    title = Text('//div[@id="main-content"]//h3')
Exemplo n.º 22
0
class TimeProfileEntities(View):
    table = Table('//div[@id="main_div"]//table')
    breadcrumb = BreadCrumb()
    title = Text('//div[@id="main-content"]//h3')
Exemplo n.º 23
0
class StackOutputsEntities(View):
    """The entities of the resources page"""
    breadcrumb = BreadCrumb()
    title = Text('//div[@id="main-content"]//h1')
    outputs = Table('//div[@id="gtl_div"]//table')
Exemplo n.º 24
0
class TimeprofileAddEntities(View):
    breadcrumb = BreadCrumb()
    title = Text('//div[@id="main-content"]//h3')
Exemplo n.º 25
0
class DeploymentRoleComparisonEntities(View):
    """The entities on compare Deployment role page"""
    breadcrumb = BreadCrumb()
    table = Table('//*[@id="compare-grid"]/table')
Exemplo n.º 26
0
class ObjectStoreContainerDetailsEntities(View):
    """The entities on the Object Store Containers detail page"""
    breadcrumb = BreadCrumb()
    properties = SummaryTable('Properties')
    relationships = SummaryTable('Relationships')
    smart_management = SummaryTable('Smart Management')
Exemplo n.º 27
0
class StackSecurityGroupsEntities(View):
    """The entities of the resources page"""
    breadcrumb = BreadCrumb()
    title = Text('//div[@id="main-content"]//h1')
    security_groups = Table('//div[@id="list_grid"]//table')
Exemplo n.º 28
0
class RequestDetailsView(RequestsView):
    @View.nested
    class details(View):  # noqa
        request_details = SummaryForm('Request Details')

    @View.nested
    class request(Tab):  # noqa
        TAB_NAME = 'Request'
        email = SummaryFormItem('Request Information', 'E-Mail')
        first_name = SummaryFormItem('Request Information', 'First Name')
        last_name = SummaryFormItem('Request Information', 'Last Name')
        notes = SummaryFormItem('Request Information', 'Notes')
        manager_name = SummaryFormItem('Manager', 'Name')

    @View.nested
    class purpose(Tab):  # noqa
        TAB_NAME = 'Purpose'
        apply_tags = BootstrapTreeview('all_tags_treebox')

    @View.nested
    class catalog(Tab):  # noqa
        TAB_NAME = 'Catalog'
        filter_template = SummaryFormItem('Select', 'Filter')
        name = SummaryFormItem('Select', 'Name')
        provision_type = SummaryFormItem('Select', 'Provision Type')
        linked_clone = Checkbox(id='service__linked_clone')
        vm_count = SummaryFormItem('Number of VMs', 'Count')
        instance_count = SummaryFormItem('Number of Instances', 'Count')
        vm_name = SummaryFormItem('Naming', 'VM Name')
        instance_name = SummaryFormItem('Naming', 'Instance Name')
        vm_description = SummaryFormItem('Naming', 'VM Description')

    @View.nested
    class environment(Tab):  # noqa
        TAB_NAME = 'Environment'

        automatic_placement = Checkbox(name='environment__placement_auto')
        # Azure
        virtual_private_cloud = SummaryFormItem('Placement - Options',
                                                'Virtual Private Cloud')
        cloud_subnet = SummaryFormItem('Placement - Options', 'Cloud Subnet')
        security_groups = SummaryFormItem('Placement - Options',
                                          'Security Groups')
        resource_groups = SummaryFormItem('Placement - Options',
                                          'Resource Groups')
        public_ip_address = SummaryFormItem('Placement - Options',
                                            'Public IP Address ')
        # GCE
        availability_zone = SummaryFormItem('Placement - Options',
                                            'Availability Zones')
        cloud_network = SummaryFormItem('Placement - Options', 'Cloud Network')
        # Infra
        datacenter = SummaryFormItem('Datacenter', 'Name')
        cluster = SummaryFormItem('Cluster', 'Name')
        resource_pool = SummaryFormItem('Resource Pool', 'Name')
        folder = SummaryFormItem('Folder', 'Name')
        host_filter = SummaryFormItem('Host', 'Filter')
        host_name = SummaryFormItem('Host', 'Name')
        datastore_storage_profile = SummaryFormItem('Datastore',
                                                    'Storage Profile')
        datastore_filter = SummaryFormItem('Datastore', 'Filter')
        datastore_name = SummaryFormItem('Datastore', 'Name')

    @View.nested
    class hardware(Tab):  # noqa
        num_cpus = SummaryFormItem('Hardware', 'Number of CPUS')
        memory = SummaryFormItem('Hardware', 'Startup Memory (MB)')
        dynamic_memory = SummaryFormItem('Hardware', 'Dynamic Memory')
        vm_limit_cpu = SummaryFormItem('VM Limits', 'CPU (%)')
        vm_reserve_cpu = SummaryFormItem('VM Reservations', 'CPU (%)')

    @View.nested
    class network(Tab):  # noqa
        vlan = SummaryFormItem('Network Adapter Information', 'vLan')

    @View.nested
    class properties(Tab):  # noqa
        instance_type = SummaryFormItem('Properties', 'Instance Type')
        boot_disk_size = SummaryFormItem('Properties', 'Boot Disk Size ')
        is_preemtible = Checkbox(name='hardware__is_preemptible')

    @View.nested
    class customize(Tab):  # noqa
        username = SummaryFormItem('Credentials', 'Username')
        ip_mode = SummaryFormItem('IP Address Information', 'Address Mode')
        hostname = SummaryFormItem('IP Address Information', 'Address Mode')
        subnet_mask = SummaryFormItem('IP Address Information', 'Subnet Mask')
        gateway = SummaryFormItem('IP Address Information', 'Gateway')
        dns_server_list = SummaryFormItem('DNS', 'DNS Server list')
        dns_suffix_list = SummaryFormItem('DNS', 'DNS Suffix list')
        subnet_mask = SummaryFormItem('IP Address Information', 'Subnet Mask')
        customize_template = SummaryFormItem('Customize Template',
                                             'Script Name')

    @View.nested
    class schedule(Tab):  # noqa
        when_provision = SummaryFormItem('Schedule Info', 'When to Provision')
        stateless = Checkbox(name='shedule__stateless')
        power_on = SummaryFormItem('Lifespan',
                                   'Power on virtual machines after creation')
        retirement = SummaryFormItem('Lifespan', 'Time until Retirement')
        retirement_warning = SummaryFormItem('Lifespan', 'Retirement Warning')

    @property
    def is_displayed(self):
        return (self.in_requests
                and self.title.text == self.context['object'].rest.description)

    breadcrumb = BreadCrumb()
    toolbar = RequestDetailsToolBar()
Exemplo n.º 29
0
class VolumeBackupDetailsEntities(View):
    """The entities on the Volume Backup detail page"""
    breadcrumb = BreadCrumb()
    properties = SummaryTable('Properties')
    relationships = SummaryTable('Relationships')
    smart_management = SummaryTable('Smart Management')