-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from btcpayserver/feat/plugin-visibility
Plugin administration and visibility editing
- Loading branch information
Showing
10 changed files
with
224 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CREATE TYPE plugin_visibility_enum AS ENUM ('hidden', 'unlisted', 'listed'); | ||
ALTER TABLE public.plugins | ||
ADD COLUMN visibility plugin_visibility_enum NOT NULL DEFAULT 'unlisted'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace PluginBuilder.DataModels; | ||
|
||
public enum PluginVisibilityEnum | ||
{ | ||
Hidden = 0, | ||
Unlisted = 1, | ||
Listed = 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
using PluginBuilder.DataModels; | ||
|
||
namespace PluginBuilder.ViewModels.Admin; | ||
|
||
public class AdminPluginViewModel | ||
{ | ||
public string ProjectSlug { get; set; } | ||
public string Version { get; set; } | ||
public long BuildId { get; set; } | ||
public string BtccpayMinVer { get; set; } | ||
public string? Version { get; set; } | ||
public long? BuildId { get; set; } | ||
public string? BtcPayMinVer { get; set; } | ||
public bool PreRelease { get; set; } | ||
public DateTime UpdatedAt { get; set; } | ||
public string PublisherEmail { get; set; } | ||
public PluginVisibilityEnum Visibility { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using PluginBuilder.DataModels; | ||
|
||
namespace PluginBuilder.ViewModels.Admin; | ||
|
||
public class PluginViewModel | ||
{ | ||
public string Slug { get; set; } | ||
public string Identifier { get; set; } | ||
public string Settings { get; set; } | ||
public PluginVisibilityEnum Visibility { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@using Microsoft.AspNetCore.Mvc.TagHelpers | ||
@using PluginBuilder.DataModels | ||
@model PluginViewModel | ||
@{ | ||
Layout = "_Layout"; | ||
ViewData.SetActivePage(AdminNavPages.Plugins, "Are you sure you want to delete this Plugin?"); | ||
} | ||
|
||
<div class="d-sm-flex align-items-center justify-content-between"> | ||
<h2 class="mb-4"> | ||
@ViewData["Title"] | ||
</h2> | ||
</div> | ||
|
||
<form asp-action="Delete"> | ||
<div class="form-group"> | ||
<label asp-for="Slug" class="control-label"></label> | ||
<input asp-for="Slug" class="form-control" readonly="readonly" /> | ||
<span asp-validation-for="Slug" class="text-danger"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label asp-for="Identifier" class="control-label"></label> | ||
<input asp-for="Identifier" class="form-control" readonly="readonly" /> | ||
<span asp-validation-for="Identifier" class="text-danger"></span> | ||
</div> | ||
<div class="form-group"> | ||
<input type="submit" class="btn btn-primary" id="Delete" value="Delete" /> | ||
<a asp-action="ListPlugins" class="btn btn-link">Cancel</a> | ||
</div> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@using Microsoft.AspNetCore.Mvc.TagHelpers | ||
@using PluginBuilder.DataModels | ||
@model PluginViewModel | ||
@{ | ||
Layout = "_Layout"; | ||
ViewData.SetActivePage(AdminNavPages.Plugins, "Edit Plugin"); | ||
} | ||
|
||
<div class="d-sm-flex align-items-center justify-content-between"> | ||
<h2 class="mb-0"> | ||
@ViewData["Title"] | ||
</h2> | ||
</div> | ||
|
||
<form asp-action="Edit"> | ||
<div class="form-group"> | ||
<label asp-for="Slug" class="control-label"></label> | ||
<input asp-for="Slug" class="form-control" readonly="readonly" /> | ||
<span asp-validation-for="Slug" class="text-danger"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label asp-for="Identifier" class="control-label"></label> | ||
<input asp-for="Identifier" class="form-control" readonly="readonly" /> | ||
<span asp-validation-for="Identifier" class="text-danger"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label asp-for="Settings" class="control-label"></label> | ||
<textarea asp-for="Settings" class="form-control" rows="5"></textarea> | ||
<span asp-validation-for="Settings" class="text-danger"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label asp-for="Visibility" class="control-label"></label> | ||
<select asp-for="Visibility" class="form-control" asp-items="Html.GetEnumSelectList<PluginVisibilityEnum>()"></select> | ||
<span asp-validation-for="Visibility" class="text-danger"></span> | ||
</div> | ||
<div class="form-group"> | ||
<input type="submit" class="btn btn-primary" id="Save" value="Save" /> | ||
<a asp-action="ListPlugins" class="btn btn-link">Cancel</a> | ||
</div> | ||
</form> |