@celljs/ta-web 4.18.0 → 4.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/esm/browser/account/account-side.d.ts +13 -0
- package/esm/browser/account/account-side.js +74 -0
- package/esm/browser/account/device-account.d.ts +69 -0
- package/esm/browser/account/device-account.js +215 -0
- package/esm/browser/assistant/assistant-chat-list.js +2 -1
- package/esm/browser/components/account-menu.d.ts +1 -1
- package/esm/browser/components/account-menu.js +7 -2
- package/esm/browser/components/account-view.d.ts +17 -0
- package/esm/browser/components/account-view.js +216 -0
- package/esm/browser/components/app-view.js +4 -4
- package/esm/browser/components/cloud-sign-in-view.d.ts +5 -1
- package/esm/browser/components/cloud-sign-in-view.js +1 -1
- package/esm/browser/components/dino-look.d.ts +9 -1
- package/esm/browser/components/dino-look.js +46 -1
- package/esm/browser/components/environment-view.js +12 -1
- package/esm/browser/components/face-pictures.d.ts +10 -0
- package/esm/browser/components/face-pictures.js +24 -0
- package/esm/browser/components/face.d.ts +4 -1
- package/esm/browser/components/face.js +16 -1
- package/esm/browser/components/host-view.d.ts +3 -1
- package/esm/browser/components/host-view.js +7 -0
- package/esm/browser/components/picture-dialog.d.ts +18 -0
- package/esm/browser/components/picture-dialog.js +116 -0
- package/esm/browser/components/workbench-view.js +5 -1
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-api-home.d.ts +13 -0
- package/esm/browser/extension/web-api-home.js +2 -0
- package/esm/browser/extension/web-extension-api.d.ts +4 -4
- package/esm/browser/extension/web-extension-context.js +2 -1
- package/esm/browser/extension/web-home.d.ts +8 -0
- package/esm/browser/extension/web-home.js +20 -0
- package/esm/browser/gateway/console-limits.d.ts +15 -0
- package/esm/browser/gateway/console-limits.js +2 -2
- package/esm/browser/gateway/console-tenant.js +33 -2
- package/esm/browser/gateway/console-updates.d.ts +12 -0
- package/esm/browser/gateway/console-updates.js +76 -0
- package/esm/browser/gateway/console-util.d.ts +7 -1
- package/esm/browser/gateway/console-util.js +18 -0
- package/esm/browser/gateway/console-view.js +9 -2
- package/esm/browser/hosts.d.ts +5 -0
- package/esm/browser/hosts.js +11 -0
- package/esm/browser/i18n/locales.d.ts +69 -3
- package/esm/browser/i18n/locales.js +9 -3
- package/esm/browser/i18n/messages-all.d.ts +7 -0
- package/esm/browser/i18n/messages-all.js +14 -0
- package/esm/browser/i18n/messages-ja.js +64 -0
- package/esm/browser/i18n/messages-zh-tw.js +64 -0
- package/esm/browser/i18n/messages.d.ts +70 -8
- package/esm/browser/i18n/messages.js +161 -11
- package/esm/browser/i18n/use-t.js +4 -3
- package/esm/browser/settings/settings.js +3 -1
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +31 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +5 -0
- package/esm/browser/style/phone.d.ts +1 -1
- package/esm/browser/style/phone.js +2 -1
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +1 -0
- package/esm/browser/util/picture.d.ts +5 -0
- package/esm/browser/util/picture.js +43 -0
- package/esm/browser/workbench-hosts.d.ts +7 -0
- package/esm/browser/workbench-hosts.js +20 -0
- package/esm/browser/workbench-protocol.d.ts +8 -1
- package/esm/browser/workbench-services.d.ts +2 -1
- package/esm/browser/workbench-services.js +3 -0
- package/esm/browser/workbench-util.d.ts +1 -1
- package/lib/browser/account/account-side.d.ts +14 -0
- package/lib/browser/account/account-side.js +111 -0
- package/lib/browser/account/device-account.d.ts +70 -0
- package/lib/browser/account/device-account.js +219 -0
- package/lib/browser/assistant/assistant-chat-list.js +2 -1
- package/lib/browser/components/account-menu.d.ts +1 -1
- package/lib/browser/components/account-menu.js +6 -1
- package/lib/browser/components/account-view.d.ts +18 -0
- package/lib/browser/components/account-view.js +255 -0
- package/lib/browser/components/app-view.js +2 -2
- package/lib/browser/components/cloud-sign-in-view.d.ts +5 -1
- package/lib/browser/components/cloud-sign-in-view.js +1 -0
- package/lib/browser/components/dino-look.d.ts +9 -1
- package/lib/browser/components/dino-look.js +48 -1
- package/lib/browser/components/environment-view.js +11 -0
- package/lib/browser/components/face-pictures.d.ts +11 -0
- package/lib/browser/components/face-pictures.js +60 -0
- package/lib/browser/components/face.d.ts +4 -1
- package/lib/browser/components/face.js +16 -1
- package/lib/browser/components/host-view.d.ts +3 -1
- package/lib/browser/components/host-view.js +8 -0
- package/lib/browser/components/picture-dialog.d.ts +19 -0
- package/lib/browser/components/picture-dialog.js +153 -0
- package/lib/browser/components/workbench-view.js +5 -1
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-api-home.d.ts +14 -0
- package/lib/browser/extension/web-api-home.js +3 -0
- package/lib/browser/extension/web-extension-api.d.ts +4 -4
- package/lib/browser/extension/web-extension-context.js +2 -1
- package/lib/browser/extension/web-home.d.ts +8 -0
- package/lib/browser/extension/web-home.js +54 -1
- package/lib/browser/gateway/console-limits.d.ts +15 -0
- package/lib/browser/gateway/console-limits.js +2 -0
- package/lib/browser/gateway/console-tenant.js +32 -1
- package/lib/browser/gateway/console-updates.d.ts +13 -0
- package/lib/browser/gateway/console-updates.js +113 -0
- package/lib/browser/gateway/console-util.d.ts +7 -1
- package/lib/browser/gateway/console-util.js +18 -0
- package/lib/browser/gateway/console-view.js +9 -2
- package/lib/browser/hosts.d.ts +5 -0
- package/lib/browser/hosts.js +11 -0
- package/lib/browser/i18n/locales.d.ts +69 -3
- package/lib/browser/i18n/locales.js +8 -2
- package/lib/browser/i18n/messages-all.d.ts +8 -0
- package/lib/browser/i18n/messages-all.js +17 -0
- package/lib/browser/i18n/messages-ja.js +64 -0
- package/lib/browser/i18n/messages-zh-tw.js +64 -0
- package/lib/browser/i18n/messages.d.ts +70 -8
- package/lib/browser/i18n/messages.js +163 -13
- package/lib/browser/i18n/use-t.js +4 -3
- package/lib/browser/settings/settings.js +3 -1
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +31 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +5 -0
- package/lib/browser/style/phone.d.ts +1 -1
- package/lib/browser/style/phone.js +2 -1
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +1 -0
- package/lib/browser/util/picture.d.ts +6 -0
- package/lib/browser/util/picture.js +46 -0
- package/lib/browser/workbench-hosts.d.ts +7 -0
- package/lib/browser/workbench-hosts.js +20 -0
- package/lib/browser/workbench-protocol.d.ts +8 -1
- package/lib/browser/workbench-services.d.ts +2 -1
- package/lib/browser/workbench-services.js +3 -0
- package/lib/browser/workbench-util.d.ts +1 -1
- package/package.json +7 -7
|
@@ -46,6 +46,7 @@ import { Voice } from '../util/voice.js';
|
|
|
46
46
|
import { WEB_ICONS } from './icons.js';
|
|
47
47
|
import { WebCwdUtil, WebLabelUtil } from './web-extension-protocol.js';
|
|
48
48
|
import { WebExtensionRunUtil } from './web-extension-run.js';
|
|
49
|
+
import { WebHomeUtil } from './web-home.js';
|
|
49
50
|
import { WebPagesUtil } from './web-pages.js';
|
|
50
51
|
import { WebTaskUtil } from './web-tasks.js';
|
|
51
52
|
const FILE_DRAG = Object.freeze({ set: FileDragUtil.set, has: FileDragUtil.has, get: FileDragUtil.get, paths: FileDragUtil.paths });
|
|
@@ -392,7 +393,7 @@ export class WebExtensionContext {
|
|
|
392
393
|
},
|
|
393
394
|
forgetPage: id => !run.stopped && host.extensions.forgetPage(id),
|
|
394
395
|
useTasks: () => React.useSyncExternalStore(host.extensions.tasks.subscribe, host.extensions.tasks.tasks, host.extensions.tasks.tasks),
|
|
395
|
-
|
|
396
|
+
...WebHomeUtil.ui(host.extensions, () => run.stopped),
|
|
396
397
|
doubleInChats: true,
|
|
397
398
|
useRoomAddons: () => {
|
|
398
399
|
const read = () => host.extensions.state.roomAddons;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
import type { WebHomeUI } from './web-api-home.js';
|
|
1
2
|
import type { WebHomeEntry, WebHomeItem, WebHomeSource } from './web-extension-api.js';
|
|
3
|
+
import type { TaWebExtensions, WebExtensionsState } from './web-extension-protocol.js';
|
|
4
|
+
export declare namespace WebHomeUtil {
|
|
5
|
+
/** The key of the row of the double's home whose page is in front (TaWebExtensions.openHome), as the lists select it. */
|
|
6
|
+
function shown(state: Pick<WebExtensionsState, 'page' | 'pageHidden' | 'pageFrom'>): string | undefined;
|
|
7
|
+
/** The rows of the home for an extension's lists (WebHomeUI); opening none once it stopped. */
|
|
8
|
+
function ui(extensions: TaWebExtensions, stopped: () => boolean): WebHomeUI;
|
|
9
|
+
}
|
|
2
10
|
/** A source of rows of the double's home and the extension that registered it. */
|
|
3
11
|
export interface WebHomeSourceEntry {
|
|
4
12
|
extension: string;
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { LauncherSearchUtil } from '../components/launcher-search-util.js';
|
|
3
|
+
export var WebHomeUtil;
|
|
4
|
+
(function (WebHomeUtil) {
|
|
5
|
+
/** The key of the row of the double's home whose page is in front (TaWebExtensions.openHome), as the lists select it. */
|
|
6
|
+
function shown(state) {
|
|
7
|
+
return state.page && !state.pageHidden ? state.pageFrom : undefined;
|
|
8
|
+
}
|
|
9
|
+
WebHomeUtil.shown = shown;
|
|
10
|
+
/** The rows of the home for an extension's lists (WebHomeUI); opening none once it stopped. */
|
|
11
|
+
function ui(extensions, stopped) {
|
|
12
|
+
const subscribe = (listener) => extensions.subscribe(listener);
|
|
13
|
+
const read = () => shown(extensions.state);
|
|
14
|
+
return {
|
|
15
|
+
useHomeItems: () => React.useSyncExternalStore(extensions.home.subscribe, extensions.home.items, extensions.home.items),
|
|
16
|
+
openHome: entry => (stopped() ? Promise.resolve() : extensions.openHome(entry)),
|
|
17
|
+
useHomeShown: () => React.useSyncExternalStore(subscribe, read, read),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
WebHomeUtil.ui = ui;
|
|
21
|
+
})(WebHomeUtil || (WebHomeUtil = {}));
|
|
2
22
|
/** The rows of the double's home of every extension: one list, drawn again only when a source says it changed. */
|
|
3
23
|
export class WebHomeBoard {
|
|
4
24
|
constructor() {
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import type { TaGatewayLimits } from '@celljs/ta-protocol';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { type ContextMenuItem } from '../components/context-menu.js';
|
|
4
|
+
/** A value on the right of a row that opens its menu. */
|
|
5
|
+
export declare function ValueButton({ text, muted, busy, disabled, label, items, }: {
|
|
6
|
+
text: string;
|
|
7
|
+
muted?: boolean;
|
|
8
|
+
busy: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
label: string;
|
|
11
|
+
items(): ContextMenuItem[];
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
export declare function LimitRow({ label, hint, children }: {
|
|
14
|
+
label: string;
|
|
15
|
+
hint?: string;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}): React.JSX.Element;
|
|
3
18
|
export interface LimitsCardProps {
|
|
4
19
|
value: TaGatewayLimits;
|
|
5
20
|
/** Those of the gateway, for an account: what "default" is. */
|
|
@@ -21,7 +21,7 @@ const NUMBERS = [
|
|
|
21
21
|
{ key: 'connections', label: 'ta.console.connectionsMax', hint: 'ta.console.connectionsMaxHint', picks: [2, 5, 10], format: String },
|
|
22
22
|
];
|
|
23
23
|
/** A value on the right of a row that opens its menu. */
|
|
24
|
-
function ValueButton({ text, muted, busy, disabled, label, items, }) {
|
|
24
|
+
export function ValueButton({ text, muted, busy, disabled, label, items, }) {
|
|
25
25
|
const [menu, open] = useContextMenu();
|
|
26
26
|
if (disabled) {
|
|
27
27
|
return React.createElement("span", { className: `ta-console-value${muted ? ' ta-muted' : ''}` }, text);
|
|
@@ -32,7 +32,7 @@ function ValueButton({ text, muted, busy, disabled, label, items, }) {
|
|
|
32
32
|
busy ? React.createElement("span", { className: "ta-spinner ta-busy-mark", "aria-hidden": "true" }) : React.createElement(Icon, { icon: ChevronsUpDown, size: 14 })),
|
|
33
33
|
menu));
|
|
34
34
|
}
|
|
35
|
-
function LimitRow({ label, hint, children }) {
|
|
35
|
+
export function LimitRow({ label, hint, children }) {
|
|
36
36
|
return (React.createElement("div", { className: "ta-console-entry" },
|
|
37
37
|
React.createElement("div", { className: "ta-console-entry-text" },
|
|
38
38
|
React.createElement("span", { className: "ta-console-entry-label" }, label),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Gift, Pause, Play, Power, RotateCw, ShieldCheck, ShieldOff } from 'lucide-react';
|
|
1
|
+
import { ArrowUpCircle, Gift, Pause, Play, Power, RotateCw, ShieldCheck, ShieldOff, Undo2 } from 'lucide-react';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useBusy } from '../components/busy.js';
|
|
4
4
|
import { Callout } from '../components/callout.js';
|
|
@@ -50,6 +50,7 @@ export function TenantRow({ tenant, onOpen }) {
|
|
|
50
50
|
React.createElement("span", { className: "ta-console-entry-label ta-ellipsis" },
|
|
51
51
|
label,
|
|
52
52
|
React.createElement(RoleChip, { role: tenant.role }),
|
|
53
|
+
environment.latest && React.createElement("span", { className: "ta-console-chip" }, t('ta.console.updatable')),
|
|
53
54
|
quota.blocked && (React.createElement("span", { className: "ta-console-chip ta-console-chip-warn" }, t(quota.blocked === 'suspended' ? 'ta.console.suspended' : 'ta.console.outOfMinutes')))),
|
|
54
55
|
React.createElement("span", { className: "ta-console-entry-hint ta-ellipsis" }, label !== tenant.account ? `${tenant.account} · ${state}` : state)),
|
|
55
56
|
React.createElement("span", { className: "ta-console-side" },
|
|
@@ -61,6 +62,7 @@ export function TenantRow({ tenant, onOpen }) {
|
|
|
61
62
|
/** One account's Ta: who and where, what can be done to it, what it may use and took, its agents and its log. */
|
|
62
63
|
export function TenantDetail({ tenant, info, onChanged }) {
|
|
63
64
|
var _a;
|
|
65
|
+
var _b, _c;
|
|
64
66
|
const t = useT();
|
|
65
67
|
const language = useLanguage();
|
|
66
68
|
const [, bench] = useWorkbench();
|
|
@@ -91,6 +93,16 @@ export function TenantDetail({ tenant, info, onChanged }) {
|
|
|
91
93
|
if (environment.status !== 'running' && environment.status !== 'starting' && !tenant.quota.blocked) {
|
|
92
94
|
actions.push({ key: 'start', icon: Play, label: t('ta.console.start'), run: () => act('start', () => bench.gateway.startTenant(tenant.id)) });
|
|
93
95
|
}
|
|
96
|
+
if (environment.status === 'running' && environment.latest) {
|
|
97
|
+
const version = ConsoleUtil.version(environment.latest);
|
|
98
|
+
const working = (_b = (_a = tenant.agents) === null || _a === void 0 ? void 0 : _a.working) !== null && _b !== void 0 ? _b : 0;
|
|
99
|
+
actions.push({
|
|
100
|
+
key: 'update',
|
|
101
|
+
icon: ArrowUpCircle,
|
|
102
|
+
label: t('ta.console.update'),
|
|
103
|
+
run: () => void confirmThen('update', t('ta.console.updateConfirm', { account: name, version }), working > 0 ? `${t('ta.console.updateDetail')} ${t('ta.console.updateWorking', { count: working })}` : t('ta.console.updateDetail'), t('ta.console.update'), () => bench.gateway.updateTenant(tenant.id)),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
94
106
|
if (environment.status === 'running') {
|
|
95
107
|
actions.push({
|
|
96
108
|
key: 'restart',
|
|
@@ -121,6 +133,15 @@ export function TenantDetail({ tenant, info, onChanged }) {
|
|
|
121
133
|
},
|
|
122
134
|
});
|
|
123
135
|
}
|
|
136
|
+
if (environment.previous && !own) {
|
|
137
|
+
const version = ConsoleUtil.version(environment.previous);
|
|
138
|
+
rows.push({
|
|
139
|
+
key: 'rollback',
|
|
140
|
+
icon: Undo2,
|
|
141
|
+
label: t('ta.console.rollback', { version }),
|
|
142
|
+
run: () => void confirmThen('rollback', t('ta.console.rollbackConfirm', { account: name, version }), t('ta.console.rollbackDetail'), t('ta.console.rollback', { version }), () => bench.gateway.rollbackTenant(tenant.id)),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
124
145
|
if (info.role === 'owner' && tenant.role !== 'owner') {
|
|
125
146
|
const admin = tenant.role === 'admin';
|
|
126
147
|
rows.push({
|
|
@@ -163,7 +184,7 @@ export function TenantDetail({ tenant, info, onChanged }) {
|
|
|
163
184
|
React.createElement(Section, { title: t('ta.console.quota') },
|
|
164
185
|
React.createElement(QuotaMeters, { quota: tenant.quota })),
|
|
165
186
|
manage && tenant.role !== 'owner' && (React.createElement(Section, { title: t('ta.console.limits'), hint: t('ta.console.limitsHint') },
|
|
166
|
-
React.createElement(LimitsCard, { value: (
|
|
187
|
+
React.createElement(LimitsCard, { value: (_c = tenant.limits) !== null && _c !== void 0 ? _c : {}, defaults: info.policy.defaults, providers: info.providers, nullable: true, metered: info.models.length > 0, onSave: limits => bench.gateway
|
|
167
188
|
.setTenantLimits(tenant.id, Object.keys(limits).length ? limits : null)
|
|
168
189
|
.then(onChanged)
|
|
169
190
|
.catch(error => notices.error(error)) }))),
|
|
@@ -180,6 +201,16 @@ export function TenantDetail({ tenant, info, onChanged }) {
|
|
|
180
201
|
React.createElement(Section, { title: t('ta.console.about') },
|
|
181
202
|
React.createElement(Card, null, [
|
|
182
203
|
[t('ta.console.environment'), environment.url ? `${environment.name} · ${environment.url}` : environment.name],
|
|
204
|
+
...(environment.version
|
|
205
|
+
? [
|
|
206
|
+
[
|
|
207
|
+
t('ta.console.version'),
|
|
208
|
+
environment.latest
|
|
209
|
+
? ConsoleUtil.move(environment.version, environment.latest)
|
|
210
|
+
: ConsoleUtil.version(environment.version),
|
|
211
|
+
],
|
|
212
|
+
]
|
|
213
|
+
: []),
|
|
183
214
|
[t('ta.console.connectionsLabel'), String(tenant.connections)],
|
|
184
215
|
[t('ta.console.active'), date(tenant.lastActiveAt)],
|
|
185
216
|
[t('ta.console.created'), date(tenant.createdAt)],
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TaGatewayConsole } from '@celljs/ta-protocol';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/** How many running Ta may move to a newer version, to move them all; or how far a move of all went. */
|
|
4
|
+
export declare function UpdatesCallout({ info, onChanged }: {
|
|
5
|
+
info: TaGatewayConsole;
|
|
6
|
+
onChanged(): Promise<unknown>;
|
|
7
|
+
}): React.JSX.Element | null;
|
|
8
|
+
/** When running Ta move to a newer version, picked as a limit is; and a look for a newer one now. */
|
|
9
|
+
export declare function UpdatesSection({ info, onChanged }: {
|
|
10
|
+
info: TaGatewayConsole;
|
|
11
|
+
onChanged(): Promise<unknown>;
|
|
12
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { RefreshCw } from 'lucide-react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useBusy } from '../components/busy.js';
|
|
4
|
+
import { Callout } from '../components/callout.js';
|
|
5
|
+
import { Icon } from '../components/icon.js';
|
|
6
|
+
import { useNotices, useWorkbench } from '../hooks.js';
|
|
7
|
+
import { useT } from '../i18n/use-t.js';
|
|
8
|
+
import { LimitRow, ValueButton } from './console-limits.js';
|
|
9
|
+
import { Card, Section } from './console-parts.js';
|
|
10
|
+
import { ConsoleUtil } from './console-util.js';
|
|
11
|
+
/*
|
|
12
|
+
* Newer versions of Ta for the sandboxes (docs/design/ta-sandbox-update.md): on the overview, how many running Ta may
|
|
13
|
+
* move and a way to move them all, or how far that went; in the policy, when running ones move on their own.
|
|
14
|
+
*/
|
|
15
|
+
const MODES = [
|
|
16
|
+
{ value: 'idle', label: 'ta.console.updateIdle', hint: 'ta.console.updateIdleHint' },
|
|
17
|
+
{ value: 'manual', label: 'ta.console.updateManual', hint: 'ta.console.updateManualHint' },
|
|
18
|
+
];
|
|
19
|
+
/** How many running Ta may move to a newer version, to move them all; or how far a move of all went. */
|
|
20
|
+
export function UpdatesCallout({ info, onChanged }) {
|
|
21
|
+
const t = useT();
|
|
22
|
+
const [, bench] = useWorkbench();
|
|
23
|
+
const [, notices] = useNotices();
|
|
24
|
+
const [busy, run] = useBusy();
|
|
25
|
+
const behind = ConsoleUtil.behind(info);
|
|
26
|
+
if (info.updating) {
|
|
27
|
+
const { done, total } = info.updating;
|
|
28
|
+
return React.createElement(Callout, { level: "info" }, t('ta.console.updatingProgress', { done: Math.min(total, done + 1), total }));
|
|
29
|
+
}
|
|
30
|
+
if (behind.length === 0) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const version = ConsoleUtil.version(behind[0].environment.latest);
|
|
34
|
+
const updateAll = async () => {
|
|
35
|
+
const confirmed = await notices.confirm({
|
|
36
|
+
title: t('ta.console.updateAllConfirm', { count: behind.length, version }),
|
|
37
|
+
message: t('ta.console.updateAllDetail'),
|
|
38
|
+
confirmLabel: t('ta.console.updateAll'),
|
|
39
|
+
});
|
|
40
|
+
if (confirmed) {
|
|
41
|
+
await run(() => bench.gateway
|
|
42
|
+
.updateTenants()
|
|
43
|
+
.then(onChanged)
|
|
44
|
+
.catch(error => notices.error(error)));
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return (React.createElement(Callout, { level: "info", action: React.createElement("button", { type: "button", className: `ta-link-button${busy ? ' ta-busy' : ''}`, disabled: busy, onClick: () => void updateAll() }, t('ta.console.updateAll')) }, t('ta.console.updatesAvailable', { count: behind.length, version })));
|
|
48
|
+
}
|
|
49
|
+
/** When running Ta move to a newer version, picked as a limit is; and a look for a newer one now. */
|
|
50
|
+
export function UpdatesSection({ info, onChanged }) {
|
|
51
|
+
var _a;
|
|
52
|
+
const t = useT();
|
|
53
|
+
const [, bench] = useWorkbench();
|
|
54
|
+
const [, notices] = useNotices();
|
|
55
|
+
const [saving, save] = useBusy();
|
|
56
|
+
const [checking, check] = useBusy();
|
|
57
|
+
const mode = (_a = MODES.find(each => each.value === info.policy.updates)) !== null && _a !== void 0 ? _a : MODES[0];
|
|
58
|
+
const pick = (value) => void save(() => bench.gateway
|
|
59
|
+
.setUpdatePolicy(value)
|
|
60
|
+
.then(onChanged)
|
|
61
|
+
.catch(error => notices.error(error)));
|
|
62
|
+
const look = () => void check(() => bench.gateway
|
|
63
|
+
.checkUpdates()
|
|
64
|
+
.then(count => notices.notify(t('ta.console.checked', { count }), { level: 'success' }))
|
|
65
|
+
.then(onChanged)
|
|
66
|
+
.catch(error => notices.error(error)));
|
|
67
|
+
return (React.createElement(Section, { title: t('ta.console.updates'), hint: t('ta.console.updatesHint') },
|
|
68
|
+
React.createElement(Card, null,
|
|
69
|
+
React.createElement(LimitRow, { label: t('ta.console.updateMode'), hint: t(mode.hint) },
|
|
70
|
+
React.createElement(ValueButton, { text: t(mode.label), busy: saving, disabled: info.role !== 'owner', label: t('ta.console.updateMode'), items: () => MODES.map(each => ({ label: t(each.label), checked: each.value === mode.value, run: () => pick(each.value) })) })),
|
|
71
|
+
React.createElement("button", { type: "button", className: `ta-console-entry ta-console-press ta-console-command${checking ? ' ta-busy' : ''}`, disabled: checking, onClick: look },
|
|
72
|
+
React.createElement(Icon, { icon: RefreshCw, size: 16 }),
|
|
73
|
+
React.createElement("span", { className: "ta-console-entry-label" }, t('ta.console.checkUpdates')),
|
|
74
|
+
checking && React.createElement("span", { className: "ta-spinner ta-busy-mark", "aria-hidden": "true" })))));
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=console-updates.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TaGatewayConsole, TaGatewayTenant, TaQuotaState, TaUsageTrend } from '@celljs/ta-protocol';
|
|
1
|
+
import type { TaGatewayConsole, TaGatewayTenant, TaQuotaState, TaSandboxVersion, TaUsageTrend } from '@celljs/ta-protocol';
|
|
2
2
|
/** A bar of a trend: an hour or a day of the page's time zone. */
|
|
3
3
|
export interface TrendPoint {
|
|
4
4
|
/** Its start. */
|
|
@@ -33,6 +33,12 @@ export declare namespace ConsoleUtil {
|
|
|
33
33
|
working: number;
|
|
34
34
|
limited: number;
|
|
35
35
|
};
|
|
36
|
+
/** `4.18.0`, else the start of the id of its image. */
|
|
37
|
+
function version(value: TaSandboxVersion | undefined): string;
|
|
38
|
+
/** `4.17.0 → 4.18.0`; two builds of one version told apart by their revisions. */
|
|
39
|
+
function move(from: TaSandboxVersion | undefined, to: TaSandboxVersion | undefined): string;
|
|
40
|
+
/** The running Ta that may move to a newer version: those an update of all moves. */
|
|
41
|
+
function behind(info: TaGatewayConsole): TaGatewayTenant[];
|
|
36
42
|
/** 12.3k, 4.5M: as a person reads a count of tokens. */
|
|
37
43
|
function count(value: number): string;
|
|
38
44
|
/** $0.42, $12: what a model's prices made; none for nothing. */
|
|
@@ -70,6 +70,24 @@ export var ConsoleUtil;
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
ConsoleUtil.counts = counts;
|
|
73
|
+
/** `4.18.0`, else the start of the id of its image. */
|
|
74
|
+
function version(value) {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
return (_b = (_a = value === null || value === void 0 ? void 0 : value.version) !== null && _a !== void 0 ? _a : value === null || value === void 0 ? void 0 : value.id.replace(/^sha256:/, '').slice(0, 12)) !== null && _b !== void 0 ? _b : '';
|
|
77
|
+
}
|
|
78
|
+
ConsoleUtil.version = version;
|
|
79
|
+
/** `4.17.0 → 4.18.0`; two builds of one version told apart by their revisions. */
|
|
80
|
+
function move(from, to) {
|
|
81
|
+
const same = (from === null || from === void 0 ? void 0 : from.version) !== undefined && from.version === (to === null || to === void 0 ? void 0 : to.version);
|
|
82
|
+
const each = (value) => (same && (value === null || value === void 0 ? void 0 : value.revision) ? `${version(value)} (${value.revision})` : version(value));
|
|
83
|
+
return `${each(from)} → ${each(to)}`;
|
|
84
|
+
}
|
|
85
|
+
ConsoleUtil.move = move;
|
|
86
|
+
/** The running Ta that may move to a newer version: those an update of all moves. */
|
|
87
|
+
function behind(info) {
|
|
88
|
+
return info.tenants.filter(tenant => tenant.environment.latest && tenant.environment.status === 'running');
|
|
89
|
+
}
|
|
90
|
+
ConsoleUtil.behind = behind;
|
|
73
91
|
/** 12.3k, 4.5M: as a person reads a count of tokens. */
|
|
74
92
|
function count(value) {
|
|
75
93
|
if (value >= 1e9) {
|
|
@@ -15,6 +15,7 @@ import { LimitsCard } from './console-limits.js';
|
|
|
15
15
|
import { Card, REFRESH_MS, Section, Stats, usePolled } from './console-parts.js';
|
|
16
16
|
import { TenantDetail, TenantRow } from './console-tenant.js';
|
|
17
17
|
import { TrendCard } from './console-trend.js';
|
|
18
|
+
import { UpdatesCallout, UpdatesSection } from './console-updates.js';
|
|
18
19
|
import { ConsoleUtil } from './console-util.js';
|
|
19
20
|
const FILTERS = [
|
|
20
21
|
{ value: 'all', label: 'ta.console.filterAll' },
|
|
@@ -32,6 +33,10 @@ const ACTIONS = {
|
|
|
32
33
|
startTenant: 'ta.console.auditStart',
|
|
33
34
|
stopTenant: 'ta.console.auditStop',
|
|
34
35
|
restartTenant: 'ta.console.auditRestart',
|
|
36
|
+
updateTenant: 'ta.console.auditUpdate',
|
|
37
|
+
updateTenants: 'ta.console.auditUpdateAll',
|
|
38
|
+
rollbackTenant: 'ta.console.auditRollback',
|
|
39
|
+
setUpdatePolicy: 'ta.console.auditUpdatePolicy',
|
|
35
40
|
getTenantLogs: 'ta.console.auditLogs',
|
|
36
41
|
getAgentActivity: 'ta.console.auditActivity',
|
|
37
42
|
createSignInLink: 'ta.console.auditInvite',
|
|
@@ -78,7 +83,7 @@ function useInvite(info) {
|
|
|
78
83
|
t('ta.console.copy')))));
|
|
79
84
|
return [shown, start];
|
|
80
85
|
}
|
|
81
|
-
function Overview({ info, onTenant, onTab }) {
|
|
86
|
+
function Overview({ info, onTenant, onTab, onChanged, }) {
|
|
82
87
|
const t = useT();
|
|
83
88
|
const [, host] = useWebExtensions();
|
|
84
89
|
const counts = ConsoleUtil.counts(info);
|
|
@@ -100,6 +105,7 @@ function Overview({ info, onTenant, onTab }) {
|
|
|
100
105
|
{ value: counts.connections, label: t('ta.console.connectionsLabel') },
|
|
101
106
|
] }),
|
|
102
107
|
info.requests > 0 && (React.createElement(Callout, { level: "info", action: React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => host.openSettings('access') }, t('ta.console.review')) }, t('ta.console.requestsWaiting', { count: info.requests }))),
|
|
108
|
+
React.createElement(UpdatesCallout, { info: info, onChanged: onChanged }),
|
|
103
109
|
counts.limited > 0 && (React.createElement(Callout, { level: "warning", action: React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => onTab('accounts', 'limited') }, t('ta.console.view')) }, t('ta.console.limitedCount', { count: counts.limited }))),
|
|
104
110
|
React.createElement(Section, { title: t('ta.console.trend') },
|
|
105
111
|
React.createElement(TrendCard, { tenants: info.tenants, onTenant: onTenant })),
|
|
@@ -225,6 +231,7 @@ function Policy({ info, onChanged }) {
|
|
|
225
231
|
React.createElement("span", { className: "ta-console-entry-label ta-ellipsis" }, provider.name || provider.id),
|
|
226
232
|
React.createElement("span", { className: "ta-console-entry-hint" }, t('ta.console.modelsOf', { api: provider.api, count: provider.models }))))))))),
|
|
227
233
|
React.createElement(Egress, { info: info, onChanged: onChanged }),
|
|
234
|
+
React.createElement(UpdatesSection, { info: info, onChanged: onChanged }),
|
|
228
235
|
React.createElement(Section, { title: t('ta.console.managers'), hint: t('ta.console.managersHint') },
|
|
229
236
|
React.createElement(Card, null, info.policy.admins.map(admin => (React.createElement("div", { key: admin.account, className: "ta-console-entry" },
|
|
230
237
|
React.createElement("span", { className: "ta-console-tile" },
|
|
@@ -268,7 +275,7 @@ export function ConsolePage() {
|
|
|
268
275
|
{ value: 'accounts', label: 'ta.console.tabAccounts' },
|
|
269
276
|
{ value: 'policy', label: 'ta.console.tabPolicy' },
|
|
270
277
|
] }),
|
|
271
|
-
tab === 'overview' && React.createElement(Overview, { info: info, onTenant: open, onTab: goTo }),
|
|
278
|
+
tab === 'overview' && React.createElement(Overview, { info: info, onTenant: open, onTab: goTo, onChanged: read }),
|
|
272
279
|
tab === 'accounts' && React.createElement(Accounts, { info: info, onOpen: open, filter: filter, onFilter: setFilter }),
|
|
273
280
|
tab === 'policy' && React.createElement(Policy, { info: info, onChanged: read }),
|
|
274
281
|
React.createElement("p", { className: "ta-console-foot" }, [
|
package/esm/browser/hosts.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export declare namespace HostUtil {
|
|
|
14
14
|
function read(text: string | null | undefined): HostList;
|
|
15
15
|
/** `id` signed in to with `credential`, now in use: a new one goes last, one known keeps its place and name. */
|
|
16
16
|
function use(list: HostList, id: string, credential: Credential, now: number, server?: SavedHost['server']): HostList;
|
|
17
|
+
/**
|
|
18
|
+
* A computer of the account, kept without being used: a new one goes last, unused; one known gets the new way in and
|
|
19
|
+
* keeps its place, name and use.
|
|
20
|
+
*/
|
|
21
|
+
function keep(list: HostList, id: string, credential: Credential, account: string, now: number): HostList;
|
|
17
22
|
function select(list: HostList, id: string, now: number): HostList;
|
|
18
23
|
/** None in use, all kept: the sign-in shows them to pick from. */
|
|
19
24
|
function leave(list: HostList): HostList;
|
package/esm/browser/hosts.js
CHANGED
|
@@ -35,6 +35,7 @@ export var HostUtil;
|
|
|
35
35
|
credential,
|
|
36
36
|
name: typeof kept.name === 'string' && kept.name ? kept.name : undefined,
|
|
37
37
|
server,
|
|
38
|
+
...(typeof kept.account === 'string' && kept.account ? { account: kept.account } : {}),
|
|
38
39
|
addedAt: Number(kept.addedAt) || 0,
|
|
39
40
|
usedAt: Number(kept.usedAt) || 0,
|
|
40
41
|
};
|
|
@@ -61,6 +62,16 @@ export var HostUtil;
|
|
|
61
62
|
return { current: id, hosts: known ? list.hosts.map(one => (one === known ? next : one)) : [...list.hosts, next] };
|
|
62
63
|
}
|
|
63
64
|
HostUtil.use = use;
|
|
65
|
+
/**
|
|
66
|
+
* A computer of the account, kept without being used: a new one goes last, unused; one known gets the new way in and
|
|
67
|
+
* keeps its place, name and use.
|
|
68
|
+
*/
|
|
69
|
+
function keep(list, id, credential, account, now) {
|
|
70
|
+
const known = list.hosts.find(one => one.id === id);
|
|
71
|
+
const next = known ? { ...known, credential, account } : { id, credential, account, addedAt: now, usedAt: 0 };
|
|
72
|
+
return { ...list, hosts: known ? list.hosts.map(one => (one === known ? next : one)) : [...list.hosts, next] };
|
|
73
|
+
}
|
|
74
|
+
HostUtil.keep = keep;
|
|
64
75
|
function select(list, id, now) {
|
|
65
76
|
return list.hosts.some(one => one.id === id) ? { current: id, hosts: list.hosts.map(one => (one.id === id ? { ...one, usedAt: now } : one)) } : list;
|
|
66
77
|
}
|