@dxos/shell 0.4.10-main.f68a1ca → 0.4.10-main.f937af6
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/bundle/index-Cms4wG79.mjs +110 -0
- package/dist/bundle/index-Cms4wG79.mjs.map +1 -0
- package/dist/bundle/index-DACjPI-n.mjs +96625 -0
- package/dist/bundle/index-DACjPI-n.mjs.map +1 -0
- package/dist/bundle/shell.mjs +9 -81099
- package/dist/bundle/shell.mjs.map +1 -1
- package/dist/bundle/shell.umd.js +156 -88
- package/dist/bundle/shell.umd.js.map +1 -1
- package/dist/bundle/style.css +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react.mjs +866 -824
- package/dist/lib/browser/react.mjs.map +4 -4
- package/dist/lib/browser/testing/index.mjs +10 -9
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/types/src/components/AgentConfig.d.ts +3 -0
- package/dist/types/src/components/AgentConfig.d.ts.map +1 -0
- package/dist/types/src/components/AgentConfig.js +37 -0
- package/dist/types/src/components/AgentConfig.js.map +1 -0
- package/dist/types/src/components/DeviceList/DeviceList.d.ts +3 -0
- package/dist/types/src/components/DeviceList/DeviceList.d.ts.map +1 -0
- package/dist/types/src/components/DeviceList/DeviceList.js +29 -0
- package/dist/types/src/components/DeviceList/DeviceList.js.map +1 -0
- package/dist/types/src/components/DeviceList/DeviceListItem.d.ts +6 -0
- package/dist/types/src/components/DeviceList/DeviceListItem.d.ts.map +1 -0
- package/dist/types/src/components/DeviceList/DeviceListItem.js +72 -0
- package/dist/types/src/components/DeviceList/DeviceListItem.js.map +1 -0
- package/dist/types/src/components/DeviceList/DeviceListProps.d.ts +27 -0
- package/dist/types/src/components/DeviceList/DeviceListProps.d.ts.map +1 -0
- package/dist/types/src/components/DeviceList/DeviceListProps.js +6 -0
- package/dist/types/src/components/DeviceList/DeviceListProps.js.map +1 -0
- package/dist/types/src/components/DeviceList/index.d.ts +3 -0
- package/dist/types/src/components/DeviceList/index.d.ts.map +1 -0
- package/dist/types/src/components/DeviceList/index.js +22 -0
- package/dist/types/src/components/DeviceList/index.js.map +1 -0
- package/dist/types/src/components/EmojiPicker.d.ts +9 -2
- package/dist/types/src/components/EmojiPicker.d.ts.map +1 -1
- package/dist/types/src/components/EmojiPicker.js +57 -3
- package/dist/types/src/components/EmojiPicker.js.map +1 -1
- package/dist/types/src/components/HuePicker.d.ts +9 -2
- package/dist/types/src/components/HuePicker.d.ts.map +1 -1
- package/dist/types/src/components/HuePicker.js +75 -6
- package/dist/types/src/components/HuePicker.js.map +1 -1
- package/dist/types/src/components/IdentityList/index.d.ts +0 -1
- package/dist/types/src/components/IdentityList/index.d.ts.map +1 -1
- package/dist/types/src/components/IdentityList/index.js +0 -1
- package/dist/types/src/components/IdentityList/index.js.map +1 -1
- package/dist/types/src/components/InvitationList/InvitationListItem.js +5 -5
- package/dist/types/src/components/InvitationList/InvitationListItem.js.map +1 -1
- package/dist/types/src/components/Panel/Action.d.ts +2 -2
- package/dist/types/src/components/Viewport/Viewport.d.ts +1 -1
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/index.js +2 -0
- package/dist/types/src/components/index.js.map +1 -1
- package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/Shell.js +1 -5
- package/dist/types/src/composites/Shell/Shell.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +80 -40
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts +0 -3
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js +1 -43
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +8 -11
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.js +0 -24
- package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts +4 -4
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +9 -43
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js +2 -2
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts +0 -2
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/index.js +0 -2
- package/dist/types/src/panels/IdentityPanel/steps/index.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js +5 -1
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js.map +1 -1
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts.map +1 -1
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js +3 -1
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js.map +1 -1
- package/dist/types/src/playwright/invitations.spec.js +3 -1
- package/dist/types/src/playwright/invitations.spec.js.map +1 -1
- package/dist/types/src/steps/ConfirmReset.d.ts.map +1 -1
- package/dist/types/src/steps/ConfirmReset.js +4 -3
- package/dist/types/src/steps/ConfirmReset.js.map +1 -1
- package/dist/types/src/steps/InvitationManager.d.ts +1 -1
- package/dist/types/src/steps/InvitationManager.d.ts.map +1 -1
- package/dist/types/src/steps/InvitationManager.js +3 -4
- package/dist/types/src/steps/InvitationManager.js.map +1 -1
- package/dist/types/src/stories/Invitations.e2e-stories.d.ts.map +1 -1
- package/dist/types/src/stories/Invitations.e2e-stories.js +5 -2
- package/dist/types/src/stories/Invitations.e2e-stories.js.map +1 -1
- package/dist/types/src/testing/shell-manager.d.ts.map +1 -1
- package/dist/types/src/testing/shell-manager.js +10 -9
- package/dist/types/src/testing/shell-manager.js.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +12 -2
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.js +12 -2
- package/dist/types/src/translations/locales/en-US.js.map +1 -1
- package/dist/types/src/types/index.js +1 -0
- package/dist/types/src/types/index.js.map +1 -1
- package/package.json +22 -21
- package/src/components/AgentConfig.tsx +66 -0
- package/src/components/DeviceList/DeviceList.tsx +54 -0
- package/src/components/DeviceList/DeviceListItem.tsx +120 -0
- package/src/components/DeviceList/DeviceListProps.ts +33 -0
- package/src/components/DeviceList/index.ts +6 -0
- package/src/components/EmojiPicker.tsx +101 -4
- package/src/components/HuePicker.tsx +99 -5
- package/src/components/IdentityList/index.ts +0 -1
- package/src/components/InvitationList/InvitationListItem.tsx +5 -5
- package/src/components/index.ts +2 -0
- package/src/composites/Shell/Shell.tsx +1 -7
- package/src/panels/IdentityPanel/IdentityPanel.stories.tsx +0 -63
- package/src/panels/IdentityPanel/IdentityPanel.tsx +123 -34
- package/src/panels/IdentityPanel/IdentityPanelProps.ts +10 -14
- package/src/panels/IdentityPanel/identityMachine.ts +1 -31
- package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +23 -76
- package/src/panels/IdentityPanel/steps/ProfileForm.tsx +12 -4
- package/src/panels/IdentityPanel/steps/index.ts +0 -2
- package/src/panels/IdentityPanel/useAgentHandlers.ts +5 -1
- package/src/panels/SpacePanel/steps/SpaceManager.tsx +3 -1
- package/src/playwright/invitations.spec.ts +3 -1
- package/src/steps/ConfirmReset.tsx +4 -3
- package/src/steps/InvitationManager.tsx +4 -4
- package/src/stories/Invitations.e2e-stories.tsx +6 -3
- package/src/testing/shell-manager.ts +10 -9
- package/src/translations/locales/en-US.ts +13 -2
- package/src/types/index.ts +2 -0
- package/dist/types/src/components/IdentityList/DeviceList.d.ts +0 -7
- package/dist/types/src/components/IdentityList/DeviceList.d.ts.map +0 -1
- package/dist/types/src/components/IdentityList/DeviceList.js +0 -34
- package/dist/types/src/components/IdentityList/DeviceList.js.map +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/AgentForm.d.ts +0 -3
- package/dist/types/src/panels/IdentityPanel/steps/AgentForm.d.ts.map +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/AgentForm.js +0 -26
- package/dist/types/src/panels/IdentityPanel/steps/AgentForm.js.map +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.d.ts +0 -10
- package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.d.ts.map +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.js +0 -23
- package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.js.map +0 -1
- package/src/components/IdentityList/DeviceList.tsx +0 -49
- package/src/panels/IdentityPanel/steps/AgentForm.tsx +0 -61
- package/src/panels/IdentityPanel/steps/DeviceManager.tsx +0 -41
|
@@ -10,11 +10,19 @@ import { type Identity } from '@dxos/react-client/halo';
|
|
|
10
10
|
import { useTranslation } from '@dxos/react-ui';
|
|
11
11
|
import { hexToEmoji, hexToHue } from '@dxos/util';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
Action,
|
|
15
|
+
Actions,
|
|
16
|
+
StepHeading,
|
|
17
|
+
Input,
|
|
18
|
+
useClipboardContext,
|
|
19
|
+
EmojiPickerBlock,
|
|
20
|
+
HuePickerBlock,
|
|
21
|
+
} from '../../../components';
|
|
14
22
|
import { type IdentityPanelStepProps } from '../IdentityPanelProps';
|
|
15
23
|
import { type IdentityEvent } from '../identityMachine';
|
|
16
24
|
|
|
17
|
-
export interface ProfileFormProps extends Omit<IdentityPanelStepProps, 'send'> {
|
|
25
|
+
export interface ProfileFormProps extends Omit<IdentityPanelStepProps, 'send' | 'devices'> {
|
|
18
26
|
send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
|
|
19
27
|
onUpdateProfile?: (profile: NonNullable<Identity['profile']>) => Promise<void>;
|
|
20
28
|
identity?: Identity;
|
|
@@ -68,13 +76,13 @@ const ProfileFormImpl = (props: ProfileFormImplProps) => {
|
|
|
68
76
|
/>
|
|
69
77
|
<StepHeading className='mbe-2'>{t('emoji and color label')}</StepHeading>
|
|
70
78
|
<div role='none' className='grid grid-cols-[1fr_min-content] gap-y-2'>
|
|
71
|
-
<
|
|
79
|
+
<EmojiPickerBlock
|
|
72
80
|
emoji={emoji}
|
|
73
81
|
onChangeEmoji={setEmoji}
|
|
74
82
|
disabled={disabled}
|
|
75
83
|
onClickClear={() => setEmoji(getEmojiValue(identity))}
|
|
76
84
|
/>
|
|
77
|
-
<
|
|
85
|
+
<HuePickerBlock
|
|
78
86
|
hue={hue}
|
|
79
87
|
onChangeHue={setHue}
|
|
80
88
|
disabled={disabled}
|
|
@@ -67,7 +67,11 @@ export const useAgentHandlers = ({
|
|
|
67
67
|
invitations.forEach((invitation) => invitation.cancel());
|
|
68
68
|
|
|
69
69
|
// TODO(nf): do this work in the hosting provider client?
|
|
70
|
-
const invitation = client.halo.share({
|
|
70
|
+
const invitation = client.halo.share({
|
|
71
|
+
type: Invitation.Type.INTERACTIVE,
|
|
72
|
+
authMethod: Invitation.AuthMethod.NONE,
|
|
73
|
+
multiUse: true,
|
|
74
|
+
});
|
|
71
75
|
|
|
72
76
|
invitation.subscribe(handleAgentCreate);
|
|
73
77
|
};
|
|
@@ -59,6 +59,7 @@ export const SpaceManager = (props: SpaceManagerProps) => {
|
|
|
59
59
|
const invitation = space.share?.({
|
|
60
60
|
type: Invitation.Type.INTERACTIVE,
|
|
61
61
|
authMethod: Invitation.AuthMethod.SHARED_SECRET,
|
|
62
|
+
multiUse: false,
|
|
62
63
|
target,
|
|
63
64
|
});
|
|
64
65
|
if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== 'production') {
|
|
@@ -72,8 +73,9 @@ export const SpaceManager = (props: SpaceManagerProps) => {
|
|
|
72
73
|
icon: UsersThree,
|
|
73
74
|
onClick: useCallback(() => {
|
|
74
75
|
const invitation = space.share?.({
|
|
75
|
-
type: Invitation.Type.
|
|
76
|
+
type: Invitation.Type.INTERACTIVE,
|
|
76
77
|
authMethod: Invitation.AuthMethod.NONE,
|
|
78
|
+
multiUse: true,
|
|
77
79
|
target,
|
|
78
80
|
});
|
|
79
81
|
if (invitation && config.values.runtime?.app?.env?.DX_ENVIRONMENT !== 'production') {
|
|
@@ -15,7 +15,9 @@ test.describe('Invitations', () => {
|
|
|
15
15
|
let manager: InvitationsManager;
|
|
16
16
|
|
|
17
17
|
// TODO(wittjosiah): Storybook takes a bit to be ready for testing against.
|
|
18
|
-
test.beforeAll(async ({ browser }) => {
|
|
18
|
+
test.beforeAll(async ({ browser, browserName }) => {
|
|
19
|
+
// TODO(wittjosiah): Storybook is broken in Safari/Webkit.
|
|
20
|
+
test.skip(browserName === 'webkit');
|
|
19
21
|
test.setTimeout(60_000);
|
|
20
22
|
manager = new InvitationsManager(browser);
|
|
21
23
|
await manager.init();
|
|
@@ -64,6 +64,7 @@ export const ConfirmResetImpl = ({
|
|
|
64
64
|
const { t } = useTranslation('os');
|
|
65
65
|
const confirmationValue = t('confirmation value');
|
|
66
66
|
const [inputValue, setInputValue] = useState('');
|
|
67
|
+
const testIdAffix = mode === 'join new identity' ? 'join-new-identity' : 'reset-storage';
|
|
67
68
|
return (
|
|
68
69
|
<>
|
|
69
70
|
<div role='none' className='grow flex flex-col gap-2 justify-center'>
|
|
@@ -84,14 +85,14 @@ export const ConfirmResetImpl = ({
|
|
|
84
85
|
</StepHeading>
|
|
85
86
|
}
|
|
86
87
|
disabled={disabled}
|
|
87
|
-
data-testid=
|
|
88
|
+
data-testid={`${testIdAffix}.reset-identity-input`}
|
|
88
89
|
placeholder={confirmationValue}
|
|
89
90
|
onChange={({ target: { value } }) => setInputValue(value)}
|
|
90
91
|
/>
|
|
91
92
|
</div>
|
|
92
93
|
<Actions>
|
|
93
94
|
{onCancel && (
|
|
94
|
-
<Action disabled={disabled} onClick={onCancel} data-testid=
|
|
95
|
+
<Action disabled={disabled} onClick={onCancel} data-testid={`${testIdAffix}.reset-identity-cancel`}>
|
|
95
96
|
{t('cancel label')}
|
|
96
97
|
</Action>
|
|
97
98
|
)}
|
|
@@ -100,7 +101,7 @@ export const ConfirmResetImpl = ({
|
|
|
100
101
|
variant='destructive'
|
|
101
102
|
disabled={disabled || pending || inputValue !== confirmationValue}
|
|
102
103
|
onClick={onConfirm}
|
|
103
|
-
data-testid=
|
|
104
|
+
data-testid={`${testIdAffix}.reset-identity-confirm`}
|
|
104
105
|
>
|
|
105
106
|
{pending ? t('reset in progress label') : t('reset device label')}
|
|
106
107
|
</Action>
|
|
@@ -6,7 +6,7 @@ import { Check, X } from '@phosphor-icons/react';
|
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
import { QR } from 'react-qr-rounded';
|
|
8
8
|
|
|
9
|
-
import { type InvitationStatus
|
|
9
|
+
import { type InvitationStatus } from '@dxos/react-client/invitations';
|
|
10
10
|
import { useId, useTranslation } from '@dxos/react-ui';
|
|
11
11
|
import { descriptionText, getSize, mx } from '@dxos/react-ui-theme';
|
|
12
12
|
import { hexToEmoji } from '@dxos/util';
|
|
@@ -43,13 +43,13 @@ export const InvitationManager = ({
|
|
|
43
43
|
active,
|
|
44
44
|
send,
|
|
45
45
|
status,
|
|
46
|
-
|
|
46
|
+
multiUse,
|
|
47
47
|
authCode,
|
|
48
48
|
id = '0',
|
|
49
49
|
}: InvitationManagerProps) => {
|
|
50
50
|
const { t } = useTranslation('os');
|
|
51
51
|
const qrLabel = useId('invitation-manager__qr-code');
|
|
52
|
-
const statusValue =
|
|
52
|
+
const statusValue = multiUse ? 0 : invitationStatusValue.get(status!) ?? 0;
|
|
53
53
|
const showAuthCode = statusValue === 3;
|
|
54
54
|
const emoji = hexToEmoji(id);
|
|
55
55
|
const activeView = useMemo(() => {
|
|
@@ -69,7 +69,7 @@ export const InvitationManager = ({
|
|
|
69
69
|
<Viewport.Views>
|
|
70
70
|
<InvitationManagerView id='showing qr' emoji={emoji}>
|
|
71
71
|
<p className='text-sm mlb-1 font-normal text-center'>
|
|
72
|
-
{t(
|
|
72
|
+
{t(multiUse ? 'invite many qr label' : 'invite one qr label')}
|
|
73
73
|
</p>
|
|
74
74
|
<div role='none' className={mx(descriptionText, 'is-full max-is-[14rem] relative')}>
|
|
75
75
|
<QR
|
|
@@ -10,7 +10,7 @@ import React, { useMemo, useState } from 'react';
|
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
import { faker } from '@dxos/random';
|
|
12
12
|
import { useClient } from '@dxos/react-client';
|
|
13
|
-
import { type Space, type SpaceMember,
|
|
13
|
+
import { type Space, type SpaceMember, useSpaces } from '@dxos/react-client/echo';
|
|
14
14
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
15
15
|
import { Invitation, InvitationEncoder } from '@dxos/react-client/invitations';
|
|
16
16
|
import { ConnectionState, useNetworkStatus } from '@dxos/react-client/mesh';
|
|
@@ -36,7 +36,7 @@ const Panel = ({ id, panel, setPanel }: { id: number; panel?: PanelType; setPane
|
|
|
36
36
|
const spaces = useSpaces();
|
|
37
37
|
|
|
38
38
|
useMemo(() => {
|
|
39
|
-
if (panel
|
|
39
|
+
if (panel && typeof panel !== 'string') {
|
|
40
40
|
(window as any)[`peer${id}CreateSpaceInvitation`] = (options?: Partial<Invitation>) => {
|
|
41
41
|
const invitation = panel.share(options);
|
|
42
42
|
|
|
@@ -50,7 +50,7 @@ const Panel = ({ id, panel, setPanel }: { id: number; panel?: PanelType; setPane
|
|
|
50
50
|
}
|
|
51
51
|
}, [panel]);
|
|
52
52
|
|
|
53
|
-
if (panel
|
|
53
|
+
if (panel && typeof panel !== 'string') {
|
|
54
54
|
return <SpacePanel space={panel} createInvitationUrl={createInvitationUrl} />;
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -216,6 +216,9 @@ const Invitations = (args: { id: number; count: number }) => {
|
|
|
216
216
|
);
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
+
// TODO(wittjosiah): This story fails to start in Safari/Webkit.
|
|
220
|
+
// The issue appears to be related to dynamic imports during client initialization.
|
|
221
|
+
// This does not seem to be a problem in other browsers nor in Safari in the app.
|
|
219
222
|
export const Default = {
|
|
220
223
|
render: (args: { id: number }) => (
|
|
221
224
|
<ClipboardProvider>
|
|
@@ -65,17 +65,17 @@ export class ShellManager extends ScopedShellManager {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
this.page.on('dialog', handleDialog);
|
|
68
|
-
await this.shell.getByTestId('
|
|
69
|
-
await this.shell.getByTestId('
|
|
70
|
-
this.
|
|
68
|
+
await this.shell.getByTestId('device-list-item-current.options').click();
|
|
69
|
+
await this.shell.getByTestId('device-list-item-current.reset').click();
|
|
70
|
+
await this.shell.getByTestId('reset-storage.reset-identity-input').fill('CONFIRM');
|
|
71
|
+
await this.shell.getByTestId('reset-storage.reset-identity-confirm').click();
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
async joinNewIdentity(invitationCode: string) {
|
|
74
|
-
await this.shell.getByTestId('
|
|
75
|
-
await this.shell.getByTestId('
|
|
76
|
-
await this.shell.getByTestId('reset-identity-input').fill('CONFIRM');
|
|
77
|
-
await this.shell.getByTestId('reset-identity-
|
|
78
|
-
await this.shell.getByTestId('identity-chooser.join-identity').click();
|
|
75
|
+
await this.shell.getByTestId('device-list-item-current.options').click();
|
|
76
|
+
await this.shell.getByTestId('device-list-item-current.join-existing').click();
|
|
77
|
+
await this.shell.getByTestId('join-new-identity.reset-identity-input').fill('CONFIRM');
|
|
78
|
+
await this.shell.getByTestId('join-new-identity.reset-identity-confirm').click();
|
|
79
79
|
await this.inputInvitation('device', invitationCode, this.shell);
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -117,7 +117,8 @@ export class ShellManager extends ScopedShellManager {
|
|
|
117
117
|
|
|
118
118
|
private async _onConsoleMessage(message: ConsoleMessage) {
|
|
119
119
|
try {
|
|
120
|
-
const
|
|
120
|
+
const text = message.text();
|
|
121
|
+
const json = JSON.parse(text.slice(text.indexOf('{')));
|
|
121
122
|
if (json.invitationCode) {
|
|
122
123
|
this._invitationCode.wake(json.invitationCode);
|
|
123
124
|
}
|
|
@@ -45,8 +45,6 @@ export const os = {
|
|
|
45
45
|
'connected status label': 'Enter confirmation PIN',
|
|
46
46
|
'authenticating status label': 'Enter confirmation PIN',
|
|
47
47
|
'success status label': 'Success',
|
|
48
|
-
'connect label': 'Connect',
|
|
49
|
-
'reconnect label': 'Reconnect',
|
|
50
48
|
'cancel label': 'Cancel',
|
|
51
49
|
'done label': 'Done',
|
|
52
50
|
'reset label': 'Start over',
|
|
@@ -131,4 +129,17 @@ export const os = {
|
|
|
131
129
|
'fuchsia label': 'Fuchsia',
|
|
132
130
|
'pink label': 'Pink',
|
|
133
131
|
'rose label': 'Rose',
|
|
132
|
+
'current device tag label': 'This device',
|
|
133
|
+
'device name placeholder': '{{platform}} on {{os}}',
|
|
134
|
+
'more options label': 'More options',
|
|
135
|
+
'disconnect label': 'Currently online. Click to go offline.',
|
|
136
|
+
'connect label': 'Currently offline. Click to go online.',
|
|
137
|
+
'edit device label': 'Edit device name & avatar',
|
|
138
|
+
'agent heading': 'Agent',
|
|
139
|
+
'agent message title': 'About creating an agent',
|
|
140
|
+
'agent message body':
|
|
141
|
+
'Creating an agent helps keep your devices and peers in-sync. An agent is like any other device, but since it’s always online your changes will sync even when all your physical devices are asleep.',
|
|
142
|
+
'create agent label': 'Start an agent',
|
|
143
|
+
'destroy agent label': 'Shut down agent',
|
|
144
|
+
'agent device label': 'Your agent',
|
|
134
145
|
};
|
package/src/types/index.ts
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type Device } from '@dxos/react-client/halo';
|
|
2
|
-
export interface DeviceListProps {
|
|
3
|
-
devices: Device[];
|
|
4
|
-
onSelect?: (device: Device) => void;
|
|
5
|
-
}
|
|
6
|
-
export declare const DeviceList: ({ devices, onSelect }: DeviceListProps) => JSX.Element;
|
|
7
|
-
//# sourceMappingURL=DeviceList.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceList.d.ts","sourceRoot":"","sources":["../../../../../src/components/IdentityList/DeviceList.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,yBAAyB,CAAC;AAMlE,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,UAAU,0BAA2B,eAAe,gBA8BhE,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//
|
|
3
|
-
// Copyright 2023 DXOS.org
|
|
4
|
-
//
|
|
5
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.DeviceList = void 0;
|
|
10
|
-
const react_1 = __importDefault(require("react"));
|
|
11
|
-
const display_name_1 = require("@dxos/display-name");
|
|
12
|
-
const halo_1 = require("@dxos/react-client/halo");
|
|
13
|
-
const react_ui_1 = require("@dxos/react-ui");
|
|
14
|
-
const react_ui_theme_1 = require("@dxos/react-ui-theme");
|
|
15
|
-
const IdentityListItem_1 = require("./IdentityListItem");
|
|
16
|
-
const DeviceList = ({ devices, onSelect }) => {
|
|
17
|
-
const { t } = (0, react_ui_1.useTranslation)('os');
|
|
18
|
-
return devices.length > 0 ? (react_1.default.createElement(react_ui_1.List, { classNames: 'flex flex-col gap-2' }, devices.map((device) => {
|
|
19
|
-
var _a, _b;
|
|
20
|
-
// TODO(wittjosiah): Render this better. Consider communicating these as apps rather than devices.
|
|
21
|
-
const deviceType = ((_a = device.profile) === null || _a === void 0 ? void 0 : _a.type) || halo_1.DeviceType.UNKNOWN;
|
|
22
|
-
const displayName = ((_b = device.profile) === null || _b === void 0 ? void 0 : _b.label)
|
|
23
|
-
? `${device.profile.label} (${halo_1.DeviceType[deviceType]})`
|
|
24
|
-
: (0, display_name_1.generateName)(device.deviceKey.toHex());
|
|
25
|
-
const identity = {
|
|
26
|
-
identityKey: device.deviceKey,
|
|
27
|
-
profile: { displayName },
|
|
28
|
-
};
|
|
29
|
-
return (react_1.default.createElement(IdentityListItem_1.IdentityListItem, { key: device.deviceKey.toHex(), identity: identity, presence: device.presence, onClick: onSelect && (() => onSelect(device)) }));
|
|
30
|
-
}))) : (react_1.default.createElement("div", { role: 'none', className: 'grow flex items-center p-2' },
|
|
31
|
-
react_1.default.createElement("p", { className: (0, react_ui_theme_1.mx)(react_ui_theme_1.descriptionText, 'text-center is-full') }, t('empty device list message'))));
|
|
32
|
-
};
|
|
33
|
-
exports.DeviceList = DeviceList;
|
|
34
|
-
//# sourceMappingURL=DeviceList.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceList.js","sourceRoot":"","sources":["../../../../../src/components/IdentityList/DeviceList.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,kDAA0B;AAE1B,qDAAkD;AAClD,kDAAkE;AAClE,6CAAsD;AACtD,yDAA2D;AAE3D,yDAAsD;AAO/C,MAAM,UAAU,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAmB,EAAE,EAAE;IACnE,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,CAAC;IACnC,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAC1B,8BAAC,eAAI,IAAC,UAAU,EAAC,qBAAqB,IACnC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;;QACtB,kGAAkG;QAClG,MAAM,UAAU,GAAG,CAAA,MAAA,MAAM,CAAC,OAAO,0CAAE,IAAI,KAAI,iBAAU,CAAC,OAAO,CAAC;QAC9D,MAAM,WAAW,GAAG,CAAA,MAAA,MAAM,CAAC,OAAO,0CAAE,KAAK;YACvC,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,KAAK,iBAAU,CAAC,UAAU,CAAC,GAAG;YACvD,CAAC,CAAC,IAAA,2BAAY,EAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;QAE3C,MAAM,QAAQ,GAAG;YACf,WAAW,EAAE,MAAM,CAAC,SAAS;YAC7B,OAAO,EAAE,EAAE,WAAW,EAAE;SACzB,CAAC;QACF,OAAO,CACL,8BAAC,mCAAgB,IACf,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAC7B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,OAAO,EAAE,QAAQ,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAC7C,CACH,CAAC;IACJ,CAAC,CAAC,CACG,CACR,CAAC,CAAC,CAAC,CACF,uCAAK,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,4BAA4B;QACrD,qCAAG,SAAS,EAAE,IAAA,mBAAE,EAAC,gCAAe,EAAE,qBAAqB,CAAC,IAAG,CAAC,CAAC,2BAA2B,CAAC,CAAK,CAC1F,CACP,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,UAAU,cA8BrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AgentForm.d.ts","sourceRoot":"","sources":["../../../../../../src/panels/IdentityPanel/steps/AgentForm.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEzF,eAAO,MAAM,SAAS,UAAW,sBAAsB,GAAG,cAAc,gBAiDvE,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//
|
|
3
|
-
// Copyright 2023 DXOS.org
|
|
4
|
-
//
|
|
5
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.AgentForm = void 0;
|
|
10
|
-
const react_1 = __importDefault(require("react"));
|
|
11
|
-
const react_ui_1 = require("@dxos/react-ui");
|
|
12
|
-
const components_1 = require("../../../components");
|
|
13
|
-
const AgentForm = (props) => {
|
|
14
|
-
const { active, onAgentCreate, onAgentDestroy, send, validationMessage, agentStatus, agentActive, agentProviderDisabled, } = props;
|
|
15
|
-
const disabled = !active;
|
|
16
|
-
const { t } = (0, react_ui_1.useTranslation)('os');
|
|
17
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
18
|
-
react_1.default.createElement("div", { role: 'none', className: 'grow flex flex-col justify-center' },
|
|
19
|
-
react_1.default.createElement(components_1.Input, { validationMessage, label: react_1.default.createElement(components_1.StepHeading, null, "Agent Status"), disabled: disabled, "data-testid": 'agent-status', value: agentStatus })),
|
|
20
|
-
react_1.default.createElement(components_1.Actions, null,
|
|
21
|
-
react_1.default.createElement(components_1.Action, { disabled: agentActive || agentProviderDisabled, onClick: () => onAgentCreate === null || onAgentCreate === void 0 ? void 0 : onAgentCreate(), "data-testid": 'create-agent' }, "Create Agent"),
|
|
22
|
-
react_1.default.createElement(components_1.Action, { disabled: !agentActive || agentProviderDisabled, onClick: () => onAgentDestroy === null || onAgentDestroy === void 0 ? void 0 : onAgentDestroy(), "data-testid": 'destroy-agent' }, "Destroy Agent"),
|
|
23
|
-
react_1.default.createElement(components_1.Action, { disabled: disabled, onClick: () => send === null || send === void 0 ? void 0 : send({ type: 'unchooseAction' }), "data-testid": 'update-profile-form-back' }, t('back label')))));
|
|
24
|
-
};
|
|
25
|
-
exports.AgentForm = AgentForm;
|
|
26
|
-
//# sourceMappingURL=AgentForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AgentForm.js","sourceRoot":"","sources":["../../../../../../src/panels/IdentityPanel/steps/AgentForm.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,kDAA0B;AAE1B,6CAAgD;AAEhD,oDAA0E;AAGnE,MAAM,SAAS,GAAG,CAAC,KAA8C,EAAE,EAAE;IAC1E,MAAM,EACJ,MAAM,EACN,aAAa,EACb,cAAc,EACd,IAAI,EACJ,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,qBAAqB,GACtB,GAAG,KAAK,CAAC;IACV,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC;IACzB,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,CAAC;IACnC,OAAO,CACL;QACE,uCAAK,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,mCAAmC;YAC5D,8BAAC,kBAAK,IACE,iBAAiB,EACvB,KAAK,EAAE,8BAAC,wBAAW,uBAA2B,EAC9C,QAAQ,EAAE,QAAQ,iBACN,cAAc,EAC1B,KAAK,EAAE,WAAW,GAClB,CACE;QACN,8BAAC,oBAAO;YACN,8BAAC,mBAAM,IACL,QAAQ,EAAE,WAAW,IAAI,qBAAqB,EAC9C,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,EAAI,iBACnB,cAAc,mBAGpB;YACT,8BAAC,mBAAM,IACL,QAAQ,EAAE,CAAC,WAAW,IAAI,qBAAqB,EAC/C,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,EAAI,iBACpB,eAAe,oBAGrB;YACT,8BAAC,mBAAM,IACL,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAG,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,iBACpC,0BAA0B,IAEtC,CAAC,CAAC,YAAY,CAAC,CACT,CACD,CACT,CACJ,CAAC;AACJ,CAAC,CAAC;AAjDW,QAAA,SAAS,aAiDpB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type Event, type SingleOrArray } from 'xstate';
|
|
2
|
-
import { type Device } from '@dxos/react-client/halo';
|
|
3
|
-
import type { IdentityPanelStepProps } from '../IdentityPanelProps';
|
|
4
|
-
import type { IdentityEvent } from '../identityMachine';
|
|
5
|
-
export interface DeviceManagerProps extends Omit<IdentityPanelStepProps, 'send'> {
|
|
6
|
-
send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
|
|
7
|
-
devices: Device[];
|
|
8
|
-
}
|
|
9
|
-
export declare const DeviceManager: ({ devices, active, send }: DeviceManagerProps) => JSX.Element;
|
|
10
|
-
//# sourceMappingURL=DeviceManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceManager.d.ts","sourceRoot":"","sources":["../../../../../../src/panels/IdentityPanel/steps/DeviceManager.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAExD,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAItD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAC9E,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,KAAK,IAAI,CAAC;IAC5D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,eAAO,MAAM,aAAa,8BAA+B,kBAAkB,gBAqB1E,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//
|
|
3
|
-
// Copyright 2023 DXOS.org
|
|
4
|
-
//
|
|
5
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.DeviceManager = void 0;
|
|
10
|
-
const react_1 = __importDefault(require("react"));
|
|
11
|
-
const react_ui_1 = require("@dxos/react-ui");
|
|
12
|
-
const components_1 = require("../../../components");
|
|
13
|
-
const DeviceManager = ({ devices, active, send }) => {
|
|
14
|
-
const { t } = (0, react_ui_1.useTranslation)('os');
|
|
15
|
-
const disabled = !active;
|
|
16
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
17
|
-
react_1.default.createElement("div", { role: 'none', className: 'grow' },
|
|
18
|
-
react_1.default.createElement(components_1.DeviceList, { devices: devices })),
|
|
19
|
-
react_1.default.createElement(components_1.Actions, null,
|
|
20
|
-
react_1.default.createElement(components_1.Action, { variant: 'ghost', disabled: disabled, onClick: () => send === null || send === void 0 ? void 0 : send({ type: 'unchooseAction' }), "data-testid": 'manage-devices-back' }, t('back label')))));
|
|
21
|
-
};
|
|
22
|
-
exports.DeviceManager = DeviceManager;
|
|
23
|
-
//# sourceMappingURL=DeviceManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceManager.js","sourceRoot":"","sources":["../../../../../../src/panels/IdentityPanel/steps/DeviceManager.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,kDAA0B;AAI1B,6CAAgD;AAEhD,oDAAkE;AAS3D,MAAM,aAAa,GAAG,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAsB,EAAE,EAAE;IAC7E,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC;IAEzB,OAAO,CACL;QACE,uCAAK,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM;YAC/B,8BAAC,uBAAU,IAAC,OAAO,EAAE,OAAO,GAAI,CAC5B;QACN,8BAAC,oBAAO;YACN,8BAAC,mBAAM,IACL,OAAO,EAAC,OAAO,EACf,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAG,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,iBACpC,qBAAqB,IAEjC,CAAC,CAAC,YAAY,CAAC,CACT,CACD,CACT,CACJ,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,aAAa,iBAqBxB"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { generateName } from '@dxos/display-name';
|
|
8
|
-
import { type Device, DeviceType } from '@dxos/react-client/halo';
|
|
9
|
-
import { List, useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import { descriptionText, mx } from '@dxos/react-ui-theme';
|
|
11
|
-
|
|
12
|
-
import { IdentityListItem } from './IdentityListItem';
|
|
13
|
-
|
|
14
|
-
export interface DeviceListProps {
|
|
15
|
-
devices: Device[];
|
|
16
|
-
onSelect?: (device: Device) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const DeviceList = ({ devices, onSelect }: DeviceListProps) => {
|
|
20
|
-
const { t } = useTranslation('os');
|
|
21
|
-
return devices.length > 0 ? (
|
|
22
|
-
<List classNames='flex flex-col gap-2'>
|
|
23
|
-
{devices.map((device) => {
|
|
24
|
-
// TODO(wittjosiah): Render this better. Consider communicating these as apps rather than devices.
|
|
25
|
-
const deviceType = device.profile?.type || DeviceType.UNKNOWN;
|
|
26
|
-
const displayName = device.profile?.label
|
|
27
|
-
? `${device.profile.label} (${DeviceType[deviceType]})`
|
|
28
|
-
: generateName(device.deviceKey.toHex());
|
|
29
|
-
|
|
30
|
-
const identity = {
|
|
31
|
-
identityKey: device.deviceKey,
|
|
32
|
-
profile: { displayName },
|
|
33
|
-
};
|
|
34
|
-
return (
|
|
35
|
-
<IdentityListItem
|
|
36
|
-
key={device.deviceKey.toHex()}
|
|
37
|
-
identity={identity}
|
|
38
|
-
presence={device.presence}
|
|
39
|
-
onClick={onSelect && (() => onSelect(device))}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
})}
|
|
43
|
-
</List>
|
|
44
|
-
) : (
|
|
45
|
-
<div role='none' className='grow flex items-center p-2'>
|
|
46
|
-
<p className={mx(descriptionText, 'text-center is-full')}>{t('empty device list message')}</p>
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
8
|
-
|
|
9
|
-
import { Action, Actions, StepHeading, Input } from '../../../components';
|
|
10
|
-
import { type AgentFormProps, type IdentityPanelStepProps } from '../IdentityPanelProps';
|
|
11
|
-
|
|
12
|
-
export const AgentForm = (props: IdentityPanelStepProps & AgentFormProps) => {
|
|
13
|
-
const {
|
|
14
|
-
active,
|
|
15
|
-
onAgentCreate,
|
|
16
|
-
onAgentDestroy,
|
|
17
|
-
send,
|
|
18
|
-
validationMessage,
|
|
19
|
-
agentStatus,
|
|
20
|
-
agentActive,
|
|
21
|
-
agentProviderDisabled,
|
|
22
|
-
} = props;
|
|
23
|
-
const disabled = !active;
|
|
24
|
-
const { t } = useTranslation('os');
|
|
25
|
-
return (
|
|
26
|
-
<>
|
|
27
|
-
<div role='none' className='grow flex flex-col justify-center'>
|
|
28
|
-
<Input
|
|
29
|
-
{...{ validationMessage }}
|
|
30
|
-
label={<StepHeading>Agent Status</StepHeading>}
|
|
31
|
-
disabled={disabled}
|
|
32
|
-
data-testid='agent-status'
|
|
33
|
-
value={agentStatus}
|
|
34
|
-
/>
|
|
35
|
-
</div>
|
|
36
|
-
<Actions>
|
|
37
|
-
<Action
|
|
38
|
-
disabled={agentActive || agentProviderDisabled}
|
|
39
|
-
onClick={() => onAgentCreate?.()}
|
|
40
|
-
data-testid={'create-agent'}
|
|
41
|
-
>
|
|
42
|
-
Create Agent
|
|
43
|
-
</Action>
|
|
44
|
-
<Action
|
|
45
|
-
disabled={!agentActive || agentProviderDisabled}
|
|
46
|
-
onClick={() => onAgentDestroy?.()}
|
|
47
|
-
data-testid={'destroy-agent'}
|
|
48
|
-
>
|
|
49
|
-
Destroy Agent
|
|
50
|
-
</Action>
|
|
51
|
-
<Action
|
|
52
|
-
disabled={disabled}
|
|
53
|
-
onClick={() => send?.({ type: 'unchooseAction' })}
|
|
54
|
-
data-testid={'update-profile-form-back'}
|
|
55
|
-
>
|
|
56
|
-
{t('back label')}
|
|
57
|
-
</Action>
|
|
58
|
-
</Actions>
|
|
59
|
-
</>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { type Event, type SingleOrArray } from 'xstate';
|
|
7
|
-
|
|
8
|
-
import { type Device } from '@dxos/react-client/halo';
|
|
9
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
10
|
-
|
|
11
|
-
import { Action, Actions, DeviceList } from '../../../components';
|
|
12
|
-
import type { IdentityPanelStepProps } from '../IdentityPanelProps';
|
|
13
|
-
import type { IdentityEvent } from '../identityMachine';
|
|
14
|
-
|
|
15
|
-
export interface DeviceManagerProps extends Omit<IdentityPanelStepProps, 'send'> {
|
|
16
|
-
send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
|
|
17
|
-
devices: Device[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const DeviceManager = ({ devices, active, send }: DeviceManagerProps) => {
|
|
21
|
-
const { t } = useTranslation('os');
|
|
22
|
-
const disabled = !active;
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<>
|
|
26
|
-
<div role='none' className='grow'>
|
|
27
|
-
<DeviceList devices={devices} />
|
|
28
|
-
</div>
|
|
29
|
-
<Actions>
|
|
30
|
-
<Action
|
|
31
|
-
variant='ghost'
|
|
32
|
-
disabled={disabled}
|
|
33
|
-
onClick={() => send?.({ type: 'unchooseAction' })}
|
|
34
|
-
data-testid={'manage-devices-back'}
|
|
35
|
-
>
|
|
36
|
-
{t('back label')}
|
|
37
|
-
</Action>
|
|
38
|
-
</Actions>
|
|
39
|
-
</>
|
|
40
|
-
);
|
|
41
|
-
};
|