
<!-- Copyright 2014 Intel Corporation, All Rights Reserved.

 Licensed under the Apache License, Version 2.0 (the"License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied. See the License for the
 specific language governing permissions and limitations
 under the License.
 --> 

{% extends 'base.html' %}
{% load i18n %}
{% block title %}Import Cluster{% endblock %}

{% block page_header %}
  {% include "horizon/common/_page_header.html" with title=_("Import Cluster") %}
    <link href="{{ STATIC_URL }}dashboard/css/importcluster.css" rel="stylesheet">
	<link href="{{ STATIC_URL }}dashboard/css/zTreeStyle.css" rel="stylesheet">
{% endblock page_header %}

{% block main %}
    {% csrf_token %}
    <!-- the main form -->
    <div id="divImportClusterForm" >
	    <div class="left">
	    <form>
		    <fieldset>
				<div>
					<a id="btnAutoDetect" class="btn btn-primary" onclick="openAddDetectDialog()">Auto Detect</a>
				    <span class="help-block"></span>
				</div>
				<!-- Ceph.conf field -->
		    	<div id="divTxtCephConf" class="control-group form-field clearfix required">
				    <label for="id_ceph_conf">Ceph.conf:</label>
				    <span class="help-block"></span>
				    <div class="input">
				      <textarea cols="35" id="txtCephConf" rows="10"></textarea>
				    </div>
				 </div>
		    	<!-- {% include "horizon/common/_form_fields.html" %} -->
		    	<!-- Crushmap field -->

		    	<div id="divMonitorHost2" class="control-group form-field clearfix required" style="display:none">
		    		<label>Monitor Host:</label>
		    		<span class="help-block"></span>
		    		<div class="input">
		      			<select id="selMonitorHost2"  class="form-control">
							{%for monitor in  monitor_host %}
								<option value="{{monitor.id}}">{{monitor.host}}</option>
							{%endfor%}
						</select>
		    		</div>
	  			</div>

		  		<div id="divtxtMonitorKeyring2" class="control-group form-field clearfix required" style="display:none">
		    		<label>Monitor Keyring:</label>
		    		<span class="help-block"></span>
		    		<div class="input">
		      			<input id="txtMonitorKeyring2" type="text" value="/etc/ceph/ceph.client.admin.keyring" class="form-control">
		    		</div>
		  		</div>

		    	<div class="control-group form-field clearfix required">
				    <label for="id_crushmap">Crushmap:</label>
				    <div id="divTxtCrushmap" class="input">
				      <textarea cols="35" id="txtCrushmap" rows="10"></textarea>
				    </div>
					<div id="divCrushmapTree" class="ztree crushmap-tree"  style="display:none"></div>
				 </div>



		    </fieldset>
			</div>
			<div class="right">
			    <h3>{% trans "Description" %}:</h3>
				<p>{% trans "From here you can import a cluster." %}</p>

			</div>
		</form>
		 <div id="divFormOptions" class="vsm-options-bar">
		 	<button id="btnImportValidate" class="btn btn-primary" onclick="validate()">Validate</button>
	    	<button id="btnImportCluster" class="btn btn-primary" style="display:none" onclick="importCluster()">Submit</button>
	    	<a id="btnCancel" class="btn btn-default" href="/dashboard/vsm/cluster-import/">Cancel</a>
	    </div>
	</div>

	<!-- the dialog form -->
	<div id="divAutoDetectInfo" style="display:none">
		<div id="divAutoDetectInfoContext" style="width:300px;">
			<div class="control-group form-field clearfix required">
	    		<label>Monitor Host:</label>
	    		<span class="help-block"></span>
	    		<div class="input">
	      			<select id="selMonitorHost"  class="form-control">
						{%for monitor in  monitor_host %}
							<option value="{{monitor.id}}">{{monitor.host}}</option>
						{%endfor%}
					</select>
	    		</div>
	  		</div>

	  		<div class="control-group form-field clearfix required">
	    		<label>Monitor Keyring:</label>
	    		<span class="help-block"></span>
	    		<div class="input">
	      			<input id="txtMonitorKeyring" type="text" value="/etc/ceph/ceph.client.admin.keyring" class="form-control">
	    		</div>
	  		</div>
  		</div>
	</div>

{% endblock %}


{% block js %}
    {{ block.super }}
    <script src='{{ STATIC_URL }}dashboard/js/vsm.spin.js' type='text/javascript' charset='utf-8'></script>
    <script src="{{ STATIC_URL }}dashboard/js/jquery.ztree.all-3.5.min.js"></script>
    <script src="{{ STATIC_URL }}dashboard/js/importcluster.js"></script>
{% endblock %}