Пример #1
0
class Method(TreeNode, Updateable):
    """Represents a Method in the CFME ui.  `Display Name` is not
       supported (it causes the name to be displayed differently in
       different places in the UI). """

    form = Form(
        fields=[('name_text', "//input[contains(@name,'method_name')]"),
                ('display_name_text',
                 "//input[contains(@name,'method_display_name')]"),
                ('data_text', ScriptBox("miqEditor"))] +
        submit_and_cancel_buttons)

    def __init__(self,
                 name=None,
                 display_name=None,
                 location=None,
                 data=None,
                 cls=None):
        self.name = name
        # self.display_name = display_name
        self.location = location
        self.data = data
        self.cls = cls

    @property
    def parent(self):
        return self.cls

    def create(self, cancel=False):
        sel.force_navigate("automate_explorer_method_new",
                           context={'tree_item': self.cls})
        fill(
            self.form,
            {
                'name_text': self.name,
                # 'display_name_text': self.display_name,
                'data_text': self.data
            },
            action={
                True: self.form.cancel_btn,
                False: self.form.add_btn
            }[cancel])
        try:
            flash.assert_success_message('Automate Method "%s" was added' %
                                         self.name)
        except Exception as e:
            if error.match("Name has already been taken", e):
                sel.click(self.form.cancel_btn)
            raise

    def update(self, updates, cancel=False):
        sel.force_navigate("automate_explorer_method_edit",
                           context={"tree_item": self})
        fill(self.form, {
            'name_text': updates.get('name'),
            'description_text': updates.get('description'),
            'data_text': updates.get('data')
        },
             action={
                 True: self.form.cancel_btn,
                 False: self.form.save_btn
             }[cancel])

    def delete(self, cancel=False):
        sel.force_navigate("automate_explorer_tree_path",
                           context={'tree_item': self})
        cfg_btn('Remove this Method', invokes_alert=True)
        sel.handle_alert(cancel)
        return flash.assert_no_errors()
Пример #2
0
    ('pxe_menu_text', Input('pxemenu_0')),
])

pxe_image_type_form = Form(fields=[('image_type',
                                    Select("//select[@id='image_typ']"))])

template_details_page = Region(
    infoblock_type='form')  # infoblock shoudl be type 'detail' #gofigure

template_properties_form = Form(
    fields=[('name_text',
             Input('name')), ('description_text', Input('description')),
            ('image_type', Select('//select[@id="img_typ"]')
             ), ('script_type', Select('//select[@id="typ"]')),
            ('script_data',
             ScriptBox(ta_locator="//textarea[@id='script_data']"))])

image_table = Table('//div[@id="records_div"]//table')

image_properties_form = Form(fields=[(
    'name_text',
    Input('name')), ('provision_type',
                     Select('//select[@id="provision_type"]'))])

iso_details_page = Region(
    infoblock_type='form')  # infoblock shoudl be type 'detail' #gofigure

iso_properties_form = Form(fields=[
    ('provider', Select('//select[@id="ems_id"]')),
])
Пример #3
0
from utils.pretty import Pretty
from utils import error

cfg_btn = partial(tb.select, "Configuration")
accordion_tree = partial(accordion.tree, "Orchestration Templates")

dialog_form = Form(
    fields=[('dialog_name',
             Input("dialog_name")), ('save_button', form_buttons.save)])

create_template_form = Form(fields=[
    ('template_name', Input("name")),
    ('description', "textarea#description"),
    ("template_type", Select("select#type")),
    ('content',
     ScriptBox(ta_locator="//div[@id='basic_info_div']/div/div"
               "/div/div/div/div/div/div/pre/span")),
    ('add_button', form_buttons.add),
    ('edit_button', form_buttons.save),
])


def _orch_templates_create_dialog(context):
    accordion_tree('All Orchestration Templates', context['template_type'],
                   context['template_name'])
    cfg_btn('Create Service Dialog from Orchestration Template')


menu.nav.add_branch(
    'services_catalogs', {
        'orchestration_templates': [
            lambda _: accordion.click('Orchestration Templates'), {
Пример #4
0

template_details_page = Region(infoblock_type='form')  # infoblock shoudl be type 'detail' #gofigure

template_add_button = version.pick({
    'default': form_buttons.add,
    '5.3': form_buttons.save
})

template_properties_form = Form(
    fields=[
        ('name_text', "//input[@id='name']"),
        ('description_text', "//input[@id='description']"),
        ('image_type', Select('//select[@id="img_typ"]')),
        ('script_type', Select('//select[@id="typ"]')),
        ('script_data', ScriptBox("miqEditor"))
    ])


image_table = Table('//div[@id="records_div"]//table')

image_properties_form = Form(
    fields=[
        ('name_text', "//input[@id='name']"),
        ('provision_type', Select('//select[@id="provision_type"]'))
    ])

iso_details_page = Region(infoblock_type='form')  # infoblock shoudl be type 'detail' #gofigure

iso_properties_form = Form(
    fields=[
Пример #5
0
class Method(CopiableTreeNode, Updateable):
    """Represents a Method in the CFME ui.  `Display Name` is not
       supported (it causes the name to be displayed differently in
       different places in the UI). """

    # TODO These locators need updating once the multiename Input class goes in

    form = Form(fields=[
        ('name_text', "//input[contains(@name,'method_name')]"),
        ('display_name_text',
         "//input[contains(@name,'method_display_name')]"),
        ('data_text',
         ScriptBox(
             ta_locator="//textarea[@id='method_data' or @id='cls_method_data']"
         ))
    ])

    def __init__(self,
                 name=None,
                 display_name=None,
                 location=None,
                 data=None,
                 cls=None):
        self.name = name
        # self.display_name = display_name
        self.location = location
        self.data = data
        self.cls = cls

    @property
    def parent(self):
        return self.cls

    @parent.setter
    def parent(self, p):
        self.cls = p

    def create(self, cancel=False, allow_duplicate=False):
        if self.parent is not None and not self.parent.exists():
            self.parent.create()
        if self.exists() and not allow_duplicate:
            return
        sel.force_navigate("automate_explorer_method_new",
                           context={'tree_item': self.cls})
        fill(
            self.form,
            {
                'name_text': self.name,
                # 'display_name_text': self.display_name,
                'data_text': self.data
            },
            action=form_buttons.cancel if cancel else form_buttons.add)
        try:
            flash.assert_success_message('Automate Method "%s" was added' %
                                         self.name)
        except Exception as e:
            if error.match("Name has already been taken", e):
                sel.click(form_buttons.cancel)
            raise

    def update(self, updates, cancel=False):
        sel.force_navigate("automate_explorer_method_edit",
                           context={"tree_item": self})
        fill(
            self.form, {
                'name_text': updates.get('name'),
                'description_text': updates.get('description'),
                'data_text': updates.get('data')
            })
        if not cancel:
            if form_buttons.save.is_dimmed:
                # Fire off the handlers manually
                self.form.data_text.workaround_save_issue()
            sel.click(form_buttons.save)
        else:
            sel.click(form_buttons.cancel)

    def delete(self, cancel=False):
        sel.force_navigate("automate_explorer_tree_path",
                           context={'tree_item': self})
        cfg_btn('Remove this Method', invokes_alert=True)
        sel.handle_alert(cancel)
        return flash.assert_no_errors()