Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
47940145
Commit
47940145
authored
Apr 15, 2011
by
Christodoulos Psaltis
Browse files
Get metadata and show the in dialog, Refs #375
parent
d8d456de
Changes
2
Hide whitespace changes
Inline
Side-by-side
ui/static/synnefo.js
View file @
47940145
...
...
@@ -677,6 +677,28 @@ function start(serverIDs){
return
false
;
}
// get server metadata
function
get_metadata
(
serverID
)
{
$
.
ajax
({
url
:
API_URL
+
'
/servers/
'
+
serverID
+
'
/meta
'
,
type
:
"
GET
"
,
//async: false,
dataType
:
"
json
"
,
timeout
:
TIMEOUT
,
error
:
function
(
jqXHR
,
textStatus
,
errorThrown
)
{
try
{
ajax_error
(
jqXHR
.
status
,
undefined
,
'
Get metadata
'
,
jqXHR
.
responseText
);
}
catch
(
err
)
{
ajax_error
(
err
);
}
},
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
update_metadata
(
data
);
}
});
return
false
;
}
// show the welcome screen
function
showWelcome
()
{
$
(
"
#view-select
"
).
fadeOut
(
"
fast
"
);
...
...
ui/templates/machines.html
View file @
47940145
...
...
@@ -185,8 +185,8 @@
<hr
class=
"topruler"
/>
<hr
class=
"fatruler"
/>
<div
class=
"content"
>
<ul>
<li
class=
"meta-template"
>
<ul
class=
"meta-template"
style=
"display:none"
>
<li>
<label>
{% trans "Metadata key" %}
</label>
<button
type=
"button"
class=
"remove"
>
{% trans "remove x" %}
</button>
<hr
class=
"meta-separator"
>
...
...
@@ -194,6 +194,8 @@
<button
type=
"button"
class=
"edit"
>
{% trans "edit" %}
</button>
</li>
</ul>
<ul
class=
"meta-list"
>
</ul>
</div>
<button
type=
"button"
class=
"create"
>
{% trans "Create New+" %}
</button>
<div
class=
"bottomruler"
/>
...
...
@@ -593,8 +595,9 @@ function editMetadata() {
oneInstance
:
false
,
load
:
false
});
// get metadata for current server
//get_metadata(serverID);
// get metadata for current server and fill the dialog
serverID
=
$
(
"
#editor-1 h3
"
).
attr
(
'
id
'
);
get_metadata
(
serverID
);
$
(
"
a#meta-editor-1
"
).
data
(
'
overlay
'
).
load
();
return
false
;
}
...
...
@@ -652,6 +655,21 @@ $('#editor-2.meta-modal button.save').click( function(){
editMetadata
();
});
// update metadata in edit dialog
function
update_metadata
(
data
)
{
meta
=
data
.
metadata
.
values
;
for
(
key
in
meta
)
{
alert
(
key
);
alert
(
meta
[
key
]);
pair
=
$
(
"
ul.meta-template li
"
).
clone
();
pair
.
find
(
"
label
"
).
text
(
key
);
pair
.
find
(
"
p
"
).
text
(
meta
[
key
]);
pair
.
appendTo
(
"
#editor-1 div.content ul.meta-list
"
);
}
}
// basic functions executed on page load
if
(
images
.
length
>
0
)
{
// populate image list
...
...
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