@rpcbase/client 0.217.0 → 0.218.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/access-control/PolicyEditor/index.tsx +106 -11
- package/package.json +1 -1
- package/ui/Search/SearchResults/index.tsx +0 -1
- package/ui/nav/ContentView/ContentViewContext.ts +1 -0
- package/ui/nav/ContentView/index.tsx +6 -3
- package/ui/nav/HeaderContainer/header.scss +0 -1
- package/ui/nav/HeaderContainer/index.tsx +7 -3
- package/ui/nav/SidebarContainer/sidebar-container.scss +0 -1
|
@@ -1,16 +1,68 @@
|
|
|
1
1
|
import {useState} from "react"
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
const POLICY_EFFECT = [
|
|
5
|
+
{
|
|
6
|
+
name: "Grant",
|
|
7
|
+
key: "grant",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: "Deny",
|
|
11
|
+
key: "deny",
|
|
12
|
+
},
|
|
13
|
+
]
|
|
14
|
+
|
|
4
15
|
const TARGET_TYPES = [
|
|
5
16
|
{
|
|
6
17
|
name: "Collection:",
|
|
7
|
-
key: "
|
|
8
|
-
description: "Applies to all documents within the collection
|
|
18
|
+
key: "collections",
|
|
19
|
+
description: "Applies to all documents within the collection",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "Documents:",
|
|
23
|
+
key: "documents",
|
|
24
|
+
description: "Applies only to certain specific documents",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "Field:",
|
|
28
|
+
key: "fields",
|
|
29
|
+
description: "Applies only specific fields of documents",
|
|
30
|
+
},
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
const OPERATIONS = [
|
|
34
|
+
{
|
|
35
|
+
name: "Create",
|
|
36
|
+
key: "create",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "Read",
|
|
40
|
+
key: "read",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "Update",
|
|
44
|
+
key: "update",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "Delete",
|
|
48
|
+
key: "delete",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "All of the above",
|
|
52
|
+
key: "all",
|
|
53
|
+
},
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
//
|
|
58
|
+
const APPLIES_TO = [
|
|
59
|
+
{
|
|
60
|
+
name: "Users",
|
|
61
|
+
key: "users",
|
|
9
62
|
},
|
|
10
63
|
{
|
|
11
|
-
name: "
|
|
12
|
-
key: "
|
|
13
|
-
description: "Applies only to certain specific documents.",
|
|
64
|
+
name: "Groups",
|
|
65
|
+
key: "groups",
|
|
14
66
|
},
|
|
15
67
|
]
|
|
16
68
|
|
|
@@ -24,7 +76,31 @@ export const PolicyEditor = () => {
|
|
|
24
76
|
return (
|
|
25
77
|
<div>
|
|
26
78
|
<h6>Policy Editor</h6>
|
|
27
|
-
<
|
|
79
|
+
<hr />
|
|
80
|
+
|
|
81
|
+
<h6>Effect:</h6>
|
|
82
|
+
<div className="mb-3" style={{maxWidth: 300}}>
|
|
83
|
+
{POLICY_EFFECT.map((type) => (
|
|
84
|
+
<div key={type.key} className="d-flex flex-row mb-1">
|
|
85
|
+
<input
|
|
86
|
+
className="form-check-input"
|
|
87
|
+
type="radio"
|
|
88
|
+
name="targetTypeOptions"
|
|
89
|
+
id={type.key}
|
|
90
|
+
value={type.key}
|
|
91
|
+
checked={targetType === type.key}
|
|
92
|
+
onChange={onChangeTargetType}
|
|
93
|
+
/>
|
|
94
|
+
<label
|
|
95
|
+
className="form-check-label cursor-pointer ps-2"
|
|
96
|
+
htmlFor={type.key}
|
|
97
|
+
>
|
|
98
|
+
<b>{type.name}</b>
|
|
99
|
+
</label>
|
|
100
|
+
</div>
|
|
101
|
+
))}
|
|
102
|
+
</div>
|
|
103
|
+
|
|
28
104
|
<div className="d-flex flex-row">
|
|
29
105
|
<div className="me-2">
|
|
30
106
|
<h6>Target Type:</h6>
|
|
@@ -58,11 +134,30 @@ export const PolicyEditor = () => {
|
|
|
58
134
|
</div>
|
|
59
135
|
</div>
|
|
60
136
|
</div>
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
137
|
+
|
|
138
|
+
<h6 className="mt-3">Operation:</h6>
|
|
139
|
+
<div className="" style={{maxWidth: 300}}>
|
|
140
|
+
{OPERATIONS.map((type) => (
|
|
141
|
+
<div key={type.key} className="d-flex flex-row mb-1">
|
|
142
|
+
<input
|
|
143
|
+
className="form-check-input"
|
|
144
|
+
type="radio"
|
|
145
|
+
name="targetTypeOptions"
|
|
146
|
+
id={type.key}
|
|
147
|
+
value={type.key}
|
|
148
|
+
checked={targetType === type.key}
|
|
149
|
+
onChange={onChangeTargetType}
|
|
150
|
+
/>
|
|
151
|
+
<label
|
|
152
|
+
className="form-check-label cursor-pointer ps-2"
|
|
153
|
+
htmlFor={type.key}
|
|
154
|
+
>
|
|
155
|
+
<b>{type.name}</b>
|
|
156
|
+
</label>
|
|
157
|
+
</div>
|
|
158
|
+
))}
|
|
159
|
+
</div>
|
|
160
|
+
|
|
66
161
|
<br />
|
|
67
162
|
to attributes / conditions add support for expiry date
|
|
68
163
|
</div>
|
package/package.json
CHANGED
|
@@ -13,9 +13,11 @@ const SIDEVIEW_WIDTH = "sideview_width"
|
|
|
13
13
|
|
|
14
14
|
export const ContentView = memo(
|
|
15
15
|
({
|
|
16
|
+
headerHeight = 45,
|
|
16
17
|
children,
|
|
17
18
|
storageKeyPrefix: _storageKeyPrefix,
|
|
18
19
|
}: {
|
|
20
|
+
headerHeight?: number;
|
|
19
21
|
children: ReactNode;
|
|
20
22
|
storageKeyPrefix?: string;
|
|
21
23
|
}) => {
|
|
@@ -76,6 +78,7 @@ export const ContentView = memo(
|
|
|
76
78
|
contentViewHeight,
|
|
77
79
|
sidebarWidth,
|
|
78
80
|
setSidebarWidth,
|
|
81
|
+
headerHeight,
|
|
79
82
|
}}
|
|
80
83
|
>
|
|
81
84
|
<div
|
|
@@ -85,15 +88,15 @@ export const ContentView = memo(
|
|
|
85
88
|
flexDirection: "row",
|
|
86
89
|
}}
|
|
87
90
|
>
|
|
88
|
-
<div id="sidebar-container" />
|
|
91
|
+
<div id="sidebar-container" style={{top: headerHeight}} />
|
|
89
92
|
|
|
90
93
|
<div
|
|
91
94
|
ref={contentViewRef}
|
|
92
95
|
key={`content-wrapper-${"content_view_"}`}
|
|
93
96
|
style={{
|
|
94
97
|
width: `calc(100vw - ${contentWidthOffset}px)`,
|
|
95
|
-
height:
|
|
96
|
-
marginTop:
|
|
98
|
+
height: `calc(100vh - ${headerHeight}px)`,
|
|
99
|
+
marginTop: headerHeight,
|
|
97
100
|
overflowY: "scroll",
|
|
98
101
|
marginLeft: sidebarWidth,
|
|
99
102
|
}}
|
|
@@ -28,7 +28,7 @@ import {ReactNode} from "react"
|
|
|
28
28
|
// import EnvSettingsDropdown from "./components/EnvSettingsDropdown"
|
|
29
29
|
|
|
30
30
|
import "./header.scss"
|
|
31
|
-
|
|
31
|
+
import {useContentViewContext} from "../ContentView/ContentViewContext"
|
|
32
32
|
|
|
33
33
|
// const DefaultHeader = () => {
|
|
34
34
|
// return (
|
|
@@ -136,14 +136,18 @@ import "./header.scss"
|
|
|
136
136
|
// )
|
|
137
137
|
// }
|
|
138
138
|
|
|
139
|
-
export const HeaderContainer = ({children}: {children: ReactNode}) => {
|
|
139
|
+
export const HeaderContainer = ({children}: { children: ReactNode }) => {
|
|
140
|
+
const contentViewContext = useContentViewContext()
|
|
140
141
|
|
|
141
142
|
if (!children) return null
|
|
142
143
|
|
|
143
144
|
return (
|
|
144
145
|
<nav
|
|
145
146
|
id="header-container"
|
|
146
|
-
className={
|
|
147
|
+
className={
|
|
148
|
+
"d-flex align-items-center fixed-top bg-dark flex-md-nowrap shadow p-0 text-light"
|
|
149
|
+
}
|
|
150
|
+
style={{height: contentViewContext.headerHeight}}
|
|
147
151
|
>
|
|
148
152
|
{children}
|
|
149
153
|
</nav>
|