Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
slapos.core
Commits
aad0686b
Commit
aad0686b
authored
Jul 19, 2012
by
Thomas Lechauve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instance page have stop/start/destroy button
parent
0d0d73ad
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
23 deletions
+95
-23
vifib/js/pages.js
vifib/js/pages.js
+15
-18
vifib/js/pages.mobile.js
vifib/js/pages.mobile.js
+55
-0
vifib/js/panels.js
vifib/js/panels.js
+25
-5
No files found.
vifib/js/pages.js
View file @
aad0686b
...
...
@@ -59,28 +59,22 @@ $.vifib.softwareList = function (context) {
list
.
append
(
row
);
});
list
.
listview
(
'
refresh
'
);
}
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
});
}
$
.
vifib
.
instanceList
=
function
(
context
)
{
var
list
,
countRequest
=
0
;
var
list
;
return
context
.
each
(
function
()
{
list
=
$
(
this
).
find
(
'
ul
'
);
$
(
this
).
slapos
(
'
instanceList
'
,
{
success
:
function
(
response
)
{
$
(
this
).
ajaxSend
(
function
()
{
++
countRequest
;
});
$
(
this
).
ajaxComplete
(
function
()
{
if
(
countRequest
--
==
0
)
{
console
.
log
(
"
the end
"
)
list
.
listview
(
'
refresh
'
);
}
else
{
console
.
log
(
countRequest
)
}
$
.
each
(
response
.
list
,
function
(
i
,
e
)
{
$
.
vifib
.
fillRowInstance
(
list
,
$
(
'
<li></li>
'
),
e
);
});
$
.
vifib
.
fillRowInstance
(
list
,
$
(
'
<li></li>
'
),
''
);
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
});
}
...
...
@@ -91,9 +85,9 @@ $.vifib.fillRowInstance = function (list, row, instid) {
$
(
this
).
html
(
Mustache
.
render
(
$
.
vifib
.
panel
.
rowinstance
,
response
));
},
complete
:
function
(
jqxhr
,
textstatus
)
{
console
.
log
(
"
complete
"
)
list
.
append
(
$
(
this
));
}
list
.
append
(
$
(
this
)).
listview
(
'
refresh
'
);
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
}
$
.
vifib
.
computerList
=
function
(
context
)
{
...
...
@@ -107,7 +101,8 @@ $.vifib.computerList = function (context) {
list
.
append
(
row
);
});
list
.
listview
(
'
refresh
'
);
}
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
});
}
...
...
@@ -117,7 +112,8 @@ $.vifib.fillRowSoftware = function (context, softid) {
success
:
function
(
response
)
{
$
.
extend
(
response
,
{
softurl
:
'
#/library/software/id
'
+
softid
});
$
(
this
).
html
(
Mustache
.
render
(
$
.
vifib
.
panel
.
rowsoftware
,
response
));
}
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
})
}
...
...
@@ -127,7 +123,8 @@ $.vifib.fillRowComputer = function (context, compid) {
success
:
function
(
response
)
{
$
.
extend
(
response
,
{
compurl
:
'
#/dashboard/computer/id/
'
+
compid
});
$
(
this
).
html
(
Mustache
.
render
(
$
.
vifib
.
panel
.
rowcomputer
,
response
));
}
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
})
}
vifib/js/pages.mobile.js
View file @
aad0686b
...
...
@@ -88,6 +88,15 @@ $.vifib.mobile = {
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/dashboard/instance/id<path:instid>
'
,
1
)
.
done
(
$
.
vifib
.
mobile
.
dashboard
.
instance
);
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/dashboard/instance/start<path:instid>
'
,
1
)
.
done
(
$
.
vifib
.
mobile
.
dashboard
.
instancestart
);
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/dashboard/instance/stop<path:instid>
'
,
1
)
.
done
(
$
.
vifib
.
mobile
.
dashboard
.
instancestop
);
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/dashboard/instance/destroy<path:instid>
'
,
1
)
.
done
(
$
.
vifib
.
mobile
.
dashboard
.
instancedestroy
);
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/dashboard/computer/list
'
,
1
)
.
done
(
$
.
vifib
.
mobile
.
dashboard
.
computerlist
);
...
...
@@ -150,12 +159,58 @@ $.vifib.mobile = {
var
page
;
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
success
:
function
(
response
)
{
response
[
response
.
status
]
=
true
;
response
.
stop_url
=
'
#/dashboard/instance/stop
'
+
instid
;
response
.
start_url
=
'
#/dashboard/instance/start
'
+
instid
;
response
.
destroy_url
=
'
#/dashboard/instance/destroy
'
+
instid
;
page
=
$
.
vifib
.
onepanel
(
$
.
vifib
.
panel
.
instance
,
response
);
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
Instance
'
}));
$
.
vifib
.
changepage
(
$
(
page
));
}
});
},
instancestart
:
function
(
instid
)
{
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
success
:
function
(
response
)
{
if
(
response
.
status
===
'
stop_requested
'
)
{
response
.
status
=
'
started
'
;
$
(
this
).
slapos
(
'
instanceRequest
'
,
{
data
:
response
,
success
:
function
(
response
)
{
$
.
url
.
redirect
(
'
/dashboard/instance/id
'
+
instid
);
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
})
}
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
},
instancestop
:
function
(
instid
)
{
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
success
:
function
(
response
)
{
if
(
response
.
status
===
'
start_requested
'
)
{
response
.
status
=
'
stopped
'
;
$
(
this
).
slapos
(
'
instanceRequest
'
,
{
data
:
response
,
success
:
function
(
response
)
{
$
.
url
.
redirect
(
'
/dashboard/instance/id
'
+
instid
);
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
})
}
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
},
instancedestroy
:
function
(
instid
)
{
$
(
this
).
slapos
(
'
instanceDelete
'
,
instid
,
{
success
:
function
(
response
)
{
$
.
url
.
redirect
(
'
/dashboard/instance/id
'
+
instid
);
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
})
},
computerlist
:
function
(
route
)
{
var
page
=
$
.
vifib
.
onepanel
(
$
.
vifib
.
panel
.
allcomputer
);
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
Computers
'
}));
...
...
vifib/js/panels.js
View file @
aad0686b
...
...
@@ -130,10 +130,30 @@ $.vifib.panel = {
'
</article>
'
,
instance
:
'
<article>
'
+
'
{{# image_url }}
'
+
'
<img src="{{ image_url }}">
'
+
'
{{/ image_url }}
'
+
'
<h2>{{ instance_id }}</h2>
'
+
'
<center><h3>{{ title }}</h3></center>
'
+
'
<ul data-role="listview">
'
+
'
<li class="ui-li-static">
'
+
'
<p class="ui-li-desc"><i>Software release</i></p>
'
+
'
<h3 class="ui-li-heading"><a href="{{ software_release }}">{{ software_release }}</a></h3>
'
+
'
</li>
'
+
'
<li class="ui-li-static">
'
+
'
<p class="ui-li-desc"><i>Software type</i></p>
'
+
'
<h3 class="ui-li-heading">{{ software_type }}</h3>
'
+
'
</li>
'
+
'
<li class="ui-li-static">
'
+
'
<p class="ui-li-desc"><i>Status</i></p>
'
+
'
<h3 class="ui-li-heading">{{ status }}</h3>
'
+
'
</li>
'
+
'
</ul>
'
+
'
{{# start_requested }}
'
+
'
<a data-role="button" href="{{ stop_url }}">Stop</a>
'
+
'
<a data-role="button" href="{{ destroy_url }}">Destroy</a>
'
+
'
{{/ start_requested }}
'
+
'
{{# stop_requested }}
'
+
'
<a data-role="button" href="{{ start_url }}">Start</a>
'
+
'
<a data-role="button" href="{{ destroy_url }}">Destroy</a>
'
+
'
{{/ stop_requested }}
'
+
''
+
'
</article>
'
,
instancelist
:
'
<article>
'
+
...
...
@@ -142,7 +162,7 @@ $.vifib.panel = {
'
</ul>
'
+
'
</article>
'
,
rowinstance
:
'
<a href="{{ insturl }}">{{
title
}}</a>
'
,
'
<a href="{{ insturl }}">{{
instance_id
}}</a>
'
,
computer
:
'
<article>
'
+
'
<h2>{{ computer_id }}</h2>
'
+
...
...
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