patch on discord bot UI
This commit is contained in:
72
DiscordBotPlugins/DiscordBotUI/Views/Bot/PluginsPage.cshtml
Normal file
72
DiscordBotPlugins/DiscordBotUI/Views/Bot/PluginsPage.cshtml
Normal file
@@ -0,0 +1,72 @@
|
||||
@model DiscordBotUI.Models.Bot.PluginsPageModel
|
||||
|
||||
<html>
|
||||
<link rel="stylesheet" href="~/css/bot/plugins.css" asp-append-version="true" />
|
||||
<table class="text-white">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Plugin Name</th>
|
||||
<th>Plugin Description</th>
|
||||
<th>Plugin Type</th>
|
||||
<th>Plugin Version</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model.Plugins)
|
||||
{
|
||||
@if (item.Contains("+") || item.Contains("-") || item[0].Length < 2 || item[0] == "Name") continue;
|
||||
<tr>
|
||||
<td>@item[0]</td>
|
||||
<td>@item[1]</td>
|
||||
<td>@item[2]</td>
|
||||
<td>@item[3]</td>
|
||||
@if (Model.InstalledCommands.Contains(item[0]) || Model.InstalledEvents.Contains(item[0]) ||
|
||||
Model.InstalledSlashCommands.Contains(item[0]))
|
||||
{
|
||||
<td>Installed</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td><input type="button" value="Install" onclick="install(this)" name="@item[0]" /></td>
|
||||
}
|
||||
<td>
|
||||
<div class="demo-container" style="display: none;">
|
||||
<div class="progress-bar">
|
||||
<div class="progress-bar-value"></div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</html>
|
||||
|
||||
</html>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function install(button) {
|
||||
var pluginName = button.name;
|
||||
var progress = button.parentElement.nextElementSibling.firstElementChild;
|
||||
progress.style.display = "";
|
||||
$.ajax({
|
||||
url: "/Bot/InstallPlugin",
|
||||
type: "GET",
|
||||
data: { pluginName: pluginName },
|
||||
success: function (data) {
|
||||
if (data == 0)
|
||||
button.value = "Installed";
|
||||
button.disabled = true;
|
||||
progress.style.display = "none";
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
alert("Error: " + error);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -1,10 +1,12 @@
|
||||
@model DiscordBotUI.Models.Bot.BotModel
|
||||
<link rel="stylesheet" href="~/css/bot/start.css" asp-append-version="true" />
|
||||
|
||||
<label>Bot Name: @Model.BotName</label>
|
||||
|
||||
<label class="text-white">Bot Name: @Model.BotName</label>
|
||||
<br />
|
||||
<label>Connection Status: @Model.StartStatus</label>
|
||||
<label class="text-white">Connection Status: @Model.StartStatus</label>
|
||||
<br />
|
||||
<label>Number of plugins loaded: @Model.PluginsLoaded</label>
|
||||
<label class="text-white">Number of plugins loaded: @Model.PluginsLoaded</label>
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
@@ -45,7 +47,7 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="row text-white">
|
||||
<div class="column">
|
||||
<h2>Commands</h2>
|
||||
<table>
|
||||
@@ -57,7 +59,7 @@
|
||||
</tr>
|
||||
@foreach(var cmd in Model.Commands)
|
||||
{
|
||||
<tr>
|
||||
<tr class="text-white bg-gradient" style="border: 0px; background-color: transparent;">
|
||||
<td>@cmd.Command</td>
|
||||
<td>@cmd.Description</td>
|
||||
<td>@cmd.Usage</td>
|
||||
@@ -81,7 +83,7 @@
|
||||
</tr>
|
||||
@foreach(var eve in Model.Events)
|
||||
{
|
||||
<tr>
|
||||
<tr class="text-white bg-gradient" style="border: 0px; background-color: transparent;">
|
||||
<td>@eve.Name</td>
|
||||
<td>@eve.Description</td>
|
||||
</tr>
|
||||
@@ -99,7 +101,7 @@
|
||||
</tr>
|
||||
@foreach(var scmd in Model.SlashCommands)
|
||||
{
|
||||
<tr>
|
||||
<tr class="text-white bg-gradient" style="border: 0px; background-color: transparent;">
|
||||
<td>@scmd.Name</td>
|
||||
<td>@scmd.Description</td>
|
||||
@if (scmd.canUseDM)
|
||||
@@ -113,4 +115,4 @@
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user