@schemavaults/auth-ui 0.18.0 → 0.20.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/AssignOrganizationMemberDialog/AssignOrganizationMemberDialog.d.ts +52 -0
- package/dist/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialog.js +119 -0
- package/dist/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialog.js.map +1 -0
- package/dist/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialogDispatchContext.d.ts +2 -0
- package/dist/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialogDispatchContext.js +8 -0
- package/dist/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialogDispatchContext.js.map +1 -0
- package/dist/components/AssignOrganizationMemberDialog/index.d.ts +3 -0
- package/dist/components/AssignOrganizationMemberDialog/index.js +3 -0
- package/dist/components/AssignOrganizationMemberDialog/index.js.map +1 -0
- 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/OrganizationMembersCard/OrganizationMembersCard.d.ts +12 -1
- package/dist/components/OrganizationMembersCard/OrganizationMembersCard.js +4 -1
- package/dist/components/OrganizationMembersCard/OrganizationMembersCard.js.map +1 -1
- package/dist/components/OrganizationMembersTable/OrganizationMembersTable.d.ts +8 -1
- package/dist/components/OrganizationMembersTable/OrganizationMembersTable.js +21 -4
- package/dist/components/OrganizationMembersTable/OrganizationMembersTable.js.map +1 -1
- package/dist/components/OrganizationMembersTable/index.d.ts +1 -1
- package/dist/components/OrganizationMembersTable/index.js +1 -1
- package/dist/components/OrganizationMembersTable/index.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 +5 -1
- package/dist/components/index.js +3 -1
- 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"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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,iCAAiC,EACjC,2BAA2B,GAG5B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,eAAe,EAAE,EACtB,kCAAkC,GACnC,MAAM,8BAA8B,CAAC;AACtC,OAAO,qBAAqB,EAAE,EAC5B,gCAAgC,EAChC,wCAAwC,GACzC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,gCAAgC,EAAE,EACvC,mDAAmD,GACpD,MAAM,+CAA+C,CAAC;AACvD,OAAO,qBAAqB,EAAE,EAC5B,wCAAwC,GACzC,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AA0CtF,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,MAA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EAAE,KAAK,CAAC,eAAe,EACtC,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,EACpD,eAAe,EAAE,KAAK,CAAC,eAAe,EACtC,SAAS,EAAE,aAAa,GACxB,GACU,EACd,KAAC,UAAU,cACT,cAAK,SAAS,EAAC,+CAA+C,GAAO,GAC1D,IACR,EACP,8BACG,aAAa,IAAI,sBAAsB,IAAI,CAC1C,KAAC,eAAe,IACd,sBAAsB,EAAE,qBAAqB,EAC7C,SAAS,EAAE,sBAAsB,EACjC,IAAI,EAAE,mBAAmB,EACzB,YAAY,EAAE,sBAAsB,EACpC,IAAI,EAAE,KAAK,CAAC,IAAI,GAChB,CACH,EACA,KAAK,CAAC,SAAS,KAAK,YAAY,IAAI,CACnC,KAAC,gCAAgC,IAC/B,IAAI,EAAE,sBAAsB,EAC5B,YAAY,EAAE,yBAAyB,GACvC,CACH,EACA,KAAK,CAAC,SAAS,KAAK,KAAK,IAAI,CAC5B,KAAC,qBAAqB,IACpB,IAAI,EAAE,yBAAyB,EAC/B,YAAY,EAAE,4BAA4B,GAC1C,CACH,EACA,mBAAmB,IAAI,CACtB,KAAC,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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import { type AssignMemberSubmitData, type OrganizationID } from "@schemavaults/auth-common";
|
|
3
|
+
export type { AssignMemberSubmitData };
|
|
4
|
+
/** A user the dialog can name without asking for an identifier. */
|
|
5
|
+
export interface AssignOrganizationMemberDialogUser {
|
|
6
|
+
uid: string;
|
|
7
|
+
email: string;
|
|
8
|
+
}
|
|
9
|
+
/** An organization offered by the organization select. */
|
|
10
|
+
export interface AssignOrganizationMemberDialogOrganizationOption {
|
|
11
|
+
organization_id: OrganizationID;
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AssignOrganizationMemberDialogOpenTriggerProps {
|
|
15
|
+
triggerButtonLabel?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function AssignOrganizationMemberDialogTriggerButton({ triggerButtonLabel, }: AssignOrganizationMemberDialogOpenTriggerProps): ReactElement;
|
|
18
|
+
export interface AssignOrganizationMemberDialogProps {
|
|
19
|
+
open: boolean;
|
|
20
|
+
onOpenChange: (open: boolean) => void;
|
|
21
|
+
/** Performs the assignment; a thrown error is shown and keeps the dialog open. */
|
|
22
|
+
onSubmit: (data: AssignMemberSubmitData) => Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* The organization to add the member to (an organization's page): the
|
|
25
|
+
* dialog then asks for the user. Without it the dialog offers
|
|
26
|
+
* `organizations` to pick from.
|
|
27
|
+
*/
|
|
28
|
+
organization_id?: OrganizationID;
|
|
29
|
+
/** Display name of `organization_id`. */
|
|
30
|
+
organization_name?: string;
|
|
31
|
+
/** Organizations offered when `organization_id` is not set. */
|
|
32
|
+
organizations?: readonly AssignOrganizationMemberDialogOrganizationOption[];
|
|
33
|
+
/**
|
|
34
|
+
* The user to add (a user's admin page): the dialog then asks for the
|
|
35
|
+
* organization and role only.
|
|
36
|
+
*/
|
|
37
|
+
user?: AssignOrganizationMemberDialogUser;
|
|
38
|
+
/**
|
|
39
|
+
* The signed-in administrator. When set (and `user` is not), the dialog
|
|
40
|
+
* offers adding "Myself".
|
|
41
|
+
*/
|
|
42
|
+
currentUser?: AssignOrganizationMemberDialogUser;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @description Platform administrators' dialog to add a user to an
|
|
46
|
+
* organization directly (no invitation to accept), by e-mail address, user
|
|
47
|
+
* id or themselves, as a member or an owner. Either the organization
|
|
48
|
+
* (`organization_id`) or the user (`user`) can be fixed by the page that
|
|
49
|
+
* opens it.
|
|
50
|
+
*/
|
|
51
|
+
export declare function AssignOrganizationMemberDialog({ open, onOpenChange, onSubmit, organization_id, organization_name, organizations, user, currentUser, }: AssignOrganizationMemberDialogProps): ReactElement;
|
|
52
|
+
export default AssignOrganizationMemberDialog;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Button, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, RadioGroup, RadioGroupItem, Label, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, useForm, useToast, } from "@schemavaults/ui";
|
|
4
|
+
import { useContext, useEffect, useState, useTransition, } from "react";
|
|
5
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
6
|
+
import { ShieldPlus } from "lucide-react";
|
|
7
|
+
import { assignMemberFormSchema, } from "@schemavaults/auth-common";
|
|
8
|
+
import AssignOrganizationMemberDialogDispatchContext from "./AssignOrganizationMemberDialogDispatchContext";
|
|
9
|
+
const openAssignOrganizationMemberDialogTriggerButtonId = "open-assign-organization-member-dialog-button";
|
|
10
|
+
const assignOrganizationMemberDialogContentId = "assign-organization-member-dialog-content";
|
|
11
|
+
export function AssignOrganizationMemberDialogTriggerButton({ triggerButtonLabel = "Add Member", }) {
|
|
12
|
+
const onOpenChange = useContext(AssignOrganizationMemberDialogDispatchContext);
|
|
13
|
+
return (_jsxs(Button, { id: openAssignOrganizationMemberDialogTriggerButtonId, "data-testid": openAssignOrganizationMemberDialogTriggerButtonId, variant: "outline", onClick: (e) => {
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
onOpenChange(true);
|
|
16
|
+
}, children: [_jsx(ShieldPlus, { className: "h-4 w-4 mr-2" }), triggerButtonLabel] }));
|
|
17
|
+
}
|
|
18
|
+
const ROLE_OPTIONS = [
|
|
19
|
+
{
|
|
20
|
+
value: "member",
|
|
21
|
+
label: "Member",
|
|
22
|
+
description: "Can view the organization and its resources.",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "owner",
|
|
26
|
+
label: "Owner",
|
|
27
|
+
description: "Can also manage members, invitations and resources.",
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
function defaultValues(organization_id, fixed_user_uid) {
|
|
31
|
+
return {
|
|
32
|
+
organization_id: organization_id ?? "",
|
|
33
|
+
input_mode: fixed_user_uid ? "uid" : "email",
|
|
34
|
+
identifier: fixed_user_uid ?? "",
|
|
35
|
+
role: "member",
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @description Platform administrators' dialog to add a user to an
|
|
40
|
+
* organization directly (no invitation to accept), by e-mail address, user
|
|
41
|
+
* id or themselves, as a member or an owner. Either the organization
|
|
42
|
+
* (`organization_id`) or the user (`user`) can be fixed by the page that
|
|
43
|
+
* opens it.
|
|
44
|
+
*/
|
|
45
|
+
export function AssignOrganizationMemberDialog({ open, onOpenChange, onSubmit, organization_id, organization_name, organizations = [], user, currentUser, }) {
|
|
46
|
+
const [submitting, startSubmitting] = useTransition();
|
|
47
|
+
const { toast } = useToast();
|
|
48
|
+
const [assigneeMode, setAssigneeMode] = useState("email");
|
|
49
|
+
const fixedUserUid = user?.uid;
|
|
50
|
+
const form = useForm({
|
|
51
|
+
resolver: zodResolver(assignMemberFormSchema),
|
|
52
|
+
defaultValues: defaultValues(organization_id, fixedUserUid),
|
|
53
|
+
});
|
|
54
|
+
// Start from a clean form whenever the dialog opens.
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!open)
|
|
57
|
+
return;
|
|
58
|
+
form.reset(defaultValues(organization_id, fixedUserUid));
|
|
59
|
+
setAssigneeMode("email");
|
|
60
|
+
}, [open, organization_id, fixedUserUid, form]);
|
|
61
|
+
const organizationIsFixed = organization_id !== undefined;
|
|
62
|
+
const userIsFixed = user !== undefined;
|
|
63
|
+
const canAssignSelf = !userIsFixed && currentUser !== undefined;
|
|
64
|
+
function handleAssigneeModeChange(value) {
|
|
65
|
+
setAssigneeMode(value);
|
|
66
|
+
if (value === "self" && currentUser) {
|
|
67
|
+
form.setValue("input_mode", "uid");
|
|
68
|
+
form.setValue("identifier", currentUser.uid);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
form.setValue("input_mode", value === "uid" ? "uid" : "email");
|
|
72
|
+
form.setValue("identifier", "");
|
|
73
|
+
}
|
|
74
|
+
form.clearErrors("identifier");
|
|
75
|
+
}
|
|
76
|
+
async function handleSubmit(values) {
|
|
77
|
+
startSubmitting(async () => {
|
|
78
|
+
const submitData = {
|
|
79
|
+
organization_id: values.organization_id,
|
|
80
|
+
input_mode: values.input_mode,
|
|
81
|
+
identifier: values.identifier.trim(),
|
|
82
|
+
role: values.role,
|
|
83
|
+
};
|
|
84
|
+
try {
|
|
85
|
+
await onSubmit(submitData);
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
console.error("Error adding organization member: ", e);
|
|
89
|
+
toast({
|
|
90
|
+
variant: "destructive",
|
|
91
|
+
title: "Failed to add member",
|
|
92
|
+
description: e instanceof Error ? e.message : "An unknown error has occurred!",
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
onOpenChange(false);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function handleCancel() {
|
|
100
|
+
onOpenChange(false);
|
|
101
|
+
}
|
|
102
|
+
const inputLabel = assigneeMode === "uid" ? "User ID" : "Email Address";
|
|
103
|
+
const inputPlaceholder = assigneeMode === "uid"
|
|
104
|
+
? "00000000-0000-0000-0000-000000000000"
|
|
105
|
+
: "user@example.com";
|
|
106
|
+
const inputDescription = assigneeMode === "uid"
|
|
107
|
+
? "Enter the UUID of the user to add."
|
|
108
|
+
: "Enter the email address of the user to add.";
|
|
109
|
+
const fixedOrganizationName = organizationIsFixed
|
|
110
|
+
? (organization_name ?? organization_id)
|
|
111
|
+
: undefined;
|
|
112
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { id: assignOrganizationMemberDialogContentId, "data-testid": assignOrganizationMemberDialogContentId, className: "sm:max-w-[480px]", children: _jsx(Form, { ...form, children: _jsxs("form", { onSubmit: form.handleSubmit(handleSubmit, function onFormValidationError(errs) {
|
|
113
|
+
console.error("Error validating add organization member form inputs: ", errs);
|
|
114
|
+
}), className: "flex flex-col justify-start gap-4", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: userIsFixed ? "Add to an organization" : "Add a member" }), _jsxs(DialogDescription, { children: [userIsFixed ? (_jsxs(_Fragment, { children: ["Add", " ", _jsx("span", { className: "font-medium text-foreground", "data-testid": "assign-member-fixed-user", children: user?.email }), " ", "to an organization immediately."] })) : (_jsxs(_Fragment, { children: ["Add a user to", " ", _jsx("span", { className: "font-medium text-foreground", children: fixedOrganizationName ?? "an organization" }), " ", "immediately."] })), " ", "As an administrator you skip the invitation: the user does not have to accept, and any pending invitation of theirs to the organization is revoked."] })] }), !organizationIsFixed && (_jsx(FormField, { control: form.control, name: "organization_id", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "Organization" }), _jsxs(Select, { value: field.value === "" ? undefined : field.value, onValueChange: field.onChange, disabled: submitting || organizations.length === 0, name: field.name, children: [_jsx(FormControl, { children: _jsx(SelectTrigger, { "data-testid": "assign-member-organization-select", className: "w-full", children: _jsx(SelectValue, { placeholder: organizations.length === 0
|
|
115
|
+
? "No organizations available"
|
|
116
|
+
: "Select an organization" }) }) }), _jsx(SelectContent, { children: organizations.map((organization) => (_jsxs(SelectItem, { value: organization.organization_id, "data-testid": `assign-member-organization-select-option-${organization.organization_id}`, children: [organization.name, " ", _jsxs("span", { className: "text-muted-foreground", children: ["(", organization.organization_id, ")"] })] }, organization.organization_id))) })] }), organizations.length === 0 && (_jsxs(FormDescription, { children: ["There is no organization to add", " ", userIsFixed ? "this user" : "a member", " to."] })), _jsx(FormMessage, {})] })) })), !userIsFixed && (_jsx(FormField, { control: form.control, name: "input_mode", render: ({ field }) => (_jsxs(FormItem, { className: "flex flex-row gap-2 items-center flex-wrap", children: [_jsx(FormLabel, { className: "w-full", children: "Add by" }), _jsx(FormControl, { children: _jsxs(RadioGroup, { "data-testid": "assign-member-input-mode-radio-group", onValueChange: (value) => handleAssigneeModeChange(value), value: assigneeMode, disabled: submitting, name: field.name, className: "flex flex-row flex-wrap gap-4", children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: "email", id: "assign-member-input-mode-email", "data-testid": "assign-member-input-mode-email" }), _jsx(Label, { htmlFor: "assign-member-input-mode-email", children: "Email" })] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: "uid", id: "assign-member-input-mode-user-id", "data-testid": "assign-member-input-mode-user-id" }), _jsx(Label, { htmlFor: "assign-member-input-mode-user-id", children: "User ID" })] }), canAssignSelf && (_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: "self", id: "assign-member-input-mode-self", "data-testid": "assign-member-input-mode-self" }), _jsx(Label, { htmlFor: "assign-member-input-mode-self", children: "Myself" })] }))] }) })] })) })), !userIsFixed && assigneeMode !== "self" && (_jsx(FormField, { control: form.control, name: "identifier", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: inputLabel }), _jsx(FormControl, { children: _jsx(Input, { "data-testid": "assign-member-identifier-input", placeholder: inputPlaceholder, ...field, disabled: submitting }) }), _jsx(FormDescription, { children: inputDescription }), _jsx(FormMessage, {})] })) })), !userIsFixed && assigneeMode === "self" && currentUser && (_jsxs("p", { className: "text-sm text-muted-foreground", "data-testid": "assign-member-self-summary", children: ["You (", _jsx("span", { className: "font-medium text-foreground", children: currentUser.email }), ") will be added to the organization."] })), _jsx(FormField, { control: form.control, name: "role", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "Role" }), _jsx(FormControl, { children: _jsx(RadioGroup, { "data-testid": "assign-member-role-radio-group", onValueChange: field.onChange, value: field.value, disabled: submitting, name: field.name, className: "flex flex-col gap-2", children: ROLE_OPTIONS.map((option) => (_jsxs("div", { className: "flex items-start space-x-2", children: [_jsx(RadioGroupItem, { value: option.value, id: `assign-member-role-${option.value}`, "data-testid": `assign-member-role-${option.value}`, className: "mt-0.5" }), _jsxs(Label, { htmlFor: `assign-member-role-${option.value}`, className: "flex flex-col gap-1", children: [_jsx("span", { children: option.label }), _jsx("span", { className: "text-xs font-normal text-muted-foreground", children: option.description })] })] }, option.value))) }) }), _jsx(FormMessage, {})] })) }), _jsxs(DialogFooter, { className: "gap-2 sm:gap-0", children: [_jsx(Button, { type: "button", variant: "outline", onClick: handleCancel, disabled: submitting, "data-testid": "cancel-assign-member-button", children: "Cancel" }), _jsxs(Button, { type: "submit", disabled: submitting, "data-testid": "submit-assign-member-form-button", children: [_jsx(ShieldPlus, { className: "h-4 w-4 mr-2" }), "Add Member"] })] })] }) }) }) }));
|
|
117
|
+
}
|
|
118
|
+
export default AssignOrganizationMemberDialog;
|
|
119
|
+
//# sourceMappingURL=AssignOrganizationMemberDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssignOrganizationMemberDialog.js","sourceRoot":"","sources":["../../../src/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,EACL,UAAU,EACV,cAAc,EACd,KAAK,EACL,MAAM,EACN,aAAa,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B,MAAM,CAAC,KAAK,EAAE,EAC7C,SAAS,EAAC,qBAAqB,aAE/B,yBAAO,MAAM,CAAC,KAAK,GAAQ,EAC3B,eAAM,SAAS,EAAC,2CAA2C,YACxD,MAAM,CAAC,WAAW,GACd,IACD,KAjBH,MAAM,CAAC,KAAK,CAkBb,CACP,CAAC,GACS,GACD,EACd,KAAC,WAAW,KAAG,IACN,CACZ,GACD,EAEF,MAAC,YAAY,IAAC,SAAS,EAAC,gBAAgB,aACtC,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,UAAU,iBACR,6BAA6B,uBAGlC,EACT,MAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,UAAU,iBACR,kCAAkC,aAE9C,KAAC,UAAU,IAAC,SAAS,EAAC,cAAc,GAAG,kBAEhC,IACI,IACV,GACF,GACO,GACT,CACV,CAAC;AACJ,CAAC;AAED,eAAe,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext } from "react";
|
|
3
|
+
export const AssignOrganizationMemberDialogDispatchContext = createContext((val) => {
|
|
4
|
+
void val;
|
|
5
|
+
throw new Error("Not within AssignOrganizationMemberDialogDispatchContext.Provider render tree!");
|
|
6
|
+
});
|
|
7
|
+
export default AssignOrganizationMemberDialogDispatchContext;
|
|
8
|
+
//# sourceMappingURL=AssignOrganizationMemberDialogDispatchContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssignOrganizationMemberDialogDispatchContext.js","sourceRoot":"","sources":["../../../src/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialogDispatchContext.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,6CAA6C,GAAG,aAAa,CAExE,CAAC,GAAY,EAAE,EAAE;IACjB,KAAK,GAAG,CAAC;IACT,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,6CAA6C,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { AssignOrganizationMemberDialog, AssignOrganizationMemberDialog as default, AssignOrganizationMemberDialogTriggerButton, } from "./AssignOrganizationMemberDialog";
|
|
2
|
+
export type { AssignOrganizationMemberDialogProps, AssignOrganizationMemberDialogOpenTriggerProps, AssignOrganizationMemberDialogUser, AssignOrganizationMemberDialogOrganizationOption, AssignMemberSubmitData, } from "./AssignOrganizationMemberDialog";
|
|
3
|
+
export { AssignOrganizationMemberDialogDispatchContext } from "./AssignOrganizationMemberDialogDispatchContext";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { AssignOrganizationMemberDialog, AssignOrganizationMemberDialog as default, AssignOrganizationMemberDialogTriggerButton, } from "./AssignOrganizationMemberDialog";
|
|
2
|
+
export { AssignOrganizationMemberDialogDispatchContext } from "./AssignOrganizationMemberDialogDispatchContext";
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AssignOrganizationMemberDialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,IAAI,OAAO,EACzC,2CAA2C,GAC5C,MAAM,kCAAkC,CAAC;AAS1C,OAAO,EAAE,6CAA6C,EAAE,MAAM,iDAAiD,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"}
|