Added Account section
This commit is contained in:
91
account/account.css
Normal file
91
account/account.css
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
#account {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
#balance {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.balance-negative {
|
||||
color: #F00;
|
||||
}
|
||||
|
||||
.balance-positive {
|
||||
color: #008000;
|
||||
}
|
||||
|
||||
#billing-activity tr td:first-of-type {
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#billing-activity tr td:last-of-type {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#billing-link {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#billing-row {
|
||||
border: none;
|
||||
}
|
||||
|
||||
#cancel {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.gdpr {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#learn-more {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
#managed {
|
||||
display: none;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#pay {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.promotions {
|
||||
display: none;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#uninvoiced {
|
||||
display: none;
|
||||
}
|
387
account/account.js
Normal file
387
account/account.js
Normal file
@ -0,0 +1,387 @@
|
||||
/*
|
||||
* 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, apiPost, parseParams, setupHeader, timeString } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.active = "active";
|
||||
elements.address = "address";
|
||||
elements.balance = "balance";
|
||||
elements.balanceNegative = "balance-negative";
|
||||
elements.balancePositive = "balance-positive";
|
||||
elements.balanceStatus = "balance-status";
|
||||
elements.billingActivity = "billing-activity";
|
||||
elements.ccNumber = "cc-number";
|
||||
elements.ccDuration = "cc-duration";
|
||||
elements.ccExpire = "cc-expire";
|
||||
elements.current = "current";
|
||||
elements.email = "email";
|
||||
elements.gdpr = "gdpr";
|
||||
elements.gdprDate = "gdpr-date";
|
||||
elements.info = "info";
|
||||
elements.lmcRow = "lmc-tr1";
|
||||
elements.lmcRowAlt = "lmc-tr2";
|
||||
elements.lmcRowStandard = "lmc-tr3";
|
||||
elements.managed = "managed";
|
||||
elements.managedButton = "managed-button";
|
||||
elements.pay = "pay";
|
||||
elements.promotions = "promotions";
|
||||
elements.promotionsTable = "promotions-table";
|
||||
elements.uninvoiced = "uninvoiced";
|
||||
elements.uninvoicedBalance = "uninvoiced-balance";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
data.account = {};
|
||||
data.invoices = [];
|
||||
data.linodes = [];
|
||||
data.payments = [];
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.active = {};
|
||||
ui.address = {};
|
||||
ui.balance = {};
|
||||
ui.balanceStatus = {};
|
||||
ui.billingActivity = {};
|
||||
ui.ccNumber = {};
|
||||
ui.ccDuration = {};
|
||||
ui.ccExpire = {};
|
||||
ui.current = {};
|
||||
ui.email = {};
|
||||
ui.gdpr = [];
|
||||
ui.gdprDate = {};
|
||||
ui.managed = {};
|
||||
ui.managedButton = {};
|
||||
ui.pay = {};
|
||||
ui.promotions = [];
|
||||
ui.promotionsTable = {};
|
||||
ui.uninvoiced = {};
|
||||
ui.uninvoicedBalance = {};
|
||||
|
||||
// Temporary state
|
||||
var state = {};
|
||||
state.haveInvoices = false;
|
||||
state.havePayments = false;
|
||||
|
||||
// Creates a row for the promotion table
|
||||
var createPromoRow = function(promo)
|
||||
{
|
||||
var row = document.createElement("tr");
|
||||
row.className = elements.lmcRowStandard;
|
||||
|
||||
var name = document.createElement("td");
|
||||
name.innerHTML = promo.summary;
|
||||
row.appendChild(name);
|
||||
|
||||
var details = document.createElement("td");
|
||||
var line1 = document.createElement("span");
|
||||
var expire = new Date(promo.expire_dt + "Z");
|
||||
line1.innerHTML = "$" + promo.credit_remaining + " remaining. Exp: " + expire.toLocaleDateString();
|
||||
var br = document.createElement("br");
|
||||
var line2 = document.createElement("span");
|
||||
line2.innerHTML = "($" + promo.this_month_credit_remaining + " remaining this month. Monthly cap: $" + promo.credit_monthly_cap + ")";
|
||||
details.appendChild(line1);
|
||||
details.appendChild(br);
|
||||
details.appendChild(line2);
|
||||
row.appendChild(details);
|
||||
|
||||
var description = document.createElement("td");
|
||||
description.className = elements.info;
|
||||
description.innerHTML = promo.description;
|
||||
row.appendChild(description);
|
||||
|
||||
return row;
|
||||
};
|
||||
|
||||
// Creates a row for the recent activity table
|
||||
var createRecentRow = function(recent, alt)
|
||||
{
|
||||
var row = document.createElement("tr");
|
||||
if (alt)
|
||||
row.className = elements.lmcRowAlt;
|
||||
else
|
||||
row.className = elements.lmcRow;
|
||||
|
||||
var dateCell = document.createElement("td");
|
||||
var date = document.createElement("span");
|
||||
var recentDate = new Date(recent.date + "Z");
|
||||
var now = new Date();
|
||||
date.innerHTML = recentDate.toLocaleDateString();
|
||||
var br = document.createElement("br");
|
||||
var ago = document.createElement("span");
|
||||
ago.className = elements.info;
|
||||
ago.innerHTML = timeString(now - recentDate, true);
|
||||
dateCell.appendChild(date);
|
||||
dateCell.appendChild(br);
|
||||
dateCell.appendChild(ago);
|
||||
row.appendChild(dateCell);
|
||||
|
||||
if (recent.label) {
|
||||
// Invoice stuff
|
||||
var linkCell = document.createElement("td");
|
||||
var link = document.createElement("a");
|
||||
link.href = "/account/invoice?iid=" + recent.id;
|
||||
link.innerHTML = recent.label;
|
||||
linkCell.appendChild(link);
|
||||
row.appendChild(linkCell);
|
||||
|
||||
var total = document.createElement("td");
|
||||
if (recent.total < 0)
|
||||
total.innerHTML = "($" + (-recent.total).toFixed(2) + ")";
|
||||
else
|
||||
total.innerHTML = "$" + recent.total.toFixed(2);
|
||||
row.appendChild(total);
|
||||
} else {
|
||||
// Payment stuff
|
||||
var thanks = document.createElement("td");
|
||||
thanks.innerHTML = "Payment. Thank you";
|
||||
row.appendChild(thanks);
|
||||
|
||||
var total = document.createElement("td");
|
||||
if (total > 0)
|
||||
total.innerHTML = "($" + recent.total.toFixed(2) + ")";
|
||||
else
|
||||
total.innerHTML = "$" + (-recent.total).toFixed(2);
|
||||
row.appendChild(total);
|
||||
}
|
||||
|
||||
return row;
|
||||
};
|
||||
|
||||
// Callback for account details API call
|
||||
var displayAccount = function(response)
|
||||
{
|
||||
data.account = response;
|
||||
|
||||
// Contact info
|
||||
var br = document.createElement("br");
|
||||
if (data.account.company.length) {
|
||||
var company = document.createElement("span");
|
||||
company.innerHTML = data.account.company;
|
||||
ui.address.appendChild(company);
|
||||
ui.address.appendChild(br);
|
||||
}
|
||||
var name = document.createElement("span");
|
||||
name.innerHTML = data.account.first_name + " " + data.account.last_name;
|
||||
ui.address.appendChild(name);
|
||||
ui.address.appendChild(br.cloneNode(true));
|
||||
var address1 = document.createElement("span");
|
||||
address1.innerHTML = data.account.address_1;
|
||||
ui.address.appendChild(address1);
|
||||
ui.address.appendChild(br.cloneNode(true));
|
||||
if (data.account.address_2.length) {
|
||||
var address2 = document.createElement("span");
|
||||
address2.innerHTML = data.account.address_2;
|
||||
ui.address.appendChild(address2);
|
||||
ui.address.appendChild(br.cloneNode(true));
|
||||
}
|
||||
var address3 = document.createElement("span");
|
||||
address3.innerHTML = data.account.city + ", " + data.account.state + " " + data.account.zip;
|
||||
ui.address.appendChild(address3);
|
||||
|
||||
// Email
|
||||
ui.email.innerHTML = data.account.email;
|
||||
|
||||
// CC info
|
||||
ui.ccNumber.innerHTML = data.account.credit_card.last_four;
|
||||
var expired = document.createElement("span");
|
||||
var strong = document.createElement("strong");
|
||||
strong.innerHTML = "Expired!";
|
||||
var dash = document.createElement("span");
|
||||
dash.innerHTML = " - ";
|
||||
var updateLink = document.createElement("a");
|
||||
updateLink.href = "/account/creditcard";
|
||||
updateLink.innerHTML = "update credit card";
|
||||
expired.appendChild(strong);
|
||||
expired.appendChild(dash);
|
||||
expired.appendChild(updateLink);
|
||||
if (data.account.credit_card.expiry) {
|
||||
ui.ccExpire.innerHTML = data.account.credit_card.expiry;
|
||||
var monthYear = data.account.credit_card.expiry.split("/");
|
||||
var expireDate = new Date(parseInt(monthYear[1]), parseInt(monthYear[0]), 0);
|
||||
var now = new Date();
|
||||
if (expireDate - now > 0)
|
||||
ui.ccDuration.innerHTML = "Expires " + timeString(now - expireDate, true);
|
||||
else
|
||||
ui.ccDuration.appendChild(expired);
|
||||
}
|
||||
|
||||
// Account balance
|
||||
if (data.account.balance == 0) {
|
||||
ui.balance.className = elements.balancePositive;
|
||||
ui.current.innerHTML = "Your account is current.";
|
||||
} else if (data.account.balance < 0) {
|
||||
ui.balance.className = elements.balancePositive;
|
||||
ui.balanceStatus.innerHTML = " credit";
|
||||
ui.current.innerHTML = "This will be applied towards future invoices.";
|
||||
data.account.balance = -data.account.balance;
|
||||
} else {
|
||||
ui.balance.className = elements.balanceNegative;
|
||||
ui.balanceStatus.innerHTML = " due ";
|
||||
ui.pay.href += "?amount=" + (-data.account.balance);
|
||||
ui.pay.style.display = "initial";
|
||||
ui.current.innerHTML = "Please pay now to avoid any service interruptions.";
|
||||
}
|
||||
ui.balance.innerHTML = "$" + data.account.balance.toFixed(2);
|
||||
ui.uninvoicedBalance.innerHTML = "$" + data.account.balance_uninvoiced.toFixed(2);
|
||||
if (data.account.balance_uninvoiced > 0)
|
||||
ui.uninvoiced.style.display = "table-row";
|
||||
|
||||
// Promotions
|
||||
if (data.account.active_promotions.length) {
|
||||
for (var i = 0; i < ui.promotions.length; i++)
|
||||
ui.promotions[i].style.display = "table-row-group";
|
||||
}
|
||||
for (var i = 0; i < data.account.active_promotions.length; i++)
|
||||
ui.promotionsTable.appendChild(createPromoRow(data.account.active_promotions[i]));
|
||||
|
||||
var active = new Date(data.account.active_since + "Z");
|
||||
ui.active.innerHTML = active.toLocaleDateString();
|
||||
};
|
||||
|
||||
// Callback for invoices API call
|
||||
var displayInvoices = function(response)
|
||||
{
|
||||
data.invoices = data.invoices.concat(response.data);
|
||||
|
||||
// Request the next page if there are more
|
||||
if (response.page != response.pages) {
|
||||
apiGet("/account/invoices?page=" + (response.page + 1), displayInvoices, null);
|
||||
return;
|
||||
}
|
||||
|
||||
state.haveInvoices = true;
|
||||
if (state.havePayments)
|
||||
displayRecent();
|
||||
};
|
||||
|
||||
// Callback for linodes API call
|
||||
var displayLinodes = function(response)
|
||||
{
|
||||
data.linodes = data.linodes.concat(response.data);
|
||||
|
||||
// Request the next page if there are more
|
||||
if (response.page != response.pages) {
|
||||
apiGet("/linode/instances?page=" + (response.page + 1), displayLinodes, null);
|
||||
return;
|
||||
}
|
||||
|
||||
ui.managedButton.disabled = false;
|
||||
};
|
||||
|
||||
// Callback for payments API call
|
||||
var displayPayments = function(response)
|
||||
{
|
||||
data.payments = data.payments.concat(response.data);
|
||||
|
||||
// Request the next page if there are more
|
||||
if (response.page != response.pages) {
|
||||
apiGet("/account/payments?page=" + (response.page + 1), displayPayments, null);
|
||||
return;
|
||||
}
|
||||
|
||||
state.havePayments = true;
|
||||
if (state.haveInvoices)
|
||||
displayRecent();
|
||||
};
|
||||
|
||||
// Populates table with recent invoices and payments
|
||||
var displayRecent = function()
|
||||
{
|
||||
// Combine to single array and sort by date
|
||||
var recent = data.invoices.concat(data.payments);
|
||||
recent.sort(function(a, b)
|
||||
{
|
||||
var aDate = new Date(a.date + "Z");
|
||||
var bDate = new Date(b.date + "Z");
|
||||
return aDate - bDate;
|
||||
});
|
||||
|
||||
// Insert items into table
|
||||
for (var i = recent.length - 1, count = 0; i >= 0, count < 4; i--, count++)
|
||||
ui.billingActivity.appendChild(createRecentRow(recent[i], ui.billingActivity.children.length % 2));
|
||||
};
|
||||
|
||||
// Callback for account settings API call
|
||||
var displaySettings = function(response)
|
||||
{
|
||||
// Show managed signup if not managed
|
||||
if (!response.managed)
|
||||
ui.managed.style.display = "table";
|
||||
};
|
||||
|
||||
// Click handler for managed button
|
||||
var handleManaged = function(event)
|
||||
{
|
||||
if (event.currentTarget.disabled)
|
||||
return;
|
||||
|
||||
if (!confirm("Linode Managed costs an additional $100/mo per Linode. This will increase your projected monthly bill by $" + (data.linodes.length * 100) + ". Are you sure?"))
|
||||
return;
|
||||
|
||||
apiPost("/account/settings/managed-enable", {}, function(response)
|
||||
{
|
||||
location.reload();
|
||||
});
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Get element references
|
||||
ui.active = document.getElementById(elements.active);
|
||||
ui.address = document.getElementById(elements.address);
|
||||
ui.balance = document.getElementById(elements.balance);
|
||||
ui.balanceStatus = document.getElementById(elements.balanceStatus);
|
||||
ui.billingActivity = document.getElementById(elements.billingActivity);
|
||||
ui.ccNumber = document.getElementById(elements.ccNumber);
|
||||
ui.ccDuration = document.getElementById(elements.ccDuration);
|
||||
ui.ccExpire = document.getElementById(elements.ccExpire);
|
||||
ui.current = document.getElementById(elements.current);
|
||||
ui.email = document.getElementById(elements.email);
|
||||
ui.gdpr = document.getElementsByClassName(elements.gdpr);
|
||||
ui.gdprDate = document.getElementById(elements.gdprDate);
|
||||
ui.managed = document.getElementById(elements.managed);
|
||||
ui.managedButton = document.getElementById(elements.managedButton);
|
||||
ui.pay = document.getElementById(elements.pay);
|
||||
ui.promotions = document.getElementsByClassName(elements.promotions);
|
||||
ui.promotionsTable = document.getElementById(elements.promotionsTable);
|
||||
ui.uninvoiced = document.getElementById(elements.uninvoiced);
|
||||
ui.uninvoicedBalance = document.getElementById(elements.uninvoicedBalance);
|
||||
|
||||
// Register event handlers
|
||||
ui.managedButton.addEventListener("click", handleManaged);
|
||||
|
||||
// Get data from API
|
||||
apiGet("/account", displayAccount, null);
|
||||
apiGet("/account/settings", displaySettings, null);
|
||||
apiGet("/account/invoices", displayInvoices, null);
|
||||
apiGet("/account/payments", displayPayments, null);
|
||||
apiGet("/linode/instances", displayLinodes, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
30
account/backups_enable_all/backups_enable_all.css
Normal file
30
account/backups_enable_all/backups_enable_all.css
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
#backups-enable-all {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.info {
|
||||
font-size: 12px;
|
||||
}
|
179
account/backups_enable_all/backups_enable_all.js
Normal file
179
account/backups_enable_all/backups_enable_all.js
Normal file
@ -0,0 +1,179 @@
|
||||
/*
|
||||
* 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, apiPost, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.cost = "cost";
|
||||
elements.doIt = "doit";
|
||||
elements.linodeCount = "linode-count";
|
||||
elements.subnav = "subnav-link";
|
||||
elements.subnavActive = "subnav-link-active";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
data.linodes = [];
|
||||
data.plans = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.cost = {};
|
||||
ui.dotIt = {};
|
||||
ui.linodeCount = [];
|
||||
|
||||
// Temporary state
|
||||
var state = {};
|
||||
state.haveLinodes = false;
|
||||
state.havePlans = false;
|
||||
state.numResponses = 0;
|
||||
state.numRequests = 0;
|
||||
|
||||
// Computes and displays the total monthly cost
|
||||
var displayCost = function()
|
||||
{
|
||||
var cost = 0;
|
||||
var haveAll = true;
|
||||
for (var i = 0; i < data.linodes.length; i++) {
|
||||
if (data.linodes[i].backups.enabled)
|
||||
continue;
|
||||
|
||||
if (!data.plans[data.linodes[i].type]) {
|
||||
haveAll = false;
|
||||
apiGet("/linode/types/" + data.linodes[i].type, function(response)
|
||||
{
|
||||
data.plans[response.id] = response;
|
||||
displayCost();
|
||||
}, null);
|
||||
continue;
|
||||
}
|
||||
|
||||
cost += data.plans[data.linodes[i].type].addons.backups.price.monthly;
|
||||
}
|
||||
|
||||
if (haveAll) {
|
||||
ui.cost.innerHTML = cost.toFixed(2);
|
||||
ui.doIt.disabled = false;
|
||||
}
|
||||
};
|
||||
|
||||
// Callback for linodes API call
|
||||
var displayLinodes = function(response)
|
||||
{
|
||||
data.linodes = data.linodes.concat(response.data);
|
||||
|
||||
// Request the next page if there are more
|
||||
if (response.page != response.pages) {
|
||||
apiGet("/linode/instances?page=" + (response.page + 1), displayLinodes, null);
|
||||
return;
|
||||
}
|
||||
|
||||
state.haveLinodes = true;
|
||||
|
||||
// Display count of linodes without backups
|
||||
var count = 0;
|
||||
for (var i = 0; i < data.linodes.length; i++) {
|
||||
if (!data.linodes[i].backups.enabled)
|
||||
count++;
|
||||
}
|
||||
|
||||
// If there are no linodes without backups, go back
|
||||
if (!count)
|
||||
location.href = "/account/settings";
|
||||
|
||||
for (var i = 0; i < ui.linodeCount.length; i++)
|
||||
ui.linodeCount[i].innerHTML = count;
|
||||
|
||||
if (state.havePlans)
|
||||
displayCost();
|
||||
};
|
||||
|
||||
// Callback for plans API call
|
||||
var displayPlans = function(response)
|
||||
{
|
||||
for (var i = 0; i < response.data.length; i++)
|
||||
data.plans[response.data[i].id] = response.data[i];
|
||||
|
||||
// Request the next page if there are more
|
||||
if (response.page != response.pages) {
|
||||
apiGet("/linode/types?page=" + (response.page + 1), displayPlans, null);
|
||||
return;
|
||||
}
|
||||
|
||||
state.havePlans = true;
|
||||
|
||||
if (state.haveLinode)
|
||||
displayCost();
|
||||
};
|
||||
|
||||
// Click handler for enable button
|
||||
var doIt = function(event)
|
||||
{
|
||||
if (event.currentTarget.disabled)
|
||||
return;
|
||||
|
||||
// Enable backups for each linode without backups
|
||||
for (var i = 0; i < data.linodes.length; i++) {
|
||||
if (data.linodes[i].backups.enabled)
|
||||
continue;
|
||||
|
||||
state.numRequests++;
|
||||
apiPost("/linode/instances/" + data.linodes[i].id + "/backups/enable", {}, function(response)
|
||||
{
|
||||
state.numResponses++;
|
||||
if (state.numResponses >= state.numRequests)
|
||||
location.href = "/account/settings";
|
||||
});
|
||||
}
|
||||
|
||||
ui.doIt.disabled = true;
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Highlight the account settings subnav link
|
||||
var subnavLinks = document.getElementsByClassName(elements.subnav);
|
||||
for (var i = 0; i < subnavLinks.length; i++) {
|
||||
if (subnavLinks[i].pathname == "/account/settings")
|
||||
subnavLinks[i].className = elements.subnav + " " + elements.subnavActive;
|
||||
else
|
||||
subnavLinks[i].className = elements.subnav;
|
||||
}
|
||||
|
||||
// Get element references
|
||||
ui.cost = document.getElementById(elements.cost);
|
||||
ui.doIt = document.getElementById(elements.doIt);
|
||||
ui.linodeCount = document.getElementsByClassName(elements.linodeCount);
|
||||
|
||||
// Attach event handlers
|
||||
ui.doIt.addEventListener("click", doIt);
|
||||
|
||||
// Get data from the API
|
||||
apiGet("/linode/instances", displayLinodes, null);
|
||||
apiGet("/linode/types", displayPlans, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
39
account/backups_enable_all/index.shtml
Normal file
39
account/backups_enable_all/index.shtml
Normal file
@ -0,0 +1,39 @@
|
||||
<!--
|
||||
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 // Enable Backups for All Linodes</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="backups_enable_all.css" />
|
||||
<script src="backups_enable_all.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="backups-enable-all">
|
||||
<h2>Backup Enrollment</h2>
|
||||
<p>This will enable the Linode Backup Service for <strong><span class="linode-count"></span></strong> Linodes, for a total additional cost of <strong>$<span id="cost"></span></strong>/month.</p>
|
||||
<p>Are you sure you want to do this?</p>
|
||||
<p class="info">The cost of the Linode Backup Service for each Linode plan is listed on the <a href="https://www.linode.com/products/backups" target="_blank">Backups info page</a>.</p>
|
||||
<button disabled id="doit" type="button">Yes, I want to enable Backups for <span class="linode-count"></span> Linodes</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
44
account/billing_history/billing_history.css
Normal file
44
account/billing_history/billing_history.css
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
.balance-negative {
|
||||
color: #F00;
|
||||
}
|
||||
|
||||
.balance-positive {
|
||||
color: #008000;
|
||||
}
|
||||
|
||||
#billing-history {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
#current {
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
td:nth-of-type(3) {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
tr {
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
}
|
210
account/billing_history/billing_history.js
Normal file
210
account/billing_history/billing_history.js
Normal file
@ -0,0 +1,210 @@
|
||||
/*
|
||||
* 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, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.balance = "balance";
|
||||
elements.balanceNegative = "balance-negative";
|
||||
elements.billingTable = "billing-table";
|
||||
elements.lmcRow = "lmc-tr1";
|
||||
elements.lmcRowAlt = "lmc-tr2";
|
||||
elements.loading = "loading";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
data.invoices = [];
|
||||
data.payments = [];
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.balance = {};
|
||||
ui.billingTable = {};
|
||||
ui.loading = {};
|
||||
|
||||
// Temporary state
|
||||
var state = {};
|
||||
state.haveInvoices = false;
|
||||
state.havePayments = false;
|
||||
|
||||
// Creates a row for the billing table
|
||||
var createBillingRow = function(item, alt)
|
||||
{
|
||||
var row = document.createElement("tr");
|
||||
if (alt)
|
||||
row.className = elements.lmcRowAlt;
|
||||
else
|
||||
row.className = elements.lmcRow;
|
||||
|
||||
var dateCell = document.createElement("td");
|
||||
var date = new Date(item.date + "Z");
|
||||
dateCell.innerHTML = date.toLocaleDateString();
|
||||
row.appendChild(dateCell);
|
||||
|
||||
var description = document.createElement("td");
|
||||
var amount = document.createElement("td");
|
||||
|
||||
if (item.year) {
|
||||
// Yearly payment report
|
||||
var span1 = document.createElement("span");
|
||||
span1.innerHTML = "Yearly Payments Report (";
|
||||
var link = document.createElement("a");
|
||||
link.href = "/account/paymentreceiptyear?year=" + item.year;
|
||||
link.innerHTML = item.year;
|
||||
var span2 = document.createElement("span");
|
||||
span2.innerHTML = ")";
|
||||
description.appendChild(span1);
|
||||
description.appendChild(link);
|
||||
description.appendChild(span2);
|
||||
} else if (item.label) {
|
||||
// Invoice
|
||||
var link = document.createElement("a");
|
||||
link.href = "/account/invoice?iid=" + item.id;
|
||||
link.innerHTML = item.label;
|
||||
description.appendChild(link);
|
||||
|
||||
if (item.total < 0)
|
||||
amount.innerHTML = "($" + (-item.total).toFixed(2) + ")";
|
||||
else
|
||||
amount.innerHTML = "$" + item.total.toFixed(2);
|
||||
} else {
|
||||
// Payment
|
||||
var link = document.createElement("a");
|
||||
link.href = "/account/paymentreceipt?pid=" + item.id;
|
||||
link.innerHTML = "Payment";
|
||||
var thanks = document.createElement("span");
|
||||
thanks.innerHTML = " - Thank you";
|
||||
description.appendChild(link);
|
||||
description.appendChild(thanks);
|
||||
|
||||
if (item.usd > 0)
|
||||
amount.innerHTML = "($" + item.usd.toFixed(2) + ")";
|
||||
else
|
||||
amount.innerHTML = "$" + (-item.usd).toFixed(2);
|
||||
}
|
||||
|
||||
row.appendChild(description);
|
||||
row.appendChild(amount);
|
||||
|
||||
return row;
|
||||
};
|
||||
|
||||
// Populate billing table with invoices and payments
|
||||
var displayAll = function()
|
||||
{
|
||||
// Remove loading row
|
||||
ui.loading.remove();
|
||||
|
||||
// Combine to single array
|
||||
var combined = data.invoices.concat(data.payments);
|
||||
|
||||
// Insert yearly payment reports
|
||||
var now = new Date();
|
||||
var lowestYear = now.getFullYear();
|
||||
for (var i = 0; i < combined.length; i++) {
|
||||
var date = new Date(combined[i].date + "Z");
|
||||
if (date.getFullYear() < lowestYear)
|
||||
lowestYear = date.getFullYear();
|
||||
}
|
||||
for (var i = now.getFullYear(); i >= lowestYear; i--) {
|
||||
combined.push({
|
||||
"date": i + "-01-01T12:00:00",
|
||||
"year": i
|
||||
});
|
||||
}
|
||||
|
||||
// Sort
|
||||
combined.sort(function(a, b)
|
||||
{
|
||||
var aDate = new Date(a.date + "Z");
|
||||
var bDate = new Date(b.date + "Z");
|
||||
return bDate - aDate;
|
||||
});
|
||||
|
||||
// Insert
|
||||
for (var i = 0; i < combined.length; i++)
|
||||
ui.billingTable.appendChild(createBillingRow(combined[i], ui.billingTable.children.length % 2));
|
||||
};
|
||||
|
||||
// Callback for account details API call
|
||||
var displayBalance = function(response)
|
||||
{
|
||||
ui.balance.innerHTML = "$" + response.balance.toFixed(2);
|
||||
if (response.balance < 0) {
|
||||
ui.balance.innerHTML += " credit";
|
||||
} else if (response.balance > 0) {
|
||||
ui.balance.innerHTML += " outstanding";
|
||||
ui.balance.className = elements.balanceNegative;
|
||||
}
|
||||
};
|
||||
|
||||
// Callback for invoices API call
|
||||
var displayInvoices = function(response)
|
||||
{
|
||||
data.invoices = data.invoices.concat(response.data);
|
||||
|
||||
// Request the next page if there are more
|
||||
if (response.page != response.pages) {
|
||||
apiGet("/account/invoices?page=" + (response.page + 1), displayInvoices, null);
|
||||
return;
|
||||
}
|
||||
|
||||
state.haveInvoices = true;
|
||||
if (state.havePayments)
|
||||
displayAll();
|
||||
};
|
||||
|
||||
// Callback for payments API call
|
||||
var displayPayments = function(response)
|
||||
{
|
||||
data.payments = data.payments.concat(response.data);
|
||||
|
||||
// Request the next page if there are more
|
||||
if (response.page != response.pages) {
|
||||
apiGet("/account/payments?page=" + (response.page + 1), displayPayments, null);
|
||||
return;
|
||||
}
|
||||
|
||||
state.havePayments = true;
|
||||
if (state.haveInvoices)
|
||||
displayAll();
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Get element references
|
||||
ui.balance = document.getElementById(elements.balance);
|
||||
ui.billingTable = document.getElementById(elements.billingTable);
|
||||
ui.loading = document.getElementById(elements.loading);
|
||||
|
||||
// Get data from API
|
||||
apiGet("/account", displayBalance, null);
|
||||
apiGet("/account/invoices", displayInvoices, null);
|
||||
apiGet("/account/payments", displayPayments, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
52
account/billing_history/index.shtml
Normal file
52
account/billing_history/index.shtml
Normal file
@ -0,0 +1,52 @@
|
||||
<!--
|
||||
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 // Billing History</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="billing_history.css" />
|
||||
<script src="billing_history.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="billing-history">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="3">Billing History</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Date</td>
|
||||
<td>Description</td>
|
||||
<td>Amount</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="billing-table">
|
||||
<tr id="loading" class="lmc-tr1">
|
||||
<td colspan="3">Loading...</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p id="current">Current Balance <span id="balance" class="balance-positive"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
34
account/cancel/cancel.css
Normal file
34
account/cancel/cancel.css
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
#cancel {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
#cancel-note {
|
||||
background-color: #8BCBEA;
|
||||
margin: 15px auto 0;
|
||||
padding: 10px;
|
||||
width: 51%;
|
||||
}
|
||||
|
||||
tbody tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
74
account/cancel/cancel.js
Normal file
74
account/cancel/cancel.js
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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, apiPost, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.cancelButton = "cancel-button";
|
||||
elements.confirm = "confirm";
|
||||
elements.reason = "reason";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.cancelButton = {};
|
||||
ui.confirm = {};
|
||||
ui.reason = {};
|
||||
|
||||
// Click handler for cancel button
|
||||
var handleCancel = function(event)
|
||||
{
|
||||
if (!ui.confirm.checked)
|
||||
return;
|
||||
|
||||
var req = {
|
||||
"comments": ui.reason.value
|
||||
};
|
||||
|
||||
apiPost("/account/cancel", req, function(response)
|
||||
{
|
||||
if (response.survey_link)
|
||||
location.href = response.survey_link;
|
||||
else
|
||||
location.href = "/logout";
|
||||
});
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Get element references
|
||||
ui.cancelButton = document.getElementById(elements.cancelButton);
|
||||
ui.confirm = document.getElementById(elements.confirm);
|
||||
ui.reason = document.getElementById(elements.reason);
|
||||
|
||||
// Attach event handlers
|
||||
ui.cancelButton.addEventListener("click", handleCancel);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
62
account/cancel/index.shtml
Normal file
62
account/cancel/index.shtml
Normal file
@ -0,0 +1,62 @@
|
||||
<!--
|
||||
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 // Cancel</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="cancel.css" />
|
||||
<script src="cancel.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="cancel">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2">Cancel Account</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">Sorry to see you go!</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Reason</td>
|
||||
<td>
|
||||
Please share why you're cancelling your account:<br />
|
||||
<textarea id="reason" rows="6" cols="65"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td></td>
|
||||
<td>
|
||||
<input id="confirm" type="checkbox" /> <label for="confirm">I confirm that I want to cancel this entire account</label><br />
|
||||
<br />
|
||||
<button id="cancel-button" type="button">Cancel this Account Immediately</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p id="cancel-note">NOTE: This will <strong>immediately</strong> shut down and cancel all of your Linodes, DNS hosting, and inactivate all Users. You will not be able to log into your account after cancelling.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
27
account/contact/contact.css
Normal file
27
account/contact/contact.css
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
#contact {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
tbody tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
143
account/contact/contact.js
Normal file
143
account/contact/contact.js
Normal file
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* 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";
|
||||
import { countries } from "/account/contact/countries.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.address1 = "address1";
|
||||
elements.address2 = "address2";
|
||||
elements.city = "city";
|
||||
elements.company = "company";
|
||||
elements.country = "country";
|
||||
elements.email = "email";
|
||||
elements.firstName = "first-name";
|
||||
elements.lastName = "last-name";
|
||||
elements.phone = "phone";
|
||||
elements.saveButton = "save-button";
|
||||
elements.state = "state";
|
||||
elements.tax = "tax";
|
||||
elements.zip = "zip";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.address1 = {};
|
||||
ui.address2 = {};
|
||||
ui.city = {};
|
||||
ui.company = {};
|
||||
ui.country = {};
|
||||
ui.email = {};
|
||||
ui.firstName = {};
|
||||
ui.lastName = {};
|
||||
ui.phone = {};
|
||||
ui.saveButton = {};
|
||||
ui.state = {};
|
||||
ui.tax = {};
|
||||
ui.zip = {};
|
||||
|
||||
// Callback for account details API call
|
||||
var displayAccount = function(response)
|
||||
{
|
||||
ui.company.value = response.company;
|
||||
ui.email.value = response.email;
|
||||
ui.firstName.value = response.first_name;
|
||||
ui.lastName.value = response.last_name;
|
||||
ui.address1.value = response.address_1;
|
||||
ui.address2.value = response.address_2;
|
||||
ui.city.value = response.city;
|
||||
ui.state.value = response.state;
|
||||
ui.zip.value = response.zip;
|
||||
ui.country.value = response.country;
|
||||
ui.tax.value = response.tax_id;
|
||||
ui.phone.value = response.phone;
|
||||
|
||||
ui.saveButton.disabled = false;
|
||||
};
|
||||
|
||||
// Click handler for save button
|
||||
var handleSave = function(event)
|
||||
{
|
||||
if (event.currentTarget.disabled)
|
||||
return;
|
||||
|
||||
var req = {
|
||||
"company": ui.company.value,
|
||||
"email": ui.email.value,
|
||||
"first_name": ui.firstName.value,
|
||||
"last_name": ui.lastName.value,
|
||||
"address_1": ui.address1.value,
|
||||
"address_2": ui.address2.value,
|
||||
"city": ui.city.value,
|
||||
"state": ui.state.value,
|
||||
"zip": ui.zip.value,
|
||||
"country": ui.country.value,
|
||||
"tax": ui.tax.value,
|
||||
"phone": ui.phone.value
|
||||
};
|
||||
|
||||
apiPut("/account", req, function(response)
|
||||
{
|
||||
location.href = "/account";
|
||||
});
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Get element references
|
||||
ui.address1 = document.getElementById(elements.address1);
|
||||
ui.address2 = document.getElementById(elements.address2);
|
||||
ui.city = document.getElementById(elements.city);
|
||||
ui.company = document.getElementById(elements.company);
|
||||
ui.country = document.getElementById(elements.country);
|
||||
ui.email = document.getElementById(elements.email);
|
||||
ui.firstName = document.getElementById(elements.firstName);
|
||||
ui.lastName = document.getElementById(elements.lastName);
|
||||
ui.phone = document.getElementById(elements.phone);
|
||||
ui.saveButton = document.getElementById(elements.saveButton);
|
||||
ui.state = document.getElementById(elements.state);
|
||||
ui.tax = document.getElementById(elements.tax);
|
||||
ui.zip = document.getElementById(elements.zip);
|
||||
|
||||
// Populate country selector
|
||||
for (var i = 0; i < countries.length; i++) {
|
||||
var option = document.createElement("option");
|
||||
option.value = countries[i].code;
|
||||
option.innerHTML = countries[i]["name"];
|
||||
ui.country.appendChild(option);
|
||||
}
|
||||
|
||||
// Register event handlers
|
||||
ui.saveButton.addEventListener("click", handleSave);
|
||||
|
||||
// Get data from API
|
||||
apiGet("/account", displayAccount, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
1013
account/contact/countries.js
Normal file
1013
account/contact/countries.js
Normal file
File diff suppressed because it is too large
Load Diff
107
account/contact/index.shtml
Normal file
107
account/contact/index.shtml
Normal file
@ -0,0 +1,107 @@
|
||||
<!--
|
||||
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 // Contact Info</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="contact.css" />
|
||||
<script src="contact.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="contact">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="3">Contact Information</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Company Name</td>
|
||||
<td><input id="company" type="text" size="30" maxLength="128" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Email</td>
|
||||
<td><input id="email" type="email" size="30" maxLength="128" /></td>
|
||||
<td class="info">Main point of contact and receives all emails.</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>First Name</td>
|
||||
<td><input id="first-name" type="text" size="30" maxLength="50" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Last Name</td>
|
||||
<td><input id="last-name" type="text" size="30" maxLength="50" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Address1</td>
|
||||
<td><input id="address1" type="text" size="30" maxLength="64" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Address2</td>
|
||||
<td><input id="address2" type="text" size="30" maxLength="64" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>City</td>
|
||||
<td><input id="city" type="text" size="30" maxLength="24" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>State</td>
|
||||
<td><input id="state" type="text" size="30" maxLength="24" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Zip</td>
|
||||
<td><input id="zip" type="text" size="30" maxLength="16" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Country</td>
|
||||
<td><select id="country"></select></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Tax ID</td>
|
||||
<td><input id="tax" type="text" size="30" maxLength="100" /></td>
|
||||
<td class="info">VAT, GST, etc. identification number</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Phone1</td>
|
||||
<td><input id="phone" type="tel" size="30" maxLength="32" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td></td>
|
||||
<td colspan="2"><button disabled id="save-button" type="button">Save Changes</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
27
account/creditcard/creditcard.css
Normal file
27
account/creditcard/creditcard.css
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
#creditcard {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
105
account/creditcard/creditcard.js
Normal file
105
account/creditcard/creditcard.js
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* 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, apiPost, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.ccCurrent = "cc-current";
|
||||
elements.ccNew = "cc-new";
|
||||
elements.expiryCurrent = "expiry-current";
|
||||
elements.expiryMonth = "expiry-month";
|
||||
elements.expiryYear = "expiry-year";
|
||||
elements.updateButton = "update-button";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.ccCurrent = {};
|
||||
ui.ccNew = {};
|
||||
ui.expiryCurrent = {};
|
||||
ui.expiryMonth = {};
|
||||
ui.expiryYear = {};
|
||||
ui.updateButton = {};
|
||||
|
||||
// Callback for account details API call
|
||||
var displayCC = function(response)
|
||||
{
|
||||
if (!response.credit_card)
|
||||
return;
|
||||
|
||||
ui.ccCurrent.innerHTML = response.credit_card.last_four;
|
||||
ui.expiryCurrent.innerHTML = response.credit_card.expiry;
|
||||
};
|
||||
|
||||
// Click handler for update button
|
||||
var handleUpdate = function(event)
|
||||
{
|
||||
if (event.currentTarget.disabled)
|
||||
return;
|
||||
|
||||
var req = {
|
||||
"card_number": ui.ccNew.value,
|
||||
"expiry_month": parseInt(ui.expiryMonth.value),
|
||||
"expiry_year": parseInt(ui.expiryYear.value)
|
||||
};
|
||||
|
||||
apiPost("/account/credit-card", req, function(response)
|
||||
{
|
||||
location.href = "/account";
|
||||
});
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Get element references
|
||||
ui.ccCurrent = document.getElementById(elements.ccCurrent);
|
||||
ui.ccNew = document.getElementById(elements.ccNew);
|
||||
ui.expiryCurrent = document.getElementById(elements.expiryCurrent);
|
||||
ui.expiryMonth = document.getElementById(elements.expiryMonth);
|
||||
ui.expiryYear = document.getElementById(elements.expiryYear);
|
||||
ui.updateButton = document.getElementById(elements.updateButton);
|
||||
|
||||
// Populate expiry selectors
|
||||
var now = new Date();
|
||||
ui.expiryMonth.value = now.getMonth() + 1;
|
||||
for (var i = 0; i < 25; i++) {
|
||||
var year = document.createElement("option");
|
||||
year.value = now.getFullYear() + i;
|
||||
year.innerHTML = now.getFullYear() + i;
|
||||
ui.expiryYear.appendChild(year);
|
||||
}
|
||||
|
||||
// Register event handlers
|
||||
ui.updateButton.addEventListener("click", handleUpdate);
|
||||
|
||||
// Get data from API
|
||||
apiGet("/account", displayCC, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
91
account/creditcard/index.shtml
Normal file
91
account/creditcard/index.shtml
Normal file
@ -0,0 +1,91 @@
|
||||
<!--
|
||||
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 // Update Credit Card</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="creditcard.css" />
|
||||
<script src="creditcard.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="creditcard">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="3">Update Credit Card</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">Current Card</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Current Card</td>
|
||||
<td>xxxxxxxxxxxx<span id="cc-current"></span> Exp: <span id="expiry-current"></span></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody class="lmc-tbody-head">
|
||||
<tr class="noshow">
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">Update Card</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>New Card Number</td>
|
||||
<td><input id="cc-new" type="text" /></td>
|
||||
<td class="info">Linode accepts Visa, MasterCard, American Express, and Discover</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Expires</td>
|
||||
<td>
|
||||
<select id="expiry-month">
|
||||
<option value="1">01</option>
|
||||
<option value="2">02</option>
|
||||
<option value="3">03</option>
|
||||
<option value="4">04</option>
|
||||
<option value="5">05</option>
|
||||
<option value="6">06</option>
|
||||
<option value="7">07</option>
|
||||
<option value="8">08</option>
|
||||
<option value="9">09</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
</select>
|
||||
<select id="expiry-year"></select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td></td>
|
||||
<td colspan="2"><button id="update-button" type="button">Update Credit Card</button>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
165
account/index.shtml
Normal file
165
account/index.shtml
Normal file
@ -0,0 +1,165 @@
|
||||
<!--
|
||||
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</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="account.css" />
|
||||
<script src="account.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="account">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="3">Account Information</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">Contact</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Address</td>
|
||||
<td colspan="2" id="address"></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Email</td>
|
||||
<td colspan="2" id="email"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody class="lmc-tbody-head">
|
||||
<tr class="noshow">
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">Credit Card</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Credit Card</td>
|
||||
<td colspan="2">
|
||||
xxxxxxxxxxxx<span id="cc-number"></span> Exp: <span id="cc-expire"></span><br />
|
||||
<span id="cc-duration"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody class="lmc-tbody-head">
|
||||
<tr class="noshow">
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">Recent Billing Activity</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr id="billing-row" class="lmc-tr3">
|
||||
<td>Recent Activity</td>
|
||||
<td colspan="2">
|
||||
<table class="lmc-table">
|
||||
<tbody id="billing-activity"></tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="billing-link" class="lmc-tr3">
|
||||
<td></td>
|
||||
<td colspan="2"><a href="/account/billing_history">Billing History »</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody class="lmc-tbody-head">
|
||||
<tr class="noshow">
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">Account Balance</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Account Balance</td>
|
||||
<td><span id="balance"></span><span id="balance-status"><a id="pay" href="/account/make_a_payment">(make a payment)</a></span></td>
|
||||
<td id="current" class="info"></td>
|
||||
</tr>
|
||||
<tr id="uninvoiced" class="lmc-tr3">
|
||||
<td>Uninvoiced Balance</td>
|
||||
<td><span id="uninvoiced-balance"></span> and counting</td>
|
||||
<td class="info">This will appear on your next invoice.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody class="lmc-tbody-head promotions">
|
||||
<tr class="noshow">
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">Promotions</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="promotions-table" class="promotions"></tbody>
|
||||
<tbody class="lmc-tbody-head gdpr">
|
||||
<tr class="noshow">
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">EU Model Contract</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody class="gdpr">
|
||||
<tr class="lmc-tr3">
|
||||
<td>Signed</td>
|
||||
<td colspan="2"><span id="gdpr-date"></span> (<a href="/account/eu_model">view</a>)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table id="managed" class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2">Upgrade to Managed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Linode Managed</td>
|
||||
<td>
|
||||
Let Linode worry about your infrastructure, so you can get back to worrying about your business. Linode Managed helps keep your systems up and running with a team of experts responding to monitoring events, so you can sleep well.<br />
|
||||
<br />
|
||||
Linode Managed includes 24/7 monitoring and incident responses, backups, and Longview Pro, +$100/mo. per Linode.
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td></td>
|
||||
<td><button disabled id="managed-button" type="button">Upgrade to Managed now!</button> <span id="learn-more">or <a target="_blank" href="https://www.linode.com/products/managed/">learn more</a>.</span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>
|
||||
Your account has been active since <span id="active"></span><br />
|
||||
<br />
|
||||
<a id="cancel" href="/account/cancel">Cancel this Account</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
68
account/invoice/index.shtml
Normal file
68
account/invoice/index.shtml
Normal file
@ -0,0 +1,68 @@
|
||||
<!--
|
||||
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 // View Invoice</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="invoice.css" />
|
||||
<script src="invoice.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="invoice">
|
||||
<table id="invoice-table" class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="8"><strong>Invoice #<span id="invoice-id"></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>From</td>
|
||||
<td>To</td>
|
||||
<td>Quantity</td>
|
||||
<td>Unit Price</td>
|
||||
<td>Subtotal</td>
|
||||
<td>Tax</td>
|
||||
<td>Total</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="invoice-body"></tbody>
|
||||
</table>
|
||||
<table id="totals">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Subtotal:</td>
|
||||
<td id="subtotal"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Tax:</td>
|
||||
<td id="tax"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Invoice Total:</td>
|
||||
<td id="total"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
59
account/invoice/invoice.css
Normal file
59
account/invoice/invoice.css
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
#invoice {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
#invoice-table td:nth-of-type(4) {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#invoice-table td:nth-of-type(5) {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#invoice-table td:nth-of-type(6) {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#invoice-table td:nth-of-type(7) {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#invoice-table td:nth-of-type(8) {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.lmc-table tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
}
|
||||
|
||||
#totals {
|
||||
margin: 20px 0 0 auto;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#totals td {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#totals tr:last-of-type {
|
||||
font-weight: bold;
|
||||
}
|
151
account/invoice/invoice.js
Normal file
151
account/invoice/invoice.js
Normal file
@ -0,0 +1,151 @@
|
||||
/*
|
||||
* 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, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.invoiceBody = "invoice-body";
|
||||
elements.invoiceID = "invoice-id";
|
||||
elements.lmcRow = "lmc-tr1";
|
||||
elements.lmcRowAlt = "lmc-tr2";
|
||||
elements.subnav = "subnav-link";
|
||||
elements.subnavActive = "subnav-link-active";
|
||||
elements.subtotal = "subtotal";
|
||||
elements.tax = "tax";
|
||||
elements.total = "total";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.invoiceBody = {};
|
||||
ui.invoiceID = {};
|
||||
ui.subtotal = {};
|
||||
ui.tax = {};
|
||||
ui.total = {};
|
||||
|
||||
// Generates an invoice item table row
|
||||
var createItemRow = function(item, alt)
|
||||
{
|
||||
var row = document.createElement("tr");
|
||||
if (alt)
|
||||
row.className = elements.lmcRowAlt;
|
||||
else
|
||||
row.className = elements.lmcRow;
|
||||
|
||||
var description = document.createElement("td");
|
||||
description.innerHTML = item.label;
|
||||
row.appendChild(description);
|
||||
|
||||
var from = document.createElement("td");
|
||||
var fromDate = new Date(item.from + "Z");
|
||||
from.innerHTML = fromDate.toLocaleString();
|
||||
row.appendChild(from);
|
||||
|
||||
var to = document.createElement("td");
|
||||
var toDate = new Date(item.to + "Z");
|
||||
to.innerHTML = toDate.toLocaleString();
|
||||
row.appendChild(to);
|
||||
|
||||
var quantity = document.createElement("td");
|
||||
quantity.innerHTML = item.quantity;
|
||||
row.appendChild(quantity);
|
||||
|
||||
var unitPrice = document.createElement("td");
|
||||
unitPrice.innerHTML = "$" + parseFloat(item.unit_price).toFixed(4);
|
||||
row.appendChild(unitPrice);
|
||||
|
||||
var subtotal = document.createElement("td");
|
||||
subtotal.innerHTML = "$" + item.amount.toFixed(2);
|
||||
row.appendChild(subtotal);
|
||||
|
||||
var tax = document.createElement("td");
|
||||
tax.innerHTML = "$" + item.tax.toFixed(2);
|
||||
row.appendChild(tax);
|
||||
|
||||
var total = document.createElement("td");
|
||||
total.innerHTML = "$" + item.total.toFixed(2);
|
||||
row.appendChild(total);
|
||||
|
||||
return row;
|
||||
};
|
||||
|
||||
// Callback for invoice API call
|
||||
var displayInvoice = function(response)
|
||||
{
|
||||
ui.subtotal.innerHTML = "$" + response.subtotal.toFixed(2);
|
||||
ui.tax.innerHTML = "$" + response.tax.toFixed(2);
|
||||
ui.total.innerHTML = "$" + response.total.toFixed(2);
|
||||
};
|
||||
|
||||
// Callback for invoice items API call
|
||||
var displayItems = function(response)
|
||||
{
|
||||
// Insert invoice items into table
|
||||
for (var i = 0; i < response.data.length; i++)
|
||||
ui.invoiceBody.appendChild(createItemRow(response.data[i], ui.invoiceBody.children.length % 2));
|
||||
|
||||
// Request the next page if there are more
|
||||
if (response.page != response.pages)
|
||||
apiGet("/account/invoices/" + data.params.iid + "/items?page=" + (response.page + 1), displayItems, null);
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
// We need an invoice ID, so die if we don't have it
|
||||
if (!data.params.iid) {
|
||||
alert("No invoice ID supplied!");
|
||||
return;
|
||||
}
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Highlight the remote access subnav link
|
||||
var subnavLinks = document.getElementsByClassName(elements.subnav);
|
||||
for (var i = 0; i < subnavLinks.length; i++) {
|
||||
if (subnavLinks[i].pathname == "/account/billing_history")
|
||||
subnavLinks[i].className = elements.subnav + " " + elements.subnavActive;
|
||||
else
|
||||
subnavLinks[i].className = elements.subnav;
|
||||
}
|
||||
|
||||
// Get element references
|
||||
ui.invoiceBody = document.getElementById(elements.invoiceBody);
|
||||
ui.invoiceID = document.getElementById(elements.invoiceID);
|
||||
ui.subtotal = document.getElementById(elements.subtotal);
|
||||
ui.tax = document.getElementById(elements.tax);
|
||||
ui.total = document.getElementById(elements.total);
|
||||
|
||||
// Set title and table header
|
||||
document.title += " " + data.params.iid;
|
||||
ui.invoiceID.innerHTML = data.params.iid;
|
||||
|
||||
// Get data from API
|
||||
apiGet("/account/invoices/" + data.params.iid, displayInvoice, null);
|
||||
apiGet("/account/invoices/" + data.params.iid + "/items", displayItems, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
96
account/make_a_payment/index.shtml
Normal file
96
account/make_a_payment/index.shtml
Normal file
@ -0,0 +1,96 @@
|
||||
<!--
|
||||
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 // Make a Payment</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="make_a_payment.css" />
|
||||
<script src="make_a_payment.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="make-a-payment">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="3">Make a Payment</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Current Balance</td>
|
||||
<td id="balance" class="balance-positive"></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody class="lmc-tbody-head">
|
||||
<tr class="noshow">
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">Make a Payment - via Credit Card</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Current Card</td>
|
||||
<td>xxxxxxxxxxxx<span id="cc-number"></span> Exp: <span id="cc-exp"></span></td>
|
||||
<td class="info"><a href="/account/creditcard">(update credit card)</a></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Amount to Charge</td>
|
||||
<td><input id="cc-amount" type="number" min="0" max="50000" step="0.01" value="0.00" /> <span class="info">(USD)</span></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>CVV</td>
|
||||
<td><input id="cvv" type="text" size="8" /> <span class="info">(optional)</span></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td></td>
|
||||
<td colspan="2"><button disabled id="cc-charge" type="button">Charge Credit Card</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody class="lmc-tbody-head">
|
||||
<tr class="noshow">
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">Make a Payment - via PayPal</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Amount to Pay</td>
|
||||
<td><input id="paypal-amount" type="number" min="0" max="10000" step="0.01" value="0.00" /> <span class="info">(USD)</span></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td></td>
|
||||
<td colspan="2"><button disabled id="paypal-charge" type="button">Continue...</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
43
account/make_a_payment/make_a_payment.css
Normal file
43
account/make_a_payment/make_a_payment.css
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
#balance {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.balance-negative {
|
||||
color: #F00;
|
||||
}
|
||||
|
||||
.balance-positive {
|
||||
color: #008000;
|
||||
}
|
||||
|
||||
input[type="number"] {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
#make-a-payment {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
125
account/make_a_payment/make_a_payment.js
Normal file
125
account/make_a_payment/make_a_payment.js
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* 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, apiPost, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.balance = "balance";
|
||||
elements.balanceNegative = "balance-negative";
|
||||
elements.ccAmount = "cc-amount";
|
||||
elements.ccCharge = "cc-charge";
|
||||
elements.ccExp = "cc-exp";
|
||||
elements.ccNumber = "cc-number";
|
||||
elements.cvv = "cvv";
|
||||
elements.paypalAmount = "paypal-amount";
|
||||
elements.paypalCharge = "paypal-charge";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.balance = {};
|
||||
ui.ccAmount = {};
|
||||
ui.ccCharge = {};
|
||||
ui.ccExp = {};
|
||||
ui.ccNumber = {};
|
||||
ui.cvv = {};
|
||||
ui.paypalAmount = {};
|
||||
ui.paypalCharge = {};
|
||||
|
||||
// Callback for account details API call
|
||||
var displayAccount = function(response)
|
||||
{
|
||||
ui.balance.innerHTML = "$";
|
||||
if (response.balance < 0) {
|
||||
ui.balance.innerHTML += (-response.balance).toFixed(2) + " credit";
|
||||
} else if (response.balance > 0) {
|
||||
ui.balance.innerHTML += response.balance.toFixed(2) + " outstanding";
|
||||
ui.balance.className = elements.balanceNegative;
|
||||
} else {
|
||||
ui.balance.innerHTML += response.balance.toFixed(2);
|
||||
}
|
||||
|
||||
if (response.credit_card) {
|
||||
ui.ccNumber.innerHTML = response.credit_card.last_four;
|
||||
ui.ccExp.innerHTML = response.credit_card.expiry;
|
||||
}
|
||||
|
||||
ui.ccCharge.disabled = false;
|
||||
//ui.paypalCharge.disabled = false;
|
||||
};
|
||||
|
||||
// Click handler for CC charge button
|
||||
var handleCharge = function(event)
|
||||
{
|
||||
if (event.currentTarget.disabled)
|
||||
return;
|
||||
|
||||
if (!confirm("Charge $" + parseInt(ui.ccAmount.value).toFixed(2) + " against your credit card?"))
|
||||
return;
|
||||
|
||||
var req = {
|
||||
"usd": ui.ccAmount.value
|
||||
};
|
||||
if (ui.cvv.value.length)
|
||||
req.cvv = ui.cvv.value;
|
||||
|
||||
apiPost("/account/payments", req, function(response)
|
||||
{
|
||||
location.href = "/account";
|
||||
});
|
||||
};
|
||||
|
||||
// Click handler for PayPal button
|
||||
var handlePayPal = function(event)
|
||||
{
|
||||
if (event.currentTarget.disabled)
|
||||
return;
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Get element references
|
||||
ui.balance = document.getElementById(elements.balance);
|
||||
ui.ccAmount = document.getElementById(elements.ccAmount);
|
||||
ui.ccCharge = document.getElementById(elements.ccCharge);
|
||||
ui.ccExp = document.getElementById(elements.ccExp);
|
||||
ui.ccNumber = document.getElementById(elements.ccNumber);
|
||||
ui.cvv = document.getElementById(elements.cvv);
|
||||
ui.paypalAmount = document.getElementById(elements.paypalAmount);
|
||||
ui.paypalCharge = document.getElementById(elements.paypalCharge);
|
||||
|
||||
// Register event handlers
|
||||
ui.ccCharge.addEventListener("click", handleCharge);
|
||||
ui.paypalCharge.addEventListener("click", handlePayPal);
|
||||
|
||||
// Get data from API
|
||||
apiGet("/account", displayAccount, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
54
account/paymentreceipt/index.shtml
Normal file
54
account/paymentreceipt/index.shtml
Normal file
@ -0,0 +1,54 @@
|
||||
<!--
|
||||
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 // View Payment</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="paymentreceipt.css" />
|
||||
<script src="paymentreceipt.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="paymentreceipt">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="3">Payment</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>Date</td>
|
||||
<td>Amount</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lmc-tr1">
|
||||
<td>Payment #<span id="payment-id"></span>. Thank you.</td>
|
||||
<td id="date"></td>
|
||||
<td id="amount"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Payment Total: <span id="total"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
36
account/paymentreceipt/paymentreceipt.css
Normal file
36
account/paymentreceipt/paymentreceipt.css
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
.lmc-table tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
}
|
||||
|
||||
#paymentreceipt {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
#paymentreceipt p {
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table td:nth-of-type(3) {
|
||||
text-align: right;
|
||||
}
|
87
account/paymentreceipt/paymentreceipt.js
Normal file
87
account/paymentreceipt/paymentreceipt.js
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.amount = "amount";
|
||||
elements.date = "date";
|
||||
elements.paymentID = "payment-id";
|
||||
elements.subnav = "subnav-link";
|
||||
elements.subnavActive = "subnav-link-active";
|
||||
elements.total = "total";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.amount = {};
|
||||
ui.date = {};
|
||||
ui.paymentID = {};
|
||||
ui.total = {};
|
||||
|
||||
// Callback for payment details API call
|
||||
var displayPayment = function(response)
|
||||
{
|
||||
var paymentDate = new Date(response.date + "Z");
|
||||
ui.date.innerHTML = paymentDate.toLocaleDateString();
|
||||
ui.amount.innerHTML = "$" + response.usd.toFixed(2);
|
||||
ui.total.innerHTML = "$" + response.usd.toFixed(2);
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
// We need a payment ID, so die if we don't have it
|
||||
if (!data.params.pid) {
|
||||
alert("No payment ID supplied!");
|
||||
return;
|
||||
}
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Highlight the billing history subnav link
|
||||
var subnavLinks = document.getElementsByClassName(elements.subnav);
|
||||
for (var i = 0; i < subnavLinks.length; i++) {
|
||||
if (subnavLinks[i].pathname == "/account/billing_history")
|
||||
subnavLinks[i].className = elements.subnav + " " + elements.subnavActive;
|
||||
else
|
||||
subnavLinks[i].className = elements.subnav;
|
||||
}
|
||||
|
||||
// Get element references
|
||||
ui.amount = document.getElementById(elements.amount);
|
||||
ui.date = document.getElementById(elements.date);
|
||||
ui.paymentID = document.getElementById(elements.paymentID);
|
||||
ui.total = document.getElementById(elements.total);
|
||||
|
||||
// Set payment ID
|
||||
ui.paymentID.innerHTML = data.params.pid;
|
||||
|
||||
// Get data from API
|
||||
apiGet("/account/payments/" + data.params.pid, displayPayment, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
55
account/paymentreceiptyear/index.shtml
Normal file
55
account/paymentreceiptyear/index.shtml
Normal file
@ -0,0 +1,55 @@
|
||||
<!--
|
||||
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 // View Payments in</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="paymentreceiptyear.css" />
|
||||
<script src="paymentreceiptyear.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="paymentreceiptyear">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="3">Payment(s) in <span id="year"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>Date</td>
|
||||
<td>Amount</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="payments-body">
|
||||
<tr id="loading" class="lmc-tr1">
|
||||
<td colspan="3">Loading...</td>
|
||||
</tr>
|
||||
<tr id="no-payments" class="lmc-tr1">
|
||||
<td colspan="3">No payments to display.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Payment Total: <span id="total"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
40
account/paymentreceiptyear/paymentreceiptyear.css
Normal file
40
account/paymentreceiptyear/paymentreceiptyear.css
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
.lmc-table tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
}
|
||||
|
||||
#no-payments {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#paymentreceiptyear {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
#paymentreceiptyear p {
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table td:nth-of-type(3) {
|
||||
text-align: right;
|
||||
}
|
146
account/paymentreceiptyear/paymentreceiptyear.js
Normal file
146
account/paymentreceiptyear/paymentreceiptyear.js
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* 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, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.lmcRow = "lmc-tr1";
|
||||
elements.lmcRowAlt = "lmc-tr2";
|
||||
elements.loading = "loading";
|
||||
elements.noPayments = "no-payments";
|
||||
elements.paymentsBody = "payments-body";
|
||||
elements.subnav = "subnav-link";
|
||||
elements.subnavActive = "subnav-link-active";
|
||||
elements.total = "total";
|
||||
elements.year = "year";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
data.payments = [];
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.loading = {};
|
||||
ui.noPayments = {};
|
||||
ui.paymentsBody = {};
|
||||
ui.total = {};
|
||||
ui.year = {};
|
||||
|
||||
// Generate a payment table row
|
||||
var createPaymentRow = function(payment, alt)
|
||||
{
|
||||
var row = document.createElement("tr");
|
||||
if (alt)
|
||||
row.className = elements.lmcRowAlt;
|
||||
else
|
||||
row.className = elements.lmcRow;
|
||||
|
||||
var description = document.createElement("td");
|
||||
description.innerHTML = "Payment. Thank you.";
|
||||
row.appendChild(description);
|
||||
|
||||
var date = document.createElement("td");
|
||||
var paymentDate = new Date(payment.date + "Z");
|
||||
date.innerHTML = paymentDate.toLocaleDateString();
|
||||
row.appendChild(date);
|
||||
|
||||
var amount = document.createElement("td");
|
||||
amount.innerHTML = "$" + payment.usd.toFixed(2);
|
||||
row.appendChild(amount);
|
||||
|
||||
return row;
|
||||
};
|
||||
|
||||
// Callback for payments API call
|
||||
var displayPayments = function(response)
|
||||
{
|
||||
// Only add payments from the specified year
|
||||
var year = parseInt(data.params.year);
|
||||
for (var i = 0; i < response.data.length; i++) {
|
||||
var paymentDate = new Date(response.data[i].date + "Z");
|
||||
if (paymentDate.getFullYear() == year)
|
||||
data.payments.push(response.data[i]);
|
||||
}
|
||||
|
||||
// Request the next page if there are more
|
||||
if (response.page != response.pages) {
|
||||
apiGet("/account/payments?page=" + (response.page + 1), displayPayments, null);
|
||||
return;
|
||||
}
|
||||
|
||||
ui.loading.remove();
|
||||
if (!data.payments.length) {
|
||||
ui.noPayments.style.display = "table-row";
|
||||
return;
|
||||
}
|
||||
|
||||
// Insert payments into table
|
||||
var total = 0.0;
|
||||
for (var i = 0; i < data.payments.length; i++) {
|
||||
total += data.payments[i].usd;
|
||||
ui.paymentsBody.appendChild(createPaymentRow(data.payments[i], i % 2));
|
||||
}
|
||||
|
||||
ui.total.innerHTML = "$" + total.toFixed(2);
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
// We need a year, so die if we don't have it
|
||||
if (!data.params.year) {
|
||||
alert("No payment ID supplied!");
|
||||
return;
|
||||
} else if (!parseInt(data.params.year)) {
|
||||
alert("Supplied year is invalid!");
|
||||
return;
|
||||
}
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Highlight the remote access subnav link
|
||||
var subnavLinks = document.getElementsByClassName(elements.subnav);
|
||||
for (var i = 0; i < subnavLinks.length; i++) {
|
||||
if (subnavLinks[i].pathname == "/account/billing_history")
|
||||
subnavLinks[i].className = elements.subnav + " " + elements.subnavActive;
|
||||
else
|
||||
subnavLinks[i].className = elements.subnav;
|
||||
}
|
||||
|
||||
// Get element references
|
||||
ui.loading = document.getElementById(elements.loading);
|
||||
ui.noPayments = document.getElementById(elements.noPayments);
|
||||
ui.paymentsBody = document.getElementById(elements.paymentsBody);
|
||||
ui.total = document.getElementById(elements.total);
|
||||
ui.year = document.getElementById(elements.year);
|
||||
|
||||
// Set year
|
||||
var year = parseInt(data.params.year);
|
||||
ui.year.innerHTML = year;
|
||||
|
||||
// Get data from API
|
||||
apiGet("/account/payments", displayPayments, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
83
account/settings/index.shtml
Normal file
83
account/settings/index.shtml
Normal 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>
|
35
account/settings/settings.css
Normal file
35
account/settings/settings.css
Normal 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;
|
||||
}
|
100
account/settings/settings.js
Normal file
100
account/settings/settings.js
Normal 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);
|
||||
})();
|
Reference in New Issue
Block a user