vassago/WebInterface/Views/Configuration/Index.cshtml
adam 56c71ee533
Some checks failed
gitea.arg.rip/vassago/pipeline/head There was a failure building this commit
frontend progress. I am *almost* returning to monke.... but my datatype uses strings to serialize some objects in order to cooperate with entity framework.
how hard do you want to not use javascript.. is knockout.js worse than a viewmodel?
2025-07-03 13:18:35 -04:00

157 lines
7.1 KiB
Plaintext

@model vassago.Models.Configuration
@using Newtonsoft.Json;
@using vassago.Behavior;
<a href="/">home</a>/configuration
<form action="@Url.Action("submit", "Configuration")" method="post">
<table class="table">
<tbody>
<tr>
<th colspan="2">Discord (@(Model?.DiscordTokens?.Count ?? 0) accounts)</th>
</tr>
@{
if(Model.DiscordTokens != null) for(var i = 0; i < Model.DiscordTokens.Count; i++)
{
<tr>
<th><label for="DiscordTokens[@i]"></label></th>
<td>
<input type="text" class="form-control" name="DiscordTokens[@i]" value="@Model.DiscordTokens[i]"/>
<button type="button" onclick="() => {removeDiscordTarget = @i; removeDiscord.showModal();}" class="btn btn-danger">del</button>
</td>
</tr>
}
}
<tr>
<td></td>
<td>
<button type="button" onclick="addDiscord.showModal()">add</button>
</td>
</tr>
<tr>
<th><label class="form-check-label" for="SetupDiscordSlashCommands">Setup Discord Slash Commands</label>
<td><input type="checkbox" class="form-check-input position-static" id="SetupDiscordSlashCommands" checked="@Model.SetupDiscordSlashCommands"/></td>
</tr>
<tr>
<th colspan="2">Twitch (@(Model?.TwitchConfigs?.Count ?? 0) accounts)</th>
</tr>
@{
if(Model.TwitchConfigs != null) for(var i = 0; i < Model.TwitchConfigs.Count; i++)
{
var tc = JsonConvert.DeserializeObject<TwitchConfig>(Model.TwitchConfigs[i]);
<tr>
<th><label for="TwitchConfigs[@i]"></label></th>
<td>
<input type="hidden" name="TwitchConfigs[@i]" value="@Model.TwitchConfigs[i]" />
<input type="text" class="form-control" value="@tc.username"/><!--//TODO: save me, knockout.js!-->
<input type="text" class="form-control" value="@tc.oauth"/>
<button type="button" onclick="() => {removeTwitchTarget = @i; removeTwitch.showModal();}" class="btn btn-danger">del</button>
</td>
</tr>
}
}
<tr>
<td></td>
<td>
<button type="button" onclick="addTwitch.showModal()">add</button>
</td>
</tr>
<tr class="form-text">
<th><label for="ExchangePairsLocation">Exchange Pairs Location</label></th>
<td><input type="text" class="form-control" id="ExchangePairsLocation" value="@Model.ExchangePairsLocation"/></td>
</tr>
<tr>
<th colspan="2">Webhooks</th>
</tr>
@{
if(Model.Webhooks != null) for(var i = 0; i< Model.Webhooks.Count; i++)
{
var wh = JsonConvert.DeserializeObject<WebhookConf>(Model.Webhooks[i]);
<tr>
<th><label for="Webhooks[@i]">@wh.Trigger</label></th>
<td>
<input type="text" class="form-control" id="Webhooks[@i].Trigger" value="@wh.Trigger"/>
<input type="text" class="form-control" id="Webhooks[@i].Uri" value="@wh.Uri"/>
<input type="text" class="form-control" id="Webhooks[@i].Method" value="@wh.Method"/>
<input type="text" class="form-control" id="Webhooks[@i].Headers" value="@wh.Headers"/>
<input type="text" class="form-control" id="Webhooks[@i].Content" value="@wh.Content"/>
<input type="text" class="form-control" id="Webhooks[@i].Description" value="@wh.Description"/>
</td>
</tr>
}
}
<tr>
<td></td>
<td>
<button type="button" onclick="addWebhook.showModal()">add</button>
</td>
</tr>
<tr class="form-text">
<th><label for="KafkaBootstrap">Kafka Bootstrap Server</label></th>
<td><input type="text" class="form-control" id="KafkaBootstrap" value="@Model.KafkaBootstrap"/></td>
</tr>
<tr class="form-text">
<th><label for="KafkaBootstrap">Kafka Bootstrap Server</label></th>
<td><input type="text" class="form-control" id="KafkaBootstrap" value="@Model.KafkaBootstrap"/></td>
</tr>
<tr class="form-text">
<th><label for="KafkaName">Kafka Name</label></th>
<td><input type="text" class="form-control" id="KafkaName" value="@Model.KafkaName"/></td>
</tr>
<tr class="form-text">
<th><label for="reportedApiUrlKafkaName">reportedApiUrl</label></th>
<td><input type="text" class="form-control" id="reportedApiUrl" value="@Model.reportedApiUrl"/></td>
</tr>
<tr class="form-text">
<td colspan="2"><button class="btn btn-success" type="submit">save</button></td>
</tr>
</tbody>
</table>
</form>
<dialog id="addDiscord">
<form action="@Url.Action("AddDiscord", "Configuration")" method="post">
<input type="text" class="form-control" name="newToken" />
<button class="btn btn-secondary" type="button" onclick="addDiscord.close()">cancel</button>
<button class="btn btn-success" type="submit">save</button>
</form>
</dialog>
<dialog id="removeDiscord">
<form action="@Url.Action("RemoveDiscord", "Configuration")" method="delete">
Are you sure?
<input type="hidden" name="id" id="removeDiscordTarget" />
<button class="btn btn-secondary" type="button" onclick="removeDiscord.close()">cancel</button>
<button class="btn btn-danger" type="submit">delete</button>
</form>
</dialog>
<dialog id="addTwitch">
<form action="@Url.Action("AddTwitch", "Configuration")" method="post">
<input type="text" class="form-control" name="newUsername" />
<input type="text" class="form-control" name="newOauth" />
<button class="btn btn-secondary" type="button" onclick="addTwitch.close()">cancel</button>
<button class="btn btn-success" type="submit">save</button>
</form>
</dialog>
<dialog id="removeTwitch">
<form action="@Url.Action("RemoveTwitch", "Configuration")" method="delete">
Are you sure?
<input type="hidden" name="id" id="removeTwitchTarget" />
<button class="btn btn-secondary" type="button" onclick="removeTwitch.close()">cancel</button>
<button class="btn btn-danger" type="submit">delete</button>
</form>
</dialog>
<dialog id="addWebhook">
<form action="@Url.Action("AddWebhook", "Configuration")" method="post">
<input type="text" class="form-control" name="newTrigger" />
<button class="btn btn-secondary" type="button" onclick="addWebhook.close()">cancel</button>
<button class="btn btn-success" type="submit">save</button>
</form>
</dialog>
<dialog id="removeWebhook">
<form action="@Url.Action("RemoveWebhook", "Configuration")" method="delete">
Are you sure?
<input type="hidden" name="id" id="removeWebhookTarget" />
<button class="btn btn-secondary" type="button" onclick="removeWebhook.close()">cancel</button>
<button class="btn btn-danger" type="submit">delete</button>
</form>
</dialog>