Added Account section

This commit is contained in:
2020-03-13 23:01:39 -04:00
parent dd1809473c
commit 396ca2366e
80 changed files with 5330 additions and 107 deletions

View File

@ -0,0 +1,83 @@
<!--
This file is part of Linode Manager Classic.
Linode Manager Classic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Linode Manager Classic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
-->
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LMC - Account // Settings</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="settings.css" />
<script src="settings.js" type="module"></script>
</head>
<body>
<!--#include virtual="/include/header.html"-->
<!--#include virtual="/include/account_subnav.html"-->
<div id="main-content" class="wrapper">
<div id="settings">
<p id="saved">Settings saved!</p>
<table class="lmc-table">
<thead>
<tr>
<td colspan="2">Account Settings</td>
</tr>
<tr>
<td colspan="2">Network Helper - Default Setting</td>
</tr>
</thead>
<tbody>
<tr class="lmc-tr3">
<td>Default Behavior</td>
<td>
This controls the default setting for the Network Helper on newly created Configuration Profiles.<br />
<br />
<input id="nh-off" type="radio" name="nh" /> <label for="nh-off"><strong>OFF</strong> - This is the legacy / old account behavior</label><br />
<input id="nh-on" type="radio" name="nh" /> <label for="nh-on"><strong>ON</strong> - This is new account behavior. You probably want this.</label>
</td>
</tr>
</tbody>
<tbody class="lmc-tbody-head">
<tr class="noshow">
<td colspan="2"></td>
</tr>
<tr>
<td colspan="2">Linode Backup Enrollment</td>
</tr>
</tbody>
<tbody>
<tr class="lmc-tr3">
<td>Default Behavior</td>
<td>
This controls whether Linode Backups are enabled, by default, for Linodes when they are initially created.<br />
<br />
<input id="backups-off" type="radio" name="backups" /> <label for="backups-off"><strong>MANUAL</strong> - Do <strong>not</strong> automatically enable Backups for new Linodes</label><br />
<input id="backups-on" type="radio" name="backups" /> <label for="backups-on"><strong>AUTOMATIC</strong> - Automatically enable Backups for new Linodes</label><br />
<br />
<a href="/account/backups_enable_all">Enable backups for all existing Linodes</a><br />
<br />
<span class="info">For each Linode with Backups enabled, your account will be billed the additional hourly rate noted on the <a href="https://www.linode.com/products/backups/" target="_blank">Backups info page</a>.</span>
</td>
</tr>
<tr class="lmc-tr3">
<td></td>
<td><button disabled id="save-button" type="button">Save</button></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,35 @@
/*
* This file is part of Linode Manager Classic.
*
* Linode Manager Classic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Linode Manager Classic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
*/
@import url('/global.css');
#saved {
background-color: #ADD370;
display: none;
font-size: 16px;
margin-top: 0;
padding: 7px;
}
#settings {
padding: 15px 15px 15px;
}
tbody:not(.lmc-tbody-head) tr td:first-of-type {
font-weight: bold;
text-align: right;
}

View File

@ -0,0 +1,100 @@
/*
* This file is part of Linode Manager Classic.
*
* Linode Manager Classic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Linode Manager Classic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
*/
import { settings, elements, apiGet, apiPut, parseParams, setupHeader } from "/global.js";
(function()
{
// Element names specific to this page
elements.backupsOff = "backups-off";
elements.backupsOn = "backups-on";
elements.nhOff = "nh-off";
elements.nhOn = "nh-on";
elements.saveButton = "save-button";
elements.saved = "saved";
// Data received from API calls
var data = {};
// Static references to UI elements
var ui = {};
ui.backupsOff = {};
ui.backupsOn = {};
ui.nhOff = {};
ui.nhOn = {};
ui.saveButton = {};
ui.saved = {};
// Callback for account settings API call
var displaySettings = function(response)
{
if (response.backups_enabled)
ui.backupsOn.checked = true;
else
ui.backupsOff.checked = true;
if (response.network_helper)
ui.nhOn.checked = true;
else
ui.nhOff.checked = true;
ui.saveButton.disabled = false;
};
// Click handler for save button
var handleSave = function(event)
{
if (event.currentTarget.disabled)
return;
var req = {
"backups_enabled": ui.backupsOn.checked,
"network_helper": ui.nhOn.checked
};
apiPut("/account/settings", req, function(response)
{
ui.saved.style.display = "block";
});
};
// Initial setup
var setup = function()
{
// Parse URL parameters
data.params = parseParams();
setupHeader();
// Get element references
ui.backupsOff = document.getElementById(elements.backupsOff);
ui.backupsOn = document.getElementById(elements.backupsOn);
ui.nhOff = document.getElementById(elements.nhOff);
ui.nhOn = document.getElementById(elements.nhOn);
ui.saveButton = document.getElementById(elements.saveButton);
ui.saved = document.getElementById(elements.saved);
// Attach event handlers
ui.saveButton.addEventListener("click", handleSave);
// Get data from API
apiGet("/account/settings", displaySettings, null);
};
// Attach onload handler
window.addEventListener("load", setup);
})();