|
|
@@ -0,0 +1,69 @@
|
|
|
+# coding: utf8
|
|
|
+"""С этого начинается работа """
|
|
|
+
|
|
|
+from browser import document, ajax
|
|
|
+
|
|
|
+
|
|
|
+def bot_list_update(event):
|
|
|
+ """Обновляет список ботов"""
|
|
|
+ def read(req):
|
|
|
+ print(req.text)
|
|
|
+ document["bot_list"] = req.text
|
|
|
+ print(f"bot_list_update click, ev={event}!")
|
|
|
+ ajax.get("/bot_list/update", oncomplete=read)
|
|
|
+
|
|
|
+
|
|
|
+def bot_list_add(event):
|
|
|
+ """Добавляет нового бота"""
|
|
|
+ print(f"bot_list_add click, ev={event}!")
|
|
|
+ formBotNew=FormBotNew()
|
|
|
+
|
|
|
+
|
|
|
+class FormBotNew():
|
|
|
+ def __init__(self):
|
|
|
+ print(f"FormBotNew.__init__()")
|
|
|
+ self.divNew=document["bot_list_new"]
|
|
|
+ self.divNew.clear()
|
|
|
+ self.add_container_new()
|
|
|
+
|
|
|
+ def add_container_new(self):
|
|
|
+ print(f"FormBotNew.add_container_new()")
|
|
|
+ self.boxNew= document.createElement("div")
|
|
|
+ self.boxNew["class"]="container bg-secondary text-white p-3 border"
|
|
|
+ self.add_row_login()
|
|
|
+ self.add_row_pass()
|
|
|
+ self.divNew.appendChild(self.boxNew)
|
|
|
+
|
|
|
+ def add_row_login(self):
|
|
|
+ print(f"FormBotNew.add_row_login()")
|
|
|
+ self.loginRow=document.createElement("div")
|
|
|
+ self.loginRow["class"]="row"
|
|
|
+ self.labelLogin=document.createElement("label")
|
|
|
+ self.labelLogin["class"]="col-2"
|
|
|
+ self.labelLogin.text="Логин"
|
|
|
+ self.loginRow.appendChild(self.labelLogin)
|
|
|
+
|
|
|
+ self.entLogin=document.createElement("input")
|
|
|
+ self.entLogin["class"]="col-9"
|
|
|
+ self.loginRow.appendChild(self.entLogin)
|
|
|
+
|
|
|
+ self.boxNew.appendChild(self.loginRow)
|
|
|
+
|
|
|
+ def add_row_pass(self):
|
|
|
+ print(f"FormBotNew.add_row_pass()")
|
|
|
+ self.passRow=document.createElement("div")
|
|
|
+ self.passRow["class"]="row"
|
|
|
+ self.labelPass=document.createElement("label")
|
|
|
+ self.labelPass["class"]="col-2"
|
|
|
+ self.labelPass.text="Пароль"
|
|
|
+ self.passRow.appendChild(self.labelPass)
|
|
|
+
|
|
|
+ self.entPass=document.createElement("input")
|
|
|
+ self.entPass["class"]="col-9"
|
|
|
+ self.passRow.appendChild(self.entPass)
|
|
|
+
|
|
|
+ self.boxNew.appendChild(self.passRow)
|
|
|
+
|
|
|
+document["bot_list_update"].bind("click", bot_list_update)
|
|
|
+document["bot_list_add"].bind("click", bot_list_add)
|
|
|
+document.attach("Hello !")
|