mirror of
https://gitlab.com/JKANetwork/powerfulcomputermanager.git
synced 2026-02-15 17:51:32 +01:00
New changes
This commit is contained in:
@@ -41,7 +41,6 @@ def returnvalueapi(suburl,field="Name"):
|
||||
#print(suburl+twopart+"->"+r)
|
||||
jsonobj = json.loads(r)
|
||||
if isinstance(jsonobj, list):
|
||||
print("LIST")
|
||||
jsonobj = jsonobj[0]
|
||||
return jsonobj[field]
|
||||
except:
|
||||
@@ -131,14 +130,40 @@ def pAdminComputer(): #Admin see one group
|
||||
computername = returnvalueapi('/get/computers?ComputerID='+str(computerid),"Name")
|
||||
groups = returnTable("/get/groups?ComputerID="+str(computerid),['ID_G','Name'])
|
||||
for key in range(len(groups)): #Cookgs of every group
|
||||
print(groups[key])
|
||||
groups[key].append(returnTable("/get/cookgrp?GroupID="+groups[key][0],['CookName']))
|
||||
|
||||
|
||||
return render_template('/admincomputer.tmpl', title="Computer "+computername,computerid=computerid,computername=computername,groups=groups)
|
||||
allgroups = returnTable("/get/groups",['ID_G','Name']) #All groups, for adding one
|
||||
return render_template('/admincomputer.tmpl', title="Computer "+computername,computerid=computerid,computername=computername,groups=groups,allgroups=allgroups)
|
||||
return redirect('/admin')
|
||||
|
||||
|
||||
@app.route("/admin/computer/addgroup",methods=['GET'])
|
||||
def pAdminComputerAddGroup():
|
||||
computerid=request.args.get('computeridadd')
|
||||
groupid=request.args.get('groupidadd')
|
||||
if computerid is not None and groupid is not None:
|
||||
r = returnvalueapi("/add/grpcomputer?ComputerID="+computerid+"&GroupID="+str(groupid),field="RESULT")
|
||||
if r == "OK":
|
||||
return redirect('/admin/computer?ID_C='+computerid)
|
||||
else:
|
||||
return "ERROR"
|
||||
else:
|
||||
return redirect('/admin')
|
||||
|
||||
@app.route("/admin/computer/delgroup",methods=['GET'])
|
||||
def pAdminComputerDelGroup():
|
||||
computerid=request.args.get('computeriddel')
|
||||
groupname=request.args.get('groupnamedel')
|
||||
if computerid is not None and groupname is not None:
|
||||
r = returnvalueapi("/del/grpcomputer?ComputerID="+computerid+"&GroupName="+str(groupname),field="RESULT")
|
||||
if r == "OK":
|
||||
return redirect('/admin/computer?ID_C='+computerid)
|
||||
else:
|
||||
return "ERROR"
|
||||
else:
|
||||
return redirect('/admin')
|
||||
|
||||
|
||||
@app.route("/admin/groups",methods=['GET'])
|
||||
@app.route("/admin/groups/",methods=['GET'])
|
||||
def pAdminGroups(): #Admin Index groups
|
||||
|
||||
@@ -1,7 +1,64 @@
|
||||
{# -*- coding: utf-8 -*- #} {# NOT DID ALREADY!!! #}
|
||||
{% extends 'baseadmin.tmpl' %}
|
||||
{% block content %}
|
||||
<h2>Computer {{computername}}</h2>
|
||||
|
||||
|
||||
<!-- Modal Delete Group of Computer -->
|
||||
<div class="modal fade" id="delGroup" tabindex="-1" role="dialog" aria-labelledby="delGroupLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form method="get" action="/admin/computer/delgroup">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="delGroupLabel">Delete group from computer {{computername}}</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<input type="text" readonly="readonly" class="form-control" hidden="hidden" name="computeriddel" id="computeriddel" value="{{computerid}}"/>
|
||||
<p>Are you sure?<br>
|
||||
<label for="computername" class="col-form-label">Group:</label>
|
||||
</div>
|
||||
<input type="text" readonly="readonly" class="form-control" name="groupnamedel" id="groupnamedel">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-danger">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Add Group to Computer To Group -->
|
||||
<div class="modal fade" id="addGroup" tabindex="-1" role="dialog" aria-labelledby="addGroupLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form method="get" action="/admin/computer/addgroup">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="addGroupLabel">Add group to computer {{computername}}</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<p>Add group to computer {{computername}}<br>
|
||||
<input type="text" readonly="readonly" class="form-control" hidden="hidden" name="computeridadd" value="{{computerid}}"/>
|
||||
<label for="computername2" class="col-form-label">Group:</label>
|
||||
<select class="form-control" name="groupidadd" id="groupidadd">
|
||||
{% for item in allgroups %}
|
||||
<option value="{{item.0}}">{{item.1}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-primary">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<h2>Computer {{computername}}</h2>
|
||||
<br>
|
||||
<h2>Groups of {{computername}}</h2>
|
||||
<div class="table-responsive">
|
||||
@@ -24,10 +81,24 @@
|
||||
{{x.0}},
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td><a class="btn btn-outline-danger btn-sm" data-wgroup="{{item.1}}" data-toggle="modal" data-target="#delGroup">Delete {{computername}} from group {{item.1}}</a></td>
|
||||
<td><a class="btn btn-outline-danger btn-sm" data-wgroup="{{item.1}}" data-toggle="modal" data-target="#delGroup">Delete group {{item.1}} from {{computername}}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
<td>#</td>
|
||||
<td colspan="3"> <a class="btn btn-outline-success btn-sm" data-wcomp="{{computername}}" data-toggle="modal" data-target="#addGroup">Add Group to {{computername}}</a></td>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
|
||||
<script>
|
||||
$('#delGroup').on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget) // Button that triggered the modal
|
||||
var recipient = button.data('wgroup') // Extract info from data-* attributes
|
||||
var modal = $(this)
|
||||
//modal.find('.modal-title').text('New message to ' + recipient)
|
||||
modal.find('#groupnamedel').val(recipient)
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -87,7 +87,7 @@
|
||||
<td>{{item.2|int - item.8|int}}/{{item.2}}</td>
|
||||
<td>
|
||||
{% for x in item.6 %}
|
||||
{{x.Volume}}({{x.FreeSpace}}/{{x.Capacity}} GB)<br>
|
||||
{{x.Volume}}({{x.UsedSpace}}/{{x.Capacity}} GB)<br>
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td>{{item.7}}</td>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Build 17. Using API 2
|
||||
# Build 18. Using API 2
|
||||
param([Int32]$startup=0)
|
||||
#Write-Host $startup
|
||||
$srcdir = $PSCommandPath | Split-Path -Parent
|
||||
@@ -58,10 +58,11 @@ $objDisks = Get-CimInstance -Class win32_LogicalDisk -Filter "DriveType = '3'"
|
||||
$diskResults = @()
|
||||
ForEach( $disk in $objDisks )
|
||||
{
|
||||
$ThisVolume = "" | Select-Object Volume,Capacity,FreeSpace
|
||||
$ThisVolume = "" | Select-Object Volume,Capacity,UsedSpace,FreeSpace
|
||||
$ThisVolume.Volume = $disk.DeviceID
|
||||
$ThisVolume.Capacity = $([Math]::Round($disk.Size / 1GB,2))
|
||||
$ThisVolume.FreeSpace = $([Math]::Round($disk.FreeSpace / 1GB,2))
|
||||
$ThisVolume.UsedSpace = $([Math]::Round(($disk.Size - $disk.FreeSpace) / 1GB,2))
|
||||
$DiskResults += $ThisVolume
|
||||
}
|
||||
$DisksData = ConvertTo-Json -Depth 4 $DiskResults
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 2020/07/16
|
||||
- Fixes and improvments to web gui
|
||||
- General bugfix
|
||||
|
||||
## 2020/07/03
|
||||
- Fixes to web gui and some new options
|
||||
-
|
||||
|
||||
## 2020/03/17
|
||||
- New function copy
|
||||
|
||||
Reference in New Issue
Block a user