|
@@ -7,9 +7,13 @@
|
|
|
|
|
|
<h3><i class="ui green share alternate icon"></i> Samba Share Lists</h3>
|
|
|
<p>A list of SMB shares currently written into smb.conf</p>
|
|
|
-<div id="sharelist">
|
|
|
+<div style="width: 100%; overflow-y: auto;">
|
|
|
+ <div id="sharelist">
|
|
|
|
|
|
+ </div>
|
|
|
+ <br>
|
|
|
</div>
|
|
|
+
|
|
|
<div class="ui divider"></div>
|
|
|
<h3><i class="ui green circle add icon"></i> Add Samba Share</h3>
|
|
|
<p>Create a new SMB share folder from local disk</p>
|
|
@@ -26,10 +30,6 @@
|
|
|
<div class="field">
|
|
|
<label for="validUsers">Valid Users</label>
|
|
|
<select multiple="" class="ui search dropdown" id="validUsers">
|
|
|
- <option value="user1">User 1</option>
|
|
|
- <option value="user2">User 2</option>
|
|
|
- <option value="user3">User 3</option>
|
|
|
- <!-- Add options for all users in the system -->
|
|
|
</select>
|
|
|
</div>
|
|
|
<div class="field">
|
|
@@ -53,7 +53,7 @@
|
|
|
<small>Enable guest account on this share</small></label>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <button type="button" class="ui small basic button" onclick="submitForm()"><i class="ui green circle add icon"></i> Create Share</button>
|
|
|
+ <button type="button" class="ui small basic button" onclick="newSambaShare(); event.preventDefault();"><i class="ui green circle add icon"></i> Create Share</button>
|
|
|
</form>
|
|
|
</div>
|
|
|
|
|
@@ -135,13 +135,13 @@
|
|
|
<table class="ui basic celled unstackable table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
- <th><i class="ui yellow folder icon"></i> Name</th>
|
|
|
- <th><i class="ui grey hdd icon"></i> Path</th>
|
|
|
- <th>Valid Users</th>
|
|
|
+ <th style="min-width: 100px;"><i class="ui yellow folder icon"></i> Name</th>
|
|
|
+ <th style="min-width: 100px;"><i class="ui grey hdd icon"></i> Path</th>
|
|
|
+ <th style="min-width: 100px;">Valid Users</th>
|
|
|
<th>Read Only</th>
|
|
|
<th>Browseable</th>
|
|
|
<th>Guest Ok</th>
|
|
|
- <th>Actions</th>
|
|
|
+ <th></th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
@@ -172,6 +172,59 @@
|
|
|
$("#sharelist").html(table);
|
|
|
}
|
|
|
|
|
|
+ //Create a new samba share
|
|
|
+ function newSambaShare(){
|
|
|
+ let shareName = $("#shareName").val().trim();
|
|
|
+ let sharePath = $("#sharePath").val().trim();
|
|
|
+ let allowedUsers = $("#validUsers").dropdown("get value");
|
|
|
+ let isReadOnly = $("#readOnly")[0].checked;
|
|
|
+ let isBrowseable = $("#browseable")[0].checked;
|
|
|
+ let allowGuest = $("#allowGuest")[0].checked;
|
|
|
+
|
|
|
+ if (shareName == ""){
|
|
|
+ $("#shareName").parent().addClass("error");
|
|
|
+ msgbox("Share name cannot be empty", false);
|
|
|
+ return;
|
|
|
+ }else{
|
|
|
+ $("#shareName").parent().removeClass("error");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sharePath == ""){
|
|
|
+ $("#sharePath").parent().addClass("error");
|
|
|
+ msgbox("Share path cannot be empty", false);
|
|
|
+ return;
|
|
|
+ }else{
|
|
|
+ $("#sharePath").parent().removeClass("error");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (allowedUsers.length == 0){
|
|
|
+ msgbox("At least one user is required to create share");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ url: "../../system/storage/samba/add",
|
|
|
+ method: "POST",
|
|
|
+ data: {
|
|
|
+ "name":shareName,
|
|
|
+ "path": sharePath,
|
|
|
+ "users": JSON.stringify(allowedUsers),
|
|
|
+ "readonly":isReadOnly,
|
|
|
+ "browseable": isBrowseable,
|
|
|
+ "guestok":allowGuest
|
|
|
+ },
|
|
|
+ success: function(data){
|
|
|
+ if (data.error != undefined){
|
|
|
+ msgbox(data.error, false, 6000);
|
|
|
+ }else{
|
|
|
+ msgbox("New Samba share created");
|
|
|
+ }
|
|
|
+ initShareListTable();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
//Delete the given smb share name
|
|
|
function deleteSMBShare(smbShareName){
|
|
|
if (confirm("Confirm remove share " + smbShareName + " ?")){
|
|
@@ -185,9 +238,9 @@
|
|
|
if (data.error != undefined){
|
|
|
msgbox(data.error, false);
|
|
|
}else{
|
|
|
- msgbox("SMB share removed");
|
|
|
- initShareListTable();
|
|
|
+ msgbox("Samba share removed");
|
|
|
}
|
|
|
+ initShareListTable();
|
|
|
}
|
|
|
})
|
|
|
}
|