src/api2/node: start node configuration api
This commit is contained in:
parent
d15009c0ce
commit
b2b3485d5f
@ -6,6 +6,7 @@ use serde_json::{json, Value};
|
|||||||
|
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod admin;
|
pub mod admin;
|
||||||
|
pub mod node;
|
||||||
mod version;
|
mod version;
|
||||||
mod subscription;
|
mod subscription;
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ pub fn router() -> Router {
|
|||||||
.subdir("subdir3", route4);
|
.subdir("subdir3", route4);
|
||||||
|
|
||||||
let nodes = Router::new()
|
let nodes = Router::new()
|
||||||
.match_all("node", nodeinfo);
|
.subdir("localhost", node::router());
|
||||||
|
|
||||||
|
|
||||||
let route = Router::new()
|
let route = Router::new()
|
||||||
|
@ -12,7 +12,7 @@ pub fn router() -> Router {
|
|||||||
let route = Router::new()
|
let route = Router::new()
|
||||||
.get(ApiMethod::new(
|
.get(ApiMethod::new(
|
||||||
|_,_| Ok(json!([
|
|_,_| Ok(json!([
|
||||||
{"subdir": "datastore"}
|
{"subdir": "datastore"},
|
||||||
])),
|
])),
|
||||||
ObjectSchema::new("Directory index.")))
|
ObjectSchema::new("Directory index.")))
|
||||||
.subdir("datastore", datastore::router());
|
.subdir("datastore", datastore::router());
|
||||||
|
23
src/api2/node.rs
Normal file
23
src/api2/node.rs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
use crate::api::schema::*;
|
||||||
|
use crate::api::router::*;
|
||||||
|
use serde_json::{json};
|
||||||
|
|
||||||
|
mod time;
|
||||||
|
mod network;
|
||||||
|
mod dns;
|
||||||
|
|
||||||
|
pub fn router() -> Router {
|
||||||
|
|
||||||
|
let route = Router::new()
|
||||||
|
.get(ApiMethod::new(
|
||||||
|
|_,_| Ok(json!([
|
||||||
|
{"subdir": "network"},
|
||||||
|
{"subdir": "time"},
|
||||||
|
])),
|
||||||
|
ObjectSchema::new("Directory index.")))
|
||||||
|
.subdir("dns", dns::router())
|
||||||
|
.subdir("network", network::router())
|
||||||
|
.subdir("time", time::router());
|
||||||
|
|
||||||
|
route
|
||||||
|
}
|
27
src/api2/node/dns.rs
Normal file
27
src/api2/node/dns.rs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
use failure::*;
|
||||||
|
|
||||||
|
use crate::tools;
|
||||||
|
use crate::api::schema::*;
|
||||||
|
use crate::api::router::*;
|
||||||
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
|
|
||||||
|
fn get_dns(_param: Value, _info: &ApiMethod) -> Result<Value, Error> {
|
||||||
|
|
||||||
|
Ok(json!({
|
||||||
|
"search": "test.com",
|
||||||
|
"dns1": "1.2.3.4",
|
||||||
|
"dns2": "1.2.3.4",
|
||||||
|
"dns3": "1.2.3.4",
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn router() -> Router {
|
||||||
|
|
||||||
|
let route = Router::new()
|
||||||
|
.get(ApiMethod::new(
|
||||||
|
get_dns,
|
||||||
|
ObjectSchema::new("Read DNS settings.")));
|
||||||
|
|
||||||
|
route
|
||||||
|
}
|
22
src/api2/node/network.rs
Normal file
22
src/api2/node/network.rs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
use failure::*;
|
||||||
|
|
||||||
|
use crate::tools;
|
||||||
|
use crate::api::schema::*;
|
||||||
|
use crate::api::router::*;
|
||||||
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
|
|
||||||
|
fn get_network_config(_param: Value, _info: &ApiMethod) -> Result<Value, Error> {
|
||||||
|
|
||||||
|
Ok(json!({}))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn router() -> Router {
|
||||||
|
|
||||||
|
let route = Router::new()
|
||||||
|
.get(ApiMethod::new(
|
||||||
|
get_network_config,
|
||||||
|
ObjectSchema::new("Read network configuration.")));
|
||||||
|
|
||||||
|
route
|
||||||
|
}
|
26
src/api2/node/time.rs
Normal file
26
src/api2/node/time.rs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
use failure::*;
|
||||||
|
|
||||||
|
use crate::tools;
|
||||||
|
use crate::api::schema::*;
|
||||||
|
use crate::api::router::*;
|
||||||
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
|
|
||||||
|
fn get_time(_param: Value, _info: &ApiMethod) -> Result<Value, Error> {
|
||||||
|
|
||||||
|
Ok(json!({
|
||||||
|
"timezone": "Europe/Vienna",
|
||||||
|
"time": 1297163644,
|
||||||
|
"localtime": 1297163644,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn router() -> Router {
|
||||||
|
|
||||||
|
let route = Router::new()
|
||||||
|
.get(ApiMethod::new(
|
||||||
|
get_time,
|
||||||
|
ObjectSchema::new("Read server time and time zone settings.")));
|
||||||
|
|
||||||
|
route
|
||||||
|
}
|
@ -31,23 +31,24 @@ Ext.define('PBS.SystemConfiguration', {
|
|||||||
title: gettext('Interfaces'),
|
title: gettext('Interfaces'),
|
||||||
xtype: 'proxmoxNodeNetworkView',
|
xtype: 'proxmoxNodeNetworkView',
|
||||||
types: ['bond'],
|
types: ['bond'],
|
||||||
nodename: Proxmox.NodeName
|
nodename: 'localhost'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: gettext('DNS'),
|
title: gettext('DNS'),
|
||||||
xtype: 'proxmoxNodeDNSView',
|
xtype: 'proxmoxNodeDNSView',
|
||||||
nodename: Proxmox.NodeName
|
nodename: 'localhost'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: gettext('Time'),
|
title: gettext('Time'),
|
||||||
xtype: 'proxmoxNodeTimeView',
|
xtype: 'proxmoxNodeTimeView',
|
||||||
nodename: Proxmox.NodeName
|
nodename: 'localhost'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// itemId: 'options',
|
// itemId: 'options',
|
||||||
// title: gettext('Options'),
|
// title: gettext('Options'),
|
||||||
|
// html: "TESWT"
|
||||||
// xtype: 'pbsSystemOptions'
|
// xtype: 'pbsSystemOptions'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user