mirror of
https://github.com/newnius/YAO-portal.git
synced 2025-06-06 07:11:54 +00:00
update
This commit is contained in:
parent
dbfe0c5bb7
commit
75657a7d6d
@ -15,21 +15,20 @@ class WorkspaceManager
|
|||||||
public static function add(CRObject $workspace)
|
public static function add(CRObject $workspace)
|
||||||
{
|
{
|
||||||
$name = $workspace->get('name');
|
$name = $workspace->get('name');
|
||||||
$content = $workspace->get('content');
|
$type = $workspace->get('type');
|
||||||
$virtual_cluster = $workspace->getInt('virtual_cluster');
|
$git_repo = $workspace->get('git_repo');
|
||||||
$permission = $workspace->getInt('permission');
|
|
||||||
$created_at = $workspace->getInt('created_at', time());
|
$created_at = $workspace->getInt('created_at', time());
|
||||||
$updated_at = $workspace->getInt('updated_at', time());
|
$updated_at = $workspace->getInt('updated_at', time());
|
||||||
$created_by = $workspace->get('created_by');
|
$created_by = $workspace->get('created_by');
|
||||||
|
|
||||||
$key_values = array(
|
$key_values = array(
|
||||||
'name' => '?', 'content' => '?', 'virtual_cluster' => '?', 'permission' => '?',
|
'name' => '?', 'type' => '?', 'git_repo' => '?',
|
||||||
'created_at' => '?', 'updated_at' => '?', 'created_by' => '?'
|
'created_at' => '?', 'updated_at' => '?', 'created_by' => '?'
|
||||||
);
|
);
|
||||||
$builder = new SQLBuilder();
|
$builder = new SQLBuilder();
|
||||||
$builder->insert(self::$table, $key_values);
|
$builder->insert(self::$table, $key_values);
|
||||||
$sql = $builder->build();
|
$sql = $builder->build();
|
||||||
$params = array($name, $content, $virtual_cluster, $permission, $created_at, $updated_at, $created_by);
|
$params = array($name, $type, $git_repo, $created_at, $updated_at, $created_by);
|
||||||
return (new MysqlPDO())->execute($sql, $params);
|
return (new MysqlPDO())->execute($sql, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,19 +86,19 @@ class WorkspaceManager
|
|||||||
{
|
{
|
||||||
$id = $workspace->getInt('id');
|
$id = $workspace->getInt('id');
|
||||||
$name = $workspace->get('name');
|
$name = $workspace->get('name');
|
||||||
$content = $workspace->get('content');
|
$type = $workspace->get('type');
|
||||||
$permission = $workspace->getInt('permission');
|
$git_repo = $workspace->get('git_repo');
|
||||||
$updated_at = $workspace->getInt('updated_at', time());
|
$updated_at = $workspace->getInt('updated_at', time());
|
||||||
|
|
||||||
$key_values = array(
|
$key_values = array(
|
||||||
'name' => '?', 'content' => '?', 'permission' => '?', 'updated_at' => '?'
|
'name' => '?', 'type' => '?', 'git_repo' => '?', 'updated_at' => '?'
|
||||||
);
|
);
|
||||||
$where = array('id' => '?');
|
$where = array('id' => '?');
|
||||||
$builder = new SQLBuilder();
|
$builder = new SQLBuilder();
|
||||||
$builder->update(self::$table, $key_values);
|
$builder->update(self::$table, $key_values);
|
||||||
$builder->where($where);
|
$builder->where($where);
|
||||||
$sql = $builder->build();
|
$sql = $builder->build();
|
||||||
$params = array($name, $content, $permission, $updated_at, $id);
|
$params = array($name, $type, $git_repo, $updated_at, $id);
|
||||||
return (new MysqlPDO())->execute($sql, $params);
|
return (new MysqlPDO())->execute($sql, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,3 +63,24 @@ function agent_list(CRObject $rule)
|
|||||||
$res['errno'] = $res['agents'] === null ? Code::FAIL : Code::SUCCESS;
|
$res['errno'] = $res['agents'] === null ? Code::FAIL : Code::SUCCESS;
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resource_list()
|
||||||
|
{
|
||||||
|
if (!AccessController::hasAccess(Session::get('role', 'visitor'), 'system.summary')) {
|
||||||
|
$res['errno'] = Code::NO_PRIVILEGE;
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
$spider = new Spider();
|
||||||
|
$spider->doGet(YAO_SCHEDULER_ADDR . '?action=resource_list');
|
||||||
|
$msg = json_decode($spider->getBody(), true);
|
||||||
|
|
||||||
|
if ($msg['code'] !== 0) {
|
||||||
|
$res['errno'] = $msg['code'] !== null ? $msg['code'] : Code::UNKNOWN_ERROR;
|
||||||
|
$res['msg'] = $msg['error'];
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
$res['resources'] = $msg['resources'];
|
||||||
|
$res['errno'] = Code::SUCCESS;
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
19
ajax.php
19
ajax.php
@ -128,6 +128,10 @@ switch ($action) {
|
|||||||
$res = agent_remove($job);
|
$res = agent_remove($job);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'resource_list':
|
||||||
|
$res = resource_list();
|
||||||
|
break;
|
||||||
|
|
||||||
case 'workspace_list':
|
case 'workspace_list':
|
||||||
$rule = new CRObject();
|
$rule = new CRObject();
|
||||||
$rule->set('offset', cr_get_GET('offset'));
|
$rule->set('offset', cr_get_GET('offset'));
|
||||||
@ -138,9 +142,8 @@ switch ($action) {
|
|||||||
case 'workspace_add':
|
case 'workspace_add':
|
||||||
$workspace = new CRObject();
|
$workspace = new CRObject();
|
||||||
$workspace->set('name', cr_get_POST('name'));
|
$workspace->set('name', cr_get_POST('name'));
|
||||||
$workspace->set('content', cr_get_POST('content'));
|
$workspace->set('type', cr_get_POST('type'));
|
||||||
$workspace->set('virtual_cluster', cr_get_POST('virtual_cluster'));
|
$workspace->set('git_repo', cr_get_POST('git_repo'));
|
||||||
$workspace->set('permission', cr_get_POST('permission'));
|
|
||||||
$res = workspace_add($workspace);
|
$res = workspace_add($workspace);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -148,9 +151,8 @@ switch ($action) {
|
|||||||
$workspace = new CRObject();
|
$workspace = new CRObject();
|
||||||
$workspace->set('id', cr_get_POST('id'));
|
$workspace->set('id', cr_get_POST('id'));
|
||||||
$workspace->set('name', cr_get_POST('name'));
|
$workspace->set('name', cr_get_POST('name'));
|
||||||
$workspace->set('content', cr_get_POST('content'));
|
$workspace->set('type', cr_get_POST('type'));
|
||||||
$workspace->set('virtual_cluster', cr_get_POST('virtual_cluster'));
|
$workspace->set('git_repo', cr_get_POST('git_repo'));
|
||||||
$workspace->set('permission', cr_get_POST('permission'));
|
|
||||||
$res = workspace_update($workspace);
|
$res = workspace_update($workspace);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -177,6 +179,11 @@ switch ($action) {
|
|||||||
$res = oauth_get_url();
|
$res = oauth_get_url();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'user_login':
|
||||||
|
$user = new CRObject();
|
||||||
|
$res = user_login($user);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ require_once('config.inc.php');
|
|||||||
<div class="footer">
|
<div class="footer">
|
||||||
<ul class="breadcrumb">
|
<ul class="breadcrumb">
|
||||||
<li>©2018 <a href="<?= BASE_URL ?>/">YAO</a></li>
|
<li>©2018 <a href="<?= BASE_URL ?>/">YAO</a></li>
|
||||||
<li><a href="https://blog.newnius.com/" target="_blank">Newnius</a></li>
|
|
||||||
<li><a href="<?= BASE_URL ?>/help#TOS">TOS</a></li>
|
<li><a href="<?= BASE_URL ?>/help#TOS">TOS</a></li>
|
||||||
<li><a href="<?= BASE_URL ?>/help#privacy">Privacy</a></li>
|
<li><a href="<?= BASE_URL ?>/help#privacy">Privacy</a></li>
|
||||||
<li><a href="<?= BASE_URL ?>/help#feedback">Feedback</a></li>
|
<li><a href="<?= BASE_URL ?>/help#feedback">Feedback</a></li>
|
||||||
|
4
help.php
4
help.php
@ -67,9 +67,7 @@ require_once('secure.inc.php');
|
|||||||
<div id="feedback" class="panel panel-default">
|
<div id="feedback" class="panel panel-default">
|
||||||
<div class="panel-heading">Feedback</div>
|
<div class="panel-heading">Feedback</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<p>Contact with
|
<p>This is feedback.</p>
|
||||||
<a href="mailto:<?= FEEDBACK_EMAIL ?>?subject=From LS"><?= FEEDBACK_EMAIL ?></a>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ require_once('secure.inc.php');
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<div id="main" class="form ui-widget load-overlay container">
|
<div id="main" class="form ui-widget load-overlay container">
|
||||||
<h2>YAO-Yet Another Octopus</h2>
|
<h2 style="text-align: center">YAO---Yet Another Octopus</h2>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- /container -->
|
</div> <!-- /container -->
|
||||||
<!--This div exists to avoid footer from covering main body-->
|
<!--This div exists to avoid footer from covering main body-->
|
||||||
|
53
install.php
53
install.php
@ -17,9 +17,7 @@ MysqlPDO::configure($config);
|
|||||||
create_table_user();
|
create_table_user();
|
||||||
create_table_workspace();
|
create_table_workspace();
|
||||||
create_table_cluster();
|
create_table_cluster();
|
||||||
create_table_job();
|
|
||||||
create_table_agent();
|
create_table_agent();
|
||||||
create_table_resource();
|
|
||||||
create_table_model();
|
create_table_model();
|
||||||
create_table_log();
|
create_table_log();
|
||||||
|
|
||||||
@ -61,14 +59,12 @@ function create_table_workspace()
|
|||||||
'CREATE TABLE `yao_workspace`(
|
'CREATE TABLE `yao_workspace`(
|
||||||
`id` int AUTO_INCREMENT,
|
`id` int AUTO_INCREMENT,
|
||||||
PRIMARY KEY(`id`),
|
PRIMARY KEY(`id`),
|
||||||
`name` varchar(64) NOT NULL,
|
`name` VARCHAR(64) NOT NULL,
|
||||||
`content` json NOT NULL,
|
`type` VARCHAR(16) NOT NULL,
|
||||||
`created_at` BIGINT NOT NULL,
|
`created_at` BIGINT NOT NULL,
|
||||||
`updated_at` BIGINT NOT NULL,
|
`updated_at` BIGINT NOT NULL,
|
||||||
`virtual_cluster` varchar(64) NOT NULL,
|
`git_repo` varchar(256),
|
||||||
INDEX(`virtual_cluster`),
|
|
||||||
`created_by` int NOT NULL,
|
`created_by` int NOT NULL,
|
||||||
`permission` int, /* [0, 1, 2] * 10 + [0, 1, 2] => [-, r, w] * [-, r, w] */
|
|
||||||
`version` int NOT NULL DEFAULT 0 /* for upgrade purpose */
|
`version` int NOT NULL DEFAULT 0 /* for upgrade purpose */
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci',
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci',
|
||||||
);
|
);
|
||||||
@ -88,30 +84,12 @@ function create_table_cluster()
|
|||||||
`reserved_nodes` json NOT NULL,
|
`reserved_nodes` json NOT NULL,
|
||||||
`quota_per_day` int NOT NULL,
|
`quota_per_day` int NOT NULL,
|
||||||
`quota_used` int NOT NULL,
|
`quota_used` int NOT NULL,
|
||||||
|
|
||||||
`version` int NOT NULL DEFAULT 0 /* for upgrade purpose */
|
`version` int NOT NULL DEFAULT 0 /* for upgrade purpose */
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci',
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci',
|
||||||
);
|
);
|
||||||
execute_sqls($sqls);
|
execute_sqls($sqls);
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_table_resource()
|
|
||||||
{
|
|
||||||
$sqls = array(
|
|
||||||
// 'DROP `yao_resource`' => 'DROP TABLE IF EXISTS `yao_resource`',
|
|
||||||
'CREATE `yao_resource`' =>
|
|
||||||
'CREATE TABLE `yao_resource`(
|
|
||||||
`id` int AUTO_INCREMENT,
|
|
||||||
PRIMARY KEY(`id`),
|
|
||||||
`ip` bigint NOT NULL,
|
|
||||||
`type` int NOT NULL, /* 0-CPU, 1-GPU */
|
|
||||||
`model` VARCHAR(64) NOT NULL, /* eg. i7, P100 */
|
|
||||||
`memory` int NOT NULL /* MB */
|
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci',
|
|
||||||
);
|
|
||||||
execute_sqls($sqls);
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_table_agent()
|
function create_table_agent()
|
||||||
{
|
{
|
||||||
$sqls = array(
|
$sqls = array(
|
||||||
@ -149,31 +127,6 @@ function create_table_model()
|
|||||||
execute_sqls($sqls);
|
execute_sqls($sqls);
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_table_job()
|
|
||||||
{
|
|
||||||
$sqls = array(
|
|
||||||
// 'DROP `yao_job`' => 'DROP TABLE IF EXISTS `yao_job`',
|
|
||||||
'CREATE `yao_job`' =>
|
|
||||||
'CREATE TABLE `yao_job`(
|
|
||||||
`id` int AUTO_INCREMENT,
|
|
||||||
PRIMARY KEY(`id`),
|
|
||||||
`name` varchar(64) NOT NULL,
|
|
||||||
`image` varchar(256) NOT NULL,
|
|
||||||
`tasks` json NOT NULL,
|
|
||||||
`workspace` int NOT NULL,
|
|
||||||
`virtual_cluster` int NOT NULL DEFAULT 0,
|
|
||||||
`priority` int NOT NULL DEFAULT 0,
|
|
||||||
`run_before` bigint,
|
|
||||||
`status` int NOT NULL DEFAULT 0,/* 0-submitted, 1-running, 2-finished, 3-failed, 4-stopped */
|
|
||||||
`created_at` BIGINT NOT NULL,
|
|
||||||
`updated_at` BIGINT,
|
|
||||||
`created_by` int,
|
|
||||||
`version` int NOT NULL DEFAULT 0 /* for upgrade purpose */
|
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci',
|
|
||||||
);
|
|
||||||
execute_sqls($sqls);
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_table_log()
|
function create_table_log()
|
||||||
{
|
{
|
||||||
$sqls = array(
|
$sqls = array(
|
||||||
|
@ -22,13 +22,6 @@ function job_submit(CRObject $job)
|
|||||||
}
|
}
|
||||||
$job->set('created_by', Session::get('uid'));
|
$job->set('created_by', Session::get('uid'));
|
||||||
$job->set('created_at', time());
|
$job->set('created_at', time());
|
||||||
// $res['errno'] = JobManager::add($job) ? Code::SUCCESS : Code::UNKNOWN_ERROR;
|
|
||||||
// $log = new CRObject();
|
|
||||||
// $log->set('scope', Session::get('uid'));
|
|
||||||
// $log->set('tag', 'job.submit');
|
|
||||||
// $content = array('job' => $job, 'response' => $res['errno']);
|
|
||||||
// $log->set('content', json_encode($content));
|
|
||||||
// CRLogger::log($log);
|
|
||||||
|
|
||||||
/* notify YAO-scheduler */
|
/* notify YAO-scheduler */
|
||||||
$spider = new Spider();
|
$spider = new Spider();
|
||||||
@ -54,8 +47,14 @@ function job_submit(CRObject $job)
|
|||||||
if ($msg['code'] !== 0) {
|
if ($msg['code'] !== 0) {
|
||||||
$res['errno'] = Code::FAIL;
|
$res['errno'] = Code::FAIL;
|
||||||
$res['msg'] = $msg['error'];
|
$res['msg'] = $msg['error'];
|
||||||
return $res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$log = new CRObject();
|
||||||
|
$log->set('scope', Session::get('uid'));
|
||||||
|
$log->set('tag', 'job.submit');
|
||||||
|
$content = array('job' => $job, 'response' => $res['errno']);
|
||||||
|
$log->set('content', json_encode($content));
|
||||||
|
CRLogger::log($log);
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +107,7 @@ function job_list(CRObject $rule)
|
|||||||
|
|
||||||
|
|
||||||
if ($msg['code'] !== 0) {
|
if ($msg['code'] !== 0) {
|
||||||
$res['errno'] = $msg['code'];
|
$res['errno'] = $msg['code'] !== null ? $msg['code'] : Code::UNKNOWN_ERROR;
|
||||||
$res['msg'] = $msg['error'];
|
$res['msg'] = $msg['error'];
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
@ -121,10 +120,6 @@ function job_list(CRObject $rule)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$res['errno'] = Code::SUCCESS;
|
$res['errno'] = Code::SUCCESS;
|
||||||
|
|
||||||
//$res['jobs'] = JobManager::gets($rule);
|
|
||||||
//$res['count'] = JobManager::count($rule);
|
|
||||||
//$res['errno'] = $res['jobs'] === null ? Code::FAIL : Code::SUCCESS;
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +157,7 @@ function summary_get()
|
|||||||
$msg = json_decode($spider->getBody(), true);
|
$msg = json_decode($spider->getBody(), true);
|
||||||
|
|
||||||
if ($msg['code'] !== 0) {
|
if ($msg['code'] !== 0) {
|
||||||
$res['errno'] = $msg['code'];
|
$res['errno'] = $msg['code'] !== null ? $msg['code'] : Code::UNKNOWN_ERROR;
|
||||||
$res['msg'] = $msg['error'];
|
$res['msg'] = $msg['error'];
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
39
modals.php
39
modals.php
@ -31,6 +31,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- node GPU detail modal -->
|
||||||
|
<div class="modal fade" id="modal-resource-gpu-detail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
||||||
|
aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content panel-info">
|
||||||
|
<div class="modal-header panel-heading">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">GPUs on this node</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<pre id="modal-resource-gpu-detail-content"></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- task logs modal -->
|
<!-- task logs modal -->
|
||||||
<div class="modal fade" id="modal-task-logs" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
<div class="modal fade" id="modal-task-logs" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
||||||
aria-hidden="true">
|
aria-hidden="true">
|
||||||
@ -68,8 +85,7 @@
|
|||||||
<label>Workspace</label>
|
<label>Workspace</label>
|
||||||
<div class="form-group form-group-lg">
|
<div class="form-group form-group-lg">
|
||||||
<label for="form-job-workspace" class="sr-only">Workspace</label>
|
<label for="form-job-workspace" class="sr-only">Workspace</label>
|
||||||
<input id="form-job-workspace" type="text" class="form-control"
|
<select id="form-job-workspace" class="form-control"></select>
|
||||||
placeholder="git repo" required/>
|
|
||||||
</div>
|
</div>
|
||||||
<label>Virtual Cluster</label>
|
<label>Virtual Cluster</label>
|
||||||
<div class="form-group form-group-lg">
|
<div class="form-group form-group-lg">
|
||||||
@ -106,7 +122,9 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label>Docker Image</label>
|
<label>Docker Image</label>
|
||||||
<select class="form-control form-control task-image" required>
|
<select class="form-control form-control task-image" required>
|
||||||
<option value="quickdeploy/yao-tensorflow:1.12" selected>quickdeploy/yao-tensorflow:1.12</option>
|
<option value="quickdeploy/yao-tensorflow:1.12" selected>
|
||||||
|
quickdeploy/yao-tensorflow:1.12
|
||||||
|
</option>
|
||||||
<option value="nvidia/cuda:9.0-base">nvidia/cuda:9.0-base</option>
|
<option value="nvidia/cuda:9.0-base">nvidia/cuda:9.0-base</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -228,17 +246,18 @@
|
|||||||
<input type="text" id="form-workspace-name" class="form-control" maxlength="64"
|
<input type="text" id="form-workspace-name" class="form-control" maxlength="64"
|
||||||
placeholder="" required/>
|
placeholder="" required/>
|
||||||
</div>
|
</div>
|
||||||
<label>Virtual Cluster</label>
|
<label>Type</label>
|
||||||
<div class="form-group form-group-lg">
|
<div class="form-group form-group-lg">
|
||||||
<label for="form-workspace-virtual-cluster" class="sr-only">Virtual Cluster</label>
|
<label for="form-workspace-type" class="sr-only">Type</label>
|
||||||
<select id="form-workspace-virtual-cluster" class="form-control">
|
<select id="form-workspace-type" class="form-control">
|
||||||
<option value="0">default</option>
|
<option value="git">git</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<label>Permission</label>
|
<label>Repo</label>
|
||||||
<div class="form-group form-group-lg">
|
<div class="form-group form-group-lg">
|
||||||
<label for="form-workspace-permission" class="sr-only">Token</label>
|
<label for="form-workspace-git-repo" class="sr-only">Git Repo</label>
|
||||||
<input type="number" id="form-workspace-permission" class="form-control" placeholder=""/>
|
<input type="text" id="form-workspace-git-repo" class="form-control"
|
||||||
|
placeholder="http://192.168.100.100:3000/newnius/tf.git"/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="hidden" id="form-workspace-submit-type"/>
|
<input type="hidden" id="form-workspace-submit-type"/>
|
||||||
|
@ -30,7 +30,6 @@ function register_events_agent() {
|
|||||||
$("#modal-msg").modal('show');
|
$("#modal-msg").modal('show');
|
||||||
}
|
}
|
||||||
$('#table-agent').bootstrapTable("refresh");
|
$('#table-agent').bootstrapTable("refresh");
|
||||||
|
|
||||||
});
|
});
|
||||||
ajax.fail(function (jqXHR, textStatus) {
|
ajax.fail(function (jqXHR, textStatus) {
|
||||||
$("#modal-msg-content").html("Request failed : " + jqXHR.statusText);
|
$("#modal-msg-content").html("Request failed : " + jqXHR.statusText);
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
function register_events_job() {
|
function register_events_job() {
|
||||||
$('#btn-job-add').click(function (e) {
|
$('#btn-job-add').click(function (e) {
|
||||||
|
cb = function (workspaces) {
|
||||||
|
$('#form-job-workspace').children().remove();
|
||||||
|
$.each(workspaces, function (i, workspace) {
|
||||||
|
var newGroupOption = '<option value="' + workspace.git_repo + '">' + workspace.name + '</option>';
|
||||||
|
$('#form-job-workspace').append(newGroupOption);
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
wordspace_gets(null, cb);
|
||||||
$('#modal-job').modal('show');
|
$('#modal-job').modal('show');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -158,7 +167,7 @@ var workspaceFormatter = function (workspace) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var clusterFormatter = function (cluster) {
|
var clusterFormatter = function (cluster) {
|
||||||
return cluster;
|
return 'default';
|
||||||
};
|
};
|
||||||
|
|
||||||
var priorityFormatter = function (status) {
|
var priorityFormatter = function (status) {
|
||||||
@ -219,8 +228,9 @@ function jobOperateFormatter(value, row, index) {
|
|||||||
|
|
||||||
window.jobOperateEvents = {
|
window.jobOperateEvents = {
|
||||||
'click .config': function (e, value, row, index) {
|
'click .config': function (e, value, row, index) {
|
||||||
row.tasks = JSON.parse(row.tasks);
|
var tmp = jQuery.extend(true, {}, row);
|
||||||
var formattedData = JSON.stringify(row, null, '\t');
|
tmp.tasks = JSON.parse(tmp.tasks);
|
||||||
|
var formattedData = JSON.stringify(tmp, null, '\t');
|
||||||
$('#modal-job-description-content').text(formattedData);
|
$('#modal-job-description-content').text(formattedData);
|
||||||
$('#modal-job-description').modal('show');
|
$('#modal-job-description').modal('show');
|
||||||
},
|
},
|
||||||
|
105
static/resource.js
Executable file
105
static/resource.js
Executable file
@ -0,0 +1,105 @@
|
|||||||
|
function register_events_resource() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function load_resources() {
|
||||||
|
$("#table-resource").bootstrapTable({
|
||||||
|
url: window.config.BASE_URL + '/service?action=resource_list',
|
||||||
|
responseHandler: resourceResponseHandler,
|
||||||
|
sidePagination: 'server',
|
||||||
|
cache: true,
|
||||||
|
striped: true,
|
||||||
|
pagination: false,
|
||||||
|
pageSize: 10,
|
||||||
|
pageList: [10, 25, 50, 100, 200],
|
||||||
|
search: false,
|
||||||
|
showColumns: true,
|
||||||
|
showRefresh: true,
|
||||||
|
showToggle: false,
|
||||||
|
showPaginationSwitch: true,
|
||||||
|
minimumCountColumns: 2,
|
||||||
|
clickToSelect: false,
|
||||||
|
sortName: 'nobody',
|
||||||
|
sortOrder: 'desc',
|
||||||
|
smartDisplay: true,
|
||||||
|
mobileResponsive: true,
|
||||||
|
showExport: true,
|
||||||
|
columns: [{
|
||||||
|
field: 'id',
|
||||||
|
title: 'ID',
|
||||||
|
align: 'center',
|
||||||
|
valign: 'middle',
|
||||||
|
visible: false
|
||||||
|
}, {
|
||||||
|
field: 'host',
|
||||||
|
title: 'Node',
|
||||||
|
align: 'center',
|
||||||
|
valign: 'middle',
|
||||||
|
escape: true
|
||||||
|
}, {
|
||||||
|
field: 'CPU',
|
||||||
|
title: 'CPU',
|
||||||
|
align: 'center',
|
||||||
|
valign: 'middle'
|
||||||
|
}, {
|
||||||
|
field: 'MEM',
|
||||||
|
title: 'MEM',
|
||||||
|
align: 'center',
|
||||||
|
valign: 'middle',
|
||||||
|
escape: true,
|
||||||
|
visible: true
|
||||||
|
}, {
|
||||||
|
field: 'GPU',
|
||||||
|
title: 'GPU',
|
||||||
|
align: 'center',
|
||||||
|
valign: 'middle',
|
||||||
|
escape: true,
|
||||||
|
visible: true
|
||||||
|
}, {
|
||||||
|
field: 'operate',
|
||||||
|
title: 'Operate',
|
||||||
|
align: 'center',
|
||||||
|
events: resourceOperateEvents,
|
||||||
|
formatter: resourceOperateFormatter
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function resourceResponseHandler(res) {
|
||||||
|
if (res['errno'] === 0) {
|
||||||
|
var tmp = {};
|
||||||
|
tmp["rows"] = [];
|
||||||
|
$.each(res["resources"], function (i, node) {
|
||||||
|
var item = {
|
||||||
|
'host': node.host,
|
||||||
|
'CPU': '-',
|
||||||
|
'MEM': '-',
|
||||||
|
'GPU': node.status.length,
|
||||||
|
'status': node.status
|
||||||
|
};
|
||||||
|
tmp["rows"].push(item);
|
||||||
|
});
|
||||||
|
|
||||||
|
return tmp['rows'];
|
||||||
|
}
|
||||||
|
$("#modal-msg-content").html(res["msg"]);
|
||||||
|
$("#modal-msg").modal('show');
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function resourceOperateFormatter(value, row, index) {
|
||||||
|
var div = '<div class="btn-group" role="group" aria-label="...">';
|
||||||
|
div += '<button class="btn btn-default view"><i class="glyphicon glyphicon-eye-open"></i> </button>';
|
||||||
|
div += '</div>';
|
||||||
|
return div;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
window.resourceOperateEvents = {
|
||||||
|
'click .view': function (e, value, row, index) {
|
||||||
|
var tmp = jQuery.extend(true, {}, row.status);
|
||||||
|
var formattedData = JSON.stringify(tmp, null, '\t');
|
||||||
|
$('#modal-resource-gpu-detail-content').text(formattedData);
|
||||||
|
$('#modal-resource-gpu-detail').modal('show');
|
||||||
|
}
|
||||||
|
};
|
@ -14,12 +14,17 @@ $(function () {
|
|||||||
$("#btn-oauth-login").click(function (e) {
|
$("#btn-oauth-login").click(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var ajax = $.ajax({
|
var ajax = $.ajax({
|
||||||
url: window.config.BASE_URL + "/service?action=oauth_get_url",
|
url: window.config.BASE_URL + "/service?action=user_login",
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: {}
|
data: {}
|
||||||
});
|
});
|
||||||
ajax.done(function (res) {
|
ajax.done(function (res) {
|
||||||
window.location.href = res['url'];
|
if (res["errno"] !== 0) {
|
||||||
|
$("#modal-msg-content").html(res["msg"]);
|
||||||
|
$("#modal-msg").modal('show');
|
||||||
|
} else {
|
||||||
|
window.location.pathname = "/ucenter";
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ function summary_render() {
|
|||||||
var ctx_mem = document.getElementById('summary-chart-mem').getContext('2d');
|
var ctx_mem = document.getElementById('summary-chart-mem').getContext('2d');
|
||||||
var ctx_jobs = document.getElementById('summary-chart-jobs').getContext('2d');
|
var ctx_jobs = document.getElementById('summary-chart-jobs').getContext('2d');
|
||||||
var ctx_gpu = document.getElementById('summary-chart-gpu').getContext('2d');
|
var ctx_gpu = document.getElementById('summary-chart-gpu').getContext('2d');
|
||||||
|
var ctx_gpu_util = document.getElementById('summary-chart-gpu-util').getContext('2d');
|
||||||
|
var ctx_gpu_mem = document.getElementById('summary-chart-gpu-mem').getContext('2d');
|
||||||
|
|
||||||
var ajax = $.ajax({
|
var ajax = $.ajax({
|
||||||
url: window.config.BASE_URL + "/service?action=summary_get",
|
url: window.config.BASE_URL + "/service?action=summary_get",
|
||||||
@ -19,7 +21,7 @@ function summary_render() {
|
|||||||
$("#modal-msg").modal('show');
|
$("#modal-msg").modal('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* CPU Load */
|
||||||
ctx_cpu.canvas.height = 200;
|
ctx_cpu.canvas.height = 200;
|
||||||
new Chart(ctx_cpu, {
|
new Chart(ctx_cpu, {
|
||||||
"type": "line",
|
"type": "line",
|
||||||
@ -34,15 +36,19 @@ function summary_render() {
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'GPU Load'
|
||||||
|
},
|
||||||
legend: {
|
legend: {
|
||||||
display: false
|
display: false
|
||||||
},
|
},
|
||||||
maintainAspectRatio:false
|
maintainAspectRatio: false
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/* Jobs */
|
||||||
var data = {
|
var data = {
|
||||||
datasets: [{
|
datasets: [{
|
||||||
data: Object.values(res['jobs']),
|
data: Object.values(res['jobs']),
|
||||||
@ -56,12 +62,69 @@ function summary_render() {
|
|||||||
type: 'pie',
|
type: 'pie',
|
||||||
data: data,
|
data: data,
|
||||||
options: {
|
options: {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'Jobs'
|
||||||
|
},
|
||||||
legend: {
|
legend: {
|
||||||
display: false
|
display: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* Mem Using */
|
||||||
|
ctx_mem.canvas.height = 200;
|
||||||
|
new Chart(ctx_mem, {
|
||||||
|
"type": "line",
|
||||||
|
"data": {
|
||||||
|
"labels": ["January", "February", "March", "April", "May", "June", "July"],
|
||||||
|
"datasets": [{
|
||||||
|
"label": "My First Data set",
|
||||||
|
"data": [2, 0.5, 1.5, 0.81, 1.56, 1.55, 1.40],
|
||||||
|
"fill": true,
|
||||||
|
"borderColor": "rgb(75, 192, 192)",
|
||||||
|
"lineTension": 0.1
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'MEM Using'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
display: false
|
||||||
|
},
|
||||||
|
maintainAspectRatio: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* GPU Util */
|
||||||
|
ctx_gpu_util.canvas.height = 200;
|
||||||
|
new Chart(ctx_gpu_util, {
|
||||||
|
"type": "line",
|
||||||
|
"data": {
|
||||||
|
"labels": ["January", "February", "March", "April", "May", "June", "July"],
|
||||||
|
"datasets": [{
|
||||||
|
"label": "My First Data set",
|
||||||
|
"data": [2, 0.5, 1.5, 0.81, 1.56, 1.55, 1.40],
|
||||||
|
"fill": true,
|
||||||
|
"borderColor": "rgb(75, 192, 192)",
|
||||||
|
"lineTension": 0.1
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'GPU Utilization'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
display: false
|
||||||
|
},
|
||||||
|
maintainAspectRatio: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* GPUs */
|
||||||
var data2 = {
|
var data2 = {
|
||||||
datasets: [{
|
datasets: [{
|
||||||
data: Object.values(res['gpu']),
|
data: Object.values(res['gpu']),
|
||||||
@ -75,11 +138,42 @@ function summary_render() {
|
|||||||
type: 'pie',
|
type: 'pie',
|
||||||
data: data2,
|
data: data2,
|
||||||
options: {
|
options: {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'GPUs'
|
||||||
|
},
|
||||||
legend: {
|
legend: {
|
||||||
display: false
|
display: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/* GPU Mem Using */
|
||||||
|
ctx_gpu_mem.canvas.height = 200;
|
||||||
|
new Chart(ctx_gpu_mem, {
|
||||||
|
"type": "line",
|
||||||
|
"data": {
|
||||||
|
"labels": ["January", "February", "March", "April", "May", "June", "July"],
|
||||||
|
"datasets": [{
|
||||||
|
"label": "My First Data set",
|
||||||
|
"data": [2, 0.5, 1.5, 0.81, 1.56, 1.55, 1.40],
|
||||||
|
"fill": true,
|
||||||
|
"borderColor": "rgb(75, 192, 192)",
|
||||||
|
"lineTension": 0.1
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'GPU MEM Using'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
display: false
|
||||||
|
},
|
||||||
|
maintainAspectRatio: false
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
ajax.fail(function (jqXHR, textStatus) {
|
ajax.fail(function (jqXHR, textStatus) {
|
||||||
$("#modal-msg-content").html("Request failed : " + jqXHR.statusText);
|
$("#modal-msg-content").html("Request failed : " + jqXHR.statusText);
|
||||||
|
@ -27,6 +27,10 @@ $(function () {
|
|||||||
register_events_workspace();
|
register_events_workspace();
|
||||||
load_workspaces('');
|
load_workspaces('');
|
||||||
break;
|
break;
|
||||||
|
case "resources":
|
||||||
|
register_events_resource();
|
||||||
|
load_resources();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
function register_events_workspace() {
|
function register_events_workspace() {
|
||||||
$('#btn-workspace-add').click(function (e) {
|
$('#btn-workspace-add').click(function (e) {
|
||||||
$('#form-workspace-submit-type').val('add');
|
$('#form-workspace-submit-type').val('add');
|
||||||
|
$('#form-workspace-name').val('');
|
||||||
|
$('#form-workspace-git-repo').val('');
|
||||||
$('#modal-workspace').modal('show');
|
$('#modal-workspace').modal('show');
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#form-workspace-submit").click(function (e) {
|
$("#form-workspace-submit").click(function (e) {
|
||||||
var id = $('#form-workspace-id').val();
|
var id = $('#form-workspace-id').val();
|
||||||
var name = $('#form-workspace-name').val();
|
var name = $('#form-workspace-name').val();
|
||||||
var content = $('#form-workspace-content').val();
|
var type = $('#form-workspace-type').val();
|
||||||
var virtual_cluster = $('#form-workspace-virtual-cluster').val();
|
var git_repo = $('#form-workspace-git-repo').val();
|
||||||
var permission = $('#form-workspace-permission').val();
|
|
||||||
|
|
||||||
/* TODO validate form */
|
/* TODO validate form */
|
||||||
|
|
||||||
@ -24,9 +25,8 @@ function register_events_workspace() {
|
|||||||
data: {
|
data: {
|
||||||
id: id,
|
id: id,
|
||||||
name: name,
|
name: name,
|
||||||
content: "[]",
|
type: type,
|
||||||
virtual_cluster: virtual_cluster,
|
git_repo: git_repo
|
||||||
permission: permission
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ajax.done(function (res) {
|
ajax.done(function (res) {
|
||||||
@ -81,15 +81,17 @@ function load_workspaces(cluster) {
|
|||||||
valign: 'middle',
|
valign: 'middle',
|
||||||
escape: true
|
escape: true
|
||||||
}, {
|
}, {
|
||||||
field: 'virtual_cluster',
|
field: 'type',
|
||||||
title: 'Virtual Cluster',
|
title: 'Type',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
valign: 'middle'
|
valign: 'middle'
|
||||||
}, {
|
}, {
|
||||||
field: 'permission',
|
field: 'git_repo',
|
||||||
title: 'Permission',
|
title: 'Git Repo',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
valign: 'middle'
|
valign: 'middle',
|
||||||
|
escape: true,
|
||||||
|
visible: true
|
||||||
}, {
|
}, {
|
||||||
field: 'operate',
|
field: 'operate',
|
||||||
title: 'Operate',
|
title: 'Operate',
|
||||||
@ -121,15 +123,43 @@ function workspaceOperateFormatter(value, row, index) {
|
|||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function wordspace_gets(cluster, cb) {
|
||||||
|
var ajax = $.ajax({
|
||||||
|
url: window.config.BASE_URL + '/service?action=workspace_list&who=' + cluster,
|
||||||
|
type: 'GET',
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
ajax.done(function (res) {
|
||||||
|
if (res["errno"] !== 0) {
|
||||||
|
$("#modal-msg-content").html(res["msg"]);
|
||||||
|
$("#modal-msg").modal('show');
|
||||||
|
} else {
|
||||||
|
if (cb !== undefined) {
|
||||||
|
cb(res['workspaces']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ajax.fail(function (jqXHR, textStatus) {
|
||||||
|
$("#modal-msg-content").html("Request failed : " + jqXHR.statusText);
|
||||||
|
$("#modal-msg").modal('show');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
window.workspaceOperateEvents = {
|
window.workspaceOperateEvents = {
|
||||||
'click .view': function (e, value, row, index) {
|
'click .view': function (e, value, row, index) {
|
||||||
$('#form-workspace-id').val(row.id);
|
$('#form-workspace-id').val(row.id);
|
||||||
$('#form-workspace-submit-type').val('view');
|
$('#form-workspace-submit-type').val('view');
|
||||||
|
$('#form-workspace-name').val(row.name);
|
||||||
|
$('#form-workspace-type').val(row.type);
|
||||||
|
$('#form-workspace-git-repo').val(row.git_repo);
|
||||||
$('#modal-workspace').modal('show');
|
$('#modal-workspace').modal('show');
|
||||||
},
|
},
|
||||||
'click .edit': function (e, value, row, index) {
|
'click .edit': function (e, value, row, index) {
|
||||||
$('#form-workspace-id').val(row.id);
|
$('#form-workspace-id').val(row.id);
|
||||||
$('#form-workspace-submit-type').val('view');
|
$('#form-workspace-submit-type').val('view');
|
||||||
|
$('#form-workspace-name').val(row.name);
|
||||||
|
$('#form-workspace-type').val(row.type);
|
||||||
|
$('#form-workspace-git-repo').val(row.git_repo);
|
||||||
$('#modal-workspace').modal('show');
|
$('#modal-workspace').modal('show');
|
||||||
},
|
},
|
||||||
'click .remove': function (e, value, row, index) {
|
'click .remove': function (e, value, row, index) {
|
||||||
|
22
ucenter.php
22
ucenter.php
@ -55,7 +55,7 @@ $entries = array(
|
|||||||
array('jobs', 'Jobs'),
|
array('jobs', 'Jobs'),
|
||||||
array('workspaces', 'Workspaces'),
|
array('workspaces', 'Workspaces'),
|
||||||
array('resources', 'Resources'),
|
array('resources', 'Resources'),
|
||||||
array('logs', 'Logs'),
|
array('logs', 'Activities'),
|
||||||
array('admin', 'Administration'),
|
array('admin', 'Administration'),
|
||||||
array('agents', '->Agents'),
|
array('agents', '->Agents'),
|
||||||
array('clusters', '->Virtual Clusters'),
|
array('clusters', '->Virtual Clusters'),
|
||||||
@ -119,23 +119,26 @@ foreach ($entries as $entry) {
|
|||||||
<div class="panel-heading">Summary</div>
|
<div class="panel-heading">Summary</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4" style="height: 200px">CPU
|
<div class="col-md-4">
|
||||||
<canvas id="summary-chart-cpu"></canvas>
|
<canvas id="summary-chart-cpu"></canvas>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
Jobs
|
|
||||||
<canvas id="summary-chart-jobs"></canvas>
|
<canvas id="summary-chart-jobs"></canvas>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">Mem
|
<div class="col-md-4">
|
||||||
<canvas id="summary-chart-mem"></canvas>
|
<canvas id="summary-chart-mem"></canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">GPU CPU</div>
|
<div class="col-md-4">
|
||||||
<div class="col-md-4">GPUs
|
<canvas id="summary-chart-gpu-util"></canvas>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
<canvas id="summary-chart-gpu"></canvas>
|
<canvas id="summary-chart-gpu"></canvas>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">GPU Mem</div>
|
<div class="col-md-4">
|
||||||
|
<canvas id="summary-chart-gpu-mem"></canvas>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -194,7 +197,7 @@ foreach ($entries as $entry) {
|
|||||||
<?php } elseif ($page_type === 'logs' || $page_type === 'logs_all') { ?>
|
<?php } elseif ($page_type === 'logs' || $page_type === 'logs_all') { ?>
|
||||||
<div id="logs">
|
<div id="logs">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">日志</div>
|
<div class="panel-heading">Activities</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<div id="toolbar"></div>
|
<div id="toolbar"></div>
|
||||||
@ -258,9 +261,10 @@ foreach ($entries as $entry) {
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.10.1/tableExport.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.10.1/tableExport.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
|
||||||
|
|
||||||
|
<script src="static/workspace.js"></script>
|
||||||
<script src="static/job.js"></script>
|
<script src="static/job.js"></script>
|
||||||
<script src="static/agent.js"></script>
|
<script src="static/agent.js"></script>
|
||||||
<script src="static/workspace.js"></script>
|
<script src="static/resource.js"></script>
|
||||||
<script src="static/summary.js"></script>
|
<script src="static/summary.js"></script>
|
||||||
<script src="static/ucenter.js"></script>
|
<script src="static/ucenter.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
@ -67,4 +67,35 @@ function oauth_get_url()
|
|||||||
$res['errno'] = Code::SUCCESS;
|
$res['errno'] = Code::SUCCESS;
|
||||||
$res['url'] = $url;
|
$res['url'] = $url;
|
||||||
return $res;
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
function user_login($user)
|
||||||
|
{
|
||||||
|
/* mock */
|
||||||
|
$info = array('open_id' => 'admin', 'role' => 'normal', 'nickname' => 'Admin');
|
||||||
|
$open_id = ($info !== null && isset($info['open_id'])) ? $info['open_id'] : null;
|
||||||
|
$email = ($info !== null && isset($info['email'])) ? $info['email'] : null;
|
||||||
|
$role = ($info !== null && isset($info['role'])) ? $info['role'] : 'normal';
|
||||||
|
$nickname = ($info !== null && isset($info['nickname'])) ? $info['nickname'] : 'u2913';
|
||||||
|
|
||||||
|
$user = new CRObject();
|
||||||
|
$user->set('open_id', $open_id);
|
||||||
|
$user->set('email', $email);
|
||||||
|
$user->set('role', $role);
|
||||||
|
$res = user_get($user);
|
||||||
|
|
||||||
|
if ($res['errno'] === 0) {
|
||||||
|
$user = $res['user'];
|
||||||
|
Session::put('uid', $user['uid']);
|
||||||
|
Session::put('role', $user['role']);
|
||||||
|
Session::put('nickname', $nickname);
|
||||||
|
|
||||||
|
$log = new CRObject();
|
||||||
|
$log->set('scope', $user['uid']);
|
||||||
|
$log->set('tag', 'user.login');
|
||||||
|
$content = array('uid' => $user['uid'], 'response' => $res['errno']);
|
||||||
|
$log->set('content', json_encode($content));
|
||||||
|
CRLogger::log($log);
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user