Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cockpit. added ui & api #12

Merged
merged 25 commits into from Jun 10, 2019
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0a8598b
Cockpit scaffolded
andre8244 May 27, 2019
7dbc975
rpm. Fixed build
andre8244 May 28, 2019
569815b
api. Added read, update, validate
andre8244 May 28, 2019
f1a182d
ui. Added settings and app views
andre8244 May 28, 2019
60e8649
ui & api. Improved read api and completed settings view
andre8244 Jun 3, 2019
98dd587
ui. Completed settings and logs pages
andre8244 Jun 4, 2019
f6ebea7
ui. Completed about page
andre8244 Jun 4, 2019
ae7008f
api. Added action status to read
andre8244 Jun 5, 2019
01e6c5c
manifest. Changed app name
andre8244 Jun 5, 2019
2b36efa
ui. Completed dashboard, settings and logs view
andre8244 Jun 5, 2019
2ec2fa7
ui. Removed useless menu index
andre8244 Jun 5, 2019
5c18401
travis. Fixed build
andre8244 Jun 5, 2019
e8d68ca
ui. Added logo
andre8244 Jun 5, 2019
48e89c0
api. Fixed validate, refactored read and update
andre8244 Jun 6, 2019
8e2e94f
ui. Enhanced dashboard and settings views
andre8244 Jun 6, 2019
788ba66
api. Removed mock for ups@nethservice.nethesis.it
andre8244 Jun 6, 2019
63d4994
ui. Dashboard: fix for connected clients
andre8244 Jun 6, 2019
a8bc1df
api. Fixed timeout of bash commands, added copyright headers, removed…
andre8244 Jun 6, 2019
3e306fe
ui. Fixed configuration for nut-server/status; removed axios dependen…
andre8244 Jun 6, 2019
798e222
ui. Fixed labels for device combobox
andre8244 Jun 7, 2019
c1e73b7
api. Fixed master validation
andre8244 Jun 7, 2019
126ca75
api. Changed dashboard read api
andre8244 Jun 7, 2019
96f8d11
ui. Improved UI
andre8244 Jun 7, 2019
2bcf5f3
ui. Minor improvements
andre8244 Jun 7, 2019
1ed5e84
ui. Improved donut charts in dashboard
andre8244 Jun 10, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

ui. Enhanced dashboard and settings views

  • Loading branch information...
andre8244 committed Jun 6, 2019
commit 8e2e94f16544af9def57411af4144d363334051d
@@ -40,15 +40,16 @@
"ups_credentials": "UPS credentials",
"ups_name": "UPS name",
"ups_user": "UPS user",
"password_for_slaves": "Password for slaves",
"password_for_clients": "Password for clients",
"master_server_address": "Master server address",
"password": "Password",
"configuration_saved": "Configuration saved succesfully",
"configuration_failed": "Configuration not saved",
"master_validation": "Master server address must be a valid hostname or empty",
"password_validation": "Password must not be empty",
"ups_name_validation": "UPS name must not be empty",
"ups_user_validation": "UPS user must be a valid username"
"ups_user_validation": "UPS user must be a valid username",
"search_for_model": "Search for model"
},
"about": {
"title": "About",
@@ -64,19 +65,22 @@
"filter_label": "Regexp filter"
},
"dashboard":{
"title": "Dashboard",
"title": "UPS dashboard",
"load": "Load",
"battery_charge": "Battery charge",
"model": "Model",
"status": "Status",
"statistics": "Statistics",
"input_voltage": "Input voltage",
"output_voltage": "Output voltage",
"temperature": "Temperature",
"raw_output": "Raw output",
"full_status": "Full status",
"details": "Details",
"battery_runtime": "Battery runtime",
"battery_voltage": "Battery voltage",
"minutes": "minutes"
"minutes": "minutes",
"clients_connected": "Clients connected",
"ups_clients": "UPS clients",
"ups_not_configured": "UPS not configured",
"empty_state": "Configuration is incomplete or incorrect. Click the button below to configure"
}
}
@@ -4,7 +4,24 @@
<h1>{{$t('dashboard.title')}}</h1>

<div v-show="!configLoaded" class="spinner spinner-lg"></div>
<div v-show="configLoaded">

<!-- Empty state -->
<div v-show="configLoaded && showEmptyState" class="blank-slate-pf " id="">
<div class="blank-slate-pf-icon">
<span class="fa fa-bolt"></span>
</div>
<h1>
{{$t('dashboard.ups_not_configured')}}
</h1>
<p>
{{$t('dashboard.empty_state')}}.
</p>
<div class="blank-slate-pf-main-action">
<a href="#/settings" class="btn btn-primary btn-lg">{{$t('settings.title')}}</a>
</div>
</div>

<div v-show="configLoaded && !showEmptyState">
<div class="row fluid divider margin-top-20">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="form-horizontal">
@@ -34,7 +51,7 @@
</div>
</div>

<h3>{{$t('dashboard.statistics')}}</h3>
<h3>{{$t('dashboard.status')}}</h3>

<div class="row row-stat fluid">
<div class="row-inline-block">
@@ -85,6 +102,20 @@
<div class="panel-body">
<div id="load-chart" class="text-center"></div>
</div>
<div class="panel-footer" v-show="nutMonitorConfig.Master">
<div>
<span class="pficon pficon-users filter-icon"></span>
<span>
{{$t('dashboard.clients_connected')}}:
<span class="bold">{{ clients.length }}</span>

<a href="#" class="margin-left-4" data-toggle="popover" data-html="true"
:title="this.$i18n.t('dashboard.ups_clients')"
:data-content="this.clients_popover_text">{{$t('dashboard.details')}}
</a>
</span>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 resources-panel">
@@ -122,7 +153,7 @@
</div>
</div>

<h3>{{$t('dashboard.raw_output')}}</h3>
<h3>{{$t('dashboard.full_status')}}</h3>
<div class="form-group">
<legend class="fields-section-header-pf col-sm-1" aria-expanded="true">
<span
@@ -134,7 +165,7 @@
>{{$t('dashboard.details')}}</a>
</legend>
</div>
<div class="form-group margin-top-40" v-if="showRawOutput">
<div class="form-group margin-top-40" v-show="showRawOutput">
<ul>
<li v-for="(i, ik) in status" :key="ik">
<code>{{ ik }}</code>
@@ -157,26 +188,42 @@ export default {
msg: String
},
mounted() {
this.getUpsStatus();
this.getUpsData();
// Initialize Popovers
$('[data-toggle=popover]').popovers()
.on('hidden.bs.popover', function (e) {
$(e.target).data('bs.popover').inState.click = false;
});
},
data() {
return {
configLoaded: false,
status: {},
showRawOutput: false
showRawOutput: false,
clients: [],
clients_popover_text: '',
nutServerConfig: {},
nutMonitorConfig: {},
showEmptyState: false
};
},
methods: {
getUpsStatus: function() {
getUpsData: function() {
var ctx = this;
nethserver.exec(
["nethserver-nut/read"],
{ app_info: "status" },
["nethserver-nut/dashboard/read"],
{},
null,
function(success) {
try {
success = JSON.parse(success);
ctx.status = success.status;
ctx.clients = success.clients;
ctx.nutServerConfig = success.configuration.nut_server.props;
ctx.nutMonitorConfig = success.configuration.nut_monitor.props;
ctx.getClientsPopoverText();
ctx.showEmptyState = false;
ctx.configLoaded = true;
ctx.initMemoryCharts();
} catch (e) {
@@ -185,9 +232,18 @@ export default {
},
function(error) {
console.error(error); /* eslint-disable-line no-console */
ctx.showEmptyState = true;
ctx.configLoaded = true;
}
);
},
getClientsPopoverText() {
this.clients_popover_text = '<ul>'
for (var client of this.clients) {
this.clients_popover_text += '<li>' + client + '</li>';
}
this.clients_popover_text += '</ul>'
},
toggleRawOutput() {
this.showRawOutput = !this.showRawOutput;
},
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.