Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Wiggins authored and Roy Wiggins committed Dec 12, 2024
2 parents 278c375 + 7768c68 commit acbd415
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# ignore a few flake8 issues that we're choosing to live with for now, eg complexity, star imports
flake8 . --ignore C901,F405,W503,W504,W293,F403 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: typecheck with mypy
run: |
mypy --exclude app/tests --no-namespace-packages .
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ build-getdcmtags-Desktop_Qt_5_13_0_GCC_64bit-Release/getdcmtags
build-getdcmtags-Desktop_Qt_5_13_0_GCC_64bit-Release/main.o
build-getdcmtags-Desktop_Qt_5_13_0_GCC_64bit-Release/Makefile
build-getdcmtags-Desktop_Qt_5_13_0_GCC_64bit-Debug/Makefile
index.html
index.html.*

# ignoring subfolders with vagrant VM information
.vagrant
Expand Down
139 changes: 139 additions & 0 deletions app/webinterface/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{% extends "base.html" %}

{% block title %}Overview{% endblock %}

{% block content %}
<main role="main">

<div class="container">
<h1 class="title">System Status</h1>

<h5 class="title is-5 configtitle" style="margin-top: 34px; margin-bottom: 4px !important;"><i
class="fas fa-sitemap has-text-success"></i>&nbsp;&nbsp;Services</h5>
<div class="columns">
<div class="column">
<div class="field is-grouped is-grouped-multiline" style="margin-top: 16px;">
{% for service in service_status %}
<div class="control">
<div class="tags has-addons">
<span class="tag is-dark">{{ service['name'] }}</span>
<span {% if service['running'] == True %} class="tag is-success">
UP
{% elif service['running'] == False %} class="tag is-danger">DOWN
{% else %} class="tag">UNKNOWN
{% endif %}</span>
</div>
</div>
{% endfor %}
</div>
<h5 class="title is-5 configtitle" style="margin-top: 40px; margin-bottom: 0px !important;"><i
class="fas fa-heartbeat has-text-success"></i>&nbsp;&nbsp;Server Health</h5>
<div class="columns" style="margin-top: 0px;">
<div class="column is-one-third">
<label class="label">Diskspace:</label>
<progress
class="progress {% if used_space|int < 60 %}is-success{% else %}{% if used_space|int > 80 %} is-danger{% else %}is-warning{% endif %}{% endif %}"
value="{{used_space}}" max="100"></progress>{{free_space}} / {{total_space}} GB available
</div>
</div>
<h5 class="title is-5 configtitle" style="margin-top: 40px; margin-bottom: 0px !important;"><i
class="fas fa-toolbox has-text-success"></i>&nbsp;&nbsp;Control</h5>
<div class="columns" style="margin-top: 10px;">
<div class="column is-one-third">
{% if is_admin %}
{% if runtime != "nomad" %}
<button class="button" id="servicecontrol" value="" onclick="showControlModal()" style="margin-right: 4px;"><i
class="fas fa-wrench"></i>&nbsp;Service Control</button>
{% endif %}
{% endif %}
<a class="button" href="/configuration" id="configurationbutton" ><i
class="fas fa-sliders-h" ></i>&nbsp;Configuration</a>
</div>
</div>
</div>
</div>
</div>

<div class="modal" id="controlmodal">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Service Control</p>
</header>
<section class="modal-card-body">
<div class="field">
<label class="label">Selected Services</label>
<div class="control select is-multiple is-fullwidth">
<select name='services[]' multiple size="9" id="controlserviceselector" style="overflow-y: auto;">
{% for service in service_status %}
<option {% if loop.index> 1 %}selected{% endif %} value="{{service["id"]}}">{{service['name']}}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="field">
<label class="label">Action</label>
<div class="select">
<div class="control">
<select name="action" id="controlserviceaction">
<option value="start">Start</option>
<option value="stop">Stop</option>
<option value="restart">Restart</option>
<option value="kill">Kill</option>
</select>
</div>
</div>
</div>
<div class="field">
<p class="control" style="margin-top: 20px;">
<a id="confirmcontrolmodal" class="button is-success">Execute</a>
<a id="closecontrolmodal" class="button">Cancel</a>
</p>
</div>
</section>
</div>
</div>
<div class="pageloader is-success" id="controlpageloader"><span class="title">Please Wait...</span></div>
</main>

<script>
function showControlModal(val) {
$("#controlmodal").addClass("is-active");
$("#controlserviceselector").focus();
}

$(function () {
$('#closecontrolmodal').click(function () {
$("#controlmodal").removeClass("is-active");
})
});

$('#confirmcontrolmodal').click(function () {
$("#controlpageloader").addClass('is-active');
$("#controlmodal").removeClass("is-active");
$.ajax({
type: 'POST',
url: '/services/control',
data: {
"services": $("#controlserviceselector").val().join(),
"action": $("#controlserviceaction").val()
},
dataType: 'json',
success: function (data) {
var pageloaderTimeout = setTimeout(function () {
$("#controlpageloader").removeClass('is-active');
clearTimeout(pageloaderTimeout);
location.reload();
}, 2000);
},
error: function (data) {
$("#controlpageloader").removeClass('is-active');
alert('An error occurred while trying to execute the action.')
}
});
})

</script>

{% endblock %}
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [ $UBUNTU_VERSION != "20.04" ] && [ $UBUNTU_VERSION != "22.04" ] && [ $UBUNTU
exit 1
fi

if [ ! -f "VERSION" ]; then
if [ ! -f "app/VERSION" ]; then
echo "Error: VERSION file missing. Unable to proceed."
exit 1
fi
Expand Down Expand Up @@ -562,4 +562,4 @@ case "$INSTALL_TYPE" in
;;
esac

echo "Installation complete"
echo "Installation complete"

0 comments on commit acbd415

Please sign in to comment.