Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
00c89c64
authored
Feb 07, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: close issue #47
parent
a3c44a68
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
138 deletions
+10
-138
circle/dashboard/static/dashboard/node-details.js
+0
-129
circle/dashboard/static/dashboard/node-list.js
+2
-2
circle/dashboard/static/dashboard/vm-create.js
+4
-2
circle/dashboard/static/dashboard/vm-details.js
+3
-4
circle/dashboard/static/dashboard/vm-list.js
+1
-1
No files found.
circle/dashboard/static/dashboard/node-details.js
deleted
100644 → 0
View file @
a3c44a68
$
(
function
()
{
if
(
$
(
'.timeline .activity:first i:first'
).
hasClass
(
'icon-spin'
))
checkNewActivity
();
/* save resources */
$
(
'#vm-details-resources-save'
).
click
(
function
()
{
$
(
'i.icon-save'
,
this
).
removeClass
(
"icon-save"
).
addClass
(
"icon-refresh icon-spin"
);
$
.
ajax
({
type
:
'POST'
,
url
:
location
.
href
,
data
:
$
(
'#vm-details-resources-form'
).
serialize
(),
success
:
function
(
data
,
textStatus
,
xhr
)
{
addMessage
(
data
[
'message'
],
'success'
);
$
(
"#vm-details-resources-save i"
).
removeClass
(
'icon-refresh icon-spin'
).
addClass
(
"icon-save"
);
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
$
(
"#vm-details-resources-save i"
).
removeClass
(
'icon-refresh icon-spin'
).
addClass
(
"icon-save"
);
addMessage
(
"Eww, something is wrong"
,
'danger'
);
if
(
xhr
.
status
==
500
)
{
// alert("uhuhuhuhuhuh");
}
else
{
// alert("unknown error");
}
}
});
return
false
;
});
/* rename */
$
(
"#vm-details-h1-name, .vm-details-rename-button"
).
click
(
function
()
{
$
(
"#vm-details-h1-name"
).
hide
();
$
(
"#vm-details-rename"
).
css
(
'display'
,
'inline'
);
});
/* rename ajax */
$
(
'#vm-details-rename-submit'
).
click
(
function
()
{
var
name
=
$
(
'#vm-details-rename-name'
).
val
();
$
.
ajax
({
method
:
'POST'
,
url
:
location
.
href
,
data
:
{
'new_name'
:
name
},
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
success
:
function
(
data
,
textStatus
,
xhr
)
{
$
(
"#vm-details-h1-name"
).
html
(
data
[
'new_name'
]).
show
();
$
(
'#vm-details-rename'
).
hide
();
// addMessage(data['message'], "success");
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"uhoh"
,
"danger"
);
}
});
return
false
;
});
/* remove tag */
$
(
'.vm-details-remove-tag'
).
click
(
function
()
{
var
to_remove
=
$
.
trim
(
$
(
this
).
parent
(
'div'
).
text
());
var
clicked
=
$
(
this
);
$
.
ajax
({
type
:
'POST'
,
url
:
location
.
href
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
data
:
{
'to_remove'
:
to_remove
},
success
:
function
(
re
)
{
if
(
re
[
'message'
].
toLowerCase
()
==
"success"
)
{
$
(
clicked
).
closest
(
".label"
).
fadeOut
(
500
,
function
()
{
$
(
this
).
remove
();
});
}
},
error
:
function
()
{
addMessage
(
re
[
'message'
],
'danger'
);
}
});
return
false
;
});
});
function
checkNewActivity
()
{
var
latest
=
$
(
'.activity:first'
).
data
(
'activity-id'
);
var
latest_sub
=
$
(
'div[data-activity-id="'
+
latest
+
'"] .sub-timeline .sub-activity:first'
).
data
(
'activity-id'
);
var
instance
=
location
.
href
.
split
(
'/'
);
instance
=
instance
[
instance
.
length
-
2
];
$
.
ajax
({
type
:
'POST'
,
url
:
'/dashboard/vm/'
+
instance
+
'/activity/'
,
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)},
data
:
{
'latest'
:
latest
,
'latest_sub'
:
latest_sub
},
success
:
function
(
data
)
{
if
(
data
[
'new_sub_activities'
].
length
>
0
)
{
d
=
data
[
'new_sub_activities'
];
html
=
""
for
(
var
i
=
0
;
i
<
d
.
length
;
i
++
)
{
html
+=
'<div data-activity-id="'
+
d
[
i
].
id
+
'" class="sub-activity">'
+
d
[
i
].
name
+
' - '
;
if
(
d
[
i
].
finished
!=
null
)
{
html
+=
d
[
i
].
finished
}
else
{
html
+=
'<i class="icon-refresh icon-spin" class="sub-activity-loading-icon"></i>'
;
}
html
+=
'</div>'
;
}
$
(
'div[data-activity-id="'
+
latest_sub
+
'"] .sub-activity .sub-activity-loading-icon'
).
remove
();
$
(
'div[data-activity-id="'
+
latest
+
'"] .sub-timeline'
).
prepend
(
html
);
}
if
(
data
[
'is_parent_finished'
])
{
var
c
=
"icon-plus"
$
(
'div[data-activity-id="'
+
latest
+
'"] .icon-refresh.icon-spin:first'
).
removeClass
(
'icon-refresh'
).
removeClass
(
'icon-spin'
).
addClass
(
c
);
}
if
(
data
[
'latest_sub_finished'
]
!=
null
)
{
s
=
$
(
'div[data-activity-id="'
+
latest_sub
+
'"]'
)
$
(
'.icon-refresh.icon-spin'
,
s
).
remove
();
$
(
s
).
append
(
data
[
'latest_sub_finished'
]);
}
if
(
data
[
'is_parent_finished'
])
return
;
else
setTimeout
(
checkNewActivity
,
1000
);
},
error
:
function
()
{
}
});
}
circle/dashboard/static/dashboard/node-list.js
View file @
00c89c64
...
@@ -126,7 +126,7 @@ $(function() {
...
@@ -126,7 +126,7 @@ $(function() {
// addMessage(data['message'], "success");
// addMessage(data['message'], "success");
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"
uhoh
"
,
"danger"
);
addMessage
(
"
Error during renaming!
"
,
"danger"
);
}
}
});
});
return
false
;
return
false
;
...
@@ -191,7 +191,7 @@ $(function() {
...
@@ -191,7 +191,7 @@ $(function() {
onsuccess
(
params
);
onsuccess
(
params
);
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"
uhoh
"
,
"danger"
);
addMessage
(
"
Error!
"
,
"danger"
);
}
}
});
});
return
false
;
return
false
;
...
...
circle/dashboard/static/dashboard/vm-create.js
View file @
00c89c64
...
@@ -202,10 +202,12 @@ function vmCreateLoaded() {
...
@@ -202,10 +202,12 @@ function vmCreateLoaded() {
}
}
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
var
r
=
$
(
'#create-modal'
);
r
.
next
(
'div'
).
remove
();
r
.
remove
();
if
(
xhr
.
status
==
500
)
{
if
(
xhr
.
status
==
500
)
{
a
lert
(
"uhuhuhuhuhuh
"
);
a
ddMessage
(
"500 Internal Server Error"
,
"danger
"
);
}
else
{
}
else
{
a
lert
(
"unknown erro
r"
);
a
ddMessage
(
xhr
.
status
+
" Unknown Error"
,
"dange
r"
);
}
}
}
}
});
});
...
...
circle/dashboard/static/dashboard/vm-details.js
View file @
00c89c64
...
@@ -15,11 +15,10 @@ $(function() {
...
@@ -15,11 +15,10 @@ $(function() {
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
$
(
"#vm-details-resources-save i"
).
removeClass
(
'icon-refresh icon-spin'
).
addClass
(
"icon-save"
);
$
(
"#vm-details-resources-save i"
).
removeClass
(
'icon-refresh icon-spin'
).
addClass
(
"icon-save"
);
addMessage
(
"Eww, something is wrong"
,
'danger'
);
if
(
xhr
.
status
==
500
)
{
if
(
xhr
.
status
==
500
)
{
// alert("uhuhuhuhuhuh
");
addMessage
(
"500 Internal Server Error"
,
"danger
"
);
}
else
{
}
else
{
// alert("unknown erro
r");
addMessage
(
xhr
.
status
+
" Unknown Error"
,
"dange
r"
);
}
}
}
}
});
});
...
@@ -47,7 +46,7 @@ $(function() {
...
@@ -47,7 +46,7 @@ $(function() {
// addMessage(data['message'], "success");
// addMessage(data['message'], "success");
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"
uhoh
"
,
"danger"
);
addMessage
(
"
Error during renaming!
"
,
"danger"
);
}
}
});
});
return
false
;
return
false
;
...
...
circle/dashboard/static/dashboard/vm-list.js
View file @
00c89c64
...
@@ -118,7 +118,7 @@ $(function() {
...
@@ -118,7 +118,7 @@ $(function() {
// addMessage(data['message'], "success");
// addMessage(data['message'], "success");
},
},
error
:
function
(
xhr
,
textStatus
,
error
)
{
error
:
function
(
xhr
,
textStatus
,
error
)
{
addMessage
(
"
uhoh
"
,
"danger"
);
addMessage
(
"
Error during renaming!
"
,
"danger"
);
}
}
});
});
return
false
;
return
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment