fixed pod logs

This commit is contained in:
Eugenio Marzo
2021-01-03 18:28:25 +01:00
parent 7695160042
commit 56429cd728
9 changed files with 218 additions and 13 deletions
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

+8
View File
@@ -2,6 +2,14 @@ images {
image: "/assets/box.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/assets/podlogbox.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/assets/kubelinterbox.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
margin: 0
extrude_borders: 2
inner_padding: 0
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

+179
View File
@@ -708,6 +708,185 @@ nodes {
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: -893.0
y: -739.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 1600.0
y: 600.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kubelinter/podlogbox"
id: "podlog_box"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 1200.0
y: 1000.0
z: 0.0
w: 1.0
}
color {
x: 0.0
y: 1.0
z: 0.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: ""
font: "arcade"
id: "pod_log_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: true
parent: "podlog_box"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 1.0
shadow_alpha: 1.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
nodes {
position {
x: 709.0
y: 105.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 500.0
y: 100.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: ""
font: "error"
id: "error1"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_W
outline {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: true
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 1.0
shadow_alpha: 1.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512
+13 -3
View File
@@ -20,16 +20,26 @@ function on_message(self, message_id, message, sender)
elseif message_id == hash("info") then
gui.set_text(gui.get_node("info"), message.infomessage)
elseif message_id == hash("pod_log") then
gui.set_text(gui.get_node("pod_log"), message.infomessage)
--gui.set_text(gui.get_node("pod_log"), message.infomessage)
if message.infomessage and message.infomessage ~= '' and not kubelinter_read then
gui.set_text(gui.get_node("pod_log_text"), message.infomessage)
gui.set_position(gui.get_node("podlog_box"), vmath.vector3(893, 539, 0))
--gui.set_position(gui.get_node("pod_log_text"), vmath.vector3(850, 500, 0))
elseif not kubelinter_read and message.infomessage then
gui.set_position(gui.get_node("podlog_box"), vmath.vector3(-893, -739, 0))
gui.set_text(gui.get_node("pod_log_text"), message.infomessage)
end
elseif message_id == hash("error1") then
gui.set_text(gui.get_node("error1"), message.errormessage)
elseif message_id == hash("error") then
gui.set_text(gui.get_node("error"), message.errormessage)
elseif message_id == hash("mode") then
gui.set_text(gui.get_node("mode"), message.mode)
elseif message_id == hash("open_kubelinter_box") then
gui.set_position(gui.get_node("kubelinter"), message.position)
gui.set_position(gui.get_node("kubelinter_box"), vmath.vector3(893, 739, 0))
gui.set_position(gui.get_node("kubelinter_box"), vmath.vector3(893, 539, 0))
elseif message_id == hash("close_kubelinter_box") then
gui.set_position(gui.get_node("kubelinter_box"), vmath.vector3(-893, -739, 0))
gui.set_position(gui.get_node("kubelinter_box"), vmath.vector3(-893, -539, 0))
elseif message_id == hash("set_kubelinter_text") then
gui.set_text(gui.get_node("kubelinter"), message.kubelintermessage)
+1 -1
View File
@@ -11,7 +11,7 @@ function M.http_kubelinter_result(self, _, response)
print(response.status)
print(response.response)
print(response.headers)
msg.post("ui#gui","open_kubelinter_box",{ position = vmath.vector3(850, 750, 0) })
msg.post("ui#gui","open_kubelinter_box",{ position = vmath.vector3(850, 550, 0) })
kubelinter_table = json.decode(response.response)
kubelinter_read = true
kubelinter_index = 0
+1
View File
@@ -33,6 +33,7 @@ end
function M.http_pod_log_result(self, _, response)
msg.post("ui#gui","pod_log",{infomessage = response.response})
current_pod_log = response.response
end
function M.delete_pod(pod_name)
+16 -9
View File
@@ -16,6 +16,7 @@ pod_update_time = 0.5
kubernetes_pods = {}
last_pod_log = false
last_pod_log_time = false
current_pod_log = ""
start_chaos = false
bullet_collision_action = "delete_pod"
@@ -103,6 +104,12 @@ function start_chaos()
kubelinter.run(pod_name)
kubelinter_pod = false
end
if kubelinter_read or current_pod_log ~= "" then
msg.post("ui#gui", "error1",{ errormessage = "Press SPACE!" })
else
msg.post("ui#gui", "error1",{ errormessage = "" })
end
end)
timer.repeat_seconds(1, function()
spaceship.auto()
@@ -132,29 +139,21 @@ end
function on_input(self, action_id, action)
p = go.get_position()
if action_id == hash("up") then
msg.post("ui#gui","pod_log",{infomessage = ''})
last_pod_log = false
if p.y < 1000 then
p.y = p.y + 4
go.set_position(p)
end
elseif action_id == hash("down") then
msg.post("ui#gui","pod_log",{infomessage = ''})
last_pod_log = false
if p.y > 1 then
p.y = p.y - 4
go.set_position(p)
end
elseif action_id == hash("left") then
msg.post("ui#gui","pod_log",{infomessage = ''})
last_pod_log = false
if p.x > 1 then
p.x = p.x - 4
go.set_position(p)
end
elseif action_id == hash("right") then
msg.post("ui#gui","pod_log",{infomessage = ''})
last_pod_log = false
if p.x < 1800 then
p.x = p.x + 4
go.set_position(p)
@@ -210,6 +209,9 @@ function on_input(self, action_id, action)
msg.post("ui#gui", "info",{ infomessage = info })
elseif ((action_id == hash("space")) or (action_id == hash("kubelinter"))) and action.pressed then
msg.post("ui#gui","pod_log",{infomessage = ''})
last_pod_log = false
current_pod_log = ""
if action_id == hash("space") then
bullet_collision_action = "delete_pod"
@@ -245,7 +247,9 @@ function on_input(self, action_id, action)
return
end
msg.post("ui#gui", "error",{ errormessage = "" })
if not kubelinter_read then
msg.post("ui#gui", "error",{ errormessage = "" })
end
-- Returns an approximation of the amount in seconds of CPU time used by the program.
current_hit_time = os.clock()
if automatic == false then
@@ -270,6 +274,9 @@ function on_message(self, message_id, message, sender)
current_time = os.clock()
print('DEBUG' .. message_id)
if message_id == COLLISION_RESPONSE and started_chaos then
msg.post("ui#gui","pod_log")
for i,value in ipairs(current_pods) do
if (message["other_id"] == value["id"]) then
pod_name = value["pod_name"]