class template(SatTab): name = TextInput(id='ptable_name') default = Checkbox(id='ptable_default') snippet = Checkbox(locator="//input[@id='ptable_snippet']") os_family_selection = ConditionalSwitchableView(reference='snippet') @os_family_selection.register(True) class SnippetOption(View): pass @os_family_selection.register(False) class OSFamilyOption(View): os_family = FilteredDropdown(id='s2id_ptable_os_family') template_editor = ACEEditor() audit_comment = TextInput(id='ptable_audit_comment')
class TemplateEditor(View): """Default view for template entity editor that can be present for example on provisioning template of partition table pages. It contains from different options of content rendering and ace editor where you can actually provide your inputs Usage:: editor = View.nested(TemplateEditor) """ ROOT = ".//div[@id='editor-container']" rendering_options = ItemsList(".//div[contains(@class,'navbar-editor')]/ul") import_template = Button(id='import-btn') fullscreen = Button(id='fullscreen-btn') editor = ACEEditor()
class PartitionTableEditView(BaseLoggedInView): breadcrumb = BreadCrumb() name = TextInput(locator="//input[@id='ptable_name']") default = Checkbox(id='ptable_default') template = ACEEditor() audit_comment = TextInput(id="ptable_audit_comment") submit = Text('//input[@name="commit"]') snippet = Checkbox(locator="//input[@id='ptable_snippet']") os_family_selection = ConditionalSwitchableView(reference='snippet') @os_family_selection.register(True) class SnippetOption(View): pass @os_family_selection.register(False) class OSFamilyOption(View): os_family = FilteredDropdown(id='s2id_ptable_os_family') @View.nested class locations(SatTab): resources = MultiSelect(id='ms-ptable_location_ids') def fill(self, values): self.resources.fill(values) def read(self): return self.resources.read() @View.nested class organizations(SatTab): resources = MultiSelect(id='ms-ptable_organization_ids') def fill(self, values): self.resources.fill(values) def read(self): return self.resources.read() @property def is_displayed(self): breadcrumb_loaded = self.browser.wait_for_element(self.breadcrumb, exception=False) return (breadcrumb_loaded and self.breadcrumb.locations[0] == 'Ptables' and self.breadcrumb.read().startswith('Edit '))
class TemplateEditor(View): """Default view for template entity editor that can be present for example on provisioning template of partition table pages. It contains from different options of content rendering and ace editor where you can actually provide your inputs Usage:: editor = View.nested(TemplateEditor) """ ROOT = ".//div[@class='editor-container']" rendering_options = ToggleRadioGroup(".//div[@class='btn-group']") import_template = Text(".//a[normalize-space(.)='Import']") fullscreen = Text(".//a[normalize-space(.)='Fullscreen']") syntax_type = Select(id='mode') key_binding = Select(id='keybinding') editor = ACEEditor()