summaryrefslogtreecommitdiff
path: root/Pages/Component
diff options
context:
space:
mode:
Diffstat (limited to 'Pages/Component')
-rw-r--r--Pages/Component/AclDialog.razor97
-rw-r--r--Pages/Component/AclDialog.razor.css56
-rw-r--r--Pages/Component/Dialog.razor22
-rw-r--r--Pages/Component/Dialog.razor.css1
4 files changed, 123 insertions, 53 deletions
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<HBContext> dbFactory;
@implements IDialog
-<Dialog WidthPixels=900 Title="Edit permissions" @ref=dialog>
- <div class="container">
- <div>
- @if(obj?.Acl is not null) {
- <table class="data-table">
- <tr>
- <th>Action</th>
- <th>Subject</th>
- <th colspan="2">Permissions</th>
- </tr>
- @foreach(var rule in obj.Acl.Rules.OrderByDescending(r => r.Action)) {
+<Dialog HeightPixels=500 WidthPixels=900 Title="Edit permissions" @ref=dialog>
+ <div class="vcontainer">
+ <div class="hcontainer">
+ <div>
+ @if(obj?.Acl is not null) {
+ <label>
+ Owner
+ <input type="text" autocomplete="off"/>
+ </label>
+ <table class="data-table">
<tr>
- <td><div><AclActionSwitch InitialValue=@(rule.Action == AclRuleAction.Allow)/></div></td>
- <td>
- <a class="nondecorated" href="javascript:;">@(WellKnownSid.TranslateSid(rule.Principal) ?? rule.Principal.ToString())</a>
- </td>
- <td>@GetActivePermissions(rule)</td>
- <td>
- <a title="Edit" href="javascript:;">&#x1F589</a>
- <a title="Delete" href="javascript:;">&#x2716</a>
- </td>
+ <th>Action</th>
+ <th>Subject</th>
+ <th colspan="2">Permissions</th>
</tr>
+ @foreach(var rule in obj.Acl.Rules.OrderByDescending(r => r.Action)) {
+ <tr>
+ <td><div><AclActionSwitch InitialValue=@(rule.Action == AclRuleAction.Allow)/></div></td>
+ <td>
+ @(WellKnownSid.TranslateSid(rule.Principal) ?? rule.Principal.ToString())
+ </td>
+ <td>@GetActivePermissions(rule)</td>
+ <td>
+ <a title="Edit" href="javascript:;">&#x1F589</a>
+ <a title="Delete" href="javascript:;">&#x2716</a>
+ </td>
+ </tr>
+ }
+ </table>
+ <br/>
+ <center><a href="javascript:;">Add new</a></center>
+ } else {
+ <p><i>This item does not have any permissions set!</i></p>
+ }
+ </div>
+ <div>
+ @if(obj?.Acl is not null) {
+ <div class="principal-select">
+ <label>
+ Subject
+ <input type="text" autocomplete="off"/>
+ </label>
+ <button>Submit</button>
+ </div>
+ var permissions = Acl.GetPermissionDescriptions(obj)
+ .OrderByDescending(kv => BitOperations.PopCount(kv.Value))
+ .ThenBy(kv => kv.Value);
+ foreach(var kv in permissions) {
+ <label>
+ <input type="checkbox"/>
+ @kv.Key
+ </label>
}
- </table>
- <br/>
- <center><a href="javascript:;">Add new</a></center>
- } else {
- <center><i>This item does not have any permissions set!</i></center>
- }
- </div>
- <div>
- <p><i>Click Edit next to an ACL to edit it's permissions</i></p>
+ } else {
+ <p><i>Click Edit next to an ACL to edit it's permissions</i></p>
+ }
+ </div>
</div>
- </div>
- @if(obj?.Acl is not null) {
- <ButtonContainer>
- <button class="secondary" @onclick=Hide>Cancel</button>
- <button data-keyboard-shortcut="a" @onclick=Hide><u>A</u>pply</button>
- </ButtonContainer>
- } else {
<ButtonContainer>
<button class="secondary" @onclick=Hide>Cancel</button>
+ @if(obj?.Acl is not null) {
+ <button data-keyboard-shortcut="a" @onclick=Hide><u>A</u>pply</button>
+ }
</ButtonContainer>
- }
+ </div>
</Dialog>
@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;
}