Code restructuring and comments for serve related files.

Signed-Off-By: Piyush Vijay <piyushvijay.1997@gmail.com>
This commit is contained in:
Piyush Vijay 2018-08-20 06:53:01 +05:30
parent d1e4477191
commit f7b33b00e9
9 changed files with 86 additions and 56 deletions

View File

@ -1,12 +1,23 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Module import
*/
import { $ } from '../../utils/JqueryExtended';
import CommonParams from '../../variables/common_params';
import { escapeHtml } from '../../utils/Sanitise';
import { PMA_ajaxShowMessage } from '../../utils/show_ajax_messages';
import { PMA_getImage } from '../../functions/get_image';
import { PMA_highlightSQL } from '../../utils/sql';
import { PMA_Messages as messages } from '../../variables/export_variables';
import CommonParams from '../../variables/common_params';
import { PMA_getImage } from '../../functions/get_image';
import { escapeHtml } from '../../utils/Sanitise';
import { $ } from '../../utils/JqueryExtended';
// object to store process list state information
/**
* @class Object to store process list state information
*/
class ProcessList {
/**
* @constructor Create a ProcessList
*/
constructor () {
// denotes whether auto refresh is on or off
this.autoRefresh = false;
@ -19,6 +30,8 @@ class ProcessList {
// the refresh URL (required to save last used option)
// i.e. full or sorting url
this.refreshUrl = null;
// Bindings for methods
this.init = this.init.bind(this);
this.killProcessHandler = this.killProcessHandler.bind(this);
this.refresh = this.refresh.bind(this);

View File

@ -1,13 +1,24 @@
import { PMA_Messages as PMA_messages } from '../../variables/export_variables';
export function getOsDetail (server_os, presetCharts) {
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Module import
*/
import { PMA_Messages as messages } from '../../variables/export_variables';
/**
* @param {string} serverOs Type of operating system
*
* @param {Object} presetCharts Charts already set
*/
export function getOsDetail (serverOs, presetCharts) {
/* Add OS specific system info charts to the preset chart list */
switch (server_os) {
switch (serverOs) {
case 'WINNT':
$.extend(presetCharts, {
'cpu': {
title: PMA_messages.strSystemCPUUsage,
title: messages.strSystemCPUUsage,
series: [{
label: PMA_messages.strAverageLoad
label: messages.strAverageLoad
}],
nodes: [{
dataPoints: [{ type: 'cpu', name: 'loadavg' }]
@ -16,13 +27,13 @@ export function getOsDetail (server_os, presetCharts) {
},
'memory': {
title: PMA_messages.strSystemMemory,
title: messages.strSystemMemory,
series: [{
label: PMA_messages.strTotalMemory,
label: messages.strTotalMemory,
fill: true
}, {
dataType: 'memory',
label: PMA_messages.strUsedMemory,
label: messages.strUsedMemory,
fill: true
}],
nodes: [{ dataPoints: [{ type: 'memory', name: 'MemTotal' }], valueDivisor: 1024 },
@ -32,12 +43,12 @@ export function getOsDetail (server_os, presetCharts) {
},
'swap': {
title: PMA_messages.strSystemSwap,
title: messages.strSystemSwap,
series: [{
label: PMA_messages.strTotalSwap,
label: messages.strTotalSwap,
fill: true
}, {
label: PMA_messages.strUsedSwap,
label: messages.strUsedSwap,
fill: true
}],
nodes: [{ dataPoints: [{ type: 'memory', name: 'SwapTotal' }] },
@ -51,20 +62,20 @@ export function getOsDetail (server_os, presetCharts) {
case 'Linux':
$.extend(presetCharts, {
'cpu': {
title: PMA_messages.strSystemCPUUsage,
title: messages.strSystemCPUUsage,
series: [{
label: PMA_messages.strAverageLoad
label: messages.strAverageLoad
}],
nodes: [{ dataPoints: [{ type: 'cpu', name: 'irrelevant' }], transformFn: 'cpu-linux' }],
maxYLabel: 0
},
'memory': {
title: PMA_messages.strSystemMemory,
title: messages.strSystemMemory,
series: [
{ label: PMA_messages.strBufferedMemory, fill: true },
{ label: PMA_messages.strUsedMemory, fill: true },
{ label: PMA_messages.strCachedMemory, fill: true },
{ label: PMA_messages.strFreeMemory, fill: true }
{ label: messages.strBufferedMemory, fill: true },
{ label: messages.strUsedMemory, fill: true },
{ label: messages.strCachedMemory, fill: true },
{ label: messages.strFreeMemory, fill: true }
],
nodes: [
{ dataPoints: [{ type: 'memory', name: 'Buffers' }], valueDivisor: 1024 },
@ -75,11 +86,11 @@ export function getOsDetail (server_os, presetCharts) {
maxYLabel: 0
},
'swap': {
title: PMA_messages.strSystemSwap,
title: messages.strSystemSwap,
series: [
{ label: PMA_messages.strCachedSwap, fill: true },
{ label: PMA_messages.strUsedSwap, fill: true },
{ label: PMA_messages.strFreeSwap, fill: true }
{ label: messages.strCachedSwap, fill: true },
{ label: messages.strUsedSwap, fill: true },
{ label: messages.strFreeSwap, fill: true }
],
nodes: [
{ dataPoints: [{ type: 'memory', name: 'SwapCached' }], valueDivisor: 1024 },
@ -94,9 +105,9 @@ export function getOsDetail (server_os, presetCharts) {
case 'SunOS':
$.extend(presetCharts, {
'cpu': {
title: PMA_messages.strSystemCPUUsage,
title: messages.strSystemCPUUsage,
series: [{
label: PMA_messages.strAverageLoad
label: messages.strAverageLoad
}],
nodes: [{
dataPoints: [{ type: 'cpu', name: 'loadavg' }]
@ -104,10 +115,10 @@ export function getOsDetail (server_os, presetCharts) {
maxYLabel: 0
},
'memory': {
title: PMA_messages.strSystemMemory,
title: messages.strSystemMemory,
series: [
{ label: PMA_messages.strUsedMemory, fill: true },
{ label: PMA_messages.strFreeMemory, fill: true }
{ label: messages.strUsedMemory, fill: true },
{ label: messages.strFreeMemory, fill: true }
],
nodes: [
{ dataPoints: [{ type: 'memory', name: 'MemUsed' }], valueDivisor: 1024 },
@ -116,10 +127,10 @@ export function getOsDetail (server_os, presetCharts) {
maxYLabel: 0
},
'swap': {
title: PMA_messages.strSystemSwap,
title: messages.strSystemSwap,
series: [
{ label: PMA_messages.strUsedSwap, fill: true },
{ label: PMA_messages.strFreeSwap, fill: true }
{ label: messages.strUsedSwap, fill: true },
{ label: messages.strFreeSwap, fill: true }
],
nodes: [
{ dataPoints: [{ type: 'memory', name: 'SwapUsed' }], valueDivisor: 1024 },

View File

@ -5,6 +5,7 @@
*/
import { $ } from '../../utils/JqueryExtended';
import '../../plugins/jquery/jquery.tablesorter';
// TODO: tablesorter shouldn't sort already sorted columns
/**
* @access public

View File

@ -11,16 +11,16 @@
/**
* Moduele import
*/
import { PMA_sprintf } from './utils/sprintf';
import './variables/import_variables';
import { PMA_ajaxShowMessage } from './utils/show_ajax_messages';
import { escapeHtml } from './utils/Sanitise';
import { PMA_Messages as messages } from './variables/export_variables';
import { $ } from './utils/JqueryExtended';
import { AJAX } from './ajax';
import CommonParams from './variables/common_params';
import { PMA_reloadNavigation } from './functions/navigation';
import { escapeHtml } from './utils/Sanitise';
import { getJSConfirmCommonParam } from './functions/Common';
import { PMA_ajaxShowMessage } from './utils/show_ajax_messages';
import { PMA_Messages as messages } from './variables/export_variables';
import { PMA_reloadNavigation } from './functions/navigation';
import { PMA_sprintf } from './utils/sprintf';
/**
* @package PhpMyAdmin

View File

@ -11,13 +11,13 @@
/**
* Module import
*/
import { PMA_sprintf } from './utils/sprintf';
import { checkPasswordStrength, displayPasswordGenerateButton } from './utils/password';
import { PMA_Messages as messages } from './variables/export_variables';
import { PMA_ajaxShowMessage, PMA_ajaxRemoveMessage } from './utils/show_ajax_messages';
import CommonParams from './variables/common_params';
import { $ } from './utils/JqueryExtended';
import { checkPasswordStrength, displayPasswordGenerateButton } from './utils/password';
import CommonParams from './variables/common_params';
import { PMA_ajaxShowMessage, PMA_ajaxRemoveMessage } from './utils/show_ajax_messages';
import { PMA_getSQLEditor } from './functions/Sql/SqlEditor';
import { PMA_Messages as messages } from './variables/export_variables';
import { PMA_sprintf } from './utils/sprintf';
/**
* @package PhpMyAdmin
@ -26,8 +26,6 @@ import { PMA_getSQLEditor } from './functions/Sql/SqlEditor';
*/
/**
* AJAX scripts for server_privileges page.
*
* Actions ajaxified here:
* Add user
* Revoke a user

View File

@ -1,7 +1,12 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
import { PMA_Messages as messages } from './variables/export_variables';
import { $ } from './utils/JqueryExtended';
/**
* Module import
*/
import { $ } from './utils/JqueryExtended';
import { PMA_Messages as messages } from './variables/export_variables';
// jQplot and related plugins import
import 'updated-jqplot';
import './plugins/jquery/jquery.sortableTable';
@ -14,12 +19,12 @@ import 'updated-jqplot/dist/plugins/jqplot.highlighter.js';
import 'updated-jqplot/dist/plugins/jqplot.cursor.js';
import './plugins/jqplot/jqplot.byteFormatter';
import { getOsDetail } from './functions/Server/ServerStatusMonitor';
import { isStorageSupported } from './functions/config';
import { createProfilingChart } from './functions/chart';
import CommonParams from './variables/common_params';
import { createProfilingChart } from './functions/chart';
import { escapeHtml } from './utils/Sanitise';
import { getOsDetail } from './functions/Server/ServerStatusMonitor';
import { PMA_getImage } from './functions/get_image';
import { isStorageSupported } from './functions/config';
var runtime = {};
var server_time_diff;

View File

@ -3,9 +3,9 @@
/**
* Module import
*/
import { createProfilingChart } from './functions/chart';
import { $ } from './utils/JqueryExtended';
import { initTableSorter } from './functions/Server/SeverStatusSorter';
import { createProfilingChart } from './functions/chart';
import { initTableSorter } from './functions/Server/ServerStatusSorter';
/**
* @package PhpMyAdmin

View File

@ -3,9 +3,9 @@
/**
* Module import
*/
import { escapeHtml } from './utils/Sanitise';
import { PMA_Messages as messages } from './variables/export_variables';
import { PMA_sprintf } from './utils/sprintf';
import { escapeHtml } from './utils/Sanitise';
/**
* @package PhpMyAdmin

View File

@ -24,7 +24,6 @@ function teardownServerVariables () {
* Binding event handlers on page load.
*/
function onloadServerVariables () {
// var $editLink = $('a.editLink');
var $saveLink = $('a.saveLink');
var $cancelLink = $('a.cancelLink');
@ -39,6 +38,9 @@ function onloadServerVariables () {
});
}
/**
* Module export
*/
export {
teardownServerVariables,
onloadServerVariables