@doreamonjs/page-detail 0.0.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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # `@doreamonjs/page-login`
2
+
3
+ > TODO: description
package/lib/index.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { PageProps } from '@doreamonjs/page-creator';
3
+ import { TabItem } from '@doreamonjs/components';
4
+ import { InformationItem } from '@doreamonjs/components/lib/Card/Information';
5
+ import './index.less';
6
+ export interface DetailPageProps extends PageProps {
7
+ column?: string;
8
+ infos: DInformationItem[][];
9
+ tabs?: DTabItem[];
10
+ }
11
+ export interface DInformationItem extends InformationItem {
12
+ rollout?: string;
13
+ type?: 'text' | 'datetime' | 'link' | '';
14
+ }
15
+ export interface DTabItem extends Omit<TabItem, 'render'> {
16
+ render(values: any, index: number, context: any): JSX.Element;
17
+ }
18
+ export declare const DetailPage: FunctionComponent<DetailPageProps>;
19
+ export default DetailPage;
package/lib/index.js ADDED
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DetailPage = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = tslib_1.__importDefault(require("react"));
6
+ const doreamon_1 = tslib_1.__importDefault(require("@zodash/doreamon"));
7
+ const components_1 = require("@doreamonjs/components");
8
+ const antd_1 = require("antd");
9
+ require("./index.less");
10
+ const componentName = 'doreamonjs-design-page-detail';
11
+ const DetailPage = (props) => {
12
+ var _a, _b, _c, _d, _e;
13
+ const values = (_b = (_a = props === null || props === void 0 ? void 0 : props.datasets) === null || _a === void 0 ? void 0 : _a.values) !== null && _b !== void 0 ? _b : {};
14
+ const title = (_d = (_c = values === null || values === void 0 ? void 0 : values.title) !== null && _c !== void 0 ? _c : values === null || values === void 0 ? void 0 : values.name) !== null && _d !== void 0 ? _d : '-';
15
+ const details = [
16
+ [
17
+ { key: 'id', label: '环境 ID' },
18
+ { key: 'version', label: 'Version' },
19
+ ],
20
+ [{ key: 'owner.nickname', label: '负责人' }],
21
+ [
22
+ { key: 'publish_url', label: '发布地址' },
23
+ {
24
+ key: 'visit_url',
25
+ label: '访问地址',
26
+ value: v => (react_1.default.createElement("a", { href: v, target: "_blank" }, v)),
27
+ },
28
+ ],
29
+ [
30
+ {
31
+ key: 'is_cloud_native',
32
+ label: '云原生',
33
+ value: (_, vs) => (!vs.is_host ? '是' : '否'),
34
+ },
35
+ ],
36
+ !values.is_host && [
37
+ {
38
+ key: 'instance_name',
39
+ label: '云原生实例',
40
+ value: v => (react_1.default.createElement("a", { href: `https://k8s.idp.thinkingdata.cn/#/service/te/${v}?namespace=te`, target: "_blank" }, v)),
41
+ },
42
+ ],
43
+ !values.is_host && [
44
+ { key: 'image_name', label: '镜像名称' },
45
+ { key: 'image_tag', label: '镜像标签' },
46
+ ],
47
+ !values.is_host && [{ key: 'snap_name', label: '快照' }],
48
+ [
49
+ {
50
+ key: 'description',
51
+ label: '描述',
52
+ value: v => react_1.default.createElement("pre", null, v !== null && v !== void 0 ? v : '-'),
53
+ },
54
+ ],
55
+ [
56
+ {
57
+ key: 'created_at',
58
+ label: '创建时间',
59
+ value: v => doreamon_1.default.date(v).format('YYYY-MM-DD HH:mm:ss'),
60
+ },
61
+ {
62
+ key: 'updated_at',
63
+ label: '更新时间',
64
+ value: v => doreamon_1.default.date(v).format('YYYY-MM-DD HH:mm:ss'),
65
+ },
66
+ ],
67
+ ];
68
+ const defaultTab = 'tasks';
69
+ const tabs = props.tabs.map((tab, index) => {
70
+ return {
71
+ ...tab,
72
+ render: !tab.render ? undefined : () => {
73
+ return tab.render(values, index, props);
74
+ },
75
+ };
76
+ });
77
+ if (+((_e = doreamon_1.default.dom.router.getQuery()) === null || _e === void 0 ? void 0 : _e.id) !== (values === null || values === void 0 ? void 0 : values.id)) {
78
+ return (react_1.default.createElement("div", { style: {
79
+ width: '100%',
80
+ height: '500px',
81
+ backgroundColor: '#fff',
82
+ padding: '10px 20px',
83
+ } },
84
+ react_1.default.createElement(antd_1.Skeleton, { paragraph: { rows: 10 } })));
85
+ }
86
+ return (react_1.default.createElement("div", { className: doreamon_1.default.classnames('page', componentName, props.className) },
87
+ react_1.default.createElement(components_1.Card.Information, { title: title, actions: props.attributes.actions, allowActionTypes: ['custom'], column: 2, items: details, data: values, onActionClick: (action, values) => {
88
+ props.onActionTrigger(action, {
89
+ values,
90
+ });
91
+ } }),
92
+ react_1.default.createElement(components_1.Tab, { className: 'tab', items: tabs, defaultValue: defaultTab })));
93
+ };
94
+ exports.DetailPage = DetailPage;
95
+ exports.default = exports.DetailPage;
96
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;AAAA,0DAA4D;AAC5D,wEAAwC;AAGxC,uDAA4D;AAE5D,+BAAgC;AAEhC,wBAAsB;AAGtB,MAAM,aAAa,GAAG,+BAA+B,CAAC;AAoB/C,MAAM,UAAU,GAAuC,CAAC,KAAK,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,0CAAE,MAAM,mCAAI,EAAE,CAAC;IAE7C,MAAM,KAAK,GAAG,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,mCAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,mCAAI,GAAG,CAAC;IAEnD,MAAM,OAAO,GAAG;QACd;YACE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;YAC7B,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;SACrC;QACD,CAAC,EAAE,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QACzC;YACE,EAAE,GAAG,EAAE,aAAa,EAAE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gB,EAAE,CAAC,QAAQ,CAAC,EAC5B,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,CAAC,MAAW,EAAE,MAAW,EAAE,EAAE;gBAC1C,KAAK,CAAC,eAAgB,CAAC,MAAM,EAAE;oBAC7B,MAAM;iBACP,CAAC,CAAC;YACL,CAAC,GACD;QACF,8BAAC,gBAAG,IACF,SAAS,EAAC,KAAK,EACf,KAAK,EAAE,IAAI,EACX,YAAY,EAAE,UAAU,GACxB,CACE,CACP,CAAC;AACJ,CAAC,CAAC;AArHW,QAAA,UAAU,cAqHrB;AAEF,kBAAe,kBAAU,CAAC"}
package/lib/index.less ADDED
@@ -0,0 +1,17 @@
1
+ @pageDetailPrefixCls: doreamonjs-design-page-detail;
2
+
3
+ .@{pageDetailPrefixCls}.page {
4
+ background-color: #fff;
5
+ padding: 10px 20px;
6
+
7
+ .tab {
8
+ min-height: 400px;
9
+ }
10
+
11
+ :global {
12
+ .ant-descriptions-item-container {
13
+ display: flex;
14
+ // align-items: center;
15
+ }
16
+ }
17
+ }
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "@doreamonjs/page-detail",
3
+ "version": "0.0.0",
4
+ "description": "detail page",
5
+ "keywords": [
6
+ "doreamonjs",
7
+ "page",
8
+ "detail"
9
+ ],
10
+ "author": "whatwewant <tobewhatwewant@gmail.com>",
11
+ "homepage": "https://github.com/doreamonjs/doreamon#readme",
12
+ "license": "MIT",
13
+ "main": "lib/index.js",
14
+ "typings": "lib/index.d.ts",
15
+ "directories": {
16
+ "lib": "lib"
17
+ },
18
+ "files": [
19
+ "lib"
20
+ ],
21
+ "jest": {
22
+ "roots": [
23
+ "__tests__"
24
+ ],
25
+ "transform": {
26
+ "^.+\\.tsx?$": "ts-jest"
27
+ },
28
+ "testRegex": ".*\\.(spec|test)\\.(ts|tsx)$",
29
+ "moduleDirectories": [
30
+ "node_modules",
31
+ "src"
32
+ ],
33
+ "moduleFileExtensions": [
34
+ "ts",
35
+ "tsx",
36
+ "js",
37
+ "jsx"
38
+ ],
39
+ "coverageDirectory": "./coverage/",
40
+ "collectCoverage": true,
41
+ "collectCoverageFrom": [
42
+ "src/**/*.{ts,tsx}"
43
+ ],
44
+ "coverageThreshold": {
45
+ "global": {
46
+ "branches": 60,
47
+ "functions": 60,
48
+ "lines": 60,
49
+ "statements": -10
50
+ }
51
+ }
52
+ },
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/doreamonjs/doreamon.git"
59
+ },
60
+ "scripts": {
61
+ "build": "tsc && npm run copy",
62
+ "test": "jest -w 1",
63
+ "coverage": "codecov",
64
+ "copy": "node scripts/copy.js"
65
+ },
66
+ "bugs": {
67
+ "url": "https://github.com/doreamonjs/doreamon/issues"
68
+ },
69
+ "devDependencies": {
70
+ "@types/react": "16.14.23",
71
+ "@znode/fs": "^1.0.2"
72
+ },
73
+ "dependencies": {
74
+ "@doreamonjs/components": "^1.10.21",
75
+ "@doreamonjs/page-creator": "^1.10.21",
76
+ "@zodash/doreamon": "^1.1.5",
77
+ "antd": "4.18.9",
78
+ "react-monaco-editor": "^0.50.1",
79
+ "react-router-dom": "5.1.2",
80
+ "xterm": "^4.19.0",
81
+ "xterm-addon-attach": "^0.6.0",
82
+ "xterm-addon-fit": "^0.5.0"
83
+ }
84
+ }