From 6229f86b06fde411dcff8ae3b9b69c73c5b9df31 Mon Sep 17 00:00:00 2001 From: Newnius Date: Mon, 6 May 2019 14:56:40 +0800 Subject: [PATCH] update --- .htaccess | 2 ++ footer.php | 1 - modals.php | 4 +++- static/agent.js | 6 +++--- static/config.js | 5 ----- static/job.js | 27 ++++++++++++++++++--------- static/resource.js | 2 +- static/script.js | 4 ++-- static/summary.js | 28 ++++++++++++++++++---------- static/ucenter.js | 2 +- static/workspace.js | 8 ++++---- 11 files changed, 52 insertions(+), 37 deletions(-) delete mode 100644 static/config.js diff --git a/.htaccess b/.htaccess index 9ce296e..17db925 100755 --- a/.htaccess +++ b/.htaccess @@ -5,3 +5,5 @@ RewriteRule ^auth$ /auth.php RewriteRule ^help$ /help.php RewriteRule ^ucenter$ /ucenter.php +ErrorDocument 404 /404.php + diff --git a/footer.php b/footer.php index 234d25f..efbafaa 100755 --- a/footer.php +++ b/footer.php @@ -16,7 +16,6 @@ require_once('config.inc.php'); - diff --git a/modals.php b/modals.php index 55994e5..8cb7d37 100755 --- a/modals.php +++ b/modals.php @@ -85,7 +85,9 @@
- +
diff --git a/static/agent.js b/static/agent.js index e1b6b64..ee431b8 100755 --- a/static/agent.js +++ b/static/agent.js @@ -16,7 +16,7 @@ function register_events_agent() { return; var ajax = $.ajax({ - url: window.config.BASE_URL + "/service?action=agent_add", + url: "service?action=agent_add", type: 'POST', data: { ip: ip, @@ -42,7 +42,7 @@ function register_events_agent() { function load_agents(cluster) { $("#table-agent").bootstrapTable({ - url: window.config.BASE_URL + '/service?action=agent_list&who=' + cluster, + url: 'service?action=agent_list&who=' + cluster, responseHandler: agentResponseHandler, sidePagination: 'server', cache: true, @@ -123,7 +123,7 @@ window.agentOperateEvents = { return; } var ajax = $.ajax({ - url: window.config.BASE_URL + "/service?action=agent_remove", + url: "service?action=agent_remove", type: 'POST', data: {id: row.id} }); diff --git a/static/config.js b/static/config.js deleted file mode 100644 index ce092d3..0000000 --- a/static/config.js +++ /dev/null @@ -1,5 +0,0 @@ -window.config = { - 'BASE_URL': 'http://127.0.0.1' /* No '/' at the end */ - - -}; \ No newline at end of file diff --git a/static/job.js b/static/job.js index 3164038..f44f4b9 100755 --- a/static/job.js +++ b/static/job.js @@ -2,13 +2,20 @@ function register_events_job() { $('#btn-job-add').click(function (e) { cb = function (workspaces) { $('#form-job-workspace').children().remove(); + + var newGroupOption = ''; + $('#form-job-workspace').append(newGroupOption); + $.each(workspaces, function (i, workspace) { var newGroupOption = ''; $('#form-job-workspace').append(newGroupOption); }); - }; wordspace_gets(null, cb); + + $('#form-job-name').val(''); + $('#form-job-priority').val(25); + $('#form-job-cluster').val(1); $('#modal-job').modal('show'); }); @@ -38,15 +45,17 @@ function register_events_job() { if (name.length === 0) { return true; } - if (workspace.length === 0) { - return true; - } + $.each(tasks, function (i, task) { + if (task['name'].length === 0) { + return true; + } + }); $('#modal-job').modal('hide'); var ajax = $.ajax({ - url: window.config.BASE_URL + "/service?action=job_submit", + url: "service?action=job_submit", type: 'POST', data: { name: name, @@ -76,7 +85,7 @@ function register_events_job() { function load_jobs(scope) { $("#table-job").bootstrapTable({ - url: window.config.BASE_URL + '/service?action=job_list&who=' + scope, + url: 'service?action=job_list&who=' + scope, responseHandler: jobResponseHandler, sidePagination: 'server', cache: true, @@ -242,7 +251,7 @@ window.jobOperateEvents = { return; } var ajax = $.ajax({ - url: window.config.BASE_URL + "/service?action=job_stop", + url: "service?action=job_stop", type: 'POST', data: {id: row.name} }); @@ -263,7 +272,7 @@ window.jobOperateEvents = { function load_job_status(name) { $("#table-task").bootstrapTable({ - url: window.config.BASE_URL + '/service?action=job_status&name=' + name, + url: 'service?action=job_status&name=' + name, responseHandler: jobStatusResponseHandler, sidePagination: 'server', cache: true, @@ -361,7 +370,7 @@ window.jobStatusOperateEvents = { var task = row.id; var ajax = $.ajax({ - url: window.config.BASE_URL + "/service?action=task_logs", + url: "service?action=task_logs", type: 'GET', data: { job: job, diff --git a/static/resource.js b/static/resource.js index 2b6dc76..b7c3033 100755 --- a/static/resource.js +++ b/static/resource.js @@ -4,7 +4,7 @@ function register_events_resource() { function load_resources() { $("#table-resource").bootstrapTable({ - url: window.config.BASE_URL + '/service?action=resource_list', + url: 'service?action=resource_list', responseHandler: resourceResponseHandler, sidePagination: 'server', cache: true, diff --git a/static/script.js b/static/script.js index 261c6aa..e833e42 100644 --- a/static/script.js +++ b/static/script.js @@ -2,7 +2,7 @@ $(function () { $("#btn-signout").click(function (e) { e.preventDefault(); var ajax = $.ajax({ - url: window.config.BASE_URL + "/service?action=user_signout", + url: "service?action=user_signout", type: 'POST', data: {} }); @@ -14,7 +14,7 @@ $(function () { $("#btn-oauth-login").click(function (e) { e.preventDefault(); var ajax = $.ajax({ - url: window.config.BASE_URL + "/service?action=user_login", + url: "service?action=user_login", type: 'POST', data: {} }); diff --git a/static/summary.js b/static/summary.js index 21ddbe2..03673d1 100644 --- a/static/summary.js +++ b/static/summary.js @@ -11,7 +11,7 @@ function summary_render() { var ctx_gpu_mem = document.getElementById('summary-chart-gpu-mem').getContext('2d'); var ajax = $.ajax({ - url: window.config.BASE_URL + "/service?action=summary_get", + url: "service?action=summary_get", type: 'GET', data: {} }); @@ -28,8 +28,6 @@ function summary_render() { data: Object.values(res['jobs']), backgroundColor: ["rgb(54, 162, 235)", "rgb(255, 99, 132)", "rgb(255, 205, 86)"] }], - - // These labels appear in the legend and in the tooltips when hovering different arcs labels: Object.keys(res['jobs']) }; var myPieChart = new Chart(ctx_jobs, { @@ -52,8 +50,6 @@ function summary_render() { data: Object.values(res['gpu']), backgroundColor: ["rgb(54, 162, 235)", "rgb(255, 99, 132)"] }], - - // These labels appear in the legend and in the tooltips when hovering different arcs labels: Object.keys(res['gpu']) }; var myPieChart2 = new Chart(ctx_gpu, { @@ -78,7 +74,7 @@ function summary_render() { var ajax_pool = $.ajax({ - url: window.config.BASE_URL + "/service?action=summary_get_pool_history", + url: "service?action=summary_get_pool_history", type: 'GET', data: {} }); @@ -120,7 +116,7 @@ function summary_render() { "data": { "labels": timestamps, "datasets": [{ - "label": "My First Data set", + "label": "CPU Load", "data": cpu_util, "fill": true, "borderColor": "rgb(75, 192, 192)", @@ -147,11 +143,17 @@ function summary_render() { "data": { "labels": timestamps, "datasets": [{ - "label": "My First Data set", + "label": "Using", "data": mem_using, "fill": true, "borderColor": "rgb(75, 192, 192)", "lineTension": 0.1 + }, { + "label": "Total", + "data": mem_total, + "fill": true, + "borderColor": "rgb(75, 192, 192)", + "lineTension": 0.1 }] }, "options": { @@ -173,7 +175,7 @@ function summary_render() { "data": { "labels": timestamps, "datasets": [{ - "label": "My First Data set", + "label": "GPU Util", "data": gpu_util, "fill": true, "borderColor": "rgb(75, 192, 192)", @@ -200,11 +202,17 @@ function summary_render() { "data": { "labels": timestamps, "datasets": [{ - "label": "My First Data set", + "label": "Using", "data": gpu_mem_using, "fill": true, "borderColor": "rgb(75, 192, 192)", "lineTension": 0.1 + }, { + "label": "Total", + "data": gpu_mem_total, + "fill": true, + "borderColor": "rgb(75, 192, 192)", + "lineTension": 0.1 }] }, "options": { diff --git a/static/ucenter.js b/static/ucenter.js index b62637e..352f539 100755 --- a/static/ucenter.js +++ b/static/ucenter.js @@ -38,7 +38,7 @@ $(function () { function load_logs(scope) { $("#table-log").bootstrapTable({ - url: window.config.BASE_URL + '/service?action=log_gets&who=' + scope, + url: 'service?action=log_gets&who=' + scope, responseHandler: logResponseHandler, sidePagination: 'server', cache: true, diff --git a/static/workspace.js b/static/workspace.js index 72f2aab..64a0e10 100755 --- a/static/workspace.js +++ b/static/workspace.js @@ -20,7 +20,7 @@ function register_events_workspace() { action = 'workspace_update'; var ajax = $.ajax({ - url: window.config.BASE_URL + "/service?action=" + action, + url: "service?action=" + action, type: 'POST', data: { id: id, @@ -48,7 +48,7 @@ function register_events_workspace() { function load_workspaces(cluster) { $("#table-workspace").bootstrapTable({ - url: window.config.BASE_URL + '/service?action=workspace_list&who=' + cluster, + url: 'service?action=workspace_list&who=' + cluster, responseHandler: workspaceResponseHandler, sidePagination: 'server', cache: true, @@ -125,7 +125,7 @@ function workspaceOperateFormatter(value, row, index) { function wordspace_gets(cluster, cb) { var ajax = $.ajax({ - url: window.config.BASE_URL + '/service?action=workspace_list&who=' + cluster, + url: 'service?action=workspace_list&who=' + cluster, type: 'GET', data: {} }); @@ -167,7 +167,7 @@ window.workspaceOperateEvents = { return; } var ajax = $.ajax({ - url: window.config.BASE_URL + "/service?action=workspace_remove", + url: "service?action=workspace_remove", type: 'POST', data: {id: row.id} });