Add enable/disable for DHCP server

This commit is contained in:
Ildar Kamalov 2018-12-13 14:38:00 +03:00 committed by Eugene Bujak
parent 96fbf7f134
commit d46b65f982
7 changed files with 27 additions and 64 deletions
client/src/api

View file

@ -309,64 +309,21 @@ export default class Api {
DHCP_FIND_ACTIVE = { path: 'dhcp/find_active_dhcp', method: 'GET' };
getDhcpStatus() {
// const { path, method } = this.DHCP_STATUS;
// return this.makeRequest(path, method);
const example = {
config: {
enabled: false,
gateway_ip: '192.168.1.1',
subnet_mask: '255.255.255.0',
range_start: '192.168.1.2',
range_end: '192.168.10.50',
lease_duration: '43200',
},
leases: [
{
mac: '001109b3b3b8',
ip: '192.168.1.22',
hostname: 'dell',
expires: '2017-07-21T17:32:28Z',
},
{
mac: '001109b3b3b9',
ip: '192.168.1.23',
hostname: 'dell',
expires: '2017-07-21T17:32:28Z',
},
],
};
return new Promise((resolve) => {
setTimeout(() => {
resolve(example);
}, 1000);
});
const { path, method } = this.DHCP_STATUS;
return this.makeRequest(path, method);
}
setDhcpConfig(config) {
// const { path, method } = this.DHCP_SET_CONFIG;
// const parameters = config;
// return this.makeRequest(path, method, parameters);
return new Promise((resolve) => {
setTimeout(() => {
resolve(window.alert(`Set config:\n\n${JSON.stringify(config, null, 2)}`));
}, 1000);
});
const { path, method } = this.DHCP_SET_CONFIG;
const parameters = {
data: config,
headers: { 'Content-Type': 'application/json' },
};
return this.makeRequest(path, method, parameters);
}
findActiveDhcp() {
// const { path, method } = this.DHCP_FIND_ACTIVE;
// return this.makeRequest(path, method);
return new Promise((resolve) => {
setTimeout(() => {
resolve({
gateway_ip: '127.0.0.1',
found: true,
});
}, 10000);
});
const { path, method } = this.DHCP_FIND_ACTIVE;
return this.makeRequest(path, method);
}
}