@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
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.PicturePicker = void 0;
|
|
37
|
+
exports.PictureDialog = PictureDialog;
|
|
38
|
+
const lucide_react_1 = require("lucide-react");
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
const hooks_1 = require("../hooks");
|
|
41
|
+
const use_t_1 = require("../i18n/use-t");
|
|
42
|
+
const picture_1 = require("../util/picture");
|
|
43
|
+
const face_1 = require("./face");
|
|
44
|
+
const face_pictures_1 = require("./face-pictures");
|
|
45
|
+
const icon_1 = require("./icon");
|
|
46
|
+
const side_lists_1 = require("./side-lists");
|
|
47
|
+
const web_dialog_1 = require("./web-dialog");
|
|
48
|
+
/**
|
|
49
|
+
* Whether the dialog of the user's picture is open: Me and the menu of the account open it, DinoLookHost (dino-look.tsx)
|
|
50
|
+
* shows it. Apart from it, so that what opens it needs no React.
|
|
51
|
+
*/
|
|
52
|
+
var PicturePicker;
|
|
53
|
+
(function (PicturePicker) {
|
|
54
|
+
const listeners = new Set();
|
|
55
|
+
let shown = false;
|
|
56
|
+
function open() {
|
|
57
|
+
set(true);
|
|
58
|
+
}
|
|
59
|
+
PicturePicker.open = open;
|
|
60
|
+
function close() {
|
|
61
|
+
set(false);
|
|
62
|
+
}
|
|
63
|
+
PicturePicker.close = close;
|
|
64
|
+
function isOpen() {
|
|
65
|
+
return shown;
|
|
66
|
+
}
|
|
67
|
+
PicturePicker.isOpen = isOpen;
|
|
68
|
+
function subscribe(listener) {
|
|
69
|
+
listeners.add(listener);
|
|
70
|
+
return () => listeners.delete(listener);
|
|
71
|
+
}
|
|
72
|
+
PicturePicker.subscribe = subscribe;
|
|
73
|
+
function set(open) {
|
|
74
|
+
shown = open;
|
|
75
|
+
for (const listener of listeners) {
|
|
76
|
+
listener();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
})(PicturePicker || (exports.PicturePicker = PicturePicker = {}));
|
|
80
|
+
/**
|
|
81
|
+
* The picture others see of the user in group chats and among friends (TaRoomServer.setPicture), the double staying the
|
|
82
|
+
* dinosaur: a photo picked or taken, one the double draws as the user describes it, or the dinosaur again.
|
|
83
|
+
*/
|
|
84
|
+
function PictureDialog({ onClose }) {
|
|
85
|
+
const t = (0, use_t_1.useT)();
|
|
86
|
+
const [, workbench] = (0, hooks_1.useWorkbench)();
|
|
87
|
+
const [extensions, host] = (0, hooks_1.useWebExtensions)();
|
|
88
|
+
const [, notices] = (0, hooks_1.useNotices)();
|
|
89
|
+
const pictures = React.useContext(face_pictures_1.FacePictures);
|
|
90
|
+
const mine = !!pictures.pictures[pictures.self];
|
|
91
|
+
const input = React.useRef(null);
|
|
92
|
+
const [busy, setBusy] = React.useState(false);
|
|
93
|
+
const [drawing, setDrawing] = React.useState();
|
|
94
|
+
const set = async (picture) => {
|
|
95
|
+
setBusy(true);
|
|
96
|
+
try {
|
|
97
|
+
await workbench.rooms.setPicture(picture);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
notices.error(error);
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
setBusy(false);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const picked = async (file) => {
|
|
107
|
+
const picture = await picture_1.PictureUtil.square(file).catch(() => undefined);
|
|
108
|
+
if (picture) {
|
|
109
|
+
await set(picture);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
notices.error(new Error(t('ta.picture.tooLarge')));
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const draw = async () => {
|
|
116
|
+
const what = drawing === null || drawing === void 0 ? void 0 : drawing.trim();
|
|
117
|
+
const double = extensions.views.find(view => view.id === side_lists_1.DOUBLE_PAGE);
|
|
118
|
+
if (!what || !(double === null || double === void 0 ? void 0 : double.send)) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
onClose();
|
|
122
|
+
host.showPage(side_lists_1.DOUBLE_PAGE);
|
|
123
|
+
await double.send(t('ta.picture.drawPrompt', { what })).catch(error => notices.error(error));
|
|
124
|
+
};
|
|
125
|
+
return (React.createElement(web_dialog_1.WebDialog, { title: t('ta.picture.title'), onClose: onClose },
|
|
126
|
+
React.createElement("div", { className: "ta-picture" },
|
|
127
|
+
React.createElement(face_1.Face, { double: true, size: 96 }),
|
|
128
|
+
React.createElement("p", { className: "ta-picture-hint" }, t('ta.picture.hint')),
|
|
129
|
+
drawing === undefined ? (React.createElement("div", { className: "ta-picture-actions" },
|
|
130
|
+
React.createElement("button", { type: "button", className: "ta-button ta-primary ta-wide", disabled: busy, onClick: () => { var _a; return (_a = input.current) === null || _a === void 0 ? void 0 : _a.click(); } },
|
|
131
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.ImagePlus, size: 16 }),
|
|
132
|
+
t('ta.picture.choose')),
|
|
133
|
+
React.createElement("button", { type: "button", className: "ta-button ta-wide", disabled: busy, onClick: () => setDrawing('') },
|
|
134
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.Sparkles, size: 16 }),
|
|
135
|
+
t('ta.picture.draw')),
|
|
136
|
+
mine && (React.createElement("button", { type: "button", className: "ta-button ta-wide", disabled: busy, onClick: () => void set(null) },
|
|
137
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.RotateCcw, size: 16 }),
|
|
138
|
+
t('ta.picture.reset'))))) : (React.createElement("form", { className: "ta-picture-actions", onSubmit: event => {
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
void draw();
|
|
141
|
+
} },
|
|
142
|
+
React.createElement("input", { className: "ta-input", value: drawing, placeholder: t('ta.picture.drawPlaceholder'), autoFocus: true, onChange: event => setDrawing(event.target.value) }),
|
|
143
|
+
React.createElement("button", { type: "submit", className: "ta-button ta-primary ta-wide", disabled: !drawing.trim() }, t('ta.picture.drawSend')))),
|
|
144
|
+
React.createElement("input", { ref: input, type: "file", accept: "image/*", hidden: true, onChange: event => {
|
|
145
|
+
var _a;
|
|
146
|
+
const file = (_a = event.currentTarget.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
147
|
+
event.currentTarget.value = '';
|
|
148
|
+
if (file) {
|
|
149
|
+
void picked(file);
|
|
150
|
+
}
|
|
151
|
+
} }))));
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=picture-dialog.js.map
|
|
@@ -42,6 +42,7 @@ const hooks_1 = require("../hooks");
|
|
|
42
42
|
const use_t_1 = require("../i18n/use-t");
|
|
43
43
|
const style_1 = require("../style");
|
|
44
44
|
const workbench_util_1 = require("../workbench-util");
|
|
45
|
+
const account_view_1 = require("./account-view");
|
|
45
46
|
const cloud_sign_in_view_1 = require("./cloud-sign-in-view");
|
|
46
47
|
const dino_1 = require("./dino");
|
|
47
48
|
const host_view_1 = require("./host-view");
|
|
@@ -90,7 +91,8 @@ function useDocument() {
|
|
|
90
91
|
function SignIn(props) {
|
|
91
92
|
return (React.createElement(React.Fragment, null,
|
|
92
93
|
React.createElement(SignInPage, { ...props }),
|
|
93
|
-
React.createElement(scan_screen_1.ScanReader, null)
|
|
94
|
+
React.createElement(scan_screen_1.ScanReader, null),
|
|
95
|
+
React.createElement(account_view_1.AccountAsk, null)));
|
|
94
96
|
}
|
|
95
97
|
function SignInPage({ error }) {
|
|
96
98
|
const t = (0, use_t_1.useT)();
|
|
@@ -124,6 +126,7 @@ function SignInPage({ error }) {
|
|
|
124
126
|
React.createElement("p", null, t('ta.cloud.builtInHint')),
|
|
125
127
|
React.createElement(cloud_sign_in_view_1.BuiltInSignIn, { known: company, onPick: provider => setCloud({ provider }), onOther: () => setCloud({ typing: true }) }),
|
|
126
128
|
React.createElement("div", { className: "ta-sign-in-or" }, t('ta.cloud.orComputer')),
|
|
129
|
+
app && React.createElement(account_view_1.AccountSignInEntry, null),
|
|
127
130
|
React.createElement(host_view_1.AddHostPanel, { error: error === 'refused' ? (app ? 'ta.signin.pairRefused' : 'ta.signin.refused') : undefined }))));
|
|
128
131
|
}
|
|
129
132
|
return (React.createElement("div", { className: "ta-signin" },
|
|
@@ -141,6 +144,7 @@ function SignInPage({ error }) {
|
|
|
141
144
|
: 'ta.signin.hint')),
|
|
142
145
|
!accounts && React.createElement(sign_in_picture_1.ConnectPicture, { way: way }),
|
|
143
146
|
React.createElement(sign_in_accounts_1.SignInAccounts, { providers: providers, outcome: outcome }),
|
|
147
|
+
app && React.createElement(account_view_1.AccountSignInEntry, null),
|
|
144
148
|
React.createElement(host_view_1.AddHostPanel, { error: error === 'refused' ? (app ? 'ta.signin.pairRefused' : 'ta.signin.refused') : undefined }, !accounts && React.createElement(cloud_sign_in_view_1.CloudSignInEntry, { onPick: () => setCloud({}) })))));
|
|
145
149
|
}
|
|
146
150
|
//# sourceMappingURL=workbench-view.js.map
|
|
@@ -137,6 +137,7 @@ exports.WEB_ICONS = Object.freeze({
|
|
|
137
137
|
Share2: lucide_react_1.Share2,
|
|
138
138
|
Shield: lucide_react_1.Shield,
|
|
139
139
|
ShieldCheck: lucide_react_1.ShieldCheck,
|
|
140
|
+
SlidersHorizontal: lucide_react_1.SlidersHorizontal,
|
|
140
141
|
Smartphone: lucide_react_1.Smartphone,
|
|
141
142
|
Sparkles: lucide_react_1.Sparkles,
|
|
142
143
|
Square: lucide_react_1.Square,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WebHomeEntry } from './web-api-contributions';
|
|
2
|
+
/** What the page offers of the rows of the double's home (registerHomeItems), for a list of an extension to show them as its own do. */
|
|
3
|
+
export interface WebHomeUI {
|
|
4
|
+
/** A React hook: the rows extensions add to the double's home (registerHomeItems), in the order they loaded. */
|
|
5
|
+
useHomeItems(): readonly WebHomeEntry[];
|
|
6
|
+
/**
|
|
7
|
+
* Opens a row as the double's list does: the page it shows is that row's while it is in front (useHomeShown), as a
|
|
8
|
+
* conversation shown is the list's. Newer than some Ta apps: `pi.ui.openHome?.(…)`.
|
|
9
|
+
*/
|
|
10
|
+
openHome(entry: WebHomeEntry): Promise<void>;
|
|
11
|
+
/** A React hook: the key of the row whose page is in front (openHome), to show it selected. Newer than some Ta apps. */
|
|
12
|
+
useHomeShown(): string | undefined;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=web-api-home.d.ts.map
|
|
@@ -7,8 +7,9 @@ import type { Game3DProps } from '../game/game3d-protocol';
|
|
|
7
7
|
import type { ScreenPartSpec, TaScreen } from '../screen/screen-protocol';
|
|
8
8
|
import type { Language, Theme } from '../settings/settings-protocol';
|
|
9
9
|
import type { CodeEditorProps, DiffEditorProps, WebComposerProps, WebConversationViewProps, WebDialogProps, WebEmptyProps, WebFaceProps, WebFolderPickerProps, WebFullScreenProps, WebGroupFaceProps, WebHoldToTalkProps, WebImageViewerProps, WebLoadingProps, WebModelPickerProps, WebPictureCardsProps, WebPictureProps, WebSelectBarProps, WebSelectCheckProps, WebShareSheetProps, WebStackProps, WebSwipeRowProps, WebSwitchProps, WebTaskIconProps, WebVoice } from './web-api-components';
|
|
10
|
-
import type { WebAsk, WebCallPartner, WebChatIconSource, WebCodeRendererOptions, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor,
|
|
10
|
+
import type { WebAsk, WebCallPartner, WebChatIconSource, WebCodeRendererOptions, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebOpenerOptions, WebRoomAddon, WebRoomAddonEntry, WebSearchSource, WebSessionMenu, WebSessionNotice, WebSettingsSection, WebShareTarget, WebTaskEntry, WebTaskRemoval, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebViewInfo, WidgetOptions } from './web-api-contributions';
|
|
11
11
|
import type { WebDesktop, WebFileDrag } from './web-api-desktop';
|
|
12
|
+
import type { WebHomeUI } from './web-api-home';
|
|
12
13
|
import type { WebServices } from './web-api-services';
|
|
13
14
|
import type { WebTerminal, WebTerminalOptions } from './web-api-terminal';
|
|
14
15
|
import type { WebPageInfo } from './web-pages';
|
|
@@ -21,6 +22,7 @@ export type { Language, Theme } from '../settings/settings-protocol';
|
|
|
21
22
|
export type * from './web-api-components';
|
|
22
23
|
export type * from './web-api-contributions';
|
|
23
24
|
export type * from './web-api-desktop';
|
|
25
|
+
export type * from './web-api-home';
|
|
24
26
|
export type * from './web-api-services';
|
|
25
27
|
export type * from './web-api-terminal';
|
|
26
28
|
export type { WebPageInfo, WebPageState } from './web-pages';
|
|
@@ -228,7 +230,7 @@ export interface WebNotifyOptions {
|
|
|
228
230
|
export type { ScreenAction, ScreenItem, ScreenPartSpec, ScreenPartView, ScreenPlace, ScreenScrollable, ScreenScrollTo } from '../screen/screen-protocol';
|
|
229
231
|
/** What web extensions see of TaScreen. */
|
|
230
232
|
export type WebScreen = Pick<TaScreen, 'agent' | 'parts' | 'act' | 'element' | 'where' | 'places' | 'go' | 'pageScroll' | 'scroll'>;
|
|
231
|
-
export interface WebExtensionUI {
|
|
233
|
+
export interface WebExtensionUI extends WebHomeUI {
|
|
232
234
|
/** A widget around the message box, as pi's, or a card in the workbench on the right; `undefined` removes it. */
|
|
233
235
|
setWidget(key: string, widget: React.ComponentType | undefined, options?: WidgetOptions): void;
|
|
234
236
|
/**
|
|
@@ -243,8 +245,6 @@ export interface WebExtensionUI {
|
|
|
243
245
|
* them, silent for `done`; without one, a banner that waits for the user's return when it asks or failed.
|
|
244
246
|
*/
|
|
245
247
|
notifySession(notice: WebSessionNotice): void;
|
|
246
|
-
/** A React hook: the rows extensions add to the double's home (registerHomeItems), in the order they loaded. */
|
|
247
|
-
useHomeItems(): readonly WebHomeEntry[];
|
|
248
248
|
/**
|
|
249
249
|
* The double's list is that of the conversations, its tasks and the rows of its home in it (docs/design/ta-partners.md):
|
|
250
250
|
* a sidebar view lists the rest (agents, channels, rooms), not the double. Undefined in Ta apps of before, where a
|
|
@@ -82,6 +82,7 @@ const voice_1 = require("../util/voice");
|
|
|
82
82
|
const icons_1 = require("./icons");
|
|
83
83
|
const web_extension_protocol_1 = require("./web-extension-protocol");
|
|
84
84
|
const web_extension_run_1 = require("./web-extension-run");
|
|
85
|
+
const web_home_1 = require("./web-home");
|
|
85
86
|
const web_pages_1 = require("./web-pages");
|
|
86
87
|
const web_tasks_1 = require("./web-tasks");
|
|
87
88
|
const FILE_DRAG = Object.freeze({ set: file_drag_1.FileDragUtil.set, has: file_drag_1.FileDragUtil.has, get: file_drag_1.FileDragUtil.get, paths: file_drag_1.FileDragUtil.paths });
|
|
@@ -428,7 +429,7 @@ class WebExtensionContext {
|
|
|
428
429
|
},
|
|
429
430
|
forgetPage: id => !run.stopped && host.extensions.forgetPage(id),
|
|
430
431
|
useTasks: () => React.useSyncExternalStore(host.extensions.tasks.subscribe, host.extensions.tasks.tasks, host.extensions.tasks.tasks),
|
|
431
|
-
|
|
432
|
+
...web_home_1.WebHomeUtil.ui(host.extensions, () => run.stopped),
|
|
432
433
|
doubleInChats: true,
|
|
433
434
|
useRoomAddons: () => {
|
|
434
435
|
const read = () => host.extensions.state.roomAddons;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
import type { WebHomeUI } from './web-api-home';
|
|
1
2
|
import type { WebHomeEntry, WebHomeItem, WebHomeSource } from './web-extension-api';
|
|
3
|
+
import type { TaWebExtensions, WebExtensionsState } from './web-extension-protocol';
|
|
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,7 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebHomeBoard = void 0;
|
|
36
|
+
exports.WebHomeBoard = exports.WebHomeUtil = void 0;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
4
38
|
const launcher_search_util_1 = require("../components/launcher-search-util");
|
|
39
|
+
var WebHomeUtil;
|
|
40
|
+
(function (WebHomeUtil) {
|
|
41
|
+
/** The key of the row of the double's home whose page is in front (TaWebExtensions.openHome), as the lists select it. */
|
|
42
|
+
function shown(state) {
|
|
43
|
+
return state.page && !state.pageHidden ? state.pageFrom : undefined;
|
|
44
|
+
}
|
|
45
|
+
WebHomeUtil.shown = shown;
|
|
46
|
+
/** The rows of the home for an extension's lists (WebHomeUI); opening none once it stopped. */
|
|
47
|
+
function ui(extensions, stopped) {
|
|
48
|
+
const subscribe = (listener) => extensions.subscribe(listener);
|
|
49
|
+
const read = () => shown(extensions.state);
|
|
50
|
+
return {
|
|
51
|
+
useHomeItems: () => React.useSyncExternalStore(extensions.home.subscribe, extensions.home.items, extensions.home.items),
|
|
52
|
+
openHome: entry => (stopped() ? Promise.resolve() : extensions.openHome(entry)),
|
|
53
|
+
useHomeShown: () => React.useSyncExternalStore(subscribe, read, read),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
WebHomeUtil.ui = ui;
|
|
57
|
+
})(WebHomeUtil || (exports.WebHomeUtil = WebHomeUtil = {}));
|
|
5
58
|
/** The rows of the double's home of every extension: one list, drawn again only when a source says it changed. */
|
|
6
59
|
class WebHomeBoard {
|
|
7
60
|
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';
|
|
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. */
|
|
@@ -33,6 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ValueButton = ValueButton;
|
|
37
|
+
exports.LimitRow = LimitRow;
|
|
36
38
|
exports.LimitsCard = LimitsCard;
|
|
37
39
|
const lucide_react_1 = require("lucide-react");
|
|
38
40
|
const React = __importStar(require("react"));
|
|
@@ -90,6 +90,7 @@ function TenantRow({ tenant, onOpen }) {
|
|
|
90
90
|
React.createElement("span", { className: "ta-console-entry-label ta-ellipsis" },
|
|
91
91
|
label,
|
|
92
92
|
React.createElement(RoleChip, { role: tenant.role }),
|
|
93
|
+
environment.latest && React.createElement("span", { className: "ta-console-chip" }, t('ta.console.updatable')),
|
|
93
94
|
quota.blocked && (React.createElement("span", { className: "ta-console-chip ta-console-chip-warn" }, t(quota.blocked === 'suspended' ? 'ta.console.suspended' : 'ta.console.outOfMinutes')))),
|
|
94
95
|
React.createElement("span", { className: "ta-console-entry-hint ta-ellipsis" }, label !== tenant.account ? `${tenant.account} · ${state}` : state)),
|
|
95
96
|
React.createElement("span", { className: "ta-console-side" },
|
|
@@ -101,6 +102,7 @@ function TenantRow({ tenant, onOpen }) {
|
|
|
101
102
|
/** One account's Ta: who and where, what can be done to it, what it may use and took, its agents and its log. */
|
|
102
103
|
function TenantDetail({ tenant, info, onChanged }) {
|
|
103
104
|
var _a;
|
|
105
|
+
var _b, _c;
|
|
104
106
|
const t = (0, use_t_1.useT)();
|
|
105
107
|
const language = (0, use_t_1.useLanguage)();
|
|
106
108
|
const [, bench] = (0, hooks_1.useWorkbench)();
|
|
@@ -131,6 +133,16 @@ function TenantDetail({ tenant, info, onChanged }) {
|
|
|
131
133
|
if (environment.status !== 'running' && environment.status !== 'starting' && !tenant.quota.blocked) {
|
|
132
134
|
actions.push({ key: 'start', icon: lucide_react_1.Play, label: t('ta.console.start'), run: () => act('start', () => bench.gateway.startTenant(tenant.id)) });
|
|
133
135
|
}
|
|
136
|
+
if (environment.status === 'running' && environment.latest) {
|
|
137
|
+
const version = console_util_1.ConsoleUtil.version(environment.latest);
|
|
138
|
+
const working = (_b = (_a = tenant.agents) === null || _a === void 0 ? void 0 : _a.working) !== null && _b !== void 0 ? _b : 0;
|
|
139
|
+
actions.push({
|
|
140
|
+
key: 'update',
|
|
141
|
+
icon: lucide_react_1.ArrowUpCircle,
|
|
142
|
+
label: t('ta.console.update'),
|
|
143
|
+
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)),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
134
146
|
if (environment.status === 'running') {
|
|
135
147
|
actions.push({
|
|
136
148
|
key: 'restart',
|
|
@@ -161,6 +173,15 @@ function TenantDetail({ tenant, info, onChanged }) {
|
|
|
161
173
|
},
|
|
162
174
|
});
|
|
163
175
|
}
|
|
176
|
+
if (environment.previous && !own) {
|
|
177
|
+
const version = console_util_1.ConsoleUtil.version(environment.previous);
|
|
178
|
+
rows.push({
|
|
179
|
+
key: 'rollback',
|
|
180
|
+
icon: lucide_react_1.Undo2,
|
|
181
|
+
label: t('ta.console.rollback', { version }),
|
|
182
|
+
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)),
|
|
183
|
+
});
|
|
184
|
+
}
|
|
164
185
|
if (info.role === 'owner' && tenant.role !== 'owner') {
|
|
165
186
|
const admin = tenant.role === 'admin';
|
|
166
187
|
rows.push({
|
|
@@ -203,7 +224,7 @@ function TenantDetail({ tenant, info, onChanged }) {
|
|
|
203
224
|
React.createElement(console_parts_1.Section, { title: t('ta.console.quota') },
|
|
204
225
|
React.createElement(console_parts_1.QuotaMeters, { quota: tenant.quota })),
|
|
205
226
|
manage && tenant.role !== 'owner' && (React.createElement(console_parts_1.Section, { title: t('ta.console.limits'), hint: t('ta.console.limitsHint') },
|
|
206
|
-
React.createElement(console_limits_1.LimitsCard, { value: (
|
|
227
|
+
React.createElement(console_limits_1.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
|
|
207
228
|
.setTenantLimits(tenant.id, Object.keys(limits).length ? limits : null)
|
|
208
229
|
.then(onChanged)
|
|
209
230
|
.catch(error => notices.error(error)) }))),
|
|
@@ -220,6 +241,16 @@ function TenantDetail({ tenant, info, onChanged }) {
|
|
|
220
241
|
React.createElement(console_parts_1.Section, { title: t('ta.console.about') },
|
|
221
242
|
React.createElement(console_parts_1.Card, null, [
|
|
222
243
|
[t('ta.console.environment'), environment.url ? `${environment.name} · ${environment.url}` : environment.name],
|
|
244
|
+
...(environment.version
|
|
245
|
+
? [
|
|
246
|
+
[
|
|
247
|
+
t('ta.console.version'),
|
|
248
|
+
environment.latest
|
|
249
|
+
? console_util_1.ConsoleUtil.move(environment.version, environment.latest)
|
|
250
|
+
: console_util_1.ConsoleUtil.version(environment.version),
|
|
251
|
+
],
|
|
252
|
+
]
|
|
253
|
+
: []),
|
|
223
254
|
[t('ta.console.connectionsLabel'), String(tenant.connections)],
|
|
224
255
|
[t('ta.console.active'), date(tenant.lastActiveAt)],
|
|
225
256
|
[t('ta.console.created'), date(tenant.createdAt)],
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
13
|
+
//# sourceMappingURL=console-updates.d.ts.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.UpdatesCallout = UpdatesCallout;
|
|
37
|
+
exports.UpdatesSection = UpdatesSection;
|
|
38
|
+
const lucide_react_1 = require("lucide-react");
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
const busy_1 = require("../components/busy");
|
|
41
|
+
const callout_1 = require("../components/callout");
|
|
42
|
+
const icon_1 = require("../components/icon");
|
|
43
|
+
const hooks_1 = require("../hooks");
|
|
44
|
+
const use_t_1 = require("../i18n/use-t");
|
|
45
|
+
const console_limits_1 = require("./console-limits");
|
|
46
|
+
const console_parts_1 = require("./console-parts");
|
|
47
|
+
const console_util_1 = require("./console-util");
|
|
48
|
+
/*
|
|
49
|
+
* Newer versions of Ta for the sandboxes (docs/design/ta-sandbox-update.md): on the overview, how many running Ta may
|
|
50
|
+
* move and a way to move them all, or how far that went; in the policy, when running ones move on their own.
|
|
51
|
+
*/
|
|
52
|
+
const MODES = [
|
|
53
|
+
{ value: 'idle', label: 'ta.console.updateIdle', hint: 'ta.console.updateIdleHint' },
|
|
54
|
+
{ value: 'manual', label: 'ta.console.updateManual', hint: 'ta.console.updateManualHint' },
|
|
55
|
+
];
|
|
56
|
+
/** How many running Ta may move to a newer version, to move them all; or how far a move of all went. */
|
|
57
|
+
function UpdatesCallout({ info, onChanged }) {
|
|
58
|
+
const t = (0, use_t_1.useT)();
|
|
59
|
+
const [, bench] = (0, hooks_1.useWorkbench)();
|
|
60
|
+
const [, notices] = (0, hooks_1.useNotices)();
|
|
61
|
+
const [busy, run] = (0, busy_1.useBusy)();
|
|
62
|
+
const behind = console_util_1.ConsoleUtil.behind(info);
|
|
63
|
+
if (info.updating) {
|
|
64
|
+
const { done, total } = info.updating;
|
|
65
|
+
return React.createElement(callout_1.Callout, { level: "info" }, t('ta.console.updatingProgress', { done: Math.min(total, done + 1), total }));
|
|
66
|
+
}
|
|
67
|
+
if (behind.length === 0) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const version = console_util_1.ConsoleUtil.version(behind[0].environment.latest);
|
|
71
|
+
const updateAll = async () => {
|
|
72
|
+
const confirmed = await notices.confirm({
|
|
73
|
+
title: t('ta.console.updateAllConfirm', { count: behind.length, version }),
|
|
74
|
+
message: t('ta.console.updateAllDetail'),
|
|
75
|
+
confirmLabel: t('ta.console.updateAll'),
|
|
76
|
+
});
|
|
77
|
+
if (confirmed) {
|
|
78
|
+
await run(() => bench.gateway
|
|
79
|
+
.updateTenants()
|
|
80
|
+
.then(onChanged)
|
|
81
|
+
.catch(error => notices.error(error)));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return (React.createElement(callout_1.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 })));
|
|
85
|
+
}
|
|
86
|
+
/** When running Ta move to a newer version, picked as a limit is; and a look for a newer one now. */
|
|
87
|
+
function UpdatesSection({ info, onChanged }) {
|
|
88
|
+
var _a;
|
|
89
|
+
const t = (0, use_t_1.useT)();
|
|
90
|
+
const [, bench] = (0, hooks_1.useWorkbench)();
|
|
91
|
+
const [, notices] = (0, hooks_1.useNotices)();
|
|
92
|
+
const [saving, save] = (0, busy_1.useBusy)();
|
|
93
|
+
const [checking, check] = (0, busy_1.useBusy)();
|
|
94
|
+
const mode = (_a = MODES.find(each => each.value === info.policy.updates)) !== null && _a !== void 0 ? _a : MODES[0];
|
|
95
|
+
const pick = (value) => void save(() => bench.gateway
|
|
96
|
+
.setUpdatePolicy(value)
|
|
97
|
+
.then(onChanged)
|
|
98
|
+
.catch(error => notices.error(error)));
|
|
99
|
+
const look = () => void check(() => bench.gateway
|
|
100
|
+
.checkUpdates()
|
|
101
|
+
.then(count => notices.notify(t('ta.console.checked', { count }), { level: 'success' }))
|
|
102
|
+
.then(onChanged)
|
|
103
|
+
.catch(error => notices.error(error)));
|
|
104
|
+
return (React.createElement(console_parts_1.Section, { title: t('ta.console.updates'), hint: t('ta.console.updatesHint') },
|
|
105
|
+
React.createElement(console_parts_1.Card, null,
|
|
106
|
+
React.createElement(console_limits_1.LimitRow, { label: t('ta.console.updateMode'), hint: t(mode.hint) },
|
|
107
|
+
React.createElement(console_limits_1.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) })) })),
|
|
108
|
+
React.createElement("button", { type: "button", className: `ta-console-entry ta-console-press ta-console-command${checking ? ' ta-busy' : ''}`, disabled: checking, onClick: look },
|
|
109
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.RefreshCw, size: 16 }),
|
|
110
|
+
React.createElement("span", { className: "ta-console-entry-label" }, t('ta.console.checkUpdates')),
|
|
111
|
+
checking && React.createElement("span", { className: "ta-spinner ta-busy-mark", "aria-hidden": "true" })))));
|
|
112
|
+
}
|
|
113
|
+
//# 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. */
|
|
@@ -73,6 +73,24 @@ var ConsoleUtil;
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
ConsoleUtil.counts = counts;
|
|
76
|
+
/** `4.18.0`, else the start of the id of its image. */
|
|
77
|
+
function version(value) {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
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 : '';
|
|
80
|
+
}
|
|
81
|
+
ConsoleUtil.version = version;
|
|
82
|
+
/** `4.17.0 → 4.18.0`; two builds of one version told apart by their revisions. */
|
|
83
|
+
function move(from, to) {
|
|
84
|
+
const same = (from === null || from === void 0 ? void 0 : from.version) !== undefined && from.version === (to === null || to === void 0 ? void 0 : to.version);
|
|
85
|
+
const each = (value) => (same && (value === null || value === void 0 ? void 0 : value.revision) ? `${version(value)} (${value.revision})` : version(value));
|
|
86
|
+
return `${each(from)} → ${each(to)}`;
|
|
87
|
+
}
|
|
88
|
+
ConsoleUtil.move = move;
|
|
89
|
+
/** The running Ta that may move to a newer version: those an update of all moves. */
|
|
90
|
+
function behind(info) {
|
|
91
|
+
return info.tenants.filter(tenant => tenant.environment.latest && tenant.environment.status === 'running');
|
|
92
|
+
}
|
|
93
|
+
ConsoleUtil.behind = behind;
|
|
76
94
|
/** 12.3k, 4.5M: as a person reads a count of tokens. */
|
|
77
95
|
function count(value) {
|
|
78
96
|
if (value >= 1e9) {
|