Exemple #1
0
def workflow_management() -> dict:
    return dict(
        compare_logs_form=CompareLogsForm(request.form),
        fields=workflow_table_properties,
        workflows=serialize("Workflow"),
        workflow_creation_form=JobForm(request.form),
    )
Exemple #2
0
def service_management() -> dict:
    return dict(
        compare_logs_form=CompareLogsForm(request.form),
        fields=service_table_properties,
        service_form=JobForm(request.form),
        services_classes=list(service_classes),
        services=serialize("Service"),
    )
Exemple #3
0
def view(view_type: str) -> dict:
    devices, parameters = fetch_all("Device"), get_one("Parameters").serialized
    return dict(
        template=f"{view_type}_view.html",
        pools=fetch_all("Pool"),
        parameters=parameters,
        view=request.form.get("view", parameters["default_view"]),
        google_earth_form=GoogleEarthForm(request.form),
        add_device_form=AddDevice(request.form),
        add_link_form=AddLink(request.form),
        device_automation_form=DeviceAutomationForm(request.form),
        device_subtypes=device_subtypes,
        gotty_connection_form=GottyConnectionForm(request.form),
        link_colors=link_subtype_to_color,
        name_to_id={d.name: id
                    for id, d in enumerate(devices)},
        devices=serialize("Device"),
        links=serialize("Link"),
    )
Exemple #4
0
def object_export(request: dict, path_app: PosixPath) -> bool:
    workbook = Workbook()
    for obj_type in ("Device", "Link"):
        sheet = workbook.add_sheet(obj_type)
        for index, property in enumerate(export_properties[obj_type]):
            sheet.write(0, index, property)
            for obj_index, obj in enumerate(serialize(obj_type), 1):
                sheet.write(obj_index, index, obj[property])
    workbook.save(path_app / "projects" / f'{request["export_filename"]}.xls')
    return True
Exemple #5
0
def instance_management() -> dict:
    return dict(
        fields=instance_table_properties,
        instances=serialize("Instance"),
        form=AddInstance(request.form),
    )
Exemple #6
0
def user_management() -> dict:
    return dict(
        fields=user_table_properties,
        users=serialize("User"),
        form=AddUser(request.form),
    )
Exemple #7
0
def log_management() -> dict:
    return dict(fields=log_public_properties, logs=serialize("Log"))
Exemple #8
0
def log_automation() -> dict:
    return dict(
        log_automation_form=LogAutomationForm(request.form),
        fields=log_rule_table_properties,
        log_rules=serialize("LogRule"),
    )