2016-03-31 16:03:38 +08:00
|
|
|
{% extends 'base_AdminLTE.html' %}
|
|
|
|
|
|
|
|
{% block title %}Docklet | Create Workspace{% endblock %}
|
|
|
|
|
|
|
|
{% block css_src %}
|
|
|
|
<!--<style>
|
|
|
|
.divcontent { overflow-y:scroll; height:200px;}
|
|
|
|
</style>-->
|
2016-04-29 16:08:10 +08:00
|
|
|
<link href="//cdn.bootcss.com/datatables/1.10.11/css/dataTables.bootstrap.min.css" rel="stylesheet">
|
|
|
|
<link href="//cdn.bootcss.com/datatables/1.10.11/css/jquery.dataTables_themeroller.css" rel="stylesheet">
|
|
|
|
<link href="/static/dist/css/modalconfig.css" rel="stylesheet">
|
2017-04-07 16:25:57 +08:00
|
|
|
|
2016-03-31 16:03:38 +08:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block panel_title %}Workspace Info{% endblock %}
|
|
|
|
|
|
|
|
{% block panel_list %}
|
|
|
|
<ol class="breadcrumb">
|
|
|
|
<li>
|
|
|
|
<a href="/dashboard/"><i class="fa fa-dashboard"></i>Home</a>
|
|
|
|
</li>
|
|
|
|
</ol>
|
|
|
|
{% endblock %}
|
|
|
|
|
2017-04-07 16:25:57 +08:00
|
|
|
<div>
|
2016-03-31 16:03:38 +08:00
|
|
|
{% block content %}
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-12">
|
|
|
|
<div class="box box-info">
|
|
|
|
<div class="box-header with-border">
|
|
|
|
<h3 class="box-title">Workspace Add</h3>
|
|
|
|
|
|
|
|
<div class="box-tools pull-right">
|
|
|
|
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
|
|
|
|
</button>
|
|
|
|
<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="box-body">
|
2017-06-26 18:46:01 +08:00
|
|
|
<form id="form" class="form-horizontal" action="/workspace/{{masterips[0].split("@")[0]}}/add/" method="POST">
|
2016-03-31 16:03:38 +08:00
|
|
|
|
|
|
|
<div class="form-group"><label class="col-sm-2 control-label">Workspace Name</label>
|
|
|
|
<div class="col-sm-10"><input type="text" class="form-control" name="clusterName" id="clusterName"></div>
|
|
|
|
</div>
|
|
|
|
<div class="hr-line-dashed"></div>
|
2016-05-06 18:00:49 +08:00
|
|
|
<br/>
|
2017-05-21 16:08:12 +08:00
|
|
|
<div class="form-group"><label class="col-sm-2 control-label">Location</label>
|
2017-05-07 15:47:21 +08:00
|
|
|
<div class="col-sm-10"><select id="masterselector" class="form-control">
|
|
|
|
{% for master in masterips %}
|
|
|
|
<option value="{{master.split("@")[0]}}">{{master.split("@")[1]}}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select></div>
|
2017-05-21 16:08:12 +08:00
|
|
|
</div>
|
|
|
|
<br/>
|
|
|
|
<div class="form-group"><label class="col-sm-2 control-label"></label>
|
|
|
|
<div class="col-sm-10"><p id="masterdesc">{{masterdesc}}</p></div>
|
2017-05-07 15:47:21 +08:00
|
|
|
</div>
|
|
|
|
<br/>
|
2016-03-31 16:03:38 +08:00
|
|
|
<div class="form-group"><label class="col-sm-2 control-label">Image Choose</label>
|
|
|
|
<div class="col-sm-10">
|
2017-05-07 15:47:21 +08:00
|
|
|
<table id="imagetable" class="table table-striped table-bordered table-hover table-image" >
|
2016-03-31 16:03:38 +08:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>ImageName</th>
|
|
|
|
<th>Type</th>
|
|
|
|
<th>Owner</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Choose</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>base</td>
|
2016-04-12 15:20:11 +08:00
|
|
|
<td>public</td>
|
2016-03-31 16:03:38 +08:00
|
|
|
<td>docklet</td>
|
|
|
|
<td>A base image for you</td>
|
|
|
|
<td><div class="i-checks"><label><input type="radio" name="image" value="base_base_base" checked="checked"></label></div></td>
|
|
|
|
</tr>
|
2017-05-08 16:55:20 +08:00
|
|
|
{% for image in images['private'] %}
|
2016-03-31 16:03:38 +08:00
|
|
|
<tr>
|
|
|
|
<td>{{image['name']}}</td>
|
2016-04-12 15:20:11 +08:00
|
|
|
<td>private</td>
|
2016-03-31 16:03:38 +08:00
|
|
|
<td>{{user}}</td>
|
2017-06-26 18:46:01 +08:00
|
|
|
<td><a href="/image/{{masterips[0].split("@")[1]}}/description/{{image['name']}}_{{user}}_private/" target="_blank">{{image['description']}}</a></td>
|
2016-03-31 16:03:38 +08:00
|
|
|
<td><div class="i-checks"><label><input type="radio" name="image" value="{{image['name']}}_{{user}}_private"></label></div></td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
2017-05-08 16:55:20 +08:00
|
|
|
{% for p_user,p_images in images['public'].items() %}
|
2016-03-31 16:03:38 +08:00
|
|
|
{% for image in p_images %}
|
|
|
|
<tr>
|
|
|
|
<td>{{image['name']}}</td>
|
2016-04-12 15:20:11 +08:00
|
|
|
<td>public</td>
|
2016-03-31 16:03:38 +08:00
|
|
|
<td>{{p_user}}</td>
|
2017-06-26 18:46:01 +08:00
|
|
|
<td><a href="/image/{{masterips[0].split("@")[1]}}/description/{{image['name']}}_{{p_user}}_public/" target="_blank">{{image['description']}}</a></td>
|
2016-03-31 16:03:38 +08:00
|
|
|
<td><div class="i-checks"><label><input type="radio" name="image" value="{{image['name']}}_{{p_user}}_public"></label></div></td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
2016-06-21 19:07:24 +08:00
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-03-31 16:03:38 +08:00
|
|
|
|
2016-05-06 18:00:49 +08:00
|
|
|
<div class="hr-line-dashed"></div>
|
2017-05-07 15:47:21 +08:00
|
|
|
<div class="panel-group" id="accordion">
|
2016-07-15 23:35:47 +08:00
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h4 class="panel-title">
|
2017-05-07 15:47:21 +08:00
|
|
|
<a data-toggle="collapse" data-panel="#accordion" href="#collapseOne">
|
2016-07-15 23:35:47 +08:00
|
|
|
show advanced options
|
|
|
|
</a>
|
|
|
|
</h4>
|
|
|
|
</div>
|
2017-05-07 15:47:21 +08:00
|
|
|
<div id="collapseOne" class="panel-collapse collapse">
|
2016-07-15 23:35:47 +08:00
|
|
|
<div class="panel-body">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-2 control-label">CPU</label>
|
|
|
|
<div class="col-sm-3"><input type="number" class="form-control" name="cpuSetting" id="cpuSetting" value = {{defaultsetting['cpu']}} /> {{usage['cpu']}}CORE/{{quota['cpu']}}CORE
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-2 control-label">MEMORY</label>
|
|
|
|
<div class="col-sm-3"><input type="number" class="form-control" name="memorySetting" id="memorySetting" value = {{defaultsetting['memory']}} /> {{usage['memory']}}MB/{{quota['memory']}}MB
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-2 control-label">DISK</label>
|
|
|
|
<div class="col-sm-3"><input type="number" class="form-control" name="diskSetting" id="diskSetting" value= {{defaultsetting['disk']}} /> {{usage['disk']}} MB/{{quota['disk']}}MB
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-05-06 18:00:49 +08:00
|
|
|
<br/>
|
2016-07-15 23:35:47 +08:00
|
|
|
<div class="hr-line-dashed"></div>
|
2016-03-31 16:03:38 +08:00
|
|
|
<div class="row">
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-sm-4 col-sm-offset-2">
|
|
|
|
<button class="btn btn-primary" type="submit">Create</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2017-04-07 16:25:57 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-03-31 16:03:38 +08:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block script_src %}
|
|
|
|
<!-- Custom and plugin javascript -->
|
|
|
|
<script src="/static/js/inspinia.js"></script>
|
|
|
|
|
|
|
|
<script src="http://cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
|
|
|
|
|
|
|
|
<!-- Steps -->
|
|
|
|
<script src="http://cdn.bootcss.com/jquery-steps/1.1.0/jquery.steps.min.js"></script>
|
|
|
|
|
|
|
|
<!-- Jquery Validate -->
|
|
|
|
<script src="http://cdn.bootcss.com/jquery-validate/1.15.0/jquery.validate.min.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
<script src="http://cdn.bootcss.com/datatables/1.10.11/js/jquery.dataTables.js"></script>
|
|
|
|
<script src="http://cdn.bootcss.com/datatables/1.10.11/js/dataTables.bootstrap.js"></script>
|
|
|
|
<script src="http://cdn.bootcss.com/datatables-tabletools/2.1.5/js/TableTools.min.js"></script>
|
|
|
|
|
|
|
|
|
2017-05-07 15:47:21 +08:00
|
|
|
<script type="text/javascript">
|
|
|
|
$("select#masterselector").change(function() {
|
|
|
|
var masterip=$(this).children('option:selected').val();
|
2017-05-21 16:08:12 +08:00
|
|
|
var mastername=$(this).children('option:selected').html();
|
2017-05-07 15:47:21 +08:00
|
|
|
console.log(masterip);
|
2017-06-26 18:46:01 +08:00
|
|
|
document.getElementById("form").action="/workspace/"+masterip+"/add/";
|
2017-05-07 15:47:21 +08:00
|
|
|
var host = window.location.host;
|
2017-05-21 16:08:12 +08:00
|
|
|
$.post("http://"+host+"/getmasterdesc/"+mastername+"/", {}, function(data) {
|
|
|
|
$("#masterdesc").html(data);
|
|
|
|
});
|
2017-06-26 18:46:01 +08:00
|
|
|
$.post("http://"+host+"/image/"+masterip+"/list/",{},function(data){
|
2017-05-07 15:47:21 +08:00
|
|
|
var images = data.images;
|
2017-05-08 16:55:20 +08:00
|
|
|
var imagehtml =
|
2017-05-07 15:47:21 +08:00
|
|
|
"<thread>"
|
|
|
|
+"<tr>"
|
|
|
|
+"<th>ImageName</th>"
|
|
|
|
+"<th>Type</th>"
|
|
|
|
+"<th>Owner</th>"
|
|
|
|
+"<th>Description</th>"
|
|
|
|
+"<th>Choose</th>"
|
|
|
|
+"</tr>"
|
|
|
|
+"</thead>"
|
|
|
|
+"<tbody>"
|
|
|
|
+"<tr>"
|
|
|
|
+"<td>base</td>"
|
|
|
|
+"<td>public</td>"
|
|
|
|
+"<td>docklet</td>"
|
|
|
|
+"<td>A base image for you</td>"
|
|
|
|
+'<td><div class="i-checks"><label><input type="radio" name="image" value="base_base_base" checked="checked"></label></div></td>'
|
|
|
|
+"</tr>";
|
|
|
|
for(var index in images.private) {
|
|
|
|
var image = images.private[index];
|
|
|
|
imagehtml +=
|
|
|
|
"<tr>"
|
|
|
|
+"<td>"+image.name+"</td>"
|
|
|
|
+"<td>private</td>"
|
|
|
|
+"<td>{{user}}</td>"
|
2017-09-13 14:44:45 +08:00
|
|
|
+'<td><a href="/image/' + masterip + '/description/' + image.name + '_' + '{{user}}' + '_private/" target="_blank">' + image.description + '</a></td>'
|
2017-05-07 15:47:21 +08:00
|
|
|
+'<td><div class="i-checks"><label><input type="radio" name="image" value="' + image.name + '_{{user}}_private"><label></div></td>'
|
|
|
|
+"</tr>";
|
|
|
|
}
|
|
|
|
for(var p_user in images.public) {
|
|
|
|
for(var index in images.public[p_user]) {
|
|
|
|
image=images.public[p_user][index];
|
|
|
|
imagehtml +=
|
|
|
|
"<tr>"
|
|
|
|
+"<td>"+image.name+"</td>"
|
|
|
|
+"<td>public</td>"
|
|
|
|
+"<td>" + p_user + "</td>"
|
2017-06-26 18:46:01 +08:00
|
|
|
+'<td><a href="/image/' + masterip + '/description/' + image.name + "_" + p_user + '_public/" target="_blank">' + image.description + '</a></td>'
|
2017-05-07 15:47:21 +08:00
|
|
|
+'<td><div class="i-checks"><label><input type="radio" name="image" value="' + image.name + "_" + p_user + '_public"><label></div></td>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$("#imagetable").html(imagehtml);
|
|
|
|
},"json");
|
|
|
|
});
|
2016-03-31 16:03:38 +08:00
|
|
|
</script>
|
|
|
|
{% endblock %}
|