summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2023-12-10 19:27:02 +0100
committernicolargo <nicolas@nicolargo.com>2023-12-10 19:27:02 +0100
commitcbb2facc8771ca266ea7e49ca2e73ca2dd84f43e (patch)
tree7e46a7e0a3a64001636618e84d7d7b7c712e8a67
parent5d054e12e1d38aeb6f5c026e1760665291bce110 (diff)
Unit tests are ok BUT the WebUI has a lot of issue: plugin disapear, traceback... Perhaps issue when stats are refreched ?
-rw-r--r--glances/outputs/glances_restful_api.py122
-rw-r--r--glances/outputs/static/js/components/plugin-process.vue6
-rw-r--r--glances/outputs/static/js/components/plugin-processlist.vue8
-rw-r--r--glances/outputs/static/public/glances.js2
-rw-r--r--glances/outputs/static/templates/index.html22
-rw-r--r--glances/outputs/static/templates/index.html.tpl22
-rw-r--r--glances/processes.py2
-rwxr-xr-xunitest-restful.py15
8 files changed, 118 insertions, 81 deletions
diff --git a/glances/outputs/glances_restful_api.py b/glances/outputs/glances_restful_api.py
index 54c4f908..c8e7094a 100644
--- a/glances/outputs/glances_restful_api.py
+++ b/glances/outputs/glances_restful_api.py
@@ -20,19 +20,10 @@ from urllib.parse import urljoin
# from typing import Annotated
from typing_extensions import Annotated
-from glances.globals import json_dumps
from glances.timer import Timer
from glances.logger import logger
# FastAPI import
-
-# TODO: not sure import is needed
-try:
- import jinja2
-except ImportError:
- logger.critical('Jinja2 import error. Glances cannot start in web server mode.')
- sys.exit(2)
-
try:
from fastapi import FastAPI, Depends, HTTPException, status, APIRouter, Request
from fastapi.security import HTTPBasic, HTTPBasicCredentials
@@ -78,7 +69,7 @@ class GlancesRestfulApi(object):
# Load configuration file
self.load_config(config)
- # Set the bind URL (only used for log information purpose)
+ # Set the bind URL
self.bind_url = urljoin('http://{}:{}/'.format(self.args.bind_address,
self.args.port),
self.url_prefix)
@@ -95,7 +86,6 @@ class GlancesRestfulApi(object):
# Set path for WebUI
self.STATIC_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'static/public')
- # TEMPLATE_PATH.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'static/templates'))
self.TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'static/templates')
self._templates = Jinja2Templates(directory=self.TEMPLATE_PATH)
@@ -103,7 +93,10 @@ class GlancesRestfulApi(object):
# https://fastapi.tiangolo.com/tutorial/cors/
self._app.add_middleware(
CORSMiddleware,
- allow_origins=["*"],
+ # allow_origins=["*"],
+ allow_origins=[
+ self.bind_url
+ ],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
@@ -140,7 +133,7 @@ class GlancesRestfulApi(object):
# TODO: the password comparaison is not working for the moment.
# if the password is wrong, authentication is working...
- # Perahps because the password is hashed in the GlancesPassword class
+ # Perhaps because the password is hashed in the GlancesPassword class
# and the one given by creds.password is not hashed ?
def authentication(self, creds: Annotated[HTTPBasicCredentials, Depends(security)]):
"""Check if a username/password combination is valid."""
@@ -168,21 +161,24 @@ class GlancesRestfulApi(object):
status_code=status.HTTP_200_OK,
response_class=ORJSONResponse,
endpoint=self._api_status)
+
router.add_api_route('/api/%s/config' % self.API_VERSION,
response_class=ORJSONResponse,
endpoint=self._api_config)
- router.add_api_route('/api/%s/config/{item}' % self.API_VERSION,
+ router.add_api_route('/api/%s/config/{section}' % self.API_VERSION,
response_class=ORJSONResponse,
- endpoint=self._api_config_item)
+ endpoint=self._api_config_section)
+ router.add_api_route('/api/%s/config/{section}/{item}' % self.API_VERSION,
+ response_class=ORJSONResponse,
+ endpoint=self._api_config_section_item)
+
router.add_api_route('/api/%s/args' % self.API_VERSION,
response_class=ORJSONResponse,
endpoint=self._api_args)
router.add_api_route('/api/%s/args/{item}' % self.API_VERSION,
response_class=ORJSONResponse,
endpoint=self._api_args_item)
- router.add_api_route('/api/%s/help' % self.API_VERSION,
- response_class=ORJSONResponse,
- endpoint=self._api_help)
+
router.add_api_route('/api/%s/pluginslist' % self.API_VERSION,
response_class=ORJSONResponse,
endpoint=self._api_plugins)
@@ -195,6 +191,10 @@ class GlancesRestfulApi(object):
router.add_api_route('/api/%s/all/views' % self.API_VERSION,
response_class=ORJSONResponse,
endpoint=self._api_all_views)
+
+ router.add_api_route('/api/%s/help' % self.API_VERSION,
+ response_class=ORJSONResponse,
+ endpoint=self._api_help)
router.add_api_route('/api/%s/{plugin}' % self.API_VERSION,
response_class=ORJSONResponse,
endpoint=self._api)
@@ -204,7 +204,7 @@ class GlancesRestfulApi(object):
router.add_api_route('/api/%s/{plugin}/history/{nb}' % self.API_VERSION,
response_class=ORJSONResponse,
endpoint=self._api_history)
- router.add_api_route('/api/%s/{plugin}/top/<nb:int>' % self.API_VERSION,
+ router.add_api_route('/api/%s/{plugin}/top/{nb}' % self.API_VERSION,
response_class=ORJSONResponse,
endpoint=self._api_top)
router.add_api_route('/api/%s/{plugin}/limits' % self.API_VERSION,
@@ -232,18 +232,13 @@ class GlancesRestfulApi(object):
# WEB UI
if not self.args.disable_webui:
- # Template
+ # Template for the root index.html file
router.add_api_route('/',
response_class=HTMLResponse,
endpoint=self._index)
- # TODO: to be migrated to another route
- # router.add_api_route('/{refresh_time}',
- # endpoint=self._index)
-
# Statics files
- # self._app.mount("/static", StaticFiles(directory=self.STATIC_PATH), name="static")
- self._app.mount("/",
+ self._app.mount("/static",
StaticFiles(directory=self.STATIC_PATH),
name="static")
@@ -282,30 +277,27 @@ class GlancesRestfulApi(object):
logger.critical('Error: Can not ran Glances Web server ({})'.format(e))
def end(self):
- """End the bottle."""
+ """End the Web server"""
logger.info("Close the Web server")
- # TODO: close FastAPI instance gracefully
- # self._app.close()
- # if self.url_prefix != '/':
- # self.main_app.close()
-
- # Example from FastAPI documentation
- # @app.get("/", response_class=HTMLResponse)
- # def home(request: Request):
- # return templates.TemplateResponse("index.html", {"request": request})
- def _index(self, refresh_time=None):
- """Return main index.html (/) file."""
+ def _index(self, request: Request):
+ """Return main index.html (/) file.
+ Parameters are available through the request object.
+ Example: http://localhost:61208/?refresh=5
+ """
- if refresh_time is None or refresh_time < 1:
- refresh_time = int(self.args.time)
+ refresh_time = request.query_params.get('refresh',
+ default=max(1, int(self.args.time)))
# Update the stat
self.__update__()
# Display
- # return template("index.html", refresh_time=refresh_time)
- return self.templates.TemplateResponse("index.html")
+ return self._templates.TemplateResponse("index.html",
+ {
+ "request": request,
+ "refresh_time": refresh_time,
+ })
def _api_status(self):
"""Glances API RESTful implementation.
@@ -662,29 +654,61 @@ class GlancesRestfulApi(object):
return ORJSONResponse(args_json)
- def _api_config_item(self, item):
+ def _api_config_section(self, section):
"""Glances API RESTful implementation.
- Return the JSON representation of the Glances configuration item
+ Return the JSON representation of the Glances configuration section
HTTP/200 if OK
HTTP/400 if item is not found
HTTP/404 if others error
"""
config_dict = self.config.as_dict()
- if item not in config_dict:
+ if section not in config_dict:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
- detail="Unknown configuration item %s" % item)
+ detail="Unknown configuration item %s" % section)
try:
# Get the RAW value of the config' dict
- args_json = config_dict[item]
+ ret_section = config_dict[section]
except Exception as e:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
- detail="Cannot get config item (%s)" % str(e))
+ detail="Cannot get config section %s (%s)" % (section, str(e)))
- return ORJSONResponse(args_json)
+ return ORJSONResponse(ret_section)
+
+ def _api_config_section_item(self, section, item):
+ """Glances API RESTful implementation.
+
+ Return the JSON representation of the Glances configuration section/item
+ HTTP/200 if OK
+ HTTP/400 if item is not found
+ HTTP/404 if others error
+ """
+ config_dict = self.config.as_dict()
+ if section not in config_dict:
+ raise HTTPException(
+ status_code=status.HTTP_400_BAD_REQUEST,
+ detail="Unknown configuration item %s" % section)
+
+ try:
+ # Get the RAW value of the config' dict section
+ ret_section = config_dict[section]
+ except Exception as e:
+ raise HTTPException(
+ status_code=status.HTTP_404_NOT_FOUND,
+ detail="Cannot get config section %s (%s)" % (section, str(e)))
+
+ try:
+ # Get the RAW value of the config' dict item
+ ret_item = ret_section[item]
+ except Exception as e:
+ raise HTTPException(
+ status_code=status.HTTP_404_NOT_FOUND,
+ detail="Cannot get item %s in config section %s (%s)" % (item, section, str(e)))
+
+ return ORJSONResponse(ret_item)
def _api_args(self):
"""Glances API RESTful implementation.
diff --git a/glances/outputs/static/js/components/plugin-process.vue b/glances/outputs/static/js/components/plugin-process.vue
index 36cf2500..05b053fb 100644
--- a/glances/outputs/static/js/components/plugin-process.vue
+++ b/glances/outputs/static/js/components/plugin-process.vue
@@ -64,13 +64,13 @@ export default {
}
function getColumnLabel(value) {
const labels = {
- io_counters: 'disk IO',
cpu_percent: 'CPU consumption',
memory_percent: 'memory consumption',
- cpu_times: 'process time',
username: 'user name',
- name: 'process name',
timemillis: 'process time',
+ cpu_times: 'process time',
+ io_counters: 'disk IO',
+ name: 'process name',
None: 'None'
};
return labels[value] || value;
diff --git a/glances/outputs/static/js/components/plugin-processlist.vue b/glances/outputs/static/js/components/plugin-processlist.vue
index 462fce61..71388066 100644
--- a/glances/outputs/static/js/components/plugin-processlist.vue
+++ b/glances/outputs/static/js/components/plugin-processlist.vue
@@ -78,10 +78,10 @@
<div class="table-cell" :class="getMemoryPercentAlert(process)">
{{ process.memory_percent == -1 ? '?' : $filters.number(process.memory_percent, 1) }}
</div>
- <div class="table-cell hidden-xs hidden-sm">
+ <div class="table-cell">
{{ $filters.bytes(process.memvirt) }}
</div>
- <div class="table-cell hidden-xs hidden-sm">
+ <div class="table-cell">
{{ $filters.bytes(process.memres) }}
</div>
<div class="table-cell">
@@ -159,8 +159,8 @@ export default {
process.memvirt = '?';
process.memres = '?';
if (process.memory_info) {
- process.memvirt = process.memory_info[1];
- process.memres = process.memory_info[0];
+ process.memvirt = process.memory_info.vms;
+ process.memres = process.memory_info.rss;
}
process.timeplus = '?';
diff --git a/glances/outputs/static/public/glances.js b/glances/outputs/static/public/glances.js
index ce77967b..412665af 100644
--- a/glances/outputs/static/public/glances.js
+++ b/glances/outputs/static/public/glances.js
@@ -28,4 +28,4 @@ function n(e){return"[object Object]"===Object.prototype.toString.call(e)}Object
* https://jaywcjlove.github.io/hotkeys-js
* Licensed under the MIT license
*/
-var ho="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function go(e,t,n,r){e.addEventListener?e.addEventListener(t,n,r):e.attachEvent&&e.attachEvent("on".concat(t),(function(){n(window.event)}))}function mo(e,t){for(var n=t.slice(0,t.length-1),r=0;r<n.length;r++)n[r]=e[n[r].toLowerCase()];return n}function bo(e){"string"!=typeof e&&(e="");for(var t=(e=e.replace(/\s/g,"")).split(","),n=t.lastIndexOf("");n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}for(var vo={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":ho?173:189,"=":ho?61:187,";":ho?59:186,"'":222,"[":219,"]":221,"\\":220},yo={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},wo={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},xo={16:!1,18:!1,17:!1,91:!1},_o={},ko=1;ko<20;ko++)vo["f".concat(ko)]=111+ko;var So=[],Co=!1,To="all",Ao=[],Eo=function(e){return vo[e.toLowerCase()]||yo[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function Oo(e){To=e||"all"}function Io(){return To||"all"}var Po=function(e){var t=e.key,n=e.scope,r=e.method,i=e.splitKey,s=void 0===i?"+":i;bo(t).forEach((function(e){var t=e.split(s),i=t.length,o=t[i-1],a="*"===o?"*":Eo(o);if(_o[a]){n||(n=Io());var l=i>1?mo(yo,t):[];_o[a]=_o[a].filter((function(e){return!((!r||e.method===r)&&e.scope===n&&function(e,t){for(var n=e.length>=t.length?e:t,r=e.length>=t.length?t:e,i=!0,s=0;s<n.length;s++)-1===r.indexOf(n[s])&&(i=!1);return i}(e.mods,l))}))}}))};function No(e,t,n,r){var i;if(t.element===r&&(t.scope===n||"all"===t.scope)){for(var s in i=t.mods.length>0,xo)Object.prototype.hasOwnProperty.call(xo,s)&&(!xo[s]&&t.mods.indexOf(+s)>-1||xo[s]&&-1===t.mods.indexOf(+s))&&(i=!1);(0!==t.mods.length||xo[16]||xo[18]||xo[17]||xo[91])&&!i&&"*"!==t.shortcut||(t.keys=[],t.keys=t.keys.concat(So),!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)))}}function Lo(e,t){var n=_o["*"],r=e.keyCode||e.which||e.charCode;if(Do.filter.call(this,e)){if(93!==r&&224!==r||(r=91),-1===So.indexOf(r)&&229!==r&&So.push(r),["ctrlKey","altKey","shiftKey","metaKey"].forEach((function(t){var n=wo[t];e[t]&&-1===So.indexOf(n)?So.push(n):!e[t]&&So.indexOf(n)>-1?So.splice(So.indexOf(n),1):"metaKey"===t&&e[t]&&3===So.length&&(e.ctrlKey||e.shiftKey||e.altKey||(So=So.slice(So.indexOf(n))))})),r in xo){for(var i in xo[r]=!0,yo)yo[i]===r&&(Do[i]=!0);if(!n)return}for(var s in xo)Object.prototype.hasOwnProperty.call(xo,s)&&(xo[s]=e[wo[s]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(-1===So.indexOf(17)&&So.push(17),-1===So.indexOf(18)&&So.push(18),xo[17]=!0,xo[18]=!0);var o=Io();if(n)for(var a=0;a<n.length;a++)n[a].scope===o&&("keydown"===e.type&&n[a].keydown||"keyup"===e.type&&n[a].keyup)&&No(e,n[a],o,t);if(r in _o)for(var l=0;l<_o[r].length;l++)if(("keydown"===e.type&&_o[r][l].keydown||"keyup"===e.type&&_o[r][l].keyup)&&_o[r][l].key){for(var c=_o[r][l],u=c.splitKey,d=c.key.split(u),f=[],p=0;p<d.length;p++)f.push(Eo(d[p]));f.sort().join("")===So.sort().join("")&&No(e,c,o,t)}}}function Do(e,t,n){So=[];var r=bo(e),i=[],s="all",o=document,a=0,l=!1,c=!0,u="+",d=!1;for(void 0===n&&"function"==typeof t&&(n=t),"[object Object]"===Object.prototype.toString.call(t)&&(t.scope&&(s=t.scope),t.element&&(o=t.element),t.keyup&&(l=t.keyup),void 0!==t.keydown&&(c=t.keydown),void 0!==t.capture&&(d=t.capture),"string"==typeof t.splitKey&&(u=t.splitKey)),"string"==typeof t&&(s=t);a<r.length;a++)i=[],(e=r[a].split(u)).length>1&&(i=mo(yo,e)),(e="*"===(e=e[e.length-1])?"*":Eo(e))in _o||(_o[e]=[]),_o[e].push({keyup:l,keydown:c,scope:s,mods:i,shortcut:r[a],method:n,key:r[a],splitKey:u,element:o});void 0!==o&&!function(e){return Ao.indexOf(e)>-1}(o)&&window&&(Ao.push(o),go(o,"keydown",(function(e){Lo(e,o)}),d),Co||(Co=!0,go(window,"focus",(function(){So=[]}),d)),go(o,"keyup",(function(e){Lo(e,o),function(e){var t=e.keyCode||e.which||e.charCode,n=So.indexOf(t);if(n>=0&&So.splice(n,1),e.key&&"meta"===e.key.toLowerCase()&&So.splice(0,So.length),93!==t&&224!==t||(t=91),t in xo)for(var r in xo[t]=!1,yo)yo[r]===t&&(Do[r]=!1)}(e)}),d))}var Mo={getPressedKeyString:function(){return So.map((function(e){return t=e,Object.keys(vo).find((function(e){return vo[e]===t}))||function(e){return Object.keys(yo).find((function(t){return yo[t]===e}))}(e)||String.fromCharCode(e);var t}))},setScope:Oo,getScope:Io,deleteScope:function(e,t){var n,r;for(var i in e||(e=Io()),_o)if(Object.prototype.hasOwnProperty.call(_o,i))for(n=_o[i],r=0;r<n.length;)n[r].scope===e?n.splice(r,1):r++;Io()===e&&Oo(t||"all")},getPressedKeyCodes:function(){return So.slice(0)},getAllKeyCodes:function(){var e=[];return Object.keys(_o).forEach((function(t){_o[t].forEach((function(t){var n=t.key,r=t.scope,i=t.mods,s=t.shortcut;e.push({scope:r,shortcut:s,mods:i,keys:n.split("+").map((function(e){return Eo(e)}))})}))})),e},isPressed:function(e){return"string"==typeof e&&(e=Eo(e)),-1!==So.indexOf(e)},filter:function(e){var t=e.target||e.srcElement,n=t.tagName,r=!0;return!t.isContentEditable&&("INPUT"!==n&&"TEXTAREA"!==n&&"SELECT"!==n||t.readOnly)||(r=!1),r},trigger:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";Object.keys(_o).forEach((function(n){_o[n].filter((function(n){return n.scope===t&&n.shortcut===e})).forEach((function(e){e&&e.method&&e.method()}))}))},unbind:function(e){if(void 0===e)Object.keys(_o).forEach((function(e){return delete _o[e]}));else if(Array.isArray(e))e.forEach((function(e){e.key&&Po(e)}));else if("object"==typeof e)e.key&&Po(e);else if("string"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n[0],s=n[1];"function"==typeof i&&(s=i,i=""),Po({key:e,scope:i,method:s,splitKey:"+"})}},keyMap:vo,modifier:yo,modifierMap:wo};for(var jo in Mo)Object.prototype.hasOwnProperty.call(Mo,jo)&&(Do[jo]=Mo[jo]);if("undefined"!=typeof window){var Ro=window.hotkeys;Do.noConflict=function(e){return e&&window.hotkeys===Do&&(window.hotkeys=Ro),Do},window.hotkeys=Do}const qo=kt({args:void 0,config:void 0,data:void 0,status:"IDLE"});var Bo=n(9049),Uo=n.n(Bo);const Fo=new class{limits={};limitSuffix=["critical","careful","warning"];setLimits(e){this.limits=e}getAlert(e,t,n,r,i){var s=(i=i||!1)?"_log":"",o=100*(n=n||0)/(r=r||100);if(null!=this.limits[e])for(var a=0;a<this.limitSuffix.length;a++){var l=t+this.limitSuffix[a];if(o>=this.limits[e][l]){var c=l.lastIndexOf("_");return l.substring(c+1)+s}}return"ok"+s}getAlertLog(e,t,n,r){return this.getAlert(e,t,n,r,!0)}};const zo=new class{data=void 0;init(e=60){let t;const n=()=>(qo.status="PENDING",Promise.all([fetch("api/3/all",{method:"GET"}).then((e=>e.json())),fetch("api/3/all/views",{method:"GET"}).then((e=>e.json()))]).then((e=>{const t={stats:e[0],views:e[1],isBsd:"FreeBSD"===e[0].system.os_name,isLinux:"Linux"===e[0].system.os_name,isSunOS:"SunOS"===e[0].system.os_name,isMac:"Darwin"===e[0].system.os_name,isWindows:"Windows"===e[0].system.os_name};this.data=t,qo.data=t,qo.status="SUCCESS"})).catch((e=>{console.log(e),qo.status="FAILURE"})).then((()=>{t&&clearTimeout(t),t=setTimeout(n,1e3*e)})));n(),fetch("api/3/all/limits",{method:"GET"}).then((e=>e.json())).then((e=>{Fo.setLimits(e)})),fetch("api/3/args",{method:"GET"}).then((e=>e.json())).then(((e={})=>{qo.args={...qo.args,...e}})),fetch("api/3/config",{method:"GET"}).then((e=>e.json())).then(((e={})=>{qo.config={...qo.config,...e}}))}getData(){return this.data}};const $o=new class{constructor(){this.favico=new(Uo())({animation:"none"})}badge(e){this.favico.badge(e)}reset(){this.favico.reset()}},Ho={key:0},Vo={class:"container-fluid"},Go={class:"row"},Wo={class:"col-sm-12 col-lg-24"},Zo=wi("div",{class:"row"}," ",-1),Ko={class:"row"},Qo={class:"col-sm-12 col-lg-24"},Xo=wi("div",{class:"row"}," ",-1),Jo={class:"divTable",style:{width:"100%"}},Yo={class:"divTableBody"},ea={class:"divTableRow"},ta={class:"divTableHead"},na={class:"divTableHead"},ra={class:"divTableHead"},ia={class:"divTableHead"},sa={class:"divTableRow"},oa={class:"divTableCell"},aa={class:"divTableCell"},la={class:"divTableCell"},ca={class:"divTableCell"},ua={class:"divTableRow"},da={class:"divTableCell"},fa={class:"divTableCell"},pa={class:"divTableCell"},ha={class:"divTableCell"},ga={class:"divTableRow"},ma={class:"divTableCell"},ba={class:"divTableCell"},va={class:"divTableCell"},ya={class:"divTableCell"},wa={class:"divTableRow"},xa={class:"divTableCell"},_a={class:"divTableCell"},ka={class:"divTableCell"},Sa={class:"divTableCell"},Ca={class:"divTableRow"},Ta={class:"divTableCell"},Aa={class:"divTableCell"},Ea={class:"divTableCell"},Oa={class:"divTableCell"},Ia={class:"divTableRow"},Pa={class:"divTableCell"},Na={class:"divTableCell"},La={class:"divTableCell"},Da={class:"divTableCell"},Ma={class:"divTableRow"},ja={class:"divTableCell"},Ra={class:"divTableCell"},qa={class:"divTableCell"},Ba={class:"divTableCell"},Ua={class:"divTableRow"},Fa=wi("div",{class:"divTableCell"}," ",-1),za={class:"divTableCell"},$a={class:"divTableCell"},Ha={class:"divTableCell"},Va={class:"divTableRow"},Ga=wi("div",{class:"divTableCell"}," ",-1),Wa={class:"divTableCell"},Za={class:"divTableCell"},Ka={class:"divTableCell"},Qa={class:"divTableRow"},Xa=wi("div",{class:"divTableCell"}," ",-1),Ja={class:"divTableCell"},Ya={class:"divTableCell"},el={class:"divTableCell"},tl={class:"divTableRow"},nl=wi("div",{class:"divTableCell"}," ",-1),rl={class:"divTableCell"},il=wi("div",{class:"divTableCell"}," ",-1),sl={class:"divTableCell"},ol={class:"divTableRow"},al=wi("div",{class:"divTableCell"}," ",-1),ll={class:"divTableCell"},cl=wi("div",{class:"divTableCell"}," ",-1),ul=wi("div",{class:"divTableCell"}," ",-1),dl={class:"divTableRow"},fl=wi("div",{class:"divTableCell"}," ",-1),pl={class:"divTableCell"},hl=wi("div",{class:"divTableCell"}," ",-1),gl=wi("div",{class:"divTableCell"}," ",-1),ml={class:"divTableRow"},bl=wi("div",{class:"divTableCell"}," ",-1),vl={class:"divTableCell"},yl=wi("div",{class:"divTableCell"}," ",-1),wl=wi("div",{class:"divTableCell"}," ",-1),xl={class:"divTableRow"},_l=wi("div",{class:"divTableCell"}," ",-1),kl={class:"divTableCell"},Sl=wi("div",{class:"divTableCell"}," ",-1),Cl=wi("div",{class:"divTableCell"}," ",-1),Tl={class:"divTableRow"},Al=wi("div",{class:"divTableCell"}," ",-1),El={class:"divTableCell"},Ol=wi("div",{class:"divTableCell"}," ",-1),Il=wi("div",{class:"divTableCell"}," ",-1),Pl={class:"divTableRow"},Nl=wi("div",{class:"divTableCell"}," ",-1),Ll={class:"divTableCell"},Dl=wi("div",{class:"divTableCell"}," ",-1),Ml=wi("div",{class:"divTableCell"}," ",-1),jl={class:"divTableRow"},Rl=wi("div",{class:"divTableCell"}," ",-1),ql={class:"divTableCell"},Bl=wi("div",{class:"divTableCell"}," ",-1),Ul=wi("div",{class:"divTableCell"}," ",-1),Fl={class:"divTableRow"},zl=wi("div",{class:"divTableCell"}," ",-1),$l={class:"divTableCell"},Hl=wi("div",{class:"divTableCell"}," ",-1),Vl=wi("div",{class:"divTableCell"}," ",-1),Gl={class:"divTableRow"},Wl=wi("div",{class:"divTableCell"}," ",-1),Zl={class:"divTableCell"},Kl=wi("div",{class:"divTableCell"}," ",-1),Ql=wi("div",{class:"divTableCell"}," ",-1),Xl=wi("div",null,[wi("p",null,[Si(" For an exhaustive list of key bindings, "),wi("a",{href:"https://glances.readthedocs.io/en/latest/cmds.html#interactive-commands"},"click here"),Si(". ")])],-1),Jl=wi("div",null,[wi("p",null,[Si("Press "),wi("b",null,"h"),Si(" to came back to Glances.")])],-1);const Yl={data:()=>({help:void 0}),mounted(){fetch("api/3/help",{method:"GET"}).then((e=>e.json())).then((e=>this.help=e))}};var ec=n(3744);const tc=(0,ec.Z)(Yl,[["render",function(e,t,n,r,i,s){return i.help?(li(),pi("div",Ho,[wi("div",Vo,[wi("div",Go,[wi("div",Wo,pe(i.help.version)+" "+pe(i.help.psutil_version),1)]),Zo,wi("div",Ko,[wi("div",Qo,pe(i.help.configuration_file),1)]),Xo]),wi("div",Jo,[wi("div",Yo,[wi("div",ea,[wi("div",ta,pe(i.help.header_sort.replace(":","")),1),wi("div",na,pe(i.help.header_show_hide.replace(":","")),1),wi("div",ra,pe(i.help.header_toggle.replace(":","")),1),wi("div",ia,pe(i.help.header_miscellaneous.replace(":","")),1)]),wi("div",sa,[wi("div",oa,pe(i.help.sort_auto),1),wi("div",aa,pe(i.help.show_hide_application_monitoring),1),wi("div",la,pe(i.help.toggle_bits_bytes),1),wi("div",ca,pe(i.help.misc_erase_process_filter),1)]),wi("div",ua,[wi("div",da,pe(i.help.sort_cpu),1),wi("div",fa,pe(i.help.show_hide_diskio),1),wi("div",pa,pe(i.help.toggle_count_rate),1),wi("div",ha,pe(i.help.misc_generate_history_graphs),1)]),wi("div",ga,[wi("div",ma,pe(i.help.sort_io_rate),1),wi("div",ba,pe(i.help.show_hide_containers),1),wi("div",va,pe(i.help.toggle_used_free),1),wi("div",ya,pe(i.help.misc_help),1)]),wi("div",wa,[wi("div",xa,pe(i.help.sort_mem),1),wi("div",_a,pe(i.help.show_hide_top_extended_stats),1),wi("div",ka,pe(i.help.toggle_bar_sparkline),1),wi("div",Sa,pe(i.help.misc_accumulate_processes_by_program),1)]),wi("div",Ca,[wi("div",Ta,pe(i.help.sort_process_name),1),wi("div",Aa,pe(i.help.show_hide_filesystem),1),wi("div",Ea,pe(i.help.toggle_separate_combined),1),wi("div",Oa,pe(i.help.misc_kill_process)+" - N/A in WebUI ",1)]),wi("div",Ia,[wi("div",Pa,pe(i.help.sort_cpu_times),1),wi("div",Na,pe(i.help.show_hide_gpu),1),wi("div",La,pe(i.help.toggle_live_cumulative),1),wi("div",Da,pe(i.help.misc_reset_processes_summary_min_max),1)]),wi("div",Ma,[wi("div",ja,pe(i.help.sort_user),1),wi("div",Ra,pe(i.help.show_hide_ip),1),wi("div",qa,pe(i.help.toggle_linux_percentage),1),wi("div",Ba,pe(i.help.misc_quit),1)]),wi("div",Ua,[Fa,wi("div",za,pe(i.help.show_hide_tcp_connection),1),wi("div",$a,pe(i.help.toggle_cpu_individual_combined),1),wi("div",Ha,pe(i.help.misc_reset_history),1)]),wi("div",Va,[Ga,wi("div",Wa,pe(i.help.show_hide_alert),1),wi("div",Za,pe(i.help.toggle_gpu_individual_combined),1),wi("div",Ka,pe(i.help.misc_delete_warning_alerts),1)]),wi("div",Qa,[Xa,wi("div",Ja,pe(i.help.show_hide_network),1),wi("div",Ya,pe(i.help.toggle_short_full),1),wi("div",el,pe(i.help.misc_delete_warning_and_critical_alerts),1)]),wi("div",tl,[nl,wi("div",rl,pe(i.help.sort_cpu_times),1),il,wi("div",sl,pe(i.help.misc_edit_process_filter_pattern)+" - N/A in WebUI ",1)]),wi("div",ol,[al,wi("div",ll,pe(i.help.show_hide_irq),1),cl,ul]),wi("div",dl,[fl,wi("div",pl,pe(i.help.show_hide_raid_plugin),1),hl,gl]),wi("div",ml,[bl,wi("div",vl,pe(i.help.show_hide_sensors),1),yl,wl]),wi("div",xl,[_l,wi("div",kl,pe(i.help.show_hide_wifi_module),1),Sl,Cl]),wi("div",Tl,[Al,wi("div",El,pe(i.help.show_hide_processes),1),Ol,Il]),wi("div",Pl,[Nl,wi("div",Ll,pe(i.help.show_hide_left_sidebar),1),Dl,Ml]),wi("div",jl,[Rl,wi("div",ql,pe(i.help.show_hide_quick_look),1),Bl,Ul]),wi("div",Fl,[zl,wi("div",$l,pe(i.help.show_hide_cpu_mem_swap),1),Hl,Vl]),wi("div",Gl,[Wl,wi("div",Zl,pe(i.help.show_hide_all),1),Kl,Ql])])]),Xl,Jl])):Ti("v-if",!0)}]]),nc={class:"plugin"},rc={id:"alerts"},ic={key:0,class:"title"},sc={key:1,class:"title"},oc={id:"alert"},ac={class:"table"},lc={class:"table-cell text-left"};var cc=n(6486);const uc={props:{data:{type:Object}},computed:{stats(){return this.data.stats.alert},alerts(){return(this.stats||[]).map((e=>{const t={};var n=(new Date).getTimezoneOffset();if(t.name=e[3],t.level=e[2],t.begin=1e3*e[0]-60*n*1e3,t.end=1e3*e[1]-60*n*1e3,t.ongoing=-1==e[1],t.min=e[6],t.mean=e[5],t.max=e[4],!t.ongoing){const e=t.end-t.begin,n=parseInt(e/1e3%60),r=parseInt(e/6e4%60),i=parseInt(e/36e5%24);t.duration=(0,cc.padStart)(i,2,"0")+":"+(0,cc.padStart)(r,2,"0")+":"+(0,cc.padStart)(n,2,"0")}return t}))},hasAlerts(){return this.countAlerts>0},countAlerts(){return this.alerts.length},hasOngoingAlerts(){return this.countOngoingAlerts>0},countOngoingAlerts(){return this.alerts.filter((({ongoing:e})=>e)).length}},watch:{countOngoingAlerts(){this.countOngoingAlerts?$o.badge(this.countOngoingAlerts):$o.reset()}},methods:{formatDate:e=>new Date(e).toISOString().slice(0,19).replace(/[^\d-:]/," ")}},dc=(0,ec.Z)(uc,[["render",function(e,t,n,r,i,s){return li(),pi("div",nc,[wi("section",rc,[s.hasAlerts?(li(),pi("span",ic," Warning or critical alerts (last "+pe(s.countAlerts)+" entries) ",1)):(li(),pi("span",sc,"No warning or critical alert detected"))]),wi("section",oc,[wi("div",ac,[(li(!0),pi(ni,null,pr(s.alerts,((t,n)=>(li(),pi("div",{class:"table-row",key:n},[wi("div",lc,[Si(pe(s.formatDate(t.begin))+" "+pe(t.tz)+" ("+pe(t.ongoing?"ongoing":t.duration)+") - ",1),On(wi("span",null,pe(t.level)+" on ",513),[[Ds,!t.ongoing]]),wi("span",{class:ce(t.level.toLowerCase())},pe(t.name),3),Si(" ("+pe(e.$filters.number(t.max,1))+") ",1)])])))),128))])])])}]]),fc={key:0,id:"cloud",class:"plugin"},pc={class:"title"};const hc={props:{data:{type:Object}},computed:{stats(){return this.data.stats.cloud},provider(){return void 0!==this.stats.id?`${stats.platform}`:null},instance(){const{stats:e}=this;return void 0!==this.stats.id?`${e.type} instance ${e.name} (${e.region})`:null}}},gc=(0,ec.Z)(hc,[["render",function(e,t,n,r,i,s){return s.instance||s.provider?(li(),pi("section",fc,[wi("span",pc,pe(s.provider),1),Si(" "+pe(s.instance),1)])):Ti("v-if",!0)}]]),mc={class:"plugin",id:"connections"},bc=wi("div",{class:"table-row"},[wi("div",{class:"table-cell text-left title"},"TCP CONNECTIONS"),wi("div",{class:"table-cell"})],-1),vc={class:"table-row"},yc=wi("div",{class:"table-cell text-left"},"Listen",-1),wc=wi("div",{class:"table-cell"},null,-1),xc={class:"table-cell"},_c={class:"table-row"},kc=wi("div",{class:"table-cell text-left"},"Initiated",-1),Sc=wi("div",{class:"table-cell"},null,-1),Cc={class:"table-cell"},Tc={class:"table-row"},Ac=wi("div",{class:"table-cell text-left"},"Established",-1),Ec=wi("div",{class:"table-cell"},null,-1),Oc={class:"table-cell"},Ic={class:"table-row"},Pc=wi("div",{class:"table-cell text-left"},"Terminated",-1),Nc=wi("div",{class:"table-cell"},null,-1),Lc={class:"table-cell"},Dc={class:"table-row"},Mc=wi("div",{class:"table-cell text-left"},"Tracked",-1),jc=wi("div",{class:"table-cell"},null,-1);const Rc={props:{data:{type:Object}},computed:{stats(){return this.data.stats.connections},view(){return this.data.views.connections},listen(){return this.stats.LISTEN},initiated(){return this.stats.initiated},established(){return this.stats.ESTABLISHED},terminated(){return this.stats.terminated},tracked(){return{count:this.stats.nf_conntrack_count,max:this.stats.nf_conntrack_max}}},methods:{getDecoration(e){if(void 0!==this.view[e])return this.view[e].decoration.toLowerCase()}}},qc=(0,ec.Z)(Rc,[["render",function(e,t,n,r,i,s){return li(),pi("section",mc,[bc,wi("div",vc,[yc,wc,wi("div",xc,pe(s.listen),1)]),wi("div",_c,[kc,Sc,wi("div",Cc,pe(s.initiated),1)]),wi("div",Tc,[Ac,Ec,wi("div",Oc,pe(s.established),1)]),wi("div",Ic,[Pc,Nc,wi("div",Lc,pe(s.terminated),1)]),wi("div",Dc,[Mc,jc,wi("div",{class:ce(["table-cell",s.getDecoration("nf_conntrack_percent")])},pe(s.tracked.count)+"/"+pe(s.tracked.max),3)])])}]]),Bc={id:"cpu",class:"plugin"},Uc={class:"row"},Fc={class:"col-sm-24 col-md-12 col-lg-8"},zc={class:"table"},$c={class:"table-row"},Hc=wi("div",{class:"table-cell text-left title"},"CPU",-1),Vc={class:"table-row"},Gc=wi("div",{class:"table-cell text-left"},"user:",-1),Wc={class:"table-row"},Zc=wi("div",{class:"table-cell text-left"},"system:",-1),Kc={class:"table-row"},Qc=wi("div",{class:"table-cell text-left"},"iowait:",-1),Xc={class:"table-row"},Jc=wi("div",{class:"table-cell text-left"},"dpc:",-1),Yc={class:"hidden-xs hidden-sm col-md-12 col-lg-8"},eu={class:"table"},tu={class:"table-row"},nu=wi("div",{class:"table-cell text-left"},"idle:",-1),ru={class:"table-cell"},iu={class:"table-row"},su=wi("div",{class:"table-cell text-left"},"irq:",-1),ou={class:"table-cell"},au={class:"table-row"},lu=wi("div",{class:"table-cell text-left"},"inter:",-1),cu={class:"table-cell"},uu={class:"table-row"},du=wi("div",{class:"table-cell text-left"},"nice:",-1),fu={class:"table-cell"},pu={key:0,class:"table-row"},hu=wi("div",{class:"table-cell text-left"},"ctx_sw:",-1),gu={class:"table-row"},mu=wi("div",{class:"table-cell text-left"},"steal:",-1),bu={key:1,class:"table-row"},vu=wi("div",{class:"table-cell text-left"},"syscal:",-1),yu={class:"table-cell"},wu={class:"hidden-xs hidden-sm hidden-md col-lg-8"},xu={class:"table"},_u={key:0,class:"table-row"},ku=wi("div",{class:"table-cell text-left"},"ctx_sw:",-1),Su={key:1,class:"table-row"},Cu=wi("div",{class:"table-cell text-left"},"inter:",-1),Tu={class:"table-cell"},Au={key:2,class:"table-row"},Eu=wi("div",{class:"table-cell text-left"},"sw_int:",-1),Ou={class:"table-cell"};const Iu={props:{data:{type:Object}},computed:{stats(){return this.data.stats.cpu},view(){return this.data.views.cpu},isLinux(){return this.data.isLinux},isSunOS(){return this.data.isSunOS},isWindows(){return this.data.isWindows},total(){return this.stats.total},user(){return this.stats.user},system(){return this.stats.system},idle(){return this.stats.idle},nice(){return this.stats.nice},irq(){return this.stats.irq},iowait(){return this.stats.iowait},dpc(){return this.stats.dpc},steal(){return this.stats.steal},ctx_switches(){const{stats:e}=this;return e.ctx_switches?Math.floor(e.ctx_switches/e.time_since_update):null},interrupts(){const{stats:e}=this;return e.interrupts?Math.floor(e.interrupts/e.time_since_update):null},soft_interrupts(){const{stats:e}=this;return e.soft_interrupts?Math.floor(e.soft_interrupts/e.time_since_update):null},syscalls(){const{stats:e}=this;return e.syscalls?Math.floor(e.syscalls/e.time_since_update):null}},methods:{getDecoration(e){if(void 0!==this.view[e])return this.view[e].decoration.toLowerCase()}}},Pu=(0,ec.Z)(Iu,[["render",function(e,t,n,r,i,s){return li(),pi("section",Bc,[wi("div",Uc,[wi("div",Fc,[wi("div",zc,[wi("div",$c,[Hc,wi("div",{class:ce(["table-cell",s.getDecoration("total")])},pe(s.total)+"%",3)]),wi("div",Vc,[Gc,wi("div",{class:ce(["table-cell",s.getDecoration("user")])},pe(s.user)+"%",3)]),wi("div",Wc,[Zc,wi("div",{class:ce(["table-cell",s.getDecoration("system")])},pe(s.system)+"%",3)]),On(wi("div",Kc,[Qc,wi("div",{class:ce(["table-cell",s.getDecoration("iowait")])},pe(s.iowait)+"%",3)],512),[[Ds,null!=s.iowait]]),On(wi("div",Xc,[Jc,wi("div",{class:ce(["table-cell",s.getDecoration("dpc")])},pe(s.dpc)+"%",3)],512),[[Ds,null==s.iowait&&null!=s.dpc]])])]),wi("div",Yc,[wi("div",eu,[wi("div",tu,[nu,wi("div",ru,pe(s.idle)+"%",1)]),On(wi("div",iu,[su,wi("div",ou,pe(s.irq)+"%",1)],512),[[Ds,null!=s.irq]]),Ti(" If no irq, display interrupts "),On(wi("div",au,[lu,wi("div",cu,pe(s.interrupts),1)],512),[[Ds,null==s.irq]]),On(wi("div",uu,[du,wi("div",fu,pe(s.nice)+"%",1)],512),[[Ds,null!=s.nice]]),Ti(" If no nice, display ctx_switches "),null==s.nice&&s.ctx_switches?(li(),pi("div",pu,[hu,wi("div",{class:ce(["table-cell",s.getDecoration("ctx_switches")])},pe(s.ctx_switches),3)])):Ti("v-if",!0),On(wi("div",gu,[mu,wi("div",{class:ce(["table-cell",s.getDecoration("steal")])},pe(s.steal)+"%",3)],512),[[Ds,null!=s.steal]]),!s.isLinux&&s.syscalls?(li(),pi("div",bu,[vu,wi("div",yu,pe(s.syscalls),1)])):Ti("v-if",!0)])]),wi("div",wu,[wi("div",xu,[Ti(" If not already display instead of nice, then display ctx_switches "),null!=s.nice&&s.ctx_switches?(li(),pi("div",_u,[ku,wi("div",{class:ce(["table-cell",s.getDecoration("ctx_switches")])},pe(s.ctx_switches),3)])):Ti("v-if",!0),Ti(" If not already display instead of irq, then display interrupts "),null!=s.irq&&s.interrupts?(li(),pi("div",Su,[Cu,wi("div",Tu,pe(s.interrupts),1)])):Ti("v-if",!0),s.isWindows||s.isSunOS||!s.soft_interrupts?Ti("v-if",!0):(li(),pi("div",Au,[Eu,wi("div",Ou,pe(s.soft_interrupts),1)]))])])])])}]]),Nu={class:"plugin",id:"diskio"},Lu={key:0,class:"table-row"},Du=wi("div",{class:"table-cell text-left title"},"DISK I/O",-1),Mu={class:"table-cell"},ju={class:"table-cell"},Ru={class:"table-cell"},qu={class:"table-cell"},Bu={class:"table-cell text-left"};var Uu=n(1036),Fu=n.n(Uu);function zu(e,t){return $u(e=8*Math.round(e),t)+"b"}function $u(e,t){if(t=t||!1,isNaN(parseFloat(e))||!isFinite(e)||0==e)return e;const n=["Y","Z","E","P","T","G","M","K"],r={Y:12089258196146292e8,Z:11805916207174113e5,E:0x1000000000000000,P:0x4000000000000,T:1099511627776,G:1073741824,M:1048576,K:1024};for(var i=0;i<n.length;i++){var s=n[i],o=e/r[s];if(o>1){var a=0;return o<10?a=2:o<100&&(a=1),t?a="MK"==s?0:(0,cc.min)([1,a]):"K"==s&&(a=0),parseFloat(o).toFixed(a)+s}}return e.toFixed(0)}function Hu(e){return void 0===e||""===e?"?":e}function Vu(e,t,n){return t=t||0,n=n||" ",String(e).padStart(t,n)}function Gu(e,t){return"function"!=typeof e.slice&&(e=String(e)),e.slice(0,t)}function Wu(e,t){return t=t||8,e.length>t?"_"+e.substring(e.length-t+1):e}function Zu(e){if(void 0===e)return e;var t=function(e){var t=document.createElement("div");return t.innerText=e,t.innerHTML}(e),n=t.replace(/\n/g,"<br>");return Fu()(n)}function Ku(e,t){return new Intl.NumberFormat(void 0,"number"==typeof t?{maximumFractionDigits:t}:t).format(e)}function Qu(e){for(var t=0,n=0;n<e.length;n++)t+=1e3*e[n];return t}function Xu(e){var t=Qu(e),n=new Date(t),r=Math.floor((n-new Date(n.getFullYear(),0,0))/1e3/60/60/24);return{hours:n.getUTCHours()+24*(r-1),minutes:n.getUTCMinutes(),seconds:n.getUTCSeconds(),milliseconds:parseInt(""+n.getUTCMilliseconds()/10)}}const Ju={props:{data:{type:Object}},data:()=>({store:qo}),computed:{args(){return this.store.args||{}},stats(){return this.data.stats.diskio},disks(){const e=this.stats.map((e=>{const t=e.time_since_update;return{name:e.disk_name,bitrate:{txps:$u(e.read_bytes/t),rxps:$u(e.write_bytes/t)},count:{txps:$u(e.read_count/t),rxps:$u(e.write_count/t)},alias:void 0!==e.alias?e.alias:null}}));return(0,cc.orderBy)(e,["name"])}}},Yu=(0,ec.Z)(Ju,[["render",function(e,t,n,r,i,s){return li(),pi("section",Nu,[s.disks.length>0?(li(),pi("div",Lu,[Du,On(wi("div",Mu,"R/s",512),[[Ds,!s.args.diskio_iops]]),On(wi("div",ju,"W/s",512),[[Ds,!s.args.diskio_iops]]),On(wi("div",Ru,"IOR/s",512),[[Ds,s.args.diskio_iops]]),On(wi("div",qu,"IOW/s",512),[[Ds,s.args.diskio_iops]])])):Ti("v-if",!0),(li(!0),pi(ni,null,pr(s.disks,((t,n)=>(li(),pi("div",{class:"table-row",key:n},[wi("div",Bu,pe(e.$filters.minSize(t.alias?t.alias:t.name,32)),1),On(wi("div",{class:"table-cell"},pe(t.bitrate.txps),513),[[Ds,!s.args.diskio_iops]]),On(wi("div",{class:"table-cell"},pe(t.bitrate.rxps),513),[[Ds,!s.args.diskio_iops]]),On(wi("div",{class:"table-cell"},pe(t.count.txps),513),[[Ds,s.args.diskio_iops]]),On(wi("div",{class:"table-cell"},pe(t.count.rxps),513),[[Ds,s.args.diskio_iops]])])))),128))])}]]),ed={key:0,id:"containers-plugin",class:"plugin"},td=wi("span",{class:"title"},"CONTAINERS",-1),nd={class:"table"},rd={class:"table-row"},id=wi("div",{class:"table-cell text-left"},"Engine",-1),sd=wi("div",{class:"table-cell text-left"},"Pod",-1),od=wi("div",{class:"table-cell"},"Status",-1),ad=wi("div",{class:"table-cell"},"Uptime",-1),ld=Ci('<div class="table-cell">/MAX</div><div class="table-cell">IOR/s</div><div class="table-cell">IOW/s</div><div class="table-cell">RX/s</div><div class="table-cell">TX/s</div><div class="table-cell text-left">Command</div>',6),cd={class:"table-cell text-left"},ud={class:"table-cell text-left"},dd={class:"table-cell text-left"},fd={class:"table-cell"},pd={class:"table-cell"},hd={class:"table-cell"},gd={class:"table-cell"},md={class:"table-cell"},bd={class:"table-cell"},vd={class:"table-cell"},yd={class:"table-cell"},wd={class:"table-cell text-left"};const xd={props:{data:{type:Object}},data:()=>({store:qo,sorter:void 0}),computed:{args(){return this.store.args||{}},sortProcessesKey(){return this.args.sort_processes_key},stats(){return this.data.stats.containers},containers(){const{sorter:e}=this,t=(this.stats&&this.stats.containers||[]).map((e=>({id:e.Id,name:e.name,status:e.Status,uptime:e.Uptime,cpu_percent:e.cpu.total,memory_usage:null!=e.memory.usage?e.memory.usage:"?",limit:null!=e.memory.limit?e.memory.limit:"?",ior:null!=e.io.ior?e.io.ior:"?",iow:null!=e.io.iow?e.io.iow:"?",io_time_since_update:e.io.time_since_update,rx:null!=e.network.rx?e.network.rx:"?",tx:null!=e.network.tx?e.network.tx:"?",net_time_since_update:e.network.time_since_update,command:e.Command.join(" "),image:e.Image,engine:e.engine,pod_id:e.pod_id})));return(0,cc.orderBy)(t,[e.column].reduce(((e,t)=>("memory_percent"===t&&(t=["memory_usage"]),e.concat(t))),[]),[e.isReverseColumn(e.column)?"desc":"asc"])}},watch:{sortProcessesKey:{immediate:!0,handler(e){e&&!["cpu_percent","memory_percent","name"].includes(e)||(this.sorter={column:this.args.sort_processes_key||"cpu_percent",auto:!this.args.sort_processes_key,isReverseColumn:function(e){return!["name"].includes(e)},getColumnLabel:function(e){return{io_counters:"disk IO",cpu_percent:"CPU consumption",memory_usage:"memory consumption",cpu_times:"uptime",name:"container name",None:"None"}[e]||e}})}}}},_d=(0,ec.Z)(xd,[["render",function(e,t,n,r,i,s){return s.containers.length?(li(),pi("section",ed,[td,Si(" "+pe(s.containers.length)+" sorted by "+pe(i.sorter.getColumnLabel(i.sorter.column))+" ",1),wi("div",nd,[wi("div",rd,[id,sd,wi("div",{class:ce(["table-cell text-left",["sortable","name"===i.sorter.column&&"sort"]]),onClick:t[0]||(t[0]=e=>s.args.sort_processes_key="name")}," Name ",2),od,ad,wi("div",{class:ce(["table-cell",["sortable","cpu_percent"===i.sorter.column&&"sort"]]),onClick:t[1]||(t[1]=e=>s.args.sort_processes_key="cpu_percent")}," CPU% ",2),wi("div",{class:ce(["table-cell",["sortable","memory_percent"===i.sorter.column&&"sort"]]),onClick:t[2]||(t[2]=e=>s.args.sort_processes_key="memory_percent")}," MEM ",2),ld]),(li(!0),pi(ni,null,pr(s.containers,((t,n)=>(li(),pi("div",{class:"table-row",key:n},[wi("div",cd,pe(t.engine),1),wi("div",ud,pe(t.pod_id||"-"),1),wi("div",dd,pe(t.name),1),wi("div",{class:ce(["table-cell","Paused"==t.status?"careful":"ok"])},pe(t.status),3),wi("div",fd,pe(t.uptime),1),wi("div",pd,pe(e.$filters.number(t.cpu_percent,1)),1),wi("div",hd,pe(e.$filters.bytes(t.memory_usage)),1),wi("div",gd,pe(e.$filters.bytes(t.limit)),1),wi("div",md,pe(e.$filters.bits(t.ior/t.io_time_since_update)),1),wi("div",bd,pe(e.$filters.bits(t.iow/t.io_time_since_upda