Added Account section
This commit is contained in:
parent
dd1809473c
commit
396ca2366e
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);
|
||||
})();
|
@ -29,10 +29,6 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
|
@ -21,10 +21,6 @@
|
||||
padding: 0px 15px 15px;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
|
4
dns/domain_import/domain_import.css
vendored
4
dns/domain_import/domain_import.css
vendored
@ -26,10 +26,6 @@
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
|
@ -26,7 +26,3 @@ tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
@ -30,7 +30,3 @@ tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head):not(.resource-section) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
@ -86,6 +86,14 @@ header {
|
||||
font-size: 13.3px;
|
||||
}
|
||||
|
||||
.lmc-table tbody:not(.lmc-tbody-head) tr {
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
}
|
||||
|
||||
.lmc-table tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.lmc-table tbody.lmc-tbody-head tr:first-of-type {
|
||||
font-weight: bold;
|
||||
}
|
||||
@ -118,7 +126,6 @@ header {
|
||||
|
||||
.lmc-tr3 {
|
||||
background-color: #FFF;
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
}
|
||||
|
||||
#logout-link {
|
||||
|
19
global.js
19
global.js
@ -50,7 +50,8 @@ var regionNames = {
|
||||
"ca-central": "Toronto, ON, CA",
|
||||
"ap-west": "Mumbai, IN",
|
||||
"ap-southeast": "Sydney, AU",
|
||||
"philadelphia": "Philadelphia, PA, USA"
|
||||
"philadelphia": "Philadelphia, PA, USA",
|
||||
"absecon": "Absecon, NJ, USA"
|
||||
};
|
||||
|
||||
// Human-readable event titles
|
||||
@ -163,7 +164,7 @@ function apiDelete(endpoint, callback)
|
||||
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.open("DELETE", settings.apiURL + endpoint, true);
|
||||
xmlhttp.setRequestHeader("Authorization", "Bearer " + localStorage.apiKey);
|
||||
xmlhttp.setRequestHeader("Authorization", localStorage.apiKey);
|
||||
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
@ -220,7 +221,7 @@ function apiGet(endpoint, callback, filters)
|
||||
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.open("GET", settings.apiURL + endpoint, true);
|
||||
xmlhttp.setRequestHeader("Authorization", "Bearer " + localStorage.apiKey);
|
||||
xmlhttp.setRequestHeader("Authorization", localStorage.apiKey);
|
||||
if (filters)
|
||||
xmlhttp.setRequestHeader("X-Filter", JSON.stringify(filters));
|
||||
|
||||
@ -279,7 +280,7 @@ function apiPost(endpoint, data, callback)
|
||||
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.open("POST", settings.apiURL + endpoint, true);
|
||||
xmlhttp.setRequestHeader("Authorization", "Bearer " + localStorage.apiKey);
|
||||
xmlhttp.setRequestHeader("Authorization", localStorage.apiKey);
|
||||
xmlhttp.setRequestHeader("Content-Type", "application/json");
|
||||
|
||||
xmlhttp.onreadystatechange = function()
|
||||
@ -337,7 +338,7 @@ function apiPut(endpoint, data, callback)
|
||||
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.open("PUT", settings.apiURL + endpoint, true);
|
||||
xmlhttp.setRequestHeader("Authorization", "Bearer " + localStorage.apiKey);
|
||||
xmlhttp.setRequestHeader("Authorization", localStorage.apiKey);
|
||||
xmlhttp.setRequestHeader("Content-Type", "application/json");
|
||||
|
||||
xmlhttp.onreadystatechange = function()
|
||||
@ -609,9 +610,11 @@ function setupHeader()
|
||||
|
||||
// Highlight the current page in the subnav
|
||||
var subnavLinks = document.getElementsByClassName(elements.subnavLink);
|
||||
for (var i = 0; i < subnavLinks.length; i++) {
|
||||
if ((location.origin + location.pathname).startsWith(subnavLinks[i].href.split("?")[0]))
|
||||
for (var i = subnavLinks.length - 1; i >= 0; i--) {
|
||||
if ((location.origin + location.pathname).startsWith(subnavLinks[i].href.split("?")[0])) {
|
||||
subnavLinks[i].className += " " + elements.subnavLinkActive;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get user info
|
||||
@ -695,4 +698,4 @@ function translateKernel(slug, element)
|
||||
apiGet("/linode/kernels/" + slug, callback, null);
|
||||
}
|
||||
|
||||
export { settings, elements, regionNames, apiDelete, apiGet, apiPost, apiPut, migrateETA, oauthPost, parseParams, setupHeader, eventTitles, timeString, translateKernel };
|
||||
export { settings, elements, regionNames, apiDelete, apiGet, apiPost, apiPut, md5, migrateETA, oauthPost, parseParams, setupHeader, eventTitles, timeString, translateKernel };
|
||||
|
@ -21,10 +21,6 @@
|
||||
padding: 0px 15px 15px;
|
||||
}
|
||||
|
||||
tbody tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
tbody tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
|
@ -25,7 +25,3 @@ table:first-of-type tbody tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
tbody tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
11
include/account_subnav.html
Normal file
11
include/account_subnav.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!--Begin account subnav-->
|
||||
<nav id="subnav" class="wrapper">
|
||||
<a class="subnav-link" href="/account">Account</a>
|
||||
<a class="subnav-link" href="/account/contact">Contact Info</a>
|
||||
<a class="subnav-link" href="/account/creditcard">Update Credit Card</a>
|
||||
<a class="subnav-link" href="/account/make_a_payment">Make A Payment</a>
|
||||
<a class="subnav-link" href="/account/billing_history">Billing History</a>
|
||||
<a class="subnav-link" href="/user">Users and Permissions</a>
|
||||
<a class="subnav-link" href="/account/settings">Account Settings</a>
|
||||
</nav>
|
||||
<!--End account subnav-->
|
@ -34,10 +34,6 @@ table:first-of-type tbody tr td:first-of-type {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
tbody tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
@ -45,7 +45,3 @@ table:first-of-type tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
@ -53,10 +53,6 @@
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#dest-table tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
#dest-table td:last-of-type {
|
||||
width: 100%;
|
||||
}
|
||||
|
@ -21,10 +21,6 @@
|
||||
padding: 0px 15px 15px;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
|
@ -25,11 +25,19 @@
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#config-table tr:last-of-type {
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
}
|
||||
|
||||
.disk-icon {
|
||||
height: 24px;
|
||||
width: 26px;
|
||||
}
|
||||
|
||||
#disk-table tr:last-of-type {
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
}
|
||||
|
||||
.extra-event {
|
||||
display: none;
|
||||
}
|
||||
@ -209,3 +217,7 @@ h3 {
|
||||
#uptime {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#volume-table tr:last-of-type {
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
}
|
||||
|
@ -25,10 +25,6 @@
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
tbody tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
tbody tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
|
@ -53,10 +53,6 @@ h3 {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
tbody tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
tbody tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
|
@ -21,10 +21,6 @@
|
||||
padding: 0px 15px 15px;
|
||||
}
|
||||
|
||||
tbody tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
tbody tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
|
@ -38,3 +38,7 @@ td:nth-of-type(2) {
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.lmc-table tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
}
|
||||
|
@ -85,7 +85,3 @@ p {
|
||||
table {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
@ -30,10 +30,6 @@ h2 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.lmc-tr3 {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
#mutate {
|
||||
padding: 0px 15px 15px;
|
||||
}
|
||||
|
@ -28,7 +28,3 @@ p {
|
||||
tbody tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
tbody tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
@ -21,10 +21,6 @@
|
||||
padding: 0px 15px 15px;
|
||||
}
|
||||
|
||||
tbody tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
tbody tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
|
@ -37,10 +37,6 @@ table:first-of-type {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
|
@ -25,10 +25,6 @@
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
|
@ -46,6 +46,10 @@ li {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.lmc-table tbody:not(.lmc-tbody-head) tr {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.lmc-table td {
|
||||
vertical-align: top;
|
||||
width: 25%;
|
||||
|
@ -38,7 +38,3 @@ tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
5
login.js
5
login.js
@ -63,10 +63,11 @@ import { clientID } from "/clientID.js";
|
||||
data.params = parseParams();
|
||||
|
||||
// If we're being given an access token, store it and redirect
|
||||
if (data.params.access_token && data.params.expires_in && data.params.state) {
|
||||
if (data.params.access_token && data.params.expires_in && data.params.token_type && data.params.state) {
|
||||
if (localStorage.state && localStorage.state == data.params.state) {
|
||||
localStorage.removeItem("state");
|
||||
localStorage.apiKey = data.params.access_token;
|
||||
var type = data.params.token_type.charAt(0).toUpperCase() + data.params.token_type.slice(1);
|
||||
localStorage.apiKey = type + " " + data.params.access_token;
|
||||
localStorage.apiExpire = Date.now() + (data.params.expires_in * 1000);
|
||||
if (localStorage.redirectTo)
|
||||
location.href = localStorage.redirectTo;
|
||||
|
27
user/add/add.css
Normal file
27
user/add/add.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');
|
||||
|
||||
#add {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
80
user/add/add.js
Normal file
80
user/add/add.js
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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.addButton = "add-button";
|
||||
elements.email = "email";
|
||||
elements.restrictedYes = "restricted-yes";
|
||||
elements.user = "user";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.addButton = {};
|
||||
ui.email = {};
|
||||
ui.restrictedYes = {};
|
||||
ui.user = {};
|
||||
|
||||
// Click handler for add button
|
||||
var handleAdd = function(event)
|
||||
{
|
||||
var req = {
|
||||
"username": ui.user.value,
|
||||
"email": ui.email.value,
|
||||
"restricted": ui.restrictedYes.checked
|
||||
};
|
||||
|
||||
apiPost("/account/users", req, function(response)
|
||||
{
|
||||
location.href = "/user";
|
||||
});
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Highlight the account nav link
|
||||
var navlinks = document.getElementsByClassName(elements.navlink);
|
||||
for (var i = 0; i < navlinks.length; i++) {
|
||||
if (navlinks[i].pathname == "/account/")
|
||||
navlinks[i].className = " " + elements.navlinkActive;
|
||||
}
|
||||
|
||||
// Get element references
|
||||
ui.addButton = document.getElementById(elements.addButton);
|
||||
ui.email = document.getElementById(elements.email);
|
||||
ui.restrictedYes = document.getElementById(elements.restrictedYes);
|
||||
ui.user = document.getElementById(elements.user);
|
||||
|
||||
// Attach event handlers
|
||||
ui.addButton.addEventListener("click", handleAdd);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
66
user/add/index.shtml
Normal file
66
user/add/index.shtml
Normal file
@ -0,0 +1,66 @@
|
||||
<!--
|
||||
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 // Add User</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="add.css" />
|
||||
<script src="add.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="add">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2">Add User</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Username</td>
|
||||
<td><input id="user" type="text" size="24" /></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Password</td>
|
||||
<td>A password creation link will be emailed to the user</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Email</td>
|
||||
<td><input id="email" type="email" size="24" /></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Restricted User</td>
|
||||
<td>
|
||||
<input checked id="restricted-yes" type="radio" name="restricted" /> <label for="restricted-yes">Yes - this user can only do what I specify</label><br />
|
||||
<input id="restricted-no" type="radio" name="restricted" /> <label for="restricted-no">No - this user has no access restrictions</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td></td>
|
||||
<td><button id="add-button" type="button">Add User</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
27
user/edit/edit.css
Normal file
27
user/edit/edit.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');
|
||||
|
||||
#edit {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
118
user/edit/edit.js
Normal file
118
user/edit/edit.js
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* 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, md5, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.email = "email";
|
||||
elements.pwReset = "pw-reset";
|
||||
elements.restrictedNo = "restricted-no";
|
||||
elements.restrictedYes = "restricted-yes";
|
||||
elements.saveButton = "save-button";
|
||||
elements.user = "user";
|
||||
elements.userLabel = "user-label";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.email = {};
|
||||
ui.pwReset = {};
|
||||
ui.restrictedNo = {};
|
||||
ui.restrictedYes = {};
|
||||
ui.saveButton = {};
|
||||
ui.user = {};
|
||||
ui.userLabel = {};
|
||||
|
||||
// Callback for user details API call
|
||||
var displayUser = function(response)
|
||||
{
|
||||
// Fill in form
|
||||
ui.user.value = response.username;
|
||||
ui.email.value = response.email;
|
||||
if (response.restricted)
|
||||
ui.restrictedYes.checked = true;
|
||||
else
|
||||
ui.restrictedNo.checked = true;
|
||||
ui.saveButton.disabled = false;
|
||||
};
|
||||
|
||||
// Click handler for save button
|
||||
var handleSave = function(event)
|
||||
{
|
||||
if (event.currentTarget.disabled)
|
||||
return;
|
||||
|
||||
var req = {
|
||||
"username": ui.user.value,
|
||||
"restricted": ui.restrictedYes.checked
|
||||
};
|
||||
|
||||
apiPut("/account/users/" + data.params.user, req, function(response)
|
||||
{
|
||||
location.href = "/user";
|
||||
});
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
// We need a username, so die if we don't have it
|
||||
if (!data.params.user) {
|
||||
alert("No username supplied!");
|
||||
return;
|
||||
}
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Highlight the account nav link
|
||||
var navlinks = document.getElementsByClassName(elements.navlink);
|
||||
for (var i = 0; i < navlinks.length; i++) {
|
||||
if (navlinks[i].pathname == "/account/")
|
||||
navlinks[i].className = " " + elements.navlinkActive;
|
||||
}
|
||||
|
||||
// Get element references
|
||||
ui.email = document.getElementById(elements.email);
|
||||
ui.pwReset = document.getElementById(elements.pwReset);
|
||||
ui.restrictedNo = document.getElementById(elements.restrictedNo);
|
||||
ui.restrictedYes = document.getElementById(elements.restrictedYes);
|
||||
ui.saveButton = document.getElementById(elements.saveButton);
|
||||
ui.user = document.getElementById(elements.user);
|
||||
ui.userLabel = document.getElementById(elements.userLabel);
|
||||
|
||||
// Populate username where we need it
|
||||
ui.userLabel.innerHTML = data.params.user;
|
||||
ui.pwReset.href += data.params.user;
|
||||
document.title += " - " + data.params.user;
|
||||
|
||||
// Attach event handlers
|
||||
ui.saveButton.addEventListener("click", handleSave);
|
||||
|
||||
// Get data from API
|
||||
apiGet("/account/users/" + data.params.user, displayUser, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
67
user/edit/index.shtml
Normal file
67
user/edit/index.shtml
Normal file
@ -0,0 +1,67 @@
|
||||
<!--
|
||||
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 // Edit User</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="edit.css" />
|
||||
<script src="edit.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="edit">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="3">Edit User: <span id="user-label"></span></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Username</td>
|
||||
<td colspan="2"><input id="user" type="text" size="24" /></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Reset Password</td>
|
||||
<td colspan="2"><a id="pw-reset" href="https://login.linode.com/forgot/password?username=" target="_blank">Click here to reset this user's password</a></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Email</td>
|
||||
<td><input disabled id="email" type="email" size="24" /></td>
|
||||
<td class="info">You can change your email on the <a href="/profile">profile</a> page.</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Restricted User</td>
|
||||
<td colspan="2">
|
||||
<input id="restricted-yes" type="radio" name="restricted" /> <label for="restricted-yes">Yes - this user can only do what I specify</label><br />
|
||||
<input id="restricted-no" type="radio" name="restricted" /> <label for="restricted-no">No - this user has no access restrictions</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td></td>
|
||||
<td colspan="2"><button disabled id="save-button" type="button">Save Changes</button>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
56
user/grants/grants.css
Normal file
56
user/grants/grants.css
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
#grants {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-bottom: 1px solid #4C4C4C;
|
||||
border-collapse: separate;
|
||||
border-left: 1px solid #B2B2B2;
|
||||
border-right: 1px solid #4C4C4C;
|
||||
border-spacing: 2px;
|
||||
border-top: 1px solid #B2B2B2;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
table label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
table tbody td {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table tbody td:first-of-type {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table td {
|
||||
border-bottom: 1px solid #B2B2B2;
|
||||
border-left: 1px solid #4C4C4C;
|
||||
border-right: 1px solid #B2B2B2;
|
||||
border-top: 1px solid #4C4C4C;
|
||||
padding: 2px;
|
||||
}
|
271
user/grants/grants.js
Normal file
271
user/grants/grants.js
Normal file
@ -0,0 +1,271 @@
|
||||
/*
|
||||
* 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.billingNone = "billing-none";
|
||||
elements.billingRO = "billing-ro";
|
||||
elements.billingRW = "billing-rw";
|
||||
elements.createDomain = "create-domain";
|
||||
elements.createImage = "create-image";
|
||||
elements.createLinode = "create-linode";
|
||||
elements.createLV = "create-lv";
|
||||
elements.createNB = "create-nb";
|
||||
elements.createSS = "create-ss";
|
||||
elements.createVolume = "create-volume";
|
||||
elements.grantBox = "grant-box";
|
||||
elements.grantTables = {};
|
||||
elements.grantTables.domain = "dns-grants";
|
||||
elements.grantTables.image = "image-grants";
|
||||
elements.grantTables.linode = "linode-grants";
|
||||
elements.grantTables.longview = "lv-grants";
|
||||
elements.grantTables.nodebalancer = "nb-grants";
|
||||
elements.grantTables.stackscript = "ss-grants";
|
||||
elements.grantTables.volume = "volume-grants";
|
||||
elements.modifyLV = "modify-lv";
|
||||
elements.updateButton = "update-button";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.billingNone = {};
|
||||
ui.billingRO = {};
|
||||
ui.billingRW = {};
|
||||
ui.createDomain = {};
|
||||
ui.createImage = {};
|
||||
ui.createLinode = {};
|
||||
ui.createLV = {};
|
||||
ui.createNB = {};
|
||||
ui.createSS = {};
|
||||
ui.createVolume = {};
|
||||
ui.grantTables = {};
|
||||
ui.grantTables.domain = {};
|
||||
ui.grantTables.image = {};
|
||||
ui.grantTables.linode = {};
|
||||
ui.grantTables.longview = {};
|
||||
ui.grantTables.nodebalancer = {};
|
||||
ui.grantTables.stackscript = {};
|
||||
ui.grantTables.volume = {};
|
||||
ui.modifyLV = {};
|
||||
ui.updateButton = {};
|
||||
|
||||
// Creates a row for a grant table
|
||||
var createGrantRow = function(type, perm)
|
||||
{
|
||||
var row = document.createElement("tr");
|
||||
|
||||
var label = document.createElement("td");
|
||||
label.innerHTML = perm.label;
|
||||
row.appendChild(label);
|
||||
|
||||
var none = document.createElement("td");
|
||||
var noneLabel = document.createElement("label");
|
||||
noneLabel.for = type + "-none-" + perm.id;
|
||||
var noneBox = document.createElement("input");
|
||||
noneBox.id = type + "-none-" + perm.id;
|
||||
noneBox.className = elements.grantBox;
|
||||
noneBox.type = "radio";
|
||||
noneBox.name = type + "-" + perm.id;
|
||||
noneLabel.appendChild(noneBox);
|
||||
none.appendChild(noneLabel);
|
||||
row.appendChild(none);
|
||||
|
||||
var ro = document.createElement("td");
|
||||
var roLabel = document.createElement("label");
|
||||
roLabel.for = type + "-ro-" + perm.id;
|
||||
var roBox = document.createElement("input");
|
||||
roBox.id = type + "-ro-" + perm.id;
|
||||
roBox.className = elements.grantBox;
|
||||
roBox.type = "radio";
|
||||
roBox.name = type + "-" + perm.id;
|
||||
roLabel.appendChild(roBox);
|
||||
ro.appendChild(roLabel);
|
||||
row.appendChild(ro);
|
||||
|
||||
var rw = document.createElement("td");
|
||||
var rwLabel = document.createElement("label");
|
||||
rwLabel.for = type + "-rw-" + perm.id;
|
||||
var rwBox = document.createElement("input");
|
||||
rwBox.id = type + "-rw-" + perm.id;
|
||||
rwBox.className = elements.grantBox;
|
||||
rwBox.type = "radio";
|
||||
rwBox.name = type + "-" + perm.id;
|
||||
rwLabel.appendChild(rwBox);
|
||||
rw.appendChild(rwLabel);
|
||||
row.appendChild(rw);
|
||||
|
||||
switch (perm.permissions) {
|
||||
case "read_only":
|
||||
roBox.checked = true;
|
||||
break;
|
||||
case "read_write":
|
||||
rwBox.checked = true;
|
||||
break;
|
||||
default:
|
||||
noneBox.checked = true;
|
||||
}
|
||||
|
||||
return row;
|
||||
};
|
||||
|
||||
// Callback for user grants API call
|
||||
var displayGrants = function(response)
|
||||
{
|
||||
// Set global grants
|
||||
ui.createLinode.checked = response.global.add_linodes;
|
||||
ui.createNB.checked = response.global.add_nodebalancers;
|
||||
ui.createLV.checked = response.global.add_longview;
|
||||
ui.modifyLV.checked = response.global.longview_subscription;
|
||||
ui.createDomain.checked = response.global.add_domains;
|
||||
ui.createSS.checked = response.global.add_stackscripts;
|
||||
ui.createImage.checked = response.global.add_images;
|
||||
ui.createVolume.checked = response.global.add_volumes;
|
||||
|
||||
// Billing grants
|
||||
switch (response.global.account_access) {
|
||||
case "read_only":
|
||||
ui.billingRO.checked = true;
|
||||
break;
|
||||
case "read_write":
|
||||
ui.billingRW.checked = true;
|
||||
break;
|
||||
default:
|
||||
ui.billingNone.checked = true;
|
||||
}
|
||||
|
||||
// Specific grants
|
||||
for (var i in ui.grantTables) {
|
||||
for (var j = 0; j < response[i].length; j++)
|
||||
ui.grantTables[i].appendChild(createGrantRow(i, response[i][j]));
|
||||
}
|
||||
|
||||
ui.updateButton.disabled = false;
|
||||
};
|
||||
|
||||
// Click handler for update button
|
||||
var handleUpdate = function(event)
|
||||
{
|
||||
if (event.currentTarget.disabled)
|
||||
return;
|
||||
|
||||
var req = {};
|
||||
|
||||
// Add in global permissions
|
||||
req.global = {
|
||||
"add_linodes": ui.createLinode.checked,
|
||||
"add_nodebalancers": ui.createNB.checked,
|
||||
"add_longview": ui.createLV.checked,
|
||||
"longview_subscription": ui.modifyLV.checked,
|
||||
"add_domains": ui.createDomain.checked,
|
||||
"add_stackscripts": ui.createSS.checked,
|
||||
"add_images": ui.createImage.checked,
|
||||
"add_volumes": ui.createVolume.checked
|
||||
};
|
||||
|
||||
// Add in billing permissions
|
||||
if (ui.billingRO.checked)
|
||||
req.global.account_access = "read_only";
|
||||
else if (ui.billingRW.checked)
|
||||
req.global.account_access = "read_write";
|
||||
else
|
||||
req.global.account_access = null;
|
||||
|
||||
// Add in specific persmissions
|
||||
for (var i in ui.grantTables)
|
||||
req[i] = [];
|
||||
|
||||
var grantBoxes = document.getElementsByClassName(elements.grantBox);
|
||||
for (var i = 0; i < grantBoxes.length; i++) {
|
||||
if (!grantBoxes[i].checked)
|
||||
continue;
|
||||
|
||||
// This will give us an array tuple of [type, permission, id]
|
||||
var id = grantBoxes[i].id.split("-");
|
||||
|
||||
var perm = {};
|
||||
perm.id = parseInt(id[2]);
|
||||
if (id[1] == "ro")
|
||||
perm.permissions = "read_only";
|
||||
else if (id[1] == "rw")
|
||||
perm.permissions = "read_write";
|
||||
else
|
||||
perm.permissions = null;
|
||||
|
||||
req[id[0]].push(perm);
|
||||
}
|
||||
|
||||
apiPut("/account/users/" + data.params.user + "/grants", req, function(response)
|
||||
{
|
||||
location.href = "/user";
|
||||
});
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
// We need a username, so die if we don't have it
|
||||
if (!data.params.user) {
|
||||
alert("No username supplied!");
|
||||
return;
|
||||
}
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Highlight the account nav link
|
||||
var navlinks = document.getElementsByClassName(elements.navlink);
|
||||
for (var i = 0; i < navlinks.length; i++) {
|
||||
if (navlinks[i].pathname == "/account/")
|
||||
navlinks[i].className = " " + elements.navlinkActive;
|
||||
}
|
||||
|
||||
// Get element references
|
||||
ui.billingNone = document.getElementById(elements.billingNone);
|
||||
ui.billingRO = document.getElementById(elements.billingRO);
|
||||
ui.billingRW = document.getElementById(elements.billingRW);
|
||||
ui.createDomain = document.getElementById(elements.createDomain);
|
||||
ui.createImage = document.getElementById(elements.createImage);
|
||||
ui.createLinode = document.getElementById(elements.createLinode);
|
||||
ui.createLV = document.getElementById(elements.createLV);
|
||||
ui.createNB = document.getElementById(elements.createNB);
|
||||
ui.createSS = document.getElementById(elements.createSS);
|
||||
ui.createVolume = document.getElementById(elements.createVolume);
|
||||
for (var i in ui.grantTables)
|
||||
ui.grantTables[i] = document.getElementById(elements.grantTables[i]);
|
||||
ui.modifyLV = document.getElementById(elements.modifyLV);
|
||||
ui.updateButton = document.getElementById(elements.updateButton);
|
||||
|
||||
// Populate username where we need it
|
||||
document.title += " - " + data.params.user;
|
||||
|
||||
// Attach event handlers
|
||||
ui.updateButton.addEventListener("click", handleUpdate);
|
||||
|
||||
// Get data from API
|
||||
apiGet("/account/users/" + data.params.user + "/grants", displayGrants, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
132
user/grants/index.shtml
Normal file
132
user/grants/index.shtml
Normal file
@ -0,0 +1,132 @@
|
||||
<!--
|
||||
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 // User Grants</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="grants.css" />
|
||||
<script src="grants.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="grants">
|
||||
<h2>Global Grants</h2>
|
||||
<input id="create-linode" type="checkbox" /> <label for="create-linode">Can add Linodes to this account ($)</label><br />
|
||||
<input id="create-nb" type="checkbox" /> <label for="create-nb">Can add NodeBalancers to this account ($)</label><br />
|
||||
<input id="create-lv" type="checkbox" /> <label for="create-lv">Can add Longview clients to this account</label><br />
|
||||
<input id="modify-lv" type="checkbox" /> <label for="modify-lv">Can modify this account's Longview subscription ($)</label><br />
|
||||
<input id="create-domain" type="checkbox" /> <label for="create-domain">Can add Domains using the DNS Manager</label><br />
|
||||
<input id="create-ss" type="checkbox" /> <label for="create-ss">Can create StackScripts under this account</label><br />
|
||||
<input id="create-image" type="checkbox" /> <label for="create-image">Can create frozen Images under this account</label><br />
|
||||
<input id="create-volume" type="checkbox" /> <label for="create-volume">Can add Block Storage Volumes to this account ($)</label>
|
||||
<h2>Billing Access</h2>
|
||||
<input id="billing-none" type="radio" name="billing" /> <label for="billing-none"><strong>None</strong> - Cannot view any billing information</label><br />
|
||||
<input id="billing-ro" type="radio" name="billing" /> <label for="billing-ro"><strong>Read Only</strong> - Can view invoices, billing info, and will receive copies of all invoices and payment emails</label><br />
|
||||
<input id="billing-rw" type="radio" name="billing" /> <label for="billing-rw"><strong>Read-Write</strong> - Can make payments, update contact and billing info, and will receive copies of all invoices and payment emails</label>
|
||||
<h2>Linode Grants</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Linode</td>
|
||||
<td>None</td>
|
||||
<td>Read Only</td>
|
||||
<td>Read-Write</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="linode-grants"></tbody>
|
||||
</table>
|
||||
<h2>NodeBalancer Grants</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>NodeBalancer</td>
|
||||
<td>None</td>
|
||||
<td>Read Only</td>
|
||||
<td>Read-Write</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="nb-grants"></tbody>
|
||||
</table>
|
||||
<h2>Longview Grants</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Server</td>
|
||||
<td>None</td>
|
||||
<td>Read Only</td>
|
||||
<td>Read-Write</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="lv-grants"></tbody>
|
||||
</table>
|
||||
<h2>DNS Zone Grants</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Zone</td>
|
||||
<td>None</td>
|
||||
<td>Read Only</td>
|
||||
<td>Read-Write</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="dns-grants"></tbody>
|
||||
</table>
|
||||
<h2>StackScript Grants</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>StackScript</td>
|
||||
<td>None</td>
|
||||
<td>Read Only</td>
|
||||
<td>Read-Write</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="ss-grants"></tbody>
|
||||
</table>
|
||||
<h2>Image Grants</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Image</td>
|
||||
<td>None</td>
|
||||
<td>Read Only</td>
|
||||
<td>Read-Write</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="image-grants"></tbody>
|
||||
</table>
|
||||
<h2>Volume Grants</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Volume</td>
|
||||
<td>None</td>
|
||||
<td>Read Only</td>
|
||||
<td>Read-Write</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="volume-grants"></tbody>
|
||||
</table>
|
||||
<button disabled id="update-button" type="button">Update Grants</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
53
user/index.shtml
Normal file
53
user/index.shtml
Normal file
@ -0,0 +1,53 @@
|
||||
<!--
|
||||
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 // User Manager</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="user.css" />
|
||||
<script src="user.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="user">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="4">User Manager</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Username</td>
|
||||
<td>Email</td>
|
||||
<td>Restricted</td>
|
||||
<td>Options</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="user-table">
|
||||
<tr id="loading" class="lmc-tr3">
|
||||
<td colspan="4">Loading...</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="sub-links"><a href="/user/add">Add a user</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
36
user/remove/index.shtml
Normal file
36
user/remove/index.shtml
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/>.
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>LMC - Account // Remove User</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="remove.css" />
|
||||
<script src="remove.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="remove">
|
||||
<p>Are you sure you want to delete the user '<span id="user-label"></span>'?</p>
|
||||
<button id="delete-button" type="button">Yes, Delete!</button> <button id="cancel-button" type="button">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
22
user/remove/remove.css
Normal file
22
user/remove/remove.css
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
#remove {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
84
user/remove/remove.js
Normal file
84
user/remove/remove.js
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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, apiDelete, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.cancelButton = "cancel-button";
|
||||
elements.deleteButton = "delete-button";
|
||||
elements.userLabel = "user-label";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.cancelButton = {};
|
||||
ui.deleteButton = {};
|
||||
ui.userLabel = {};
|
||||
|
||||
// Click handler for delete button
|
||||
var handleDelete = function(event)
|
||||
{
|
||||
apiDelete("/account/users/" + data.params.user, function(response)
|
||||
{
|
||||
location.href = "/user";
|
||||
});
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
// We need a username, so die if we don't have it
|
||||
if (!data.params.user) {
|
||||
alert("No username supplied!");
|
||||
return;
|
||||
}
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Highlight the account nav link
|
||||
var navlinks = document.getElementsByClassName(elements.navlink);
|
||||
for (var i = 0; i < navlinks.length; i++) {
|
||||
if (navlinks[i].pathname == "/account/")
|
||||
navlinks[i].className = " " + elements.navlinkActive;
|
||||
}
|
||||
|
||||
// Get element references
|
||||
ui.cancelButton = document.getElementById(elements.cancelButton);
|
||||
ui.deleteButton = document.getElementById(elements.deleteButton);
|
||||
ui.userLabel = document.getElementById(elements.userLabel);
|
||||
|
||||
// Populate username where we need it
|
||||
ui.userLabel.innerHTML = data.params.user;
|
||||
|
||||
// Attach event handlers
|
||||
ui.cancelButton.addEventListener("click", function(event)
|
||||
{
|
||||
location.href = "/user";
|
||||
});
|
||||
ui.deleteButton.addEventListener("click", handleDelete);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
32
user/user.css
Normal file
32
user/user.css
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
.profile-img {
|
||||
height: 36px;
|
||||
vertical-align: middle;
|
||||
width: 36px;
|
||||
}
|
||||
|
||||
td:nth-of-type(4) {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#user {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
148
user/user.js
Normal file
148
user/user.js
Normal file
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* 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, md5, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.info = "info";
|
||||
elements.lmcRow = "lmc-tr1";
|
||||
elements.lmcRowAlt = "lmc-tr2";
|
||||
elements.loading = "loading";
|
||||
elements.navlinkActive = "navlink-active";
|
||||
elements.profileImg = "profile-img";
|
||||
elements.userTable = "user-table";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
data.users = [];
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.loading = {};
|
||||
ui.userTable = {};
|
||||
|
||||
// Generates a user table row
|
||||
var createUserRow = function(user, alt)
|
||||
{
|
||||
var row = document.createElement("tr");
|
||||
if (alt)
|
||||
row.className = elements.lmcRowAlt;
|
||||
else
|
||||
row.className = elements.lmcRow;
|
||||
|
||||
var nameCell = document.createElement("td");
|
||||
var imgLink = document.createElement("a");
|
||||
imgLink.href = "/user/edit?user=" + user.username;
|
||||
var img = document.createElement("img");
|
||||
img.className = elements.profileImg;
|
||||
img.src = "https://www.gravatar.com/avatar/" + md5(user.email);
|
||||
img.alt = user.username;
|
||||
imgLink.appendChild(img);
|
||||
var separator = document.createElement("span");
|
||||
separator.innerHTML = " ";
|
||||
var nameLink = document.createElement("a");
|
||||
nameLink.href = "/user/edit?user=" + user.username;
|
||||
nameLink.innerHTML = user.username;
|
||||
nameCell.appendChild(imgLink);
|
||||
nameCell.appendChild(separator);
|
||||
nameCell.appendChild(nameLink);
|
||||
row.appendChild(nameCell);
|
||||
|
||||
var email = document.createElement("td");
|
||||
email.innerHTML = user.email;
|
||||
row.appendChild(email);
|
||||
|
||||
var restricted = document.createElement("td");
|
||||
if (user.restricted) {
|
||||
var yes = document.createElement("span");
|
||||
yes.innerHTML = "Yes (";
|
||||
var permsLink = document.createElement("a");
|
||||
permsLink.href = "/user/grants?user=" + user.username;
|
||||
permsLink.innerHTML = "edit permissions";
|
||||
var close = document.createElement("span");
|
||||
close.innerHTML = ")";
|
||||
restricted.appendChild(yes);
|
||||
restricted.appendChild(permsLink);
|
||||
restricted.appendChild(close);
|
||||
} else {
|
||||
restricted.innerHTML = "No";
|
||||
}
|
||||
row.appendChild(restricted);
|
||||
|
||||
var options = document.createElement("td");
|
||||
var editLink = document.createElement("a");
|
||||
editLink.href = "/user/edit?user=" + user.username;
|
||||
editLink.innerHTML = "Edit";
|
||||
var pipe = document.createElement("span");
|
||||
pipe.innerHTML = " | ";
|
||||
var removeLink = document.createElement("a");
|
||||
removeLink.href = "/user/remove?user=" + user.username;
|
||||
removeLink.innerHTML = "Remove";
|
||||
options.appendChild(editLink);
|
||||
options.appendChild(pipe);
|
||||
options.appendChild(removeLink);
|
||||
row.appendChild(options);
|
||||
|
||||
return row;
|
||||
};
|
||||
|
||||
// Callback for users API call
|
||||
var displayUsers = function(response)
|
||||
{
|
||||
data.users = data.users.concat(response.data);
|
||||
|
||||
// Request the next page if there are more
|
||||
if (response.page != response.pages) {
|
||||
apiGet("/account/users?page=" + (response.page + 1), displayUsers, null);
|
||||
return;
|
||||
}
|
||||
|
||||
ui.loading.remove();
|
||||
|
||||
// Add users to table
|
||||
for (var i = 0; i < data.users.length; i++)
|
||||
ui.userTable.appendChild(createUserRow(data.users[i], ui.userTable.children.length % 2));
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Highlight the account nav link
|
||||
var navlinks = document.getElementsByClassName(elements.navlink);
|
||||
for (var i = 0; i < navlinks.length; i++) {
|
||||
if (navlinks[i].pathname == "/account/")
|
||||
navlinks[i].className = " " + elements.navlinkActive;
|
||||
}
|
||||
|
||||
// Get element references
|
||||
ui.loading = document.getElementById(elements.loading);
|
||||
ui.userTable = document.getElementById(elements.userTable);
|
||||
|
||||
// Get data from API
|
||||
apiGet("/account/users", displayUsers, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
@ -25,7 +25,3 @@ tbody tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
tbody tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
@ -25,7 +25,3 @@ tbody tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
tbody tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
@ -25,7 +25,3 @@ tbody tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
tbody tr:last-of-type {
|
||||
border: none;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user