Implemented user profile settings, OAuth apps, and maintenance windows. Other minor fixes/improvements
This commit is contained in:
@@ -34,10 +34,6 @@ table:first-of-type tbody tr td:first-of-type {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
ul {
|
||||
display: inline;
|
||||
list-style-position: inside;
|
||||
|
||||
@@ -77,7 +77,7 @@ along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
|
||||
<td>Linode</td>
|
||||
<td>Plan</td>
|
||||
<td>Location</td>
|
||||
<td>Unallocated/Free Space</td>
|
||||
<td>Free Space</td>
|
||||
<td>Select</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -618,6 +618,15 @@ import { settings, elements, apiDelete, apiGet, apiPost, eventTitles, parseParam
|
||||
if (!data.notifications[i].entity || data.notifications[i].entity.type != "linode" || data.notifications[i].entity.id != data.params.lid)
|
||||
continue;
|
||||
|
||||
if (data.notifications[i].type == "maintenance") {
|
||||
var now = new Date();
|
||||
var maintStart = new Date(data.notifications[i].when + "Z");
|
||||
data.notifications[i].label = "Maintenance Scheduled";
|
||||
data.notifications[i].message = "This Linode's physical host will be undergoing maintenance on " + maintStart.toLocaleString() + " (in " + timeString(maintStart - now, false) + ").";
|
||||
data.notifications[i].message += " During this time, your Linode will be shut down and remain offline, then returned to its last state (running or powered off).";
|
||||
data.notifications[i].message += " For more information, please see your open support tickets.";
|
||||
}
|
||||
|
||||
var notification = document.createElement("div");
|
||||
notification.className = elements.notification;
|
||||
var header = document.createElement("h1");
|
||||
|
||||
+64
-9
@@ -56,6 +56,11 @@ import { settings, elements, regionNames, apiGet, parseParams, setupHeader } fro
|
||||
ui.loading = {};
|
||||
ui.notifications = {};
|
||||
|
||||
// Temporary state
|
||||
var state = {};
|
||||
state.haveLinodes = false;
|
||||
state.haveNotifications = false;
|
||||
|
||||
var createLinodeRow = function(linode, alt)
|
||||
{
|
||||
var row = document.createElement("tr");
|
||||
@@ -69,7 +74,19 @@ import { settings, elements, regionNames, apiGet, parseParams, setupHeader } fro
|
||||
nameLink.innerHTML = linode.label;
|
||||
name.appendChild(nameLink);
|
||||
var status = document.createElement("td");
|
||||
status.innerHTML = linode.status.charAt(0).toUpperCase() + linode.status.slice(1).replace(/_/g, " ");
|
||||
if (linode.lmc_maint) {
|
||||
var maintStart = new Date(linode.lmc_maint + "Z");
|
||||
var line1 = document.createElement("strong");
|
||||
line1.innerHTML = "Maintenance Scheduled";
|
||||
var br = document.createElement("br");
|
||||
var line2 = document.createElement("span");
|
||||
line2.innerHTML = maintStart.toLocaleString();
|
||||
status.appendChild(line1);
|
||||
status.appendChild(br);
|
||||
status.appendChild(line2);
|
||||
} else {
|
||||
status.innerHTML = linode.status.charAt(0).toUpperCase() + linode.status.slice(1).replace(/_/g, " ");
|
||||
}
|
||||
var plan = document.createElement("td");
|
||||
if (linode.type)
|
||||
plan.innerHTML = getPlanLabel(linode.type);
|
||||
@@ -248,6 +265,8 @@ import { settings, elements, regionNames, apiGet, parseParams, setupHeader } fro
|
||||
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
|
||||
});
|
||||
|
||||
state.haveLinodes = true;
|
||||
|
||||
// Create tables
|
||||
ui.loading.remove();
|
||||
if (data.noTag)
|
||||
@@ -256,13 +275,8 @@ import { settings, elements, regionNames, apiGet, parseParams, setupHeader } fro
|
||||
createLinodeTable(data.linodeTags[i]);
|
||||
|
||||
// Insert linodes
|
||||
for (var i = 0; i < data.linodes.length; i++) {
|
||||
if (data.linodes[i].tags.length == 0)
|
||||
ui.linodeTables[""].appendChild(createLinodeRow(data.linodes[i], ui.linodeTables[""].children.length % 2));
|
||||
|
||||
for (var j = 0; j < data.linodes[i].tags.length; j++)
|
||||
ui.linodeTables[data.linodes[i].tags[j]].appendChild(createLinodeRow(data.linodes[i], ui.linodeTables[data.linodes[i].tags[j]].children.length % 2));
|
||||
}
|
||||
if (state.haveNotifications)
|
||||
insertLinodes();
|
||||
};
|
||||
|
||||
var displayNotifications = function(response)
|
||||
@@ -276,6 +290,8 @@ import { settings, elements, regionNames, apiGet, parseParams, setupHeader } fro
|
||||
return;
|
||||
}
|
||||
|
||||
state.haveNotifications = true;
|
||||
|
||||
// Display notifications
|
||||
for (var i = 0; i < data.notifications.length; i++) {
|
||||
if (data.notifications[i].entity && data.notifications[i].entity.type == "linode")
|
||||
@@ -286,11 +302,25 @@ import { settings, elements, regionNames, apiGet, parseParams, setupHeader } fro
|
||||
var header = document.createElement("h1");
|
||||
header.innerHTML = data.notifications[i].label;
|
||||
var body = document.createElement("p");
|
||||
body.innerHTML = data.notifications[i].message;
|
||||
// Insert ticket link for ticket notifications
|
||||
if (data.notifications[i].type == "ticket_important" && data.notifications[i].entity) {
|
||||
var ticketLink = document.createElement("a");
|
||||
ticketLink.href = "/support/ticket?tid=" + data.notifications[i].entity.id;
|
||||
ticketLink.innerHTML = data.notifications[i].entity.label;
|
||||
body.appendChild(ticketLink);
|
||||
} else {
|
||||
body.innerHTML = data.notifications[i].message;
|
||||
}
|
||||
// Replace "this facility" with actual location for outages
|
||||
if (data.notifications[i].type == "outage" && data.notifications[i].entity && data.notifications[i].entity.type == "region" && regionNames[data.notifications[i].entity.id])
|
||||
header.innerHTML = header.innerHTML.replace("this facility", regionNames[data.notifications[i].entity.id]);
|
||||
notification.appendChild(header);
|
||||
notification.appendChild(body);
|
||||
ui.notifications.appendChild(notification);
|
||||
}
|
||||
|
||||
if (state.haveLinodes)
|
||||
insertLinodes();
|
||||
};
|
||||
|
||||
var displayTransfer = function(response)
|
||||
@@ -358,6 +388,31 @@ import { settings, elements, regionNames, apiGet, parseParams, setupHeader } fro
|
||||
apiGet("/linode/instances", displayLinodes, filters);
|
||||
};
|
||||
|
||||
var insertLinodes = function()
|
||||
{
|
||||
// Add maintenance windows from notifications
|
||||
for (var i = 0; i < data.notifications.length; i++) {
|
||||
if (data.notifications[i].type != "maintenance")
|
||||
continue;
|
||||
|
||||
for (var j = 0; j < data.linodes.length; j++) {
|
||||
if (data.linodes[j].id == data.notifications[i].entity.id) {
|
||||
data.linodes[j].lmc_maint = data.notifications[i].when;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Insert linodes into tables
|
||||
for (var i = 0; i < data.linodes.length; i++) {
|
||||
if (data.linodes[i].tags.length == 0)
|
||||
ui.linodeTables[""].appendChild(createLinodeRow(data.linodes[i], ui.linodeTables[""].children.length % 2));
|
||||
|
||||
for (var j = 0; j < data.linodes[i].tags.length; j++)
|
||||
ui.linodeTables[data.linodes[i].tags[j]].appendChild(createLinodeRow(data.linodes[i], ui.linodeTables[data.linodes[i].tags[j]].children.length % 2));
|
||||
}
|
||||
};
|
||||
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
|
||||
Reference in New Issue
Block a user