Commit e22e8f62 by Oláh István Gergely

dashboard: removing pk from js, changing tag colors

parent 0a7dbb2e
...@@ -234,7 +234,6 @@ $(function () { ...@@ -234,7 +234,6 @@ $(function () {
for(var i in result) { for(var i in result) {
console.log(result[i]); console.log(result[i]);
my_nodes.push({ my_nodes.push({
'pk': result[i].pk,
'name': result[i].name.toLowerCase(), 'name': result[i].name.toLowerCase(),
'icon': result[i].icon, 'icon': result[i].icon,
'status': result[i].status, 'status': result[i].status,
...@@ -274,7 +273,7 @@ $(function () { ...@@ -274,7 +273,7 @@ $(function () {
// if there is only one result and ENTER is pressed redirect // if there is only one result and ENTER is pressed redirect
if(e.keyCode == 13 && search_result.length == 1) { if(e.keyCode == 13 && search_result.length == 1) {
window.location.href = "/dashboard/node/" + search_result[0].pk + "/"; window.location.href = search_result[0].url;
} }
if(e.keyCode == 13 && search_result.length > 1 && input.length > 0) { if(e.keyCode == 13 && search_result.length > 1 && input.length > 0) {
window.location.href = "/dashboard/node/list/?s=" + input; window.location.href = "/dashboard/node/list/?s=" + input;
......
...@@ -929,7 +929,6 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView): ...@@ -929,7 +929,6 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
if self.request.is_ajax(): if self.request.is_ajax():
nodes = Node.objects.all() nodes = Node.objects.all()
nodes = [{ nodes = [{
'pk': i.pk,
'name': i.name, 'name': i.name,
'icon': i.get_status_icon(), 'icon': i.get_status_icon(),
'url': i.get_absolute_url(), 'url': i.get_absolute_url(),
......
...@@ -278,9 +278,9 @@ class Node(OperatedMixin, TimeStampedModel): ...@@ -278,9 +278,9 @@ class Node(OperatedMixin, TimeStampedModel):
def get_status_label(self): def get_status_label(self):
return { return {
'OFFLINE': 'label-danger', 'OFFLINE': 'label-warning',
'DISABLED': 'label-danger', 'DISABLED': 'label-warning',
'MISSING': 'label-warning', 'MISSING': 'label-danger',
'ONLINE': 'label-success'}.get(self.get_state(), 'ONLINE': 'label-success'}.get(self.get_state(),
'label-danger') 'label-danger')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment