@datalayer/core 1.0.12 → 1.0.13
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.
|
@@ -7,4 +7,17 @@
|
|
|
7
7
|
* .zip ZIP archive application/zip
|
|
8
8
|
*/
|
|
9
9
|
export declare const downloadFile: (data: any, filename: string, mime?: any, bom?: any) => void;
|
|
10
|
+
export type TextDownloadPayload = {
|
|
11
|
+
content: string;
|
|
12
|
+
filename: string;
|
|
13
|
+
mime: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Create a generic markdown text payload for file downloads.
|
|
17
|
+
*/
|
|
18
|
+
export declare const createMarkdownDownloadPayload: (content: string, fileStem: string) => TextDownloadPayload;
|
|
19
|
+
/**
|
|
20
|
+
* Download a text payload produced by a helper such as createMarkdownDownloadPayload.
|
|
21
|
+
*/
|
|
22
|
+
export declare const downloadTextPayload: (payload: TextDownloadPayload, withBom?: boolean) => void;
|
|
10
23
|
export default downloadFile;
|
|
@@ -35,4 +35,24 @@ export const downloadFile = (data, filename, mime, bom) => {
|
|
|
35
35
|
window.URL.revokeObjectURL(blobURL);
|
|
36
36
|
}, 200);
|
|
37
37
|
};
|
|
38
|
+
const sanitizeFileStem = (value) => value
|
|
39
|
+
.trim()
|
|
40
|
+
.replace(/\s+/g, '-')
|
|
41
|
+
.replace(/[^a-zA-Z0-9-_]/g, '-')
|
|
42
|
+
.replace(/-+/g, '-')
|
|
43
|
+
.replace(/^-+|-+$/g, '') || 'download';
|
|
44
|
+
/**
|
|
45
|
+
* Create a generic markdown text payload for file downloads.
|
|
46
|
+
*/
|
|
47
|
+
export const createMarkdownDownloadPayload = (content, fileStem) => ({
|
|
48
|
+
content,
|
|
49
|
+
filename: `${sanitizeFileStem(fileStem)}.md`,
|
|
50
|
+
mime: 'text/markdown;charset=utf-8',
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Download a text payload produced by a helper such as createMarkdownDownloadPayload.
|
|
54
|
+
*/
|
|
55
|
+
export const downloadTextPayload = (payload, withBom = true) => {
|
|
56
|
+
downloadFile(payload.content, payload.filename, payload.mime, withBom ? '\uFEFF' : undefined);
|
|
57
|
+
};
|
|
38
58
|
export default downloadFile;
|
|
@@ -12,12 +12,19 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
12
12
|
*
|
|
13
13
|
* @module views/signin
|
|
14
14
|
*/
|
|
15
|
-
import { useState, useCallback, useRef } from 'react';
|
|
15
|
+
import { useState, useCallback, useRef, useMemo } from 'react';
|
|
16
16
|
import { Box, Button, FormControl, Heading, Text, Textarea, TextInput, } from '@primer/react';
|
|
17
17
|
import { Dialog } from '@primer/react/experimental';
|
|
18
18
|
import { EyeIcon, EyeClosedIcon, KeyIcon, TelescopeIcon, } from '@primer/octicons-react';
|
|
19
|
+
import { coreStore } from '../../state';
|
|
19
20
|
// ── Component ────────────────────────────────────────────────────────
|
|
20
|
-
export const SignInSimple = ({ onSignIn, onApiKeySignIn, loginUrl
|
|
21
|
+
export const SignInSimple = ({ onSignIn, onApiKeySignIn, loginUrl: loginUrlProp, title = 'Datalayer OTEL', description = 'Sign in to access the observability dashboard.', leadingIcon = _jsx(TelescopeIcon, { size: 24 }), }) => {
|
|
22
|
+
const loginUrl = useMemo(() => {
|
|
23
|
+
if (loginUrlProp)
|
|
24
|
+
return loginUrlProp;
|
|
25
|
+
const iamRunUrl = coreStore.getState().configuration?.iamRunUrl;
|
|
26
|
+
return iamRunUrl ? `${iamRunUrl}/api/iam/v1/login` : '/api/iam/v1/login';
|
|
27
|
+
}, [loginUrlProp]);
|
|
21
28
|
const [handle, setHandle] = useState('');
|
|
22
29
|
const [password, setPassword] = useState('');
|
|
23
30
|
const [showPassword, setShowPassword] = useState(false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
105
|
"@datalayer/icons-react": "^1.0.6",
|
|
106
|
-
"@datalayer/jupyter-lexical": "^1.0.
|
|
107
|
-
"@datalayer/jupyter-react": "^2.0.
|
|
108
|
-
"@datalayer/primer-addons": "^1.0.
|
|
106
|
+
"@datalayer/jupyter-lexical": "^1.0.16",
|
|
107
|
+
"@datalayer/jupyter-react": "^2.0.7",
|
|
108
|
+
"@datalayer/primer-addons": "^1.0.12",
|
|
109
109
|
"@datalayer/primer-rjsf": "^1.0.1",
|
|
110
110
|
"@fluentui/react": "^8.125.3",
|
|
111
111
|
"@jupyter-widgets/base-manager": "^1.0.12",
|