From 33438ac951430fa370965b42a3d98a54e704ab01 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Tue, 3 Oct 2023 16:41:58 +1100 Subject: AclDialog --- wwwroot/styles/global.css | 2 ++ 1 file changed, 2 insertions(+) (limited to 'wwwroot/styles/global.css') diff --git a/wwwroot/styles/global.css b/wwwroot/styles/global.css index ebcda47..ec77442 100644 --- a/wwwroot/styles/global.css +++ b/wwwroot/styles/global.css @@ -23,6 +23,8 @@ --col-switch-bg: var(--col-bg); --col-switch-fg: #fff; --col-switch-bg-hl: var(--col-accent-pri); + --color-aclaction-allow: #8dff76; + --color-aclaction-deny: #ff4747; --size-default-gap: 30px; } -- cgit v1.3 From 3d5f6e47bd74ce77d5ec253f51b7cef1b42099ef Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Thu, 5 Oct 2023 15:53:02 +1100 Subject: Continued to refine ACLDialog --- Pages/Component/AclDialog.razor | 97 ++++++++++++++++++++++--------------- Pages/Component/AclDialog.razor.css | 56 ++++++++++++++++----- Pages/Component/Dialog.razor | 22 ++++++++- Pages/Component/Dialog.razor.css | 1 + wwwroot/styles/global.css | 7 ++- 5 files changed, 129 insertions(+), 54 deletions(-) (limited to 'wwwroot/styles/global.css') diff --git a/Pages/Component/AclDialog.razor b/Pages/Component/AclDialog.razor index 87fbd6e..6df9320 100644 --- a/Pages/Component/AclDialog.razor +++ b/Pages/Component/AclDialog.razor @@ -2,50 +2,71 @@ @inject IDbContextFactory dbFactory; @implements IDialog - -
-
- @if(obj?.Acl is not null) { - - - - - - - @foreach(var rule in obj.Acl.Rules.OrderByDescending(r => r.Action)) { + +
+
+
+ @if(obj?.Acl is not null) { + +
ActionSubjectPermissions
- - - - + + + + @foreach(var rule in obj.Acl.Rules.OrderByDescending(r => r.Action)) { + + + + + + + } +
- @(WellKnownSid.TranslateSid(rule.Principal) ?? rule.Principal.ToString()) - @GetActivePermissions(rule) - 🖉 - - ActionSubjectPermissions
+ @(WellKnownSid.TranslateSid(rule.Principal) ?? rule.Principal.ToString()) + @GetActivePermissions(rule) + 🖉 + +
+
+
Add new
+ } else { +

This item does not have any permissions set!

+ } +
+
+ @if(obj?.Acl is not null) { +
+ + +
+ var permissions = Acl.GetPermissionDescriptions(obj) + .OrderByDescending(kv => BitOperations.PopCount(kv.Value)) + .ThenBy(kv => kv.Value); + foreach(var kv in permissions) { + } - -
-
Add new
- } else { -
This item does not have any permissions set!
- } -
-
-

Click Edit next to an ACL to edit it's permissions

+ } else { +

Click Edit next to an ACL to edit it's permissions

+ } +
- - @if(obj?.Acl is not null) { - - - - - } else { + @if(obj?.Acl is not null) { + + } - } +
@code { @@ -109,7 +130,7 @@ return string.Join(", ", perms .OrderByDescending(kv => BitOperations.PopCount(kv.Value)) - .ThenByDescending(kv => kv.Value) + .ThenBy(kv => kv.Value) .Select(kv => kv.Key)); } } \ No newline at end of file diff --git a/Pages/Component/AclDialog.razor.css b/Pages/Component/AclDialog.razor.css index b98cc6d..74e405f 100644 --- a/Pages/Component/AclDialog.razor.css +++ b/Pages/Component/AclDialog.razor.css @@ -1,27 +1,57 @@ -div.container { +div.vcontainer{ + display: flex; + flex-direction: column; + height: 100%; +} + +div.hcontainer { display: flex; flex-direction: row; + flex-grow: 1; } -div.container > div { - width: 50%; +div.hcontainer > div { + width: 50%; + flex-direction: column; + display: flex; } -div.container > div:first-child { +div.hcontainer > div:first-child { border-right: 1px solid white; padding-right: 15px; } -div.container > div:last-child { +div.hcontainer > div:last-child { padding-left: 15px; - height: stretch; } -div.container > div:last-child p { - vertical-align: middle; +div.hcontainer > div > p { + margin: auto 0 auto 0; text-align: center; } +div.principal-select { + align-items: center; + display: flex; + flex-direction: row; +} + +div.principal-select * { + margin: 0; +} + +div.principal-select :not(:last-child) { + margin-right: 5px; +} + +div.principal-select input[type="text"] { + flex-grow: 1; +} + +div.hcontainer > div:last-child > label { + font-family: 'Lucida Console'; +} + table p { margin: 8px 0 8px 0; } @@ -31,10 +61,10 @@ table tr { } table td { - font-family: 'Lucida Console'; - font-size: 8pt; - text-overflow: ellipsis; white-space: nowrap; + text-overflow: ellipsis; + font-size: 8pt; + font-family: 'Lucida Console'; } table td:last-child { @@ -50,11 +80,11 @@ table tr:nth-child(2n+1) td:not(:first-child) { } table td:nth-child(2n) { - white-space: nowrap; width: 1px; + white-space: nowrap; } table td > div { - margin: auto; width: min-content; + margin: auto; } \ No newline at end of file diff --git a/Pages/Component/Dialog.razor b/Pages/Component/Dialog.razor index 8e8ddca..ac05515 100644 --- a/Pages/Component/Dialog.razor +++ b/Pages/Component/Dialog.razor @@ -30,6 +30,14 @@ public int HeightPixels { set => height = $"{value}px"; } [Parameter] public int HeightPercent { set => height = $"{value}%"; } + [Parameter] + public int MinHeightPixels { set => minHeight = $"{value}px"; } + [Parameter] + public int MinHeightPercent { set => minHeight = $"{value}%"; } + [Parameter] + public int MaxHeightPixels { set => maxHeight = $"{value}px"; } + [Parameter] + public int MaxHeightPercent { set => maxHeight = $"{value}%"; } public bool Visible { get => visible; @@ -45,6 +53,8 @@ private string? width; private string? height; + private string? minHeight; + private string? maxHeight; private ElementReference dialogDiv; @@ -68,11 +78,19 @@ } } - private string sizeStyle => widthStyle + heightStyle; + private string sizeStyle => string.Join("", new[] { + widthStyle, heightStyle, minHeightStyle, maxHeightStyle + }); private string widthStyle => $"{(width is null ? "" : $"width:{width};")}"; private string heightStyle => - $"{(height is null ? "" : $"max-height:{height};")}"; + $"{(height is null ? "" : $"height:{height};")}"; + + private string minHeightStyle => + $"{(minHeight is null ? "" : $"min-height:{minHeight};")}"; + + private string maxHeightStyle => + $"{(maxHeight is null ? "" : $"max-height:{maxHeight};")}"; } diff --git a/Pages/Component/Dialog.razor.css b/Pages/Component/Dialog.razor.css index 1447407..5e983a2 100644 --- a/Pages/Component/Dialog.razor.css +++ b/Pages/Component/Dialog.razor.css @@ -31,5 +31,6 @@ div.titlebar p.title { div.content { display: flex; flex-direction: column; + flex-grow: 1; padding: 20px; } diff --git a/wwwroot/styles/global.css b/wwwroot/styles/global.css index ec77442..5e46d37 100644 --- a/wwwroot/styles/global.css +++ b/wwwroot/styles/global.css @@ -89,6 +89,11 @@ button, input[type=submit] { user-select: none; } +input[type="checkbox"] { + accent-color: var(--col-accent-pri); + background: #222; +} + button:disabled { color: var(--col-button-disabled) !important; background: var(--col-button-disabled-bg) !important; @@ -143,7 +148,7 @@ input, textarea { margin-bottom: 10px; } -input { +input:not(input[type="checkbox"]) { height: 25px !important; } -- cgit v1.3