@redocly/theme 0.9.12-alpha.0 → 0.9.12
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/lib/Catalog/Filter.d.ts +1 -3
- package/lib/Catalog/Filter.js +4 -83
- package/lib/ReferenceDocs/DevOnboardingTryItSecurity.js +17 -3
- package/package.json +1 -2
- package/src/Catalog/Filter.tsx +3 -123
- package/src/ReferenceDocs/DevOnboardingTryItSecurity.tsx +19 -5
- package/src/types/portal/src/shared/types/catalog.d.ts +1 -3
package/lib/Catalog/Filter.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ResolvedFilter } from '@theme/types/portal/src/shared/types/catalog';
|
|
3
3
|
export declare function Filter({ filter }: {
|
|
4
|
-
filter: ResolvedFilter
|
|
5
|
-
selectedOptions: any;
|
|
6
|
-
};
|
|
4
|
+
filter: ResolvedFilter;
|
|
7
5
|
}): JSX.Element | null;
|
package/lib/Catalog/Filter.js
CHANGED
|
@@ -7,36 +7,19 @@ exports.Filter = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const Checkbox_1 = require("../ui/Checkbox");
|
|
10
|
-
// TODO: figure out how to fix this
|
|
11
|
-
const DatePicker =
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires, import/order, import/no-extraneous-dependencies
|
|
13
|
-
require('react-date-picker').default;
|
|
14
|
-
// disabled type checking for selectedOptions
|
|
15
10
|
function Filter({ filter }) {
|
|
16
|
-
var _a
|
|
11
|
+
var _a;
|
|
17
12
|
if (!filter.parentUsed)
|
|
18
13
|
return null;
|
|
19
14
|
return (react_1.default.createElement(FilterGroup, { key: filter.property + filter.title },
|
|
20
|
-
react_1.default.createElement(FilterTitle, null,
|
|
21
|
-
|
|
22
|
-
((_a = filter.selectedOptions) === null || _a === void 0 ? void 0 : _a.size) ? (react_1.default.createElement("a", { onClick: () => filter.selectOption('') }, " Clear ")) : null),
|
|
23
|
-
filter.type === 'select' ? (react_1.default.createElement(StyledSelect, { onChange: (e) => filter.selectOption(e.target.value), value: ((_b = filter.selectedOptions.values().next()) === null || _b === void 0 ? void 0 : _b.value) || '' },
|
|
15
|
+
react_1.default.createElement(FilterTitle, null, filter.title),
|
|
16
|
+
filter.type === 'select' ? (react_1.default.createElement(StyledSelect, { onChange: (e) => filter.selectOption(e.target.value), value: ((_a = filter.selectedOptions.values().next()) === null || _a === void 0 ? void 0 : _a.value) || '' },
|
|
24
17
|
react_1.default.createElement("option", { key: "none", value: "" }, "All"),
|
|
25
18
|
filter.filteredOptions.map((value) => (react_1.default.createElement("option", { key: value.value, value: value.value },
|
|
26
19
|
value.value,
|
|
27
20
|
" (",
|
|
28
21
|
value.count,
|
|
29
|
-
")"))))) : filter.
|
|
30
|
-
react_1.default.createElement(DatePickerWrapper, null,
|
|
31
|
-
react_1.default.createElement("span", null, " From: "),
|
|
32
|
-
react_1.default.createElement(DatePicker, { closeCalendar: true, format: "y-MM-dd", dayPlaceholder: "DD", monthPlaceholder: "MM", yearPlaceholder: "YYYY", value: filter.selectedOptions.from ? new Date(filter.selectedOptions.from) : null, minDetail: "decade", maxDate: new Date(), onChange: (from) => {
|
|
33
|
-
filter.selectOption(Object.assign(Object.assign({}, filter.selectedOptions), { from: formatDateWithNoTimeZone(from) }));
|
|
34
|
-
} })),
|
|
35
|
-
react_1.default.createElement(DatePickerWrapper, null,
|
|
36
|
-
react_1.default.createElement("span", null, " To: "),
|
|
37
|
-
react_1.default.createElement(DatePicker, { closeCalendar: true, dayPlaceholder: "DD", monthPlaceholder: "MM", yearPlaceholder: "YYYY", format: "y-MM-dd", minDate: filter.selectedOptions.from ? new Date(filter.selectedOptions.from) : undefined, value: filter.selectedOptions.to ? new Date(filter.selectedOptions.to) : null, minDetail: "decade", onChange: (to) => {
|
|
38
|
-
filter.selectOption(Object.assign(Object.assign({}, filter.selectedOptions), { to: formatDateWithNoTimeZone(to) }));
|
|
39
|
-
} })))) : (filter.filteredOptions.map((value) => {
|
|
22
|
+
")"))))) : (filter.filteredOptions.map((value) => {
|
|
40
23
|
const id = 'filter--' + filter.property + '--' + slug(value.value);
|
|
41
24
|
return (react_1.default.createElement(FilterValue, { key: id },
|
|
42
25
|
react_1.default.createElement(Checkbox_1.Checkbox, { type: "checkbox", id: id, checked: filter.selectedOptions.has(value.value), onChange: () => filter.toggleOption(value.value) }),
|
|
@@ -61,11 +44,6 @@ const FilterTitle = styled_components_1.default.h4 `
|
|
|
61
44
|
font-weight: var(--font-weight-bold);
|
|
62
45
|
margin: 0;
|
|
63
46
|
margin-bottom: 16px;
|
|
64
|
-
|
|
65
|
-
> a {
|
|
66
|
-
font-size: 14px;
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
}
|
|
69
47
|
`;
|
|
70
48
|
const FilterValue = styled_components_1.default.label `
|
|
71
49
|
display: block;
|
|
@@ -100,66 +78,9 @@ const StyledSelect = styled_components_1.default.select `
|
|
|
100
78
|
background-position: right 10px center;
|
|
101
79
|
background-size: 1em;
|
|
102
80
|
width: 100%;
|
|
103
|
-
padding-right: 25px;
|
|
104
81
|
`;
|
|
105
82
|
// TODO: import from portal
|
|
106
83
|
function slug(str) {
|
|
107
84
|
return str.replace(/\s/g, '-').toLowerCase();
|
|
108
85
|
}
|
|
109
|
-
const DatePickerWrapper = styled_components_1.default.div `
|
|
110
|
-
display: flex;
|
|
111
|
-
flex-direction: row;
|
|
112
|
-
margin-bottom: 5px;
|
|
113
|
-
|
|
114
|
-
align-items: center;
|
|
115
|
-
gap: 10px;
|
|
116
|
-
|
|
117
|
-
> span {
|
|
118
|
-
width: 50px;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.react-date-picker {
|
|
122
|
-
flex: 1;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.react-calendar__tile--now {
|
|
126
|
-
background: #cbf7f1;
|
|
127
|
-
color: black;
|
|
128
|
-
|
|
129
|
-
&:enabled:hover,
|
|
130
|
-
&:enabled:focus {
|
|
131
|
-
background: #b1efe7;
|
|
132
|
-
color: black;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.react-date-picker__inputGroup__input:invalid {
|
|
137
|
-
background: rgb(255 125 0 / 10%);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.react-date-picker__button {
|
|
141
|
-
padding: 4px 4px;
|
|
142
|
-
svg {
|
|
143
|
-
width: 12px;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.react-date-picker__wrapper {
|
|
148
|
-
border: 1px solid rgba(0, 0, 0, 0.23);
|
|
149
|
-
border-radius: var(--border-radius);
|
|
150
|
-
padding: var(--input-padding);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.react-date-picker__inputGroup__input {
|
|
154
|
-
width: 20px;
|
|
155
|
-
}
|
|
156
|
-
`;
|
|
157
|
-
function padZero(num) {
|
|
158
|
-
return num < 10 ? '0' + num : num;
|
|
159
|
-
}
|
|
160
|
-
function formatDateWithNoTimeZone(date) {
|
|
161
|
-
if (!date)
|
|
162
|
-
return date;
|
|
163
|
-
return `${date.getFullYear()}-${padZero(date.getMonth() + 1)}-${padZero(date.getDate())}`;
|
|
164
|
-
}
|
|
165
86
|
//# sourceMappingURL=Filter.js.map
|
|
@@ -31,11 +31,13 @@ const React = __importStar(require("react"));
|
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const Button_1 = require("../Button/Button");
|
|
33
33
|
const usePageData_1 = require("../mocks/hooks/usePageData");
|
|
34
|
+
const usePreloadHistory_1 = require("../mocks/usePreloadHistory");
|
|
34
35
|
const Dropdown_1 = require("./Dropdown");
|
|
35
36
|
function DevOnboardingTryItSecurity(props) {
|
|
36
37
|
const apiId = props.apiId;
|
|
37
38
|
// @ts-ignore
|
|
38
39
|
const { userData } = (0, usePageData_1.usePageData)('userData') || {};
|
|
40
|
+
const history = (0, usePreloadHistory_1.usePreloadHistory)();
|
|
39
41
|
// TODO: handle error
|
|
40
42
|
const [_error, setError] = React.useState();
|
|
41
43
|
const [apps, setApps] = React.useState();
|
|
@@ -45,6 +47,7 @@ function DevOnboardingTryItSecurity(props) {
|
|
|
45
47
|
const [selectedAppSecret, setSelectedAppSecret] = React.useState();
|
|
46
48
|
const [acceptValueUpdate, setAcceptValueUpdate] = React.useState(true);
|
|
47
49
|
const initialRender = React.useRef(true);
|
|
50
|
+
const hasApiAccess = !loading && !!(apps === null || apps === void 0 ? void 0 : apps.length);
|
|
48
51
|
React.useEffect(() => {
|
|
49
52
|
if (!props.value && initialRender.current)
|
|
50
53
|
return;
|
|
@@ -110,7 +113,11 @@ function DevOnboardingTryItSecurity(props) {
|
|
|
110
113
|
.finally(() => setAppLoading(false));
|
|
111
114
|
});
|
|
112
115
|
};
|
|
113
|
-
const placeholder = loading
|
|
116
|
+
const placeholder = loading
|
|
117
|
+
? 'Loading your apps...'
|
|
118
|
+
: hasApiAccess
|
|
119
|
+
? undefined
|
|
120
|
+
: 'You do not have access to this API';
|
|
114
121
|
return (React.createElement(React.Fragment, null,
|
|
115
122
|
React.createElement(FormLabel, { htmlFor: "server" }, "Select app: "),
|
|
116
123
|
React.createElement(FormControl, null,
|
|
@@ -118,7 +125,14 @@ function DevOnboardingTryItSecurity(props) {
|
|
|
118
125
|
setAppId(value);
|
|
119
126
|
loadAppCredentials(value);
|
|
120
127
|
} }),
|
|
121
|
-
React.createElement(UseKeyButton, { disabled: !selectedAppSecret || appLoading, color: "secondary", onClick: () =>
|
|
128
|
+
React.createElement(UseKeyButton, { disabled: (!selectedAppSecret && hasApiAccess) || appLoading, color: "secondary", onClick: () => {
|
|
129
|
+
if (selectedAppSecret) {
|
|
130
|
+
props.onChange(selectedAppSecret);
|
|
131
|
+
}
|
|
132
|
+
else if (!hasApiAccess) {
|
|
133
|
+
history.push('/apps/?createApp&apiId=' + apiId);
|
|
134
|
+
}
|
|
135
|
+
} }, appLoading ? 'Loading...' : hasApiAccess ? 'Use key' : 'Request access'))));
|
|
122
136
|
}
|
|
123
137
|
exports.DevOnboardingTryItSecurity = DevOnboardingTryItSecurity;
|
|
124
138
|
const TryItDropdown = (0, styled_components_1.default)(Dropdown_1.Dropdown) `
|
|
@@ -156,7 +170,7 @@ const FormLabel = styled_components_1.default.label `
|
|
|
156
170
|
`}
|
|
157
171
|
`;
|
|
158
172
|
const UseKeyButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
159
|
-
width: 100px;
|
|
173
|
+
min-width: 100px;
|
|
160
174
|
align-self: flex-end;
|
|
161
175
|
margin-top: 10px;
|
|
162
176
|
margin-right: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.9.12
|
|
3
|
+
"version": "0.9.12",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"author": "team@redocly.com",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -83,7 +83,6 @@
|
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"copy-to-clipboard": "^3.3.3",
|
|
85
85
|
"highlight-words-core": "^1.2.2",
|
|
86
|
-
"react-date-picker": "9.2.0",
|
|
87
86
|
"hotkeys-js": "^3.10.1",
|
|
88
87
|
"timeago.js": "^4.0.2"
|
|
89
88
|
},
|
package/src/Catalog/Filter.tsx
CHANGED
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import type { DatePickerProps } from 'react-date-picker';
|
|
5
|
-
|
|
6
4
|
import type { ResolvedFilter } from '@theme/types/portal/src/shared/types/catalog';
|
|
7
5
|
import { Checkbox } from '@theme/ui/Checkbox';
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
const DatePicker: React.FC<DatePickerProps> =
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires, import/order, import/no-extraneous-dependencies
|
|
12
|
-
require('react-date-picker').default;
|
|
13
|
-
|
|
14
|
-
// disabled type checking for selectedOptions
|
|
15
|
-
export function Filter({ filter }: { filter: ResolvedFilter & { selectedOptions: any } }) {
|
|
7
|
+
export function Filter({ filter }: { filter: ResolvedFilter }) {
|
|
16
8
|
if (!filter.parentUsed) return null;
|
|
17
9
|
return (
|
|
18
10
|
<FilterGroup key={filter.property + filter.title}>
|
|
19
|
-
<FilterTitle>
|
|
20
|
-
{filter.title}
|
|
21
|
-
{filter.selectedOptions?.size ? (
|
|
22
|
-
<a onClick={() => filter.selectOption('')}> Clear </a>
|
|
23
|
-
) : null}
|
|
24
|
-
</FilterTitle>
|
|
11
|
+
<FilterTitle>{filter.title}</FilterTitle>
|
|
25
12
|
{filter.type === 'select' ? (
|
|
26
13
|
<StyledSelect
|
|
27
14
|
onChange={(e) => filter.selectOption(e.target.value)}
|
|
28
|
-
value={
|
|
15
|
+
value={filter.selectedOptions.values().next()?.value || ''}
|
|
29
16
|
>
|
|
30
17
|
<option key="none" value="">
|
|
31
18
|
All
|
|
@@ -36,49 +23,6 @@ export function Filter({ filter }: { filter: ResolvedFilter & { selectedOptions:
|
|
|
36
23
|
</option>
|
|
37
24
|
))}
|
|
38
25
|
</StyledSelect>
|
|
39
|
-
) : filter.type === 'date-range' ? (
|
|
40
|
-
<>
|
|
41
|
-
<DatePickerWrapper>
|
|
42
|
-
<span> From: </span>
|
|
43
|
-
<DatePicker
|
|
44
|
-
closeCalendar={true}
|
|
45
|
-
format="y-MM-dd"
|
|
46
|
-
dayPlaceholder="DD"
|
|
47
|
-
monthPlaceholder="MM"
|
|
48
|
-
yearPlaceholder="YYYY"
|
|
49
|
-
value={filter.selectedOptions.from ? new Date(filter.selectedOptions.from) : null}
|
|
50
|
-
minDetail="decade"
|
|
51
|
-
maxDate={new Date()}
|
|
52
|
-
onChange={(from: Date) => {
|
|
53
|
-
filter.selectOption({
|
|
54
|
-
...(filter.selectedOptions as any),
|
|
55
|
-
from: formatDateWithNoTimeZone(from),
|
|
56
|
-
});
|
|
57
|
-
}}
|
|
58
|
-
/>
|
|
59
|
-
</DatePickerWrapper>
|
|
60
|
-
<DatePickerWrapper>
|
|
61
|
-
<span> To: </span>
|
|
62
|
-
<DatePicker
|
|
63
|
-
closeCalendar={true}
|
|
64
|
-
dayPlaceholder="DD"
|
|
65
|
-
monthPlaceholder="MM"
|
|
66
|
-
yearPlaceholder="YYYY"
|
|
67
|
-
format="y-MM-dd"
|
|
68
|
-
minDate={
|
|
69
|
-
filter.selectedOptions.from ? new Date(filter.selectedOptions.from) : undefined
|
|
70
|
-
}
|
|
71
|
-
value={filter.selectedOptions.to ? new Date(filter.selectedOptions.to) : null}
|
|
72
|
-
minDetail="decade"
|
|
73
|
-
onChange={(to: Date) => {
|
|
74
|
-
filter.selectOption({
|
|
75
|
-
...filter.selectedOptions,
|
|
76
|
-
to: formatDateWithNoTimeZone(to),
|
|
77
|
-
});
|
|
78
|
-
}}
|
|
79
|
-
/>
|
|
80
|
-
</DatePickerWrapper>
|
|
81
|
-
</>
|
|
82
26
|
) : (
|
|
83
27
|
filter.filteredOptions.map((value: any) => {
|
|
84
28
|
const id = 'filter--' + filter.property + '--' + slug(value.value);
|
|
@@ -115,11 +59,6 @@ const FilterTitle = styled.h4`
|
|
|
115
59
|
font-weight: var(--font-weight-bold);
|
|
116
60
|
margin: 0;
|
|
117
61
|
margin-bottom: 16px;
|
|
118
|
-
|
|
119
|
-
> a {
|
|
120
|
-
font-size: 14px;
|
|
121
|
-
cursor: pointer;
|
|
122
|
-
}
|
|
123
62
|
`;
|
|
124
63
|
|
|
125
64
|
const FilterValue = styled.label`
|
|
@@ -156,68 +95,9 @@ const StyledSelect = styled.select`
|
|
|
156
95
|
background-position: right 10px center;
|
|
157
96
|
background-size: 1em;
|
|
158
97
|
width: 100%;
|
|
159
|
-
padding-right: 25px;
|
|
160
98
|
`;
|
|
161
99
|
|
|
162
100
|
// TODO: import from portal
|
|
163
101
|
function slug(str: string): string {
|
|
164
102
|
return str.replace(/\s/g, '-').toLowerCase();
|
|
165
103
|
}
|
|
166
|
-
|
|
167
|
-
const DatePickerWrapper = styled.div`
|
|
168
|
-
display: flex;
|
|
169
|
-
flex-direction: row;
|
|
170
|
-
margin-bottom: 5px;
|
|
171
|
-
|
|
172
|
-
align-items: center;
|
|
173
|
-
gap: 10px;
|
|
174
|
-
|
|
175
|
-
> span {
|
|
176
|
-
width: 50px;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.react-date-picker {
|
|
180
|
-
flex: 1;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.react-calendar__tile--now {
|
|
184
|
-
background: #cbf7f1;
|
|
185
|
-
color: black;
|
|
186
|
-
|
|
187
|
-
&:enabled:hover,
|
|
188
|
-
&:enabled:focus {
|
|
189
|
-
background: #b1efe7;
|
|
190
|
-
color: black;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.react-date-picker__inputGroup__input:invalid {
|
|
195
|
-
background: rgb(255 125 0 / 10%);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.react-date-picker__button {
|
|
199
|
-
padding: 4px 4px;
|
|
200
|
-
svg {
|
|
201
|
-
width: 12px;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.react-date-picker__wrapper {
|
|
206
|
-
border: 1px solid rgba(0, 0, 0, 0.23);
|
|
207
|
-
border-radius: var(--border-radius);
|
|
208
|
-
padding: var(--input-padding);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.react-date-picker__inputGroup__input {
|
|
212
|
-
width: 20px;
|
|
213
|
-
}
|
|
214
|
-
`;
|
|
215
|
-
|
|
216
|
-
function padZero(num: number) {
|
|
217
|
-
return num < 10 ? '0' + num : num;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
function formatDateWithNoTimeZone(date?: Date | null) {
|
|
221
|
-
if (!date) return date;
|
|
222
|
-
return `${date.getFullYear()}-${padZero(date.getMonth() + 1)}-${padZero(date.getDate())}`;
|
|
223
|
-
}
|
|
@@ -5,6 +5,7 @@ import type { TryItSecurityAppsProps } from './TryItSecurityApps';
|
|
|
5
5
|
|
|
6
6
|
import { Button } from '@theme/Button/Button';
|
|
7
7
|
import { usePageData } from '@portal/hooks/usePageData';
|
|
8
|
+
import { usePreloadHistory } from '@portal/usePreloadHistory';
|
|
8
9
|
|
|
9
10
|
import { Dropdown } from './Dropdown';
|
|
10
11
|
|
|
@@ -13,6 +14,7 @@ export function DevOnboardingTryItSecurity(props: TryItSecurityAppsProps) {
|
|
|
13
14
|
|
|
14
15
|
// @ts-ignore
|
|
15
16
|
const { userData } = usePageData('userData') || {};
|
|
17
|
+
const history = usePreloadHistory();
|
|
16
18
|
|
|
17
19
|
// TODO: handle error
|
|
18
20
|
const [_error, setError] = React.useState<string | undefined>();
|
|
@@ -26,6 +28,8 @@ export function DevOnboardingTryItSecurity(props: TryItSecurityAppsProps) {
|
|
|
26
28
|
const [acceptValueUpdate, setAcceptValueUpdate] = React.useState(true);
|
|
27
29
|
const initialRender = React.useRef(true);
|
|
28
30
|
|
|
31
|
+
const hasApiAccess = !loading && !!apps?.length;
|
|
32
|
+
|
|
29
33
|
React.useEffect(() => {
|
|
30
34
|
if (!props.value && initialRender.current) return;
|
|
31
35
|
if (acceptValueUpdate) {
|
|
@@ -92,7 +96,11 @@ export function DevOnboardingTryItSecurity(props: TryItSecurityAppsProps) {
|
|
|
92
96
|
});
|
|
93
97
|
};
|
|
94
98
|
|
|
95
|
-
const placeholder = loading
|
|
99
|
+
const placeholder = loading
|
|
100
|
+
? 'Loading your apps...'
|
|
101
|
+
: hasApiAccess
|
|
102
|
+
? undefined
|
|
103
|
+
: 'You do not have access to this API';
|
|
96
104
|
|
|
97
105
|
return (
|
|
98
106
|
<>
|
|
@@ -109,11 +117,17 @@ export function DevOnboardingTryItSecurity(props: TryItSecurityAppsProps) {
|
|
|
109
117
|
}}
|
|
110
118
|
/>
|
|
111
119
|
<UseKeyButton
|
|
112
|
-
disabled={!selectedAppSecret || appLoading}
|
|
120
|
+
disabled={(!selectedAppSecret && hasApiAccess) || appLoading}
|
|
113
121
|
color="secondary"
|
|
114
|
-
onClick={() =>
|
|
122
|
+
onClick={() => {
|
|
123
|
+
if (selectedAppSecret) {
|
|
124
|
+
props.onChange(selectedAppSecret);
|
|
125
|
+
} else if (!hasApiAccess) {
|
|
126
|
+
history.push('/apps/?createApp&apiId=' + apiId);
|
|
127
|
+
}
|
|
128
|
+
}}
|
|
115
129
|
>
|
|
116
|
-
{appLoading ? 'Loading...' : 'Use key'}
|
|
130
|
+
{appLoading ? 'Loading...' : hasApiAccess ? 'Use key' : 'Request access'}
|
|
117
131
|
</UseKeyButton>
|
|
118
132
|
</FormControl>
|
|
119
133
|
</>
|
|
@@ -159,7 +173,7 @@ const FormLabel = styled.label<{ required?: boolean }>`
|
|
|
159
173
|
`;
|
|
160
174
|
|
|
161
175
|
const UseKeyButton = styled(Button)`
|
|
162
|
-
width: 100px;
|
|
176
|
+
min-width: 100px;
|
|
163
177
|
align-self: flex-end;
|
|
164
178
|
margin-top: 10px;
|
|
165
179
|
margin-right: 0;
|
|
@@ -8,7 +8,7 @@ export type FilteredCatalog = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export type Filter = {
|
|
11
|
-
type?: 'select' | 'checkboxes'
|
|
11
|
+
type?: 'select' | 'checkboxes';
|
|
12
12
|
title: string;
|
|
13
13
|
property: string;
|
|
14
14
|
parentFilter?: string;
|
|
@@ -44,7 +44,6 @@ export type ResolvedFilter = Omit<Filter, 'options'> & {
|
|
|
44
44
|
selectOption: (option: string) => void;
|
|
45
45
|
parentUsed: boolean;
|
|
46
46
|
selectedOptions: Set<string>;
|
|
47
|
-
range?: {from?: string; to?: string};
|
|
48
47
|
};
|
|
49
48
|
|
|
50
49
|
export type CatalogItem = {
|
|
@@ -52,6 +51,5 @@ export type CatalogItem = {
|
|
|
52
51
|
link: string;
|
|
53
52
|
description?: string;
|
|
54
53
|
image?: string;
|
|
55
|
-
docsLink?: string;
|
|
56
54
|
[k: string]: unknown;
|
|
57
55
|
};
|