<div navbar ng-init="currentItem='utils.autofm'"></div>
<div ng-show="!loaded"><div loading></div></div>

<div id="main" ng-show="loaded" style="display:none">
	<div class="module-header">
		<h3>自动格式化挂载</h3>
	</div>

	<div style="display:none" ng-show="diskcount==0">
		<div class="well" style="width:400px">
			<p>没有找到未挂载的存储设备，点击以下按钮进入磁盘分区管理。</p>
			<p style="margin-top:15px"><a class="btn" href="#/utils/partition">磁盘分区管理</a></p>
		</div>
	</div>

	<div style="display:none" ng-init="loadDiskinfo()" ng-show="diskcount > 0">
		<h5>未挂载的设备列表</h5>
		<table class="table" style="width:600px">
			<tbody>
				<tr class="warning">
					<td>设备名称</td>
					<td style="width:100px">存储空间</td>
					<td style="width:150px">操作</td>
				</tr>
				<tr ng-repeat="partition in diskinfo['partitions'] | filter:{'is_hw':true, 'is_pv':false, 'partcount':0, 'mount':''}">
					<td>{{ partition['name'] }}</td>
					<td>{{ partition['size'] }}</td>
					<td>
						<button class="btn btn-mini" ng-disabled="waiting" ng-click="confirm(partition['name'])">格式化并挂载</button>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</div>

<div id="confirm" class="modal hide fade">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>自动格式化并挂载 {{devname}} </h3>
  </div>
  <div class="modal-body">
    <form class="form-horizontal" onsubmit="return false">
		<div class="control-group">
			<label class="control-label">文件系统格式：</label>
			<div class="controls">
				<select style="width:150px" ng-model="fstype" ng-options="fs for fs in supportfs"></select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">将 {{devname}} 挂载到：</label>
			<div class="controls">
				<div class="input-append">
					<input type="text" class="input-medium" ng-model="mountpoint" ng-disabled="processing">
					<button class="btn" ng-click="selectmountpoint()" title="选择挂载点"><i class="icon-folder-open"></i></button>
				</div>
				<label class="help-block">建议直接使用默认挂载点</span>
			</div>
		</div>
	</form>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
    <button class="btn btn-primary" onclick="$('#confirm').modal('hide')" ng-disabled="!fstype||!mountpoint" ng-click="autofm()">确定</button>
  </div>
</div>

<div id="selector" class="modal hide fade">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>{{selector_title}}</h3>
  </div>
  <div class="modal-body">
	<div selector></div>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
  </div>
</div>
