@schemavaults/auth-ui 0.17.2 → 0.19.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/dist/components/ApiServersCard/api_servers_card.d.ts +20 -4
- package/dist/components/ApiServersCard/api_servers_card.js +36 -34
- package/dist/components/ApiServersCard/api_servers_card.js.map +1 -1
- package/dist/components/AppsCard/apps_card.d.ts +19 -4
- package/dist/components/AppsCard/apps_card.js +36 -36
- package/dist/components/AppsCard/apps_card.js.map +1 -1
- package/dist/components/CreateApiServerDialog/CreateApiServerDialog.d.ts +5 -4
- package/dist/components/CreateApiServerDialog/CreateApiServerDialog.js.map +1 -1
- package/dist/components/CreateApiServerDialog/CreateApiServerForm.d.ts +5 -4
- package/dist/components/CreateApiServerDialog/CreateApiServerForm.js +27 -8
- package/dist/components/CreateApiServerDialog/CreateApiServerForm.js.map +1 -1
- package/dist/components/CreateAppDialog/CreateAppDialog.d.ts +5 -4
- package/dist/components/CreateAppDialog/CreateAppDialog.js.map +1 -1
- package/dist/components/CreateAppDialog/CreateAppForm.d.ts +5 -4
- package/dist/components/CreateAppDialog/CreateAppForm.js +27 -8
- package/dist/components/CreateAppDialog/CreateAppForm.js.map +1 -1
- package/dist/components/MfaChallengeForm/mfa-challenge-form.d.ts +1 -0
- package/dist/components/MfaChallengeForm/mfa-challenge-form.js +10 -1
- package/dist/components/MfaChallengeForm/mfa-challenge-form.js.map +1 -1
- package/dist/components/ResourceOwnershipPicker/ResourceOwnershipPicker.d.ts +31 -0
- package/dist/components/ResourceOwnershipPicker/ResourceOwnershipPicker.js +107 -0
- package/dist/components/ResourceOwnershipPicker/ResourceOwnershipPicker.js.map +1 -0
- package/dist/components/ResourceOwnershipPicker/index.d.ts +8 -0
- package/dist/components/ResourceOwnershipPicker/index.js +5 -0
- package/dist/components/ResourceOwnershipPicker/index.js.map +1 -0
- package/dist/components/ResourceOwnershipPicker/resource-ownership-choices.d.ts +158 -0
- package/dist/components/ResourceOwnershipPicker/resource-ownership-choices.js +203 -0
- package/dist/components/ResourceOwnershipPicker/resource-ownership-choices.js.map +1 -0
- package/dist/components/ResourceOwnershipPicker/useResourceOwnershipChoices.d.ts +39 -0
- package/dist/components/ResourceOwnershipPicker/useResourceOwnershipChoices.js +50 -0
- package/dist/components/ResourceOwnershipPicker/useResourceOwnershipChoices.js.map +1 -0
- package/dist/components/ResourceOwnershipPicker/useResourceOwnershipSelection.d.ts +19 -0
- package/dist/components/ResourceOwnershipPicker/useResourceOwnershipSelection.js +21 -0
- package/dist/components/ResourceOwnershipPicker/useResourceOwnershipSelection.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/package.json +7 -3
|
@@ -8,6 +8,11 @@ export interface ApiServersCardProps {
|
|
|
8
8
|
cardClassName?: string;
|
|
9
9
|
queryType: ListApiServersQueryType;
|
|
10
10
|
organization_id?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Display name of `organization_id` (organization pages), shown in the
|
|
13
|
+
* create dialog's organization picker.
|
|
14
|
+
*/
|
|
15
|
+
organization_name?: string;
|
|
11
16
|
preloaded?: PreloadedApiServersTableDataWithDomainRefs;
|
|
12
17
|
uuid: () => string;
|
|
13
18
|
showConnectAppToApi?: boolean;
|
|
@@ -18,14 +23,25 @@ export interface ApiServersCardProps {
|
|
|
18
23
|
* actions).
|
|
19
24
|
*/
|
|
20
25
|
managedOrganizationIds?: readonly string[];
|
|
21
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Client-side filter on each row's resolved owner type. Also picks the
|
|
28
|
+
* owner the create dialog preselects on the "all" / "owned" /
|
|
29
|
+
* "accessible" lists (e.g. "organization" → an organization).
|
|
30
|
+
*/
|
|
22
31
|
ownerTypeFilter?: OwnerTypeFilterValue;
|
|
23
32
|
/**
|
|
24
|
-
* Whether the card offers API server creation at all (default true).
|
|
25
|
-
*
|
|
26
|
-
*
|
|
33
|
+
* Whether the card offers API server creation at all (default true). The
|
|
34
|
+
* "Create API" button is also hidden while the viewer cannot pick any
|
|
35
|
+
* owner in the create dialog.
|
|
27
36
|
*/
|
|
28
37
|
canCreate?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the create dialog offers personal (user-owned) API servers:
|
|
40
|
+
* false when the `allow_user_owned_resource_creation` server setting is
|
|
41
|
+
* disabled for a non-admin viewer (default true; the server enforces it
|
|
42
|
+
* regardless).
|
|
43
|
+
*/
|
|
44
|
+
canCreatePersonal?: boolean;
|
|
29
45
|
}
|
|
30
46
|
export declare function ApiServersCard(props: ApiServersCardProps): ReactElement;
|
|
31
47
|
export default ApiServersCard;
|
|
@@ -2,43 +2,48 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, cn, } from "@schemavaults/ui";
|
|
5
|
-
import {
|
|
5
|
+
import { hasAvailableResourceOwnership, preferredResourceOwnershipForList, useResourceOwnershipChoices, } from "../ResourceOwnershipPicker";
|
|
6
6
|
import { ApiServersTable, clearUseApiServersCache, } from "../ApiServersTable";
|
|
7
7
|
import CreateApiServerDialog, { CreateApiServerDialogOpenDispatchContext, } from "../CreateApiServerDialog";
|
|
8
8
|
import CreateApiServerDomainDialog, { CreateApiServerDomainDialogOpenContext, CreateApiServerDomainDialogOpenDispatchContext, } from "../CreateApiServerDomainDialog";
|
|
9
9
|
import { useAuthUiOwnerOrganizationId } from "../OwnerOrganizationProvider";
|
|
10
10
|
import ConnectAppToApiDialog, { ConnectAppToApiDialogOpenDispatchContext, } from "../ConnectAppToApiDialog";
|
|
11
|
-
/**
|
|
12
|
-
* @description Who an API server created from a card of the given query
|
|
13
|
-
* type belongs to: platform-owned from the admin "all" list,
|
|
14
|
-
* organization-owned from an organization page, user-owned from the
|
|
15
|
-
* "owned" (your API servers) card. Returns null when the card cannot
|
|
16
|
-
* create API servers.
|
|
17
|
-
*/
|
|
18
|
-
function resolveCreateOwnershipForCard(queryType, organization_id, platformOrganizationId, currentUserUid) {
|
|
19
|
-
switch (queryType) {
|
|
20
|
-
case "all":
|
|
21
|
-
return { owner_type: "platform" };
|
|
22
|
-
case "org":
|
|
23
|
-
return organization_id && organization_id !== platformOrganizationId
|
|
24
|
-
? { owner_type: "organization", owner_organization_id: organization_id }
|
|
25
|
-
: { owner_type: "platform" };
|
|
26
|
-
case "owned":
|
|
27
|
-
case "accessible":
|
|
28
|
-
// The "accessible" page creates personal API servers;
|
|
29
|
-
// organization-owned ones are created from the organization's page
|
|
30
|
-
// and platform-owned ones from the admin console.
|
|
31
|
-
return currentUserUid
|
|
32
|
-
? { owner_type: "user", owner_uid: currentUserUid }
|
|
33
|
-
: null;
|
|
34
|
-
default:
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
11
|
export function ApiServersCard(props) {
|
|
39
12
|
const ownerOrganizationId = useAuthUiOwnerOrganizationId();
|
|
40
|
-
|
|
41
|
-
|
|
13
|
+
// Lists whose rows the viewer may manage (add domains) and to which they
|
|
14
|
+
// may add API servers.
|
|
15
|
+
const canManageListedApiServers = props.queryType === "all" ||
|
|
16
|
+
props.queryType === "owned" ||
|
|
17
|
+
props.queryType === "accessible" ||
|
|
18
|
+
(props.queryType === "org" && !!props.isOrgOwner);
|
|
19
|
+
// The owner the create dialog preselects follows the list it was opened
|
|
20
|
+
// from; the dialog's "Owner" field lets the viewer pick another.
|
|
21
|
+
const defaultCreateOwnership = preferredResourceOwnershipForList({
|
|
22
|
+
queryType: props.queryType,
|
|
23
|
+
organization_id: props.organization_id,
|
|
24
|
+
platformOrganizationId: ownerOrganizationId,
|
|
25
|
+
ownerTypeFilter: props.ownerTypeFilter,
|
|
26
|
+
});
|
|
27
|
+
const createOwnershipOptions = defaultCreateOwnership
|
|
28
|
+
? {
|
|
29
|
+
defaultOwnership: defaultCreateOwnership,
|
|
30
|
+
allowPersonal: props.canCreatePersonal ?? true,
|
|
31
|
+
contextOrganization: props.queryType === "org" &&
|
|
32
|
+
props.isOrgOwner &&
|
|
33
|
+
props.organization_id &&
|
|
34
|
+
props.organization_id !== ownerOrganizationId
|
|
35
|
+
? {
|
|
36
|
+
organization_id: props.organization_id,
|
|
37
|
+
organization_name: props.organization_name ?? null,
|
|
38
|
+
}
|
|
39
|
+
: undefined,
|
|
40
|
+
}
|
|
41
|
+
: null;
|
|
42
|
+
const offersCreation = (props.canCreate ?? true) &&
|
|
43
|
+
canManageListedApiServers &&
|
|
44
|
+
!!createOwnershipOptions;
|
|
45
|
+
const { choices: createOwnershipChoices } = useResourceOwnershipChoices(createOwnershipOptions ?? {}, { enabled: offersCreation });
|
|
46
|
+
const canCreateApiServers = offersCreation && hasAvailableResourceOwnership(createOwnershipChoices);
|
|
42
47
|
const cardTitle = props.cardTitle ?? "API Servers";
|
|
43
48
|
const cardDescription = props.cardDescription ??
|
|
44
49
|
"View and manage backend API servers accessible from client applications.";
|
|
@@ -46,10 +51,7 @@ export function ApiServersCard(props) {
|
|
|
46
51
|
const [createApiServerDialogOpen, setCreateApiServerDialogOpen] = useState(false);
|
|
47
52
|
const [connectAppToApiDialogOpen, setConnectAppToApiDialogOpen] = useState(false);
|
|
48
53
|
const [isAddApiServerDomainDialogOpen, setAddApiServerDomainDialogOpen] = useState(false);
|
|
49
|
-
return (_jsx(CreateApiServerDialogOpenDispatchContext.Provider, { value: setCreateApiServerDialogOpen, children: _jsx(ConnectAppToApiDialogOpenDispatchContext.Provider, { value: setConnectAppToApiDialogOpen, children: _jsx(CreateApiServerDomainDialogOpenDispatchContext.Provider, { value: setAddApiServerDomainDialogOpen, children: _jsxs(CreateApiServerDomainDialogOpenContext.Provider, { value: isAddApiServerDomainDialogOpen, children: [_jsxs(Card, { className: cardClassName, children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: cardTitle }), _jsx(CardDescription, { children: cardDescription })] }), _jsx(CardContent, { children: _jsx(ApiServersTable, { queryType: props.queryType, organization_id: props.organization_id, preloaded: props.preloaded, showConnectAppToApi: props.showConnectAppToApi, isOrgOwner: props.isOrgOwner, managedOrganizationIds: props.managedOrganizationIds, ownerTypeFilter: props.ownerTypeFilter, canCreate:
|
|
50
|
-
props.queryType === "owned" ||
|
|
51
|
-
props.queryType === "accessible" ||
|
|
52
|
-
(props.queryType === "org" && props.isOrgOwner)) && (_jsx(CreateApiServerDomainDialog, { open: typeof isAddApiServerDomainDialogOpen === "string", onOpenChange: (val) => {
|
|
54
|
+
return (_jsx(CreateApiServerDialogOpenDispatchContext.Provider, { value: setCreateApiServerDialogOpen, children: _jsx(ConnectAppToApiDialogOpenDispatchContext.Provider, { value: setConnectAppToApiDialogOpen, children: _jsx(CreateApiServerDomainDialogOpenDispatchContext.Provider, { value: setAddApiServerDomainDialogOpen, children: _jsxs(CreateApiServerDomainDialogOpenContext.Provider, { value: isAddApiServerDomainDialogOpen, children: [_jsxs(Card, { className: cardClassName, children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: cardTitle }), _jsx(CardDescription, { children: cardDescription })] }), _jsx(CardContent, { children: _jsx(ApiServersTable, { queryType: props.queryType, organization_id: props.organization_id, preloaded: props.preloaded, showConnectAppToApi: props.showConnectAppToApi, isOrgOwner: props.isOrgOwner, managedOrganizationIds: props.managedOrganizationIds, ownerTypeFilter: props.ownerTypeFilter, canCreate: canCreateApiServers }) }), _jsx(CardFooter, { children: _jsx("div", { className: "flex flex-row items-start justify-start gap-2" }) })] }), canCreateApiServers && createOwnershipOptions && (_jsx(CreateApiServerDialog, { clearApiServersCache: clearUseApiServersCache, ownership: createOwnershipOptions, open: createApiServerDialogOpen, onOpenChange: setCreateApiServerDialogOpen, uuid: props.uuid })), (props.queryType === "all" || props.showConnectAppToApi) && (_jsx(ConnectAppToApiDialog, { open: connectAppToApiDialogOpen, onOpenChange: setConnectAppToApiDialogOpen })), canManageListedApiServers && (_jsx(CreateApiServerDomainDialog, { open: typeof isAddApiServerDomainDialogOpen === "string", onOpenChange: (val) => {
|
|
53
55
|
if (!val) {
|
|
54
56
|
setAddApiServerDomainDialogOpen(false);
|
|
55
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_servers_card.js","sourceRoot":"","sources":["../../../src/components/ApiServersCard/api_servers_card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAqB,MAAM,OAAO,CAAC;AACpD,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,EACT,EAAE,GACH,MAAM,kBAAkB,CAAC;AAM1B,OAAO,
|
|
1
|
+
{"version":3,"file":"api_servers_card.js","sourceRoot":"","sources":["../../../src/components/ApiServersCard/api_servers_card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAqB,MAAM,OAAO,CAAC;AACpD,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,EACT,EAAE,GACH,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EACL,6BAA6B,EAC7B,iCAAiC,EACjC,2BAA2B,GAG5B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,eAAe,EACf,uBAAuB,GAExB,MAAM,8BAA8B,CAAC;AACtC,OAAO,qBAAqB,EAAE,EAC5B,wCAAwC,GACzC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,2BAA2B,EAAE,EAClC,sCAAsC,EACtC,8CAA8C,GAC/C,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,qBAAqB,EAAE,EAC5B,wCAAwC,GACzC,MAAM,oCAAoC,CAAC;AA4C5C,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,mBAAmB,GAAW,4BAA4B,EAAE,CAAC;IACnE,yEAAyE;IACzE,uBAAu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AA+C,GAAO,GAC1D,IACR,EACN,mBAAmB,IAAI,sBAAsB,IAAI,CAChD,KAAC,qBAAqB,IACpB,oBAAoB,EAAE,uBAAuB,EAC7C,SAAS,EAAE,sBAAsB,EACjC,IAAI,EAAE,yBAAyB,EAC/B,YAAY,EAAE,4BAA4B,EAC1C,IAAI,EAAE,KAAK,CAAC,IAAI,GAChB,CACH,EACA,CAAC,KAAK,CAAC,SAAS,KAAK,KAAK,IAAI,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAC3D,KAAC,qBAAqB,IACpB,IAAI,EAAE,yBAAyB,EAC/B,YAAY,EAAE,4BAA4B,GAC1C,CACH,EACA,yBAAyB,IAAI,CAC5B,KAAC,2BAA2B,IAC1B,IAAI,EAAE,OAAO,8BAA8B,KAAK,QAAQ,EACxD,YAAY,EAAE,CAAC,GAAY,EAAQ,EAAE;gCACnC,IAAI,CAAC,GAAG,EAAE,CAAC;oCACT,+BAA+B,CAAC,KAAK,CAAC,CAAC;gCACzC,CAAC;4BACH,CAAC,EACD,IAAI,EAAE,KAAK,CAAC,IAAI,GAChB,CACH,IAC+C,GACM,GACR,GACF,CACrD,CAAC;AACJ,CAAC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -9,6 +9,11 @@ export interface AppsCardProps {
|
|
|
9
9
|
queryType: ListAppsQueryType;
|
|
10
10
|
preloaded?: PreloadedAppsTableDataWithDomainRefs;
|
|
11
11
|
organization_id?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Display name of `organization_id` (organization pages), shown in the
|
|
14
|
+
* create dialog's organization picker.
|
|
15
|
+
*/
|
|
16
|
+
organization_name?: string;
|
|
12
17
|
uuid: () => string;
|
|
13
18
|
isOrgOwner?: boolean;
|
|
14
19
|
/**
|
|
@@ -17,14 +22,24 @@ export interface AppsCardProps {
|
|
|
17
22
|
* actions).
|
|
18
23
|
*/
|
|
19
24
|
managedOrganizationIds?: readonly string[];
|
|
20
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Client-side filter on each row's resolved owner type. Also picks the
|
|
27
|
+
* owner the create dialog preselects on the "all" / "owned" /
|
|
28
|
+
* "accessible" lists (e.g. "organization" → an organization).
|
|
29
|
+
*/
|
|
21
30
|
ownerTypeFilter?: OwnerTypeFilterValue;
|
|
22
31
|
/**
|
|
23
|
-
* Whether the card offers app creation at all (default true).
|
|
24
|
-
*
|
|
25
|
-
*
|
|
32
|
+
* Whether the card offers app creation at all (default true). The
|
|
33
|
+
* "Create app" button is also hidden while the viewer cannot pick any
|
|
34
|
+
* owner in the create dialog.
|
|
26
35
|
*/
|
|
27
36
|
canCreate?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the create dialog offers personal (user-owned) apps: false when
|
|
39
|
+
* the `allow_user_owned_resource_creation` server setting is disabled for
|
|
40
|
+
* a non-admin viewer (default true; the server enforces it regardless).
|
|
41
|
+
*/
|
|
42
|
+
canCreatePersonal?: boolean;
|
|
28
43
|
}
|
|
29
44
|
export declare function AppsCard(props: AppsCardProps): ReactElement;
|
|
30
45
|
export default AppsCard;
|
|
@@ -3,50 +3,50 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, cn, } from "@schemavaults/ui";
|
|
5
5
|
import { AppsTable, clearUseAppsListCache, } from "../AppsTable";
|
|
6
|
-
import {
|
|
6
|
+
import { hasAvailableResourceOwnership, preferredResourceOwnershipForList, useResourceOwnershipChoices, } from "../ResourceOwnershipPicker";
|
|
7
7
|
import CreateAppDialog, { CreateAppDialogOpenDispatchContext, } from "../CreateAppDialog";
|
|
8
8
|
import CreateAppDomainDialog, { CreateAppDomainDialogOpenContext, CreateAppDomainDialogOpenDispatchContext, } from "../CreateAppDomainDialog";
|
|
9
9
|
import AuthorizeClientApplicationDialog, { AuthorizeClientApplicationDialogOpenDispatchContext, } from "../AuthorizeClientApplicationDialog";
|
|
10
10
|
import ConnectAppToApiDialog, { ConnectAppToApiDialogOpenDispatchContext, } from "../ConnectAppToApiDialog";
|
|
11
11
|
import { useAuthUiFriendlyName } from "../FriendlyNameProvider";
|
|
12
12
|
import { useAuthUiOwnerOrganizationId } from "../OwnerOrganizationProvider";
|
|
13
|
-
/**
|
|
14
|
-
* @description Who an app created from a card of the given query type
|
|
15
|
-
* belongs to: platform-owned from the admin "all" list, organization-owned
|
|
16
|
-
* from an organization page, user-owned from the "owned" (your
|
|
17
|
-
* applications) card. Returns null when the card cannot create apps.
|
|
18
|
-
*/
|
|
19
|
-
function resolveCreateOwnershipForCard(queryType, organization_id, platformOrganizationId, currentUserUid) {
|
|
20
|
-
switch (queryType) {
|
|
21
|
-
case "all":
|
|
22
|
-
return { owner_type: "platform" };
|
|
23
|
-
case "org":
|
|
24
|
-
return organization_id && organization_id !== platformOrganizationId
|
|
25
|
-
? { owner_type: "organization", owner_organization_id: organization_id }
|
|
26
|
-
: { owner_type: "platform" };
|
|
27
|
-
case "owned":
|
|
28
|
-
case "accessible":
|
|
29
|
-
// The "accessible" page creates personal apps; organization-owned
|
|
30
|
-
// apps are created from the organization's page and platform-owned
|
|
31
|
-
// ones from the admin console.
|
|
32
|
-
return currentUserUid
|
|
33
|
-
? { owner_type: "user", owner_uid: currentUserUid }
|
|
34
|
-
: null;
|
|
35
|
-
default:
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
13
|
export function AppsCard(props) {
|
|
40
14
|
const friendlyName = useAuthUiFriendlyName();
|
|
41
15
|
const ownerOrganizationId = useAuthUiOwnerOrganizationId();
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
16
|
+
// Lists whose rows the viewer may manage (add domains) and to which they
|
|
17
|
+
// may add apps.
|
|
18
|
+
const canManageListedApps = props.queryType === "all" ||
|
|
19
|
+
props.queryType === "owned" ||
|
|
20
|
+
props.queryType === "accessible" ||
|
|
21
|
+
(props.queryType === "org" && !!props.isOrgOwner);
|
|
22
|
+
// The owner the create dialog preselects follows the list it was opened
|
|
23
|
+
// from; the dialog's "Owner" field lets the viewer pick another.
|
|
24
|
+
const defaultCreateOwnership = preferredResourceOwnershipForList({
|
|
25
|
+
queryType: props.queryType,
|
|
26
|
+
organization_id: props.organization_id,
|
|
27
|
+
platformOrganizationId: ownerOrganizationId,
|
|
28
|
+
ownerTypeFilter: props.ownerTypeFilter,
|
|
29
|
+
});
|
|
30
|
+
const createOwnershipOptions = defaultCreateOwnership
|
|
31
|
+
? {
|
|
32
|
+
defaultOwnership: defaultCreateOwnership,
|
|
33
|
+
allowPersonal: props.canCreatePersonal ?? true,
|
|
34
|
+
contextOrganization: props.queryType === "org" &&
|
|
35
|
+
props.isOrgOwner &&
|
|
36
|
+
props.organization_id &&
|
|
37
|
+
props.organization_id !== ownerOrganizationId
|
|
38
|
+
? {
|
|
39
|
+
organization_id: props.organization_id,
|
|
40
|
+
organization_name: props.organization_name ?? null,
|
|
41
|
+
}
|
|
42
|
+
: undefined,
|
|
43
|
+
}
|
|
44
|
+
: null;
|
|
45
|
+
const offersCreation = (props.canCreate ?? true) &&
|
|
46
|
+
canManageListedApps &&
|
|
47
|
+
!!createOwnershipOptions;
|
|
48
|
+
const { choices: createOwnershipChoices } = useResourceOwnershipChoices(createOwnershipOptions ?? {}, { enabled: offersCreation });
|
|
49
|
+
const canCreateApps = offersCreation && hasAvailableResourceOwnership(createOwnershipChoices);
|
|
50
50
|
const cardTitle = props.cardTitle ?? "Applications";
|
|
51
51
|
const cardDescription = props.cardDescription ??
|
|
52
52
|
`View and manage which applications are allowed to access ${friendlyName} APIs on your behalf.`;
|
|
@@ -55,7 +55,7 @@ export function AppsCard(props) {
|
|
|
55
55
|
const [isAddAppDomainDialogOpen, setAddAppDomainDialogOpen] = useState(false);
|
|
56
56
|
const [authorizeAppDialogOpen, setAuthorizeAppDialogOpen] = useState(false);
|
|
57
57
|
const [connectAppToApiDialogOpen, setConnectAppToApiDialogOpen] = useState(false);
|
|
58
|
-
return (_jsx(CreateAppDialogOpenDispatchContext.Provider, { value: setCreateAppDialogOpen, children: _jsx(AuthorizeClientApplicationDialogOpenDispatchContext.Provider, { value: setAuthorizeAppDialogOpen, children: _jsx(ConnectAppToApiDialogOpenDispatchContext.Provider, { value: setConnectAppToApiDialogOpen, children: _jsx(CreateAppDomainDialogOpenDispatchContext.Provider, { value: setAddAppDomainDialogOpen, children: _jsxs(CreateAppDomainDialogOpenContext.Provider, { value: isAddAppDomainDialogOpen, children: [_jsxs(Card, { className: cardClassName, children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: cardTitle }), _jsx(CardDescription, { children: cardDescription })] }), _jsx(CardContent, { children: _jsx(AppsTable, { queryType: props.queryType, preloaded: props.preloaded, organization_id: props.organization_id, isOrgOwner: props.isOrgOwner, managedOrganizationIds: props.managedOrganizationIds, ownerTypeFilter: props.ownerTypeFilter, canCreate:
|
|
58
|
+
return (_jsx(CreateAppDialogOpenDispatchContext.Provider, { value: setCreateAppDialogOpen, children: _jsx(AuthorizeClientApplicationDialogOpenDispatchContext.Provider, { value: setAuthorizeAppDialogOpen, children: _jsx(ConnectAppToApiDialogOpenDispatchContext.Provider, { value: setConnectAppToApiDialogOpen, children: _jsx(CreateAppDomainDialogOpenDispatchContext.Provider, { value: setAddAppDomainDialogOpen, children: _jsxs(CreateAppDomainDialogOpenContext.Provider, { value: isAddAppDomainDialogOpen, children: [_jsxs(Card, { className: cardClassName, children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: cardTitle }), _jsx(CardDescription, { children: cardDescription })] }), _jsx(CardContent, { children: _jsx(AppsTable, { queryType: props.queryType, preloaded: props.preloaded, organization_id: props.organization_id, isOrgOwner: props.isOrgOwner, managedOrganizationIds: props.managedOrganizationIds, ownerTypeFilter: props.ownerTypeFilter, canCreate: canCreateApps }) }), _jsx(CardFooter, { children: _jsx("div", { className: "flex flex-row items-start justify-start gap-2" }) })] }), _jsxs(_Fragment, { children: [canCreateApps && createOwnershipOptions && (_jsx(CreateAppDialog, { clearFrontendAppsCache: clearUseAppsListCache, ownership: createOwnershipOptions, open: createAppDialogOpen, onOpenChange: setCreateAppDialogOpen, uuid: props.uuid })), props.queryType === "authorized" && (_jsx(AuthorizeClientApplicationDialog, { open: authorizeAppDialogOpen, onOpenChange: setAuthorizeAppDialogOpen })), props.queryType === "all" && (_jsx(ConnectAppToApiDialog, { open: connectAppToApiDialogOpen, onOpenChange: setConnectAppToApiDialogOpen })), canManageListedApps && (_jsx(CreateAppDomainDialog, { open: typeof isAddAppDomainDialogOpen === "string", onOpenChange: (val) => {
|
|
59
59
|
if (!val) {
|
|
60
60
|
setAddAppDomainDialogOpen(false);
|
|
61
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps_card.js","sourceRoot":"","sources":["../../../src/components/AppsCard/apps_card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAqB,MAAM,OAAO,CAAC;AACpD,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,EACT,EAAE,GACH,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,SAAS,EACT,qBAAqB,GAEtB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"apps_card.js","sourceRoot":"","sources":["../../../src/components/AppsCard/apps_card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAqB,MAAM,OAAO,CAAC;AACpD,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,EACT,EAAE,GACH,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,SAAS,EACT,qBAAqB,GAEtB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,6BAA6B,EAC7B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AAC,qBAAqB,IACpB,IAAI,EAAE,OAAO,wBAAwB,KAAK,QAAQ,EAClD,YAAY,EAAE,CAAC,GAAY,EAAQ,EAAE;4CACnC,IAAI,CAAC,GAAG,EAAE,CAAC;gDACT,yBAAyB,CAAC,KAAK,CAAC,CAAC;4CACnC,CAAC;wCACH,CAAC,EACD,IAAI,EAAE,KAAK,CAAC,IAAI,GAChB,CACH,IACA,IACuC,GACM,GACF,GACS,GACnB,CAC/C,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { type ReactElement } from "react";
|
|
2
2
|
import { useSWRConfig } from "swr";
|
|
3
|
-
import type {
|
|
3
|
+
import type { CreateResourceOwnershipOptions } from "../ResourceOwnershipPicker";
|
|
4
4
|
interface CreateApiServerDialogProps {
|
|
5
5
|
clearApiServersCache: (mutate: ReturnType<typeof useSWRConfig>["mutate"]) => void;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Which owners the dialog's "Owner" field offers (the platform for
|
|
8
|
+
* admins, organizations the user administers, the user's own account)
|
|
9
|
+
* and which one it preselects.
|
|
9
10
|
*/
|
|
10
|
-
ownership:
|
|
11
|
+
ownership: CreateResourceOwnershipOptions;
|
|
11
12
|
open: boolean;
|
|
12
13
|
onOpenChange: (val: boolean) => void;
|
|
13
14
|
uuid: () => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateApiServerDialog.js","sourceRoot":"","sources":["../../../src/components/CreateApiServerDialog/CreateApiServerDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"CreateApiServerDialog.js","sourceRoot":"","sources":["../../../src/components/CreateApiServerDialog/CreateApiServerDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAkBxD,MAAM,UAAU,qBAAqB,CAAC,EACpC,oBAAoB,EACpB,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,IAAI,GACuB;IAC3B,OAAO,CACL,KAAC,MAAM,IAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,YAC5C,KAAC,aAAa,IACZ,EAAE,EAAC,kCAAkC,EACrC,SAAS,EAAC,+CAA+C,YAEzD,KAAC,mBAAmB,IAClB,oBAAoB,EAAE,oBAAoB,EAC1C,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EACpC,IAAI,EAAE,IAAI,GACV,GACY,GACT,CACV,CAAC;AACJ,CAAC;AAKD,MAAM,UAAU,4BAA4B,CAAC,EAC3C,YAAY,GACsB;IAClC,OAAO,CACL,MAAC,MAAM,IACL,EAAE,EAAC,sCAAsC,EACzC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC,aAED,KAAC,MAAM,IAAC,SAAS,EAAC,cAAc,GAAG,mBAC5B,CACV,CAAC;AACJ,CAAC;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { type ReactElement } from "react";
|
|
2
2
|
import { useSWRConfig } from "swr";
|
|
3
|
-
import { type
|
|
3
|
+
import { type CreateResourceOwnershipOptions } from "../ResourceOwnershipPicker";
|
|
4
4
|
interface CreateApiServerFormProps {
|
|
5
5
|
clearApiServersCache: (mutate: ReturnType<typeof useSWRConfig>["mutate"]) => void;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Which owners the form's "Owner" field offers (the platform for admins,
|
|
8
|
+
* organizations the user administers, the user's own account) and which
|
|
9
|
+
* one it preselects (derived from where the form was opened).
|
|
9
10
|
*/
|
|
10
|
-
ownership:
|
|
11
|
+
ownership: CreateResourceOwnershipOptions;
|
|
11
12
|
uuid: () => string;
|
|
12
13
|
onSuccess: () => void;
|
|
13
14
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Button, Checkbox, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, Textarea, useToast, } from "@schemavaults/ui";
|
|
4
|
-
import { useMemo } from "react";
|
|
4
|
+
import { useMemo, useState } from "react";
|
|
5
5
|
import { DialogDescription, DialogFooter, DialogHeader, DialogTitle, useForm, } from "@schemavaults/ui";
|
|
6
6
|
import { useAppEnvironment, useAuth } from "@schemavaults/auth-react-provider";
|
|
7
7
|
import { useSWRConfig } from "swr";
|
|
@@ -10,10 +10,13 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
|
|
10
10
|
import { Server } from "lucide-react";
|
|
11
11
|
import { useAuthUiFriendlyName } from "../FriendlyNameProvider";
|
|
12
12
|
import { requestedOwnershipToDefinitionFields } from "../CreateAppDialog/requested-ownership-fields";
|
|
13
|
+
import { ResourceOwnershipPicker, describeRequestedResourceOwnership, resourceOwnershipSelectionToRequestedOwnership, useResourceOwnershipChoices, useResourceOwnershipSelection, } from "../ResourceOwnershipPicker";
|
|
13
14
|
export function CreateApiServerForm({ clearApiServersCache, ownership, uuid, onSuccess, }) {
|
|
14
15
|
const { toast } = useToast();
|
|
15
16
|
const friendlyName = useAuthUiFriendlyName();
|
|
16
|
-
const
|
|
17
|
+
const { choices, currentUserUid } = useResourceOwnershipChoices(ownership);
|
|
18
|
+
const { selection, setSelection } = useResourceOwnershipSelection(ownership.defaultOwnership, choices);
|
|
19
|
+
const [organizationError, setOrganizationError] = useState(undefined);
|
|
17
20
|
const defaultValues = useMemo(() => {
|
|
18
21
|
return {
|
|
19
22
|
api_server_name: "",
|
|
@@ -22,9 +25,8 @@ export function CreateApiServerForm({ clearApiServersCache, ownership, uuid, onS
|
|
|
22
25
|
public: false,
|
|
23
26
|
created_at: Date.now(),
|
|
24
27
|
hardcoded: false,
|
|
25
|
-
...ownershipFields,
|
|
26
28
|
};
|
|
27
|
-
}, [
|
|
29
|
+
}, [uuid]);
|
|
28
30
|
const form = useForm({
|
|
29
31
|
resolver: zodResolver(schemaVaultsApiServerDefinitionSchema),
|
|
30
32
|
defaultValues,
|
|
@@ -33,6 +35,20 @@ export function CreateApiServerForm({ clearApiServersCache, ownership, uuid, onS
|
|
|
33
35
|
const auth = useAuth();
|
|
34
36
|
const { mutate } = useSWRConfig();
|
|
35
37
|
async function onSubmit(values) {
|
|
38
|
+
const requestedOwnership = selection
|
|
39
|
+
? resourceOwnershipSelectionToRequestedOwnership(selection, currentUserUid)
|
|
40
|
+
: null;
|
|
41
|
+
if (!requestedOwnership) {
|
|
42
|
+
if (selection?.owner_type === "organization") {
|
|
43
|
+
setOrganizationError("Choose the organization that will own this API server.");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
toast({
|
|
47
|
+
variant: "destructive",
|
|
48
|
+
title: "Choose who will own this API server",
|
|
49
|
+
});
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
36
52
|
if (environment === "development") {
|
|
37
53
|
console.log("Submitting API creation form...");
|
|
38
54
|
toast({
|
|
@@ -47,9 +63,8 @@ export function CreateApiServerForm({ clearApiServersCache, ownership, uuid, onS
|
|
|
47
63
|
}
|
|
48
64
|
await authClient.createApiServer({
|
|
49
65
|
...values,
|
|
50
|
-
// The owner
|
|
51
|
-
|
|
52
|
-
...ownershipFields,
|
|
66
|
+
// The owner comes from the "Owner" field only.
|
|
67
|
+
...requestedOwnershipToDefinitionFields(requestedOwnership),
|
|
53
68
|
});
|
|
54
69
|
}
|
|
55
70
|
catch (e) {
|
|
@@ -63,13 +78,17 @@ export function CreateApiServerForm({ clearApiServersCache, ownership, uuid, onS
|
|
|
63
78
|
toast({
|
|
64
79
|
variant: "default",
|
|
65
80
|
title: "Created new API server successfully",
|
|
81
|
+
description: describeRequestedResourceOwnership(requestedOwnership, choices, friendlyName),
|
|
66
82
|
});
|
|
67
83
|
clearApiServersCache(mutate);
|
|
68
84
|
form.reset({ ...defaultValues, api_server_id: uuid() });
|
|
69
85
|
onSuccess();
|
|
70
86
|
return;
|
|
71
87
|
}
|
|
72
|
-
return (_jsx(Form, { ...form, children: _jsxs("form", { onSubmit: form.handleSubmit(onSubmit, (e) => console.error(e)), className: "flex flex-col justify-start gap-4", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Create a new API server" }), _jsxs(DialogDescription, { children: ["Create a new backend API server which ", friendlyName, " client applications can be authorized to access."] })] }), _jsx(
|
|
88
|
+
return (_jsx(Form, { ...form, children: _jsxs("form", { onSubmit: form.handleSubmit(onSubmit, (e) => console.error(e)), className: "flex flex-col justify-start gap-4", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Create a new API server" }), _jsxs(DialogDescription, { children: ["Create a new backend API server which ", friendlyName, " client applications can be authorized to access."] })] }), _jsx(ResourceOwnershipPicker, { id: "create-api-server-owner", resourceKind: "api-server", choices: choices, value: selection, onValueChange: (next) => {
|
|
89
|
+
setSelection(next);
|
|
90
|
+
setOrganizationError(undefined);
|
|
91
|
+
}, organizationError: organizationError }), _jsx(FormField, { control: form.control, name: "api_server_name", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "API Server Name" }), _jsx(FormControl, { children: _jsx(Input, { placeholder: "My New Resource Server", ...field }) }), _jsx(FormDescription, { children: "Give a user-friendly name to the new backend API server application." }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "api_server_id", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "API Server ID" }), _jsx(FormControl, { children: _jsx(Input, { placeholder: "my-new-resource-server", ...field }) }), _jsx(FormDescription, { children: "A unique identifier for the API server. Must start with a lowercase letter or number, and contain only lowercase letters, numbers, hyphens, and underscores. Defaults to a randomly generated ID." }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "api_server_description", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "Description" }), _jsx(FormControl, { children: _jsx(Textarea, { placeholder: "This API server provides search functionality to my new app.", ...field }) }), _jsx(FormDescription, { children: "Describe what this API server does." }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "public", render: ({ field }) => (_jsxs(FormItem, { className: "flex flex-row gap-2 items-center flex-wrap", children: [_jsx(FormLabel, { className: "w-full", children: "Public?" }), _jsx(FormControl, { children: _jsx(Checkbox, { checked: field.value, onCheckedChange: field.onChange }) }), _jsx(FormDescription, { className: "w-full", children: "Is this API publicly listed to end-users? I.e. can they find it without having authorized a connected client application first?" }), _jsx(FormMessage, {})] })) }), _jsx(DialogFooter, { children: _jsxs(Button, { id: "submit-create-api-server-form-button", type: "submit", disabled: !selection, children: [_jsx(Server, { className: "h-4 w-4 mr-2" }), "Create Server Application"] }) })] }) }));
|
|
73
92
|
}
|
|
74
93
|
export default CreateApiServerForm;
|
|
75
94
|
//# sourceMappingURL=CreateApiServerForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateApiServerForm.js","sourceRoot":"","sources":["../../../src/components/CreateApiServerDialog/CreateApiServerForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAqB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CreateApiServerForm.js","sourceRoot":"","sources":["../../../src/components/CreateApiServerDialog/CreateApiServerForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAqB,MAAM,OAAO,CAAC;AAE7D,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,OAAO,GACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,EAGL,qCAAqC,GAEtC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,oCAAoC,EAAE,MAAM,yDAAyD,CAAC;AAC/G,OAAO,EACL,uBAAuB,EACvB,kCAAkC,EAClC,8CAA8C,EAC9C,2BAA2B,EAC3B,6BAA6B,GAG9B,MAAM,sCAAsC,CAAC;AAgB9C,MAAM,UAAU,mBAAmB,CAAC,EAClC,oBAAoB,EACpB,SAAS,EACT,IAAI,EACJ,SAAS,GACgB;IACzB,MA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C,WAAW,KAAG,IACN,CACZ,GACD,EACF,KAAC,SAAS,IACR,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,IAAI,EAAC,wBAAwB,EAC7B,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACrB,MAAC,QAAQ,eACP,KAAC,SAAS,8BAAwB,EAClC,KAAC,WAAW,cACV,KAAC,QAAQ,IACP,WAAW,EAAC,8DAA8D,KACtE,KAAK,GACT,GACU,EACd,KAAC,eAAe,sDAEE,EAClB,KAAC,WAAW,KAAG,IACN,CACZ,GACD,EACF,KAAC,SAAS,IACR,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,IAAI,EAAC,QAAQ,EACb,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACrB,MAAC,QAAQ,IAAC,SAAS,EAAC,4CAA4C,aAC9D,KAAC,SAAS,IAAC,SAAS,EAAC,QAAQ,wBAAoB,EACjD,KAAC,WAAW,cACV,KAAC,QAAQ,IACP,OAAO,EAAE,KAAK,CAAC,KAAK,EACpB,eAAe,EAAE,KAAK,CAAC,QAAQ,GAC/B,GACU,EACd,KAAC,eAAe,IAAC,SAAS,EAAC,QAAQ,gJAGjB,EAClB,KAAC,WAAW,KAAG,IACN,CACZ,GACD,EACF,KAAC,YAAY,cACX,MAAC,MAAM,IACL,EAAE,EAAC,sCAAsC,EACzC,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,SAAS,aAEpB,KAAC,MAAM,IAAC,SAAS,EAAC,cAAc,GAAG,iCAE5B,GACI,IACV,GACF,CACR,CAAC;AACJ,CAAC;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { type ReactElement } from "react";
|
|
2
2
|
import { useSWRConfig } from "swr";
|
|
3
|
-
import type {
|
|
3
|
+
import type { CreateResourceOwnershipOptions } from "../ResourceOwnershipPicker";
|
|
4
4
|
interface CreateFrontendAppDialogProps {
|
|
5
5
|
clearFrontendAppsCache: (mutate: ReturnType<typeof useSWRConfig>["mutate"]) => void;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Which owners the dialog's "Owner" field offers (the platform for
|
|
8
|
+
* admins, organizations the user administers, the user's own account)
|
|
9
|
+
* and which one it preselects.
|
|
9
10
|
*/
|
|
10
|
-
ownership:
|
|
11
|
+
ownership: CreateResourceOwnershipOptions;
|
|
11
12
|
open: boolean;
|
|
12
13
|
onOpenChange: (val: boolean) => void;
|
|
13
14
|
uuid: () => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateAppDialog.js","sourceRoot":"","sources":["../../../src/components/CreateAppDialog/CreateAppDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAqB,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"CreateAppDialog.js","sourceRoot":"","sources":["../../../src/components/CreateAppDialog/CreateAppDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAqB,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;AAiBtF,MAAM,UAAU,eAAe,CAAC,EAC9B,sBAAsB,EACtB,SAAS,EACT,GAAG,KAAK,EACqB;IAC7B,OAAO,CACL,KAAC,MAAM,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,YACxD,KAAC,aAAa,IACZ,EAAE,EAAC,2BAA2B,EAC9B,SAAS,EAAC,+CAA+C,YAEzD,KAAC,aAAa,IACZ,SAAS,EAAE,SAAS,EACpB,sBAAsB,EAAE,sBAAsB,EAC9C,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,EAC1C,IAAI,EAAE,KAAK,CAAC,IAAI,GAChB,GACY,GACT,CACV,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,MAAM,YAAY,GAA4B,UAAU,CACtD,kCAAkC,CACnC,CAAC;IAEF,OAAO,CACL,MAAC,MAAM,IACL,EAAE,EAAC,+BAA+B,EAClC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC,aAED,KAAC,SAAS,IAAC,SAAS,EAAC,cAAc,GAAG,mBAC/B,CACV,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type ReactElement } from "react";
|
|
2
2
|
import { useSWRConfig } from "swr";
|
|
3
|
-
import { type
|
|
3
|
+
import { type CreateResourceOwnershipOptions } from "../ResourceOwnershipPicker";
|
|
4
4
|
export interface CreateAppFormProps {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Which owners the form's "Owner" field offers (the platform for admins,
|
|
7
|
+
* organizations the user administers, the user's own account) and which
|
|
8
|
+
* one it preselects (derived from where the form was opened).
|
|
8
9
|
*/
|
|
9
|
-
ownership:
|
|
10
|
+
ownership: CreateResourceOwnershipOptions;
|
|
10
11
|
clearFrontendAppsCache: (mutate: ReturnType<typeof useSWRConfig>["mutate"]) => void;
|
|
11
12
|
onSuccess: () => void;
|
|
12
13
|
uuid: () => string;
|