Root class for the 'query UI'. Manages the entire UI, forms to query the TSDB and other misc panels.
| 101 | * Manages the entire UI, forms to query the TSDB and other misc panels. |
| 102 | */ |
| 103 | public class QueryUi implements EntryPoint, HistoryListener { |
| 104 | |
| 105 | /** Map of available gnuplot data styles. */ |
| 106 | public static Map<String, Integer> stylesMap = new HashMap<String, Integer>(); |
| 107 | static { |
| 108 | Map<String, Integer> map = new HashMap<String, Integer>(); |
| 109 | map.put("linespoint", 0); |
| 110 | map.put("points", 1); |
| 111 | map.put("circles", 3); |
| 112 | map.put("dots", 4); |
| 113 | stylesMap = Collections.unmodifiableMap(map); |
| 114 | } |
| 115 | |
| 116 | // Some URLs we use to fetch data from the TSD. |
| 117 | private static final String AGGREGATORS_URL = "aggregators"; |
| 118 | private static final String LOGS_URL = "logs?json"; |
| 119 | private static final String STATS_URL = "stats?json"; |
| 120 | private static final String VERSION_URL = "version?json"; |
| 121 | |
| 122 | private static final DateTimeFormat FULLDATE = |
| 123 | DateTimeFormat.getFormat("yyyy/MM/dd-HH:mm:ss"); |
| 124 | |
| 125 | private final Label current_error = new Label(); |
| 126 | |
| 127 | private final DateTimeBox start_datebox = new DateTimeBox(); |
| 128 | private final DateTimeBox end_datebox = new DateTimeBox(); |
| 129 | private final CheckBox autoreload = new CheckBox("Autoreload"); |
| 130 | private final ValidatedTextBox autoreoload_interval = new ValidatedTextBox(); |
| 131 | private Timer autoreoload_timer; |
| 132 | |
| 133 | private final ValidatedTextBox yrange = new ValidatedTextBox(); |
| 134 | private final ValidatedTextBox y2range = new ValidatedTextBox(); |
| 135 | private final CheckBox ylog = new CheckBox(); |
| 136 | private final CheckBox y2log = new CheckBox(); |
| 137 | private final TextBox ylabel = new TextBox(); |
| 138 | private final TextBox y2label = new TextBox(); |
| 139 | private final ValidatedTextBox yformat = new ValidatedTextBox(); |
| 140 | private final ValidatedTextBox y2format = new ValidatedTextBox(); |
| 141 | private final ValidatedTextBox wxh = new ValidatedTextBox(); |
| 142 | private final CheckBox global_annotations = new CheckBox("Global annotations"); |
| 143 | |
| 144 | private String keypos = ""; // Position of the key on the graph. |
| 145 | private final CheckBox horizontalkey = new CheckBox("Horizontal layout"); |
| 146 | private final CheckBox keybox = new CheckBox("Box"); |
| 147 | private final CheckBox nokey = new CheckBox("No key (overrides others)"); |
| 148 | |
| 149 | // Styling options. |
| 150 | private final CheckBox smooth = new CheckBox(); |
| 151 | private final ListBox styles = new ListBox(); |
| 152 | private String timezone = ""; |
| 153 | |
| 154 | // Annotations handling flags. |
| 155 | private boolean hide_annotations = false; |
| 156 | private boolean show_global_annotations = false; |
| 157 | |
| 158 | /** |
| 159 | * Handles every change to the query form and gets a new graph. |
| 160 | * Whenever the user changes one of the parameters of the graph, we want |
nothing calls this directly
no test coverage detected
searching dependent graphs…