change_code.py

mail@pastecode.io avatar
unknown
python
a month ago
2.0 kB
2
Indexable
Never
def load_devices(device_container):
    device_container.clear()
    with device_container:
        if app.storage.user['input_type'] == 'Query Search with Sigma metadata':
            workbook_id = ui.input(label='Workbook ID', validation={
                                   'Input too long': lambda value: len(value) < 20})
            workbook_url = ui.input(label='Workbook URL', validation={
                                    'Input too long': lambda value: len(value) < 20})
            element_id = ui.input(label='Element ID', validation={
                                  'Input too long': lambda value: len(value) < 20})
            query_id = ui.input(label='Query ID', validation={
                                'Input too long': lambda value: len(value) < 20})
            ui.button('Execute')
        elif app.storage.user['input_type'] == 'Query Search with Query Text':
            query_text = ui.textarea(label='Query', placeholder='Put your query here').style(
                'width: 100%;')


def create():
    @ ui.page('/query_shifter_ui')
    def page_subquery_to_cte():
        with theme.frame():
            with ui.stepper().props('vertical').classes('w-full') as stepper:
                with ui.step('Query Search') as step:
                    input_type_container = ui.row().classes('w-full')
                    device_container = ui.row().classes('w-full')
                    with input_type_container:
                        ui.radio(['Query Search with Sigma metadata', 'Query Search with Query Text'], value=None, on_change=lambda: load_devices(device_container)).bind_value(
                            app.storage.user, 'input_type')
                    with ui.stepper_navigation():
                        ui.button('Next', on_click=stepper.next)
                    load_devices(device_container)
                with ui.step('Rewrite and Parse Query'):
                    query_cte = ui.textarea(label='Query', placeholder='Put your query here').style(
                        'width: 100%;')
Leave a Comment