update frontend DNS to use dns.web

This commit is contained in:
Face
2025-09-05 16:22:56 +03:00
parent 09e2af17c4
commit f2fc528f7c
6 changed files with 177 additions and 13 deletions

View File

@@ -0,0 +1,66 @@
[gd_scene load_steps=2 format=3 uid="uid://dqvgywj71hfry"]
[ext_resource type="Script" path="res://Scripts/NetworkRequestItem.gd" id="1_8v2qr"]
[node name="NetworkRequestItem" type="PanelContainer"]
custom_minimum_size = Vector2(0, 28)
script = ExtResource("1_8v2qr")
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 2
[node name="IconContainer" type="Control" parent="HBoxContainer"]
layout_mode = 2
custom_minimum_size = Vector2(20, 20)
[node name="Icon" type="TextureRect" parent="HBoxContainer/IconContainer"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -8.0
offset_top = -8.0
offset_right = 8.0
offset_bottom = 8.0
grow_horizontal = 2
grow_vertical = 2
custom_minimum_size = Vector2(16, 16)
[node name="NameLabel" type="Label" parent="HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
custom_minimum_size = Vector2(140, 0)
text = "Request Name"
clip_contents = true
text_overrun_behavior = 3
vertical_alignment = 1
[node name="StatusLabel" type="Label" parent="HBoxContainer"]
layout_mode = 2
custom_minimum_size = Vector2(60, 0)
text = "200"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TypeLabel" type="Label" parent="HBoxContainer"]
layout_mode = 2
custom_minimum_size = Vector2(60, 0)
text = "Fetch"
horizontal_alignment = 1
vertical_alignment = 1
[node name="SizeLabel" type="Label" parent="HBoxContainer"]
layout_mode = 2
custom_minimum_size = Vector2(80, 0)
text = "1.2 KB"
horizontal_alignment = 2
vertical_alignment = 1
[node name="TimeLabel" type="Label" parent="HBoxContainer"]
layout_mode = 2
custom_minimum_size = Vector2(80, 0)
text = "125ms"
horizontal_alignment = 2
vertical_alignment = 1

View File

@@ -0,0 +1,98 @@
class_name NetworkRequestItem
extends PanelContainer
@onready var icon: TextureRect = $HBoxContainer/IconContainer/Icon
@onready var name_label: Label = $HBoxContainer/NameLabel
@onready var status_label: Label = $HBoxContainer/StatusLabel
@onready var type_label: Label = $HBoxContainer/TypeLabel
@onready var size_label: Label = $HBoxContainer/SizeLabel
@onready var time_label: Label = $HBoxContainer/TimeLabel
var request: NetworkRequest
var network_tab: NetworkTab
signal item_clicked(request: NetworkRequest)
func _ready():
# Set up styles for different states
var style_normal = StyleBoxFlat.new()
style_normal.bg_color = Color.TRANSPARENT
style_normal.content_margin_left = 5
style_normal.content_margin_bottom = 5
style_normal.content_margin_right = 5
style_normal.content_margin_top = 5
style_normal.corner_radius_bottom_left = 8
style_normal.corner_radius_bottom_right = 8
style_normal.corner_radius_top_left = 8
style_normal.corner_radius_top_right = 8
add_theme_stylebox_override("panel", style_normal)
# Set up mouse handling
mouse_filter = Control.MOUSE_FILTER_PASS
gui_input.connect(_on_gui_input)
func init(network_request: NetworkRequest, parent_tab: NetworkTab):
request = network_request
network_tab = parent_tab
update_display()
func update_display():
if not request:
return
# Update icon
icon.texture = request.get_icon_texture()
# Update labels
name_label.text = request.name
status_label.text = request.get_status_display()
type_label.text = request.get_type_display()
size_label.text = request.get_size_display()
time_label.text = request.get_time_display()
# Color code status
match request.status:
NetworkRequest.RequestStatus.SUCCESS:
status_label.add_theme_color_override("font_color", Color.GREEN)
NetworkRequest.RequestStatus.ERROR:
status_label.add_theme_color_override("font_color", Color.RED)
NetworkRequest.RequestStatus.PENDING:
status_label.add_theme_color_override("font_color", Color.YELLOW)
func _on_gui_input(event: InputEvent):
if event is InputEventMouseButton:
if event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
item_clicked.emit(request)
func set_selected(selected: bool):
if selected:
var style_selected = StyleBoxFlat.new()
style_selected.bg_color = Color(0.2, 0.4, 0.8, 0.3)
style_selected.content_margin_left = 5
style_selected.content_margin_bottom = 5
style_selected.content_margin_right = 5
style_selected.content_margin_top = 5
style_selected.corner_radius_bottom_left = 8
style_selected.corner_radius_bottom_right = 8
style_selected.corner_radius_top_left = 8
style_selected.corner_radius_top_right = 8
add_theme_stylebox_override("panel", style_selected)
else:
var style_normal = StyleBoxFlat.new()
style_normal.bg_color = Color.TRANSPARENT
style_normal.content_margin_left = 5
style_normal.content_margin_bottom = 5
style_normal.content_margin_right = 5
style_normal.content_margin_top = 5
style_normal.corner_radius_bottom_left = 8
style_normal.corner_radius_bottom_right = 8
style_normal.corner_radius_top_left = 8
style_normal.corner_radius_top_right = 8
add_theme_stylebox_override("panel", style_normal)
func hide_columns(should_hide: bool):
status_label.visible = !should_hide
type_label.visible = !should_hide
size_label.visible = !should_hide
time_label.visible = !should_hide