Added server notes input/field

Added server notes input/field
This commit is contained in:
cp6 2021-01-24 12:44:51 +11:00
parent a5bf2c5f07
commit ec901e9620
5 changed files with 25 additions and 6 deletions

View File

@ -1544,7 +1544,7 @@ input:checked + .slider:before {
} }
.form-control:disabled, .form-control[readonly] { .form-control:disabled, .form-control[readonly] {
background-color: #202125 background-color: #f0f0f0;
} }
.search-result { .search-result {

View File

@ -300,6 +300,7 @@ function modalServerEdit(id) {
$("#me_swap_type").val(result["swap_type"]); $("#me_swap_type").val(result["swap_type"]);
$("#me_virt").val(result["virt"]); $("#me_virt").val(result["virt"]);
$("#me_ssh_port").val(result["ssh_port"]); $("#me_ssh_port").val(result["ssh_port"]);
$("#me_notes").val(result["notes"]);
} }
}); });
} }

View File

@ -692,7 +692,7 @@ class idlers extends helperFunctions
if ($row['has_yabs'] == 1) { if ($row['has_yabs'] == 1) {
$select = $this->dbConnect()->prepare(" $select = $this->dbConnect()->prepare("
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v, SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,
is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,virt,has_yabs,ns1,ns2,DATE_FORMAT(`owned_since`, '%M %Y') as owned_since, `owned_since` as owned_since_raw, `4k`,`4k_type`,`64k`,`64k_type`,`512k`,`512k_type`,`1m`,`1m_type`, is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,virt,has_yabs,ns1,ns2,DATE_FORMAT(`owned_since`, '%M %Y') as owned_since, `owned_since` as owned_since_raw, `4k`,`4k_type`,`64k`,`64k_type`,`512k`,`512k_type`,`1m`,`1m_type`,
loc.name as location,send,send_type,recieve,recieve_type,price,currency,term,as_usd,per_month,next_dd,pr.name as provider loc.name as location,send,send_type,recieve,recieve_type,price,currency,term,as_usd,per_month,next_dd,pr.name as provider
FROM servers INNER JOIN disk_speed ds on servers.id = ds.server_id FROM servers INNER JOIN disk_speed ds on servers.id = ds.server_id
INNER JOIN speed_tests st on servers.id = st.server_id INNER JOIN locations loc on servers.location = loc.id INNER JOIN speed_tests st on servers.id = st.server_id INNER JOIN locations loc on servers.location = loc.id
@ -707,7 +707,7 @@ class idlers extends helperFunctions
} else { } else {
$select = $this->dbConnect()->prepare(" $select = $this->dbConnect()->prepare("
SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type, SELECT servers.id as server_id,hostname,ipv4,ipv6,`cpu`,cpu_type,cpu_freq,ram,ram_type,swap,swap_type,`disk`,disk_type,
bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,virt,has_yabs,ns1,ns2, bandwidth,bandwidth_type,gb5_single,gb5_multi,gb5_id,aes_ni,amd_v,is_dedicated,is_cpu_dedicated,was_special,os,ssh_port,still_have,tags,notes,virt,has_yabs,ns1,ns2,
DATE_FORMAT(`owned_since`, '%M %Y') as owned_since,loc.name as location,price,currency,term,as_usd,per_month,next_dd,pr.name as provider DATE_FORMAT(`owned_since`, '%M %Y') as owned_since,loc.name as location,price,currency,term,as_usd,per_month,next_dd,pr.name as provider
FROM servers INNER JOIN locations loc on servers.location = loc.id FROM servers INNER JOIN locations loc on servers.location = loc.id
INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;"); INNER JOIN providers pr on servers.provider = pr.id INNER JOIN pricing on servers.id = pricing.server_id WHERE servers.id = ? LIMIT 1;");
@ -1128,6 +1128,12 @@ class idlers extends helperFunctions
$this->tagClose('select'); $this->tagClose('select');
$this->tagClose('div', 3); $this->tagClose('div', 3);
$this->rowColOpen('form-row', 'col-12');
$this->htmlPhrase('p', 'm-desc', 'Notes:');
$this->outputString("<textarea class='form-control' id='me_notes' name='me_notes' rows='4' cols='40' maxlength='255'>");
$this->outputString("</textarea>");
$this->tagClose('div', 2);
$this->rowColOpen('form-row', 'col-12'); $this->rowColOpen('form-row', 'col-12');
$this->tagOpen('div', 'input-group'); $this->tagOpen('div', 'input-group');
$this->inputPrepend('Tags'); $this->inputPrepend('Tags');
@ -2114,6 +2120,14 @@ class idlers extends helperFunctions
} }
} }
} }
$this->rowColOpen('row m-section-row', 'col-12 text-center');
$this->htmlPhrase('p', 'm-section-text', 'Notes');
$this->outputString("<textarea class='form-control' id='server_notes' name='server_notes' rows='4' cols='40' maxlength='255' disabled>");
$this->outputString($data['notes']);
$this->outputString("</textarea>");
$this->tagClose('div', 2);
$this->rowColOpen('row m-section-row', 'col-12 text-center'); $this->rowColOpen('row m-section-row', 'col-12 text-center');
$this->HTMLphrase('p', 'm-section-text', 'Tags'); $this->HTMLphrase('p', 'm-section-text', 'Tags');
$this->tagClose('div', 2); $this->tagClose('div', 2);
@ -2953,8 +2967,8 @@ class itemUpdate extends idlers
} elseif ($data['me_non_active'] == 'on') { } elseif ($data['me_non_active'] == 'on') {
$this->updateActiveStatus(0); $this->updateActiveStatus(0);
} }
$update = $this->dbConnect()->prepare("UPDATE `servers` SET `hostname` = ?,`ipv4` = ?,`ipv6` = ?,`cpu` = ?,`bandwidth` = ?,`disk` = ?,`ram` = ?,`ram_type` = ?,`swap` = ?,`swap_type` = ?, `virt` = ?, `tags` = ?, `owned_since` = ?, `ns1` = ?, `ns2` = ?, `ssh_port` = ? WHERE `id`= ? LIMIT 1;"); $update = $this->dbConnect()->prepare("UPDATE `servers` SET `hostname` = ?,`ipv4` = ?,`ipv6` = ?,`cpu` = ?,`bandwidth` = ?,`disk` = ?,`ram` = ?,`ram_type` = ?,`swap` = ?,`swap_type` = ?, `virt` = ?, `tags` = ?, `owned_since` = ?, `ns1` = ?, `ns2` = ?, `ssh_port` = ?, `notes` = ? WHERE `id`= ? LIMIT 1;");
return $update->execute([$data['me_hostname'], $data['me_ipv4'], $data['me_ipv6'], $data['me_cpu_amount'], $data['me_bandwidth'], $data['me_disk'], $data['me_ram'], $data['me_ram_type'], $data['me_swap'], $data['me_swap_type'], $data['me_virt'], $data['me_tags'], $data['me_owned_since'], $data['me_ns1'], $data['me_ns2'], $data['me_ssh_port'], $this->item_id]); return $update->execute([$data['me_hostname'], $data['me_ipv4'], $data['me_ipv6'], $data['me_cpu_amount'], $data['me_bandwidth'], $data['me_disk'], $data['me_ram'], $data['me_ram_type'], $data['me_swap'], $data['me_swap_type'], $data['me_virt'], $data['me_tags'], $data['me_owned_since'], $data['me_ns1'], $data['me_ns2'], $data['me_ssh_port'], $data['me_notes'], $this->item_id]);
} }
public function updateServerPricingFromModal() public function updateServerPricingFromModal()

View File

@ -326,6 +326,7 @@ CREATE TABLE IF NOT EXISTS `servers`
`still_have` tinyint(1) DEFAULT '1', `still_have` tinyint(1) DEFAULT '1',
`owned_since` date DEFAULT NULL, `owned_since` date DEFAULT NULL,
`tags` varchar(255) DEFAULT NULL, `tags` varchar(255) DEFAULT NULL,
`notes` varchar(255) DEFAULT NULL,
`has_yabs` tinyint(1) DEFAULT '0', `has_yabs` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `Index 2` (`ipv4`, `hostname`, `ipv6`) UNIQUE KEY `Index 2` (`ipv4`, `hostname`, `ipv6`)

View File

@ -3,3 +3,6 @@ ALTER TABLE `disk_speed`
ALTER TABLE `servers` ALTER TABLE `servers`
ADD COLUMN `ssh_port` INT(11) NULL DEFAULT '22' AFTER `os`; ADD COLUMN `ssh_port` INT(11) NULL DEFAULT '22' AFTER `os`;
ALTER TABLE `servers`
ADD COLUMN `notes` VARCHAR(255) NULL DEFAULT NULL AFTER `tags`;