File size: 978 Bytes
75448af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from typing import Literal
import gradio as gr


Grouping = Literal["histogram", "fqdn", "suffix", "summary"]

def update_graph_options(grouping: Grouping):
    """
    Updates visibility of the graph options based on the grouping type.
    The return should be in following order:
    group_settings, histogram_settings
    """
    if grouping == "histogram":
        return [
            gr.TabItem(visible=False),
            gr.TabItem(visible=True),
            gr.TabItem(visible=False),
        ]
    elif grouping in ["fqdn", "suffix"]:
        return [
            gr.Column(visible=True),
            gr.Column(visible=False),
            gr.Column(visible=False),
        ]
    elif grouping == "summary":
        return [
            gr.Column(visible=False),
            gr.Column(visible=False),
            gr.Column(visible=True),
    ]
    
    return [
        gr.Column(visible=False),
        gr.Column(visible=False),
        gr.Column(visible=False),
    ]