@ytsaurus/ui 1.21.0 → 1.22.1
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/README.md +25 -8
- package/build/cjs/@types/core.d.ts +1 -1
- package/build/cjs/server/ServerFactory.d.ts +3 -0
- package/build/cjs/server/ServerFactory.js +3 -0
- package/build/cjs/server/ServerFactory.js.map +1 -1
- package/build/cjs/server/controllers/availability.js +36 -18
- package/build/cjs/server/controllers/availability.js.map +1 -1
- package/build/cjs/server/controllers/odin-proxy-api.js +3 -4
- package/build/cjs/server/controllers/odin-proxy-api.js.map +1 -1
- package/build/cjs/server/index.js +5 -0
- package/build/cjs/server/index.js.map +1 -1
- package/build/cjs/server/middlewares/check-configuration.d.ts +3 -0
- package/build/cjs/server/middlewares/check-configuration.js +28 -0
- package/build/cjs/server/middlewares/check-configuration.js.map +1 -0
- package/build/cjs/ui/pages/odin/_actions/odin-overview.js +1 -1
- package/build/cjs/ui/pages/odin/_actions/odin-overview.js.map +1 -1
- package/build/cjs/ui/pages/odin/controls/OdinToolbar.js +2 -1
- package/build/cjs/ui/pages/odin/controls/OdinToolbar.js.map +1 -1
- package/build/cjs/ui/pages/odin/odin-utils.d.ts +1 -1
- package/build/cjs/ui/pages/odin/odin-utils.js +2 -2
- package/build/cjs/ui/pages/odin/odin-utils.js.map +1 -1
- package/build/esm/@types/core.d.ts +1 -1
- package/build/esm/server/ServerFactory.d.ts +3 -0
- package/build/esm/server/ServerFactory.js +4 -0
- package/build/esm/server/ServerFactory.js.map +1 -1
- package/build/esm/server/controllers/availability.js +43 -23
- package/build/esm/server/controllers/availability.js.map +1 -1
- package/build/esm/server/controllers/odin-proxy-api.js +9 -10
- package/build/esm/server/controllers/odin-proxy-api.js.map +1 -1
- package/build/esm/server/index.js +5 -0
- package/build/esm/server/index.js.map +1 -1
- package/build/esm/server/middlewares/check-configuration.d.ts +3 -0
- package/build/esm/server/middlewares/check-configuration.js +20 -0
- package/build/esm/server/middlewares/check-configuration.js.map +1 -0
- package/build/esm/ui/pages/odin/_actions/odin-overview.js +1 -1
- package/build/esm/ui/pages/odin/_actions/odin-overview.js.map +1 -1
- package/build/esm/ui/pages/odin/controls/OdinToolbar.js +3 -2
- package/build/esm/ui/pages/odin/controls/OdinToolbar.js.map +1 -1
- package/build/esm/ui/pages/odin/odin-utils.d.ts +1 -1
- package/build/esm/ui/pages/odin/odin-utils.js +2 -2
- package/build/esm/ui/pages/odin/odin-utils.js.map +1 -1
- package/dist/public/build/assets-manifest.json +4 -4
- package/dist/public/build/js/main.724df837.js +3 -0
- package/dist/public/build/js/{main.53d3bdc5.js.map → main.724df837.js.map} +1 -1
- package/dist/public/build/manifest.json +2 -2
- package/dist/server/ServerFactory.d.ts +3 -0
- package/dist/server/ServerFactory.js +3 -0
- package/dist/server/controllers/availability.js +36 -18
- package/dist/server/controllers/odin-proxy-api.js +3 -4
- package/dist/server/index.js +5 -0
- package/dist/server/middlewares/check-configuration.d.ts +3 -0
- package/dist/server/middlewares/check-configuration.js +28 -0
- package/package.json +2 -2
- package/dist/public/build/js/main.53d3bdc5.js +0 -3
- /package/dist/public/build/js/{main.53d3bdc5.js.LICENSE.txt → main.724df837.js.LICENSE.txt} +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"main.css": "css/main.77009ada.css",
|
3
|
-
"main.js": "js/main.
|
3
|
+
"main.js": "js/main.724df837.js",
|
4
4
|
"runtime.js": "js/runtime.22e88c00.js",
|
5
5
|
"css/861.c5a67589.chunk.css": "css/861.c5a67589.chunk.css",
|
6
6
|
"js/861.a0939319.chunk.js": "js/861.a0939319.chunk.js",
|
@@ -52,7 +52,7 @@
|
|
52
52
|
"assets/images/ui.jpg": "assets/images/ui.bab31938.jpg",
|
53
53
|
"assets/images/cluster-2x.svg": "assets/images/cluster-2x.e53788d6.svg",
|
54
54
|
"main.77009ada.css.map": "css/main.77009ada.css.map",
|
55
|
-
"main.
|
55
|
+
"main.724df837.js.map": "js/main.724df837.js.map",
|
56
56
|
"runtime.22e88c00.js.map": "js/runtime.22e88c00.js.map",
|
57
57
|
"861.c5a67589.chunk.css.map": "css/861.c5a67589.chunk.css.map",
|
58
58
|
"861.a0939319.chunk.js.map": "js/861.a0939319.chunk.js.map",
|
@@ -8,6 +8,9 @@ export interface ServerFactory {
|
|
8
8
|
renderLayout(params: AppLayoutConfig, req: Request, res: Response): Promise<string>;
|
9
9
|
}
|
10
10
|
export declare function rememberApp(v: ExpressKit): void;
|
11
|
+
/**
|
12
|
+
* @deprecated use req.ctx.config instead of App().config
|
13
|
+
*/
|
11
14
|
export declare function getApp(): ExpressKit;
|
12
15
|
export declare function configureServerFactory(overrides: Partial<ServerFactory>): void;
|
13
16
|
declare const _default: ServerFactory;
|
@@ -8,7 +8,6 @@ const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
9
9
|
const utils_1 = require("../components/utils");
|
10
10
|
const utils_2 = require("../utils");
|
11
|
-
const ServerFactory_1 = require("../ServerFactory");
|
12
11
|
function getClusterAvailability(clusterConfig, odinPath) {
|
13
12
|
const ODIN_PERIOD = 5;
|
14
13
|
const ODIN_METRIC = 'master';
|
@@ -28,38 +27,57 @@ function getClusterAvailability(clusterConfig, odinPath) {
|
|
28
27
|
return response.data;
|
29
28
|
});
|
30
29
|
}
|
31
|
-
function getAvailability(req, clusters
|
32
|
-
const
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
function getAvailability(req, clusters) {
|
31
|
+
const odinBaseUrl = req.ctx.config.odinBaseUrl;
|
32
|
+
const isMultiOdinBaseUrl = 'string' !== typeof odinBaseUrl;
|
33
|
+
const makeOdinIsAliveUrl = (odinBaseUrl) => `${odinBaseUrl}/is_alive`;
|
34
|
+
const commonIsAlive = isMultiOdinBaseUrl
|
35
|
+
? Promise.resolve({ data: true })
|
36
|
+
: axios_1.default.request({ url: makeOdinIsAliveUrl(odinBaseUrl) });
|
37
|
+
return commonIsAlive
|
38
|
+
.then(({ data: commonAlive }) => {
|
39
|
+
if (!commonAlive) {
|
37
40
|
return [];
|
38
41
|
}
|
39
42
|
return Promise.all(lodash_1.default.map(clusters, (clusterConfig) => {
|
40
|
-
const
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
const odinPath = isMultiOdinBaseUrl
|
44
|
+
? odinBaseUrl === null || odinBaseUrl === void 0 ? void 0 : odinBaseUrl[clusterConfig.id]
|
45
|
+
: odinBaseUrl;
|
46
|
+
if (!odinPath) {
|
47
|
+
return {};
|
48
|
+
}
|
49
|
+
const alive = isMultiOdinBaseUrl
|
50
|
+
? axios_1.default.get(makeOdinIsAliveUrl(odinPath)).catch((e) => {
|
51
|
+
req.ctx.logError(`Error of getting ${odinPath}`, e);
|
52
|
+
return { data: false };
|
53
|
+
})
|
54
|
+
: Promise.resolve({ data: true });
|
55
|
+
return alive.then(({ data }) => {
|
56
|
+
if (data != true) {
|
57
|
+
return {};
|
58
|
+
}
|
59
|
+
return getClusterAvailability(clusterConfig, odinPath)
|
60
|
+
.then((availability) => ({ id: clusterConfig.id, availability }))
|
61
|
+
.catch((error) => {
|
62
|
+
req.ctx.logError('getAvailability error', error);
|
63
|
+
return {};
|
64
|
+
});
|
46
65
|
});
|
47
66
|
}));
|
48
67
|
})
|
49
68
|
.catch((e) => {
|
50
|
-
req.ctx.logError(`Error of getting ${
|
69
|
+
req.ctx.logError(`Error of getting ${odinBaseUrl}`, e);
|
51
70
|
return [];
|
52
71
|
});
|
53
72
|
}
|
54
73
|
async function getClustersAvailability(req, res) {
|
55
|
-
|
56
|
-
|
57
|
-
if (!odinPath) {
|
74
|
+
const odinBaseUrl = req.ctx.config.odinBaseUrl;
|
75
|
+
if (!odinBaseUrl) {
|
58
76
|
(0, utils_2.sendAndLogError)(req.ctx, res, 500, new Error('odin base url is not configured'));
|
59
77
|
return;
|
60
78
|
}
|
61
79
|
const clusters = (0, utils_1.getClustersFromConfig)();
|
62
|
-
await getAvailability(req, clusters
|
80
|
+
await getAvailability(req, clusters)
|
63
81
|
.then((data) => (0, utils_2.sendResponse)(res, data))
|
64
82
|
.catch((error) => (0, utils_2.sendError)(res, error));
|
65
83
|
}
|
@@ -8,7 +8,6 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const axios_1 = __importDefault(require("axios"));
|
9
9
|
const qs_1 = __importDefault(require("qs"));
|
10
10
|
const utils_1 = require("../utils");
|
11
|
-
const ServerFactory_1 = require("../ServerFactory");
|
12
11
|
async function odinProxyApi(req, res) {
|
13
12
|
try {
|
14
13
|
await odinProxyApiImpl(req, res);
|
@@ -23,14 +22,14 @@ async function odinProxyApi(req, res) {
|
|
23
22
|
}
|
24
23
|
exports.odinProxyApi = odinProxyApi;
|
25
24
|
async function odinProxyApiImpl(req, res) {
|
26
|
-
|
27
|
-
const
|
25
|
+
const { action, ytAuthCluster: cluster } = req.params;
|
26
|
+
const { odinBaseUrl } = req.ctx.config;
|
27
|
+
const odinPath = typeof odinBaseUrl === 'string' ? odinBaseUrl : odinBaseUrl === null || odinBaseUrl === void 0 ? void 0 : odinBaseUrl[cluster];
|
28
28
|
if (!odinPath) {
|
29
29
|
return (0, utils_1.sendAndLogError)(req.ctx, res, 500, new Error('Odin base url is not configured'));
|
30
30
|
}
|
31
31
|
const { ctx, query } = req;
|
32
32
|
const search = lodash_1.default.isEmpty(query) ? '' : `?${qs_1.default.stringify(query)}`;
|
33
|
-
const { action, ytAuthCluster: cluster } = req.params;
|
34
33
|
const allowedActionsUrls = {
|
35
34
|
service_list: `${odinPath}/service_list`,
|
36
35
|
exists: `${odinPath}/${action}/${cluster}`,
|
package/dist/server/index.js
CHANGED
@@ -13,6 +13,7 @@ const routes_1 = __importDefault(require("./routes"));
|
|
13
13
|
const oauth_1 = require("./middlewares/oauth");
|
14
14
|
const authorization_1 = require("./middlewares/authorization");
|
15
15
|
const authorization_2 = require("./utils/authorization");
|
16
|
+
const check_configuration_1 = require("./middlewares/check-configuration");
|
16
17
|
const nodekit = new nodekit_1.NodeKit({ configsPath: path_1.default.resolve(__dirname, './configs') });
|
17
18
|
const { appName, appEnv, appInstallation, appDevMode } = nodekit.config;
|
18
19
|
nodekit.ctx.log('AppConfig details', {
|
@@ -37,6 +38,10 @@ if (authMiddlewares.length) {
|
|
37
38
|
nodekit.config.appAuthHandler = (0, authorization_1.createAuthMiddleware)();
|
38
39
|
}
|
39
40
|
(_b = (_a = nodekit.config).adjustAppConfig) === null || _b === void 0 ? void 0 : _b.call(_a, nodekit);
|
41
|
+
const configurationErrors = (0, check_configuration_1.createConfigurationErrorsMidleware)(nodekit.config);
|
42
|
+
if (configurationErrors) {
|
43
|
+
nodekit.config.appBeforeAuthMiddleware = [configurationErrors];
|
44
|
+
}
|
40
45
|
const app = new expresskit_1.ExpressKit(nodekit, routes_1.default);
|
41
46
|
(0, configure_app_1.configureApp)(app);
|
42
47
|
if (require.main === module) {
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createConfigurationErrorsMidleware = void 0;
|
4
|
+
function checkConfigurationMiddleware(errors) {
|
5
|
+
return function checkConfiguration(_req, res) {
|
6
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
7
|
+
const body = `Please fix the problems below:<br>
|
8
|
+
<ol>
|
9
|
+
${errors.map((i) => `<li>${i}</li>`).join('\n')}
|
10
|
+
</ol>
|
11
|
+
Please refer to the <a target='_blank' href='https://github.com/ytsaurus/ytsaurus-ui/tree/main/packages/ui#migration'>migration notices<a/> for more details.
|
12
|
+
`;
|
13
|
+
res.status(500).end(body);
|
14
|
+
};
|
15
|
+
}
|
16
|
+
function createConfigurationErrorsMidleware(config) {
|
17
|
+
const configurationErrors = [];
|
18
|
+
if (process.env.YT_AUTH_CLUSTER_ID) {
|
19
|
+
configurationErrors.push('The YT_AUTH_CLUSTER_ID environment variable is no longer supported, please replace it with ALLOW_PASSWORD_AUTH');
|
20
|
+
}
|
21
|
+
if ('ytAuthCluster' in config) {
|
22
|
+
configurationErrors.push('The config setting `config.ytAuthCluster` is no longer supported, please replace it with `config.allowPasswordAuth` or use ALLOW_PASSWORD_AUTH environment variable');
|
23
|
+
}
|
24
|
+
return configurationErrors.length > 0
|
25
|
+
? checkConfigurationMiddleware([...configurationErrors])
|
26
|
+
: undefined;
|
27
|
+
}
|
28
|
+
exports.createConfigurationErrorsMidleware = createConfigurationErrorsMidleware;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ytsaurus/ui",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.22.1",
|
4
4
|
"repository": {
|
5
5
|
"type": "github",
|
6
6
|
"url": "https://github.com/YTsaurus/ytsaurus-ui/tree/main/packages/ui"
|
@@ -186,7 +186,7 @@
|
|
186
186
|
"engines": {
|
187
187
|
"node": ">=18"
|
188
188
|
},
|
189
|
-
"gitHead": "
|
189
|
+
"gitHead": "0b406a4e7f0d5f7def958b64b92c278b6afa57eb",
|
190
190
|
"overrides": {
|
191
191
|
"react-split-pane": {
|
192
192
|
"react": "$react",
|