mirror of https://github.com/calzoneman/sync.git
Start working on channel detail view
This commit is contained in:
parent
ecc5ffc7da
commit
02ac983fba
|
@ -261,7 +261,7 @@ function handleDeleteChannel(user, data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleListActiveChannels(user) {
|
function handleListActiveChannels(user) {
|
||||||
user.socket.emit("acp-list-activechannels", Server.getServer().packChannelList(false));
|
user.socket.emit("acp-list-activechannels", Server.getServer().packChannelList(false, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleForceUnload(user, data) {
|
function handleForceUnload(user, data) {
|
||||||
|
|
|
@ -194,7 +194,7 @@ Server.prototype.unloadChannel = function (chan) {
|
||||||
chan.dead = true;
|
chan.dead = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
Server.prototype.packChannelList = function (publicOnly) {
|
Server.prototype.packChannelList = function (publicOnly, showMeta) {
|
||||||
var channels = this.channels.filter(function (c) {
|
var channels = this.channels.filter(function (c) {
|
||||||
if (!publicOnly) {
|
if (!publicOnly) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -203,10 +203,13 @@ Server.prototype.packChannelList = function (publicOnly) {
|
||||||
return c.modules.options && c.modules.options.get("show_public");
|
return c.modules.options && c.modules.options.get("show_public");
|
||||||
});
|
});
|
||||||
|
|
||||||
return channels.map(this.packChannel.bind(this));
|
var self = this;
|
||||||
|
return channels.map(function (c) {
|
||||||
|
return self.packChannel(c, showMeta);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Server.prototype.packChannel = function (c) {
|
Server.prototype.packChannel = function (c, showMeta) {
|
||||||
var opts = c.modules.options;
|
var opts = c.modules.options;
|
||||||
var pl = c.modules.playlist;
|
var pl = c.modules.playlist;
|
||||||
var chat = c.modules.chat;
|
var chat = c.modules.chat;
|
||||||
|
@ -238,6 +241,11 @@ Server.prototype.packChannel = function (c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add in some extra data- intended to be site admin only */
|
||||||
|
if (showMeta) {
|
||||||
|
data.activeLockCount = c.activeLock.count;
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ html(lang="en")
|
||||||
th Now Playing
|
th Now Playing
|
||||||
th Registered
|
th Registered
|
||||||
th Public
|
th Public
|
||||||
th Force Unload
|
th Control
|
||||||
#acp-eventlog.acp-panel.col-md-12(style="display: none")
|
#acp-eventlog.acp-panel.col-md-12(style="display: none")
|
||||||
h3 Event Log
|
h3 Event Log
|
||||||
strong Filter event types
|
strong Filter event types
|
||||||
|
|
|
@ -355,6 +355,72 @@ socket.on("acp-delete-channel", function (data) {
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Active channels */
|
/* Active channels */
|
||||||
|
|
||||||
|
function showChannelDetailModal(c) {
|
||||||
|
var wrap = $("<div/>").addClass("modal fade").appendTo($("body"));
|
||||||
|
var dialog = $("<div/>").addClass("modal-dialog").appendTo(wrap);
|
||||||
|
var content = $("<div/>").addClass("modal-content").appendTo(dialog);
|
||||||
|
var head = $("<div/>").addClass("modal-header").appendTo(content);
|
||||||
|
$("<button/>").addClass("close")
|
||||||
|
.attr("data-dismiss", "modal")
|
||||||
|
.attr("data-hidden", "true")
|
||||||
|
.html("×")
|
||||||
|
.appendTo(head);
|
||||||
|
$("<h4/>").addClass("modal-title").text(c.name).appendTo(head);
|
||||||
|
|
||||||
|
var body = $("<div/>").addClass("modal-body").appendTo(content);
|
||||||
|
|
||||||
|
var table = $("<table/>").addClass("table table-striped table-compact")
|
||||||
|
.appendTo(body);
|
||||||
|
var tr;
|
||||||
|
|
||||||
|
tr = $("<tr/>").appendTo(table);
|
||||||
|
$("<td/>").text("Page Title").appendTo(tr);
|
||||||
|
$("<td/>").text(c.pagetitle).appendTo(tr);
|
||||||
|
|
||||||
|
tr = $("<tr/>").appendTo(table);
|
||||||
|
$("<td/>").text("Media Title").appendTo(tr);
|
||||||
|
$("<td/>").text(c.mediatitle).appendTo(tr);
|
||||||
|
|
||||||
|
tr = $("<tr/>").appendTo(table);
|
||||||
|
$("<td/>").text("User Count").appendTo(tr);
|
||||||
|
$("<td/>").text(c.usercount).appendTo(tr);
|
||||||
|
|
||||||
|
tr = $("<tr/>").appendTo(table);
|
||||||
|
$("<td/>").text("User List").appendTo(tr);
|
||||||
|
$("<td/>").text(c.users.join(" ")).appendTo(tr);
|
||||||
|
|
||||||
|
tr = $("<tr/>").appendTo(table);
|
||||||
|
$("<td/>").text("Registered").appendTo(tr);
|
||||||
|
$("<td/>").text(c.registered).appendTo(tr);
|
||||||
|
|
||||||
|
tr = $("<tr/>").appendTo(table);
|
||||||
|
$("<td/>").text("Public").appendTo(tr);
|
||||||
|
$("<td/>").text(c.public).appendTo(tr);
|
||||||
|
|
||||||
|
tr = $("<tr/>").appendTo(table);
|
||||||
|
$("<td/>").text("ActiveLock Count").appendTo(tr);
|
||||||
|
$("<td/>").text(c.activeLockCount).appendTo(tr);
|
||||||
|
|
||||||
|
$("<h3/>").text("Recent Chat").appendTo(body);
|
||||||
|
$("<pre/>").text(c.chat.map(function (data) {
|
||||||
|
var msg = "<" + data.username;
|
||||||
|
if (data.addClass) {
|
||||||
|
msg += "." + data.addClass;
|
||||||
|
}
|
||||||
|
msg += "> " + data.msg;
|
||||||
|
|
||||||
|
msg = "[" + new Date(data.time).toTimeString().split(" ")[0] + "] " + msg;
|
||||||
|
return msg;
|
||||||
|
}).join("\n")).appendTo(body);
|
||||||
|
|
||||||
|
wrap.on("hidden.bs.modal", function () {
|
||||||
|
wrap.remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
wrap.modal();
|
||||||
|
}
|
||||||
|
|
||||||
socket.on("acp-list-activechannels", function (channels) {
|
socket.on("acp-list-activechannels", function (channels) {
|
||||||
var tbl = $("#acp-loaded-channels table");
|
var tbl = $("#acp-loaded-channels table");
|
||||||
tbl.find("tbody").remove();
|
tbl.find("tbody").remove();
|
||||||
|
@ -381,9 +447,15 @@ socket.on("acp-list-activechannels", function (channels) {
|
||||||
var nowplaying = $("<td/>").text(c.mediatitle).appendTo(tr);
|
var nowplaying = $("<td/>").text(c.mediatitle).appendTo(tr);
|
||||||
var registered = $("<td/>").text(c.registered).appendTo(tr);
|
var registered = $("<td/>").text(c.registered).appendTo(tr);
|
||||||
var public = $("<td/>").text(c.public).appendTo(tr);
|
var public = $("<td/>").text(c.public).appendTo(tr);
|
||||||
var unload = $("<td/>").appendTo(tr);
|
var controlOuter = $("<td/>").appendTo(tr);
|
||||||
|
var controlInner = $("<div/>").addClass("btn-group").appendTo(controlOuter);
|
||||||
|
$("<button/>").addClass("btn btn-default btn-xs").text("Details")
|
||||||
|
.appendTo(controlInner)
|
||||||
|
.click(function () {
|
||||||
|
showChannelDetailModal(c);
|
||||||
|
});
|
||||||
$("<button/>").addClass("btn btn-danger btn-xs").text("Force Unload")
|
$("<button/>").addClass("btn btn-danger btn-xs").text("Force Unload")
|
||||||
.appendTo(unload)
|
.appendTo(controlInner)
|
||||||
.click(function () {
|
.click(function () {
|
||||||
if (confirm("Are you sure you want to unload /r/" + c.name + "?")) {
|
if (confirm("Are you sure you want to unload /r/" + c.name + "?")) {
|
||||||
socket.emit("acp-force-unload", {
|
socket.emit("acp-force-unload", {
|
||||||
|
|
Loading…
Reference in New Issue