File tree Expand file tree Collapse file tree 3 files changed +72
-1
lines changed
packages/studio-website/src Expand file tree Collapse file tree 3 files changed +72
-1
lines changed Original file line number Diff line number Diff line change 1+ import * as React from 'react' ;
2+ import { getSupportFeature , type SupportFeature } from '../../layouts/services' ;
3+ interface IGrootCaseProps {
4+ children : React . ReactNode ;
5+ match : SupportFeature ;
6+ }
7+
8+ const FeatureCase : React . FunctionComponent < IGrootCaseProps > = props => {
9+ const { children, match } = props ;
10+ const feature = getSupportFeature ( ) ;
11+ const support = feature [ match ] ;
12+ return (
13+ < div
14+ style = { {
15+ display : support ? 'display' : 'none' ,
16+ } }
17+ >
18+ { children }
19+ </ div >
20+ ) ;
21+ } ;
22+
23+ export default FeatureCase ;
Original file line number Diff line number Diff line change @@ -8,6 +8,51 @@ import {
88
99import { notification } from '../pages/utils' ;
1010
11+ export type SupportFeature =
12+ /** 是否支持多图 */
13+ | 'MULTIPLE_GRAPHS'
14+ /** 是否支持批量创建图模型 */
15+ | 'BATCH_CREATE_SCHEMA'
16+ /** schema是否支持更新修改 */
17+ | 'SCHEMA_UPDATE'
18+ /** 是否支持CSV导图 */
19+ | 'LOAD_CSV_DATA'
20+ /** 是否支持查询多版本 */
21+ | 'QUERY_MULTIPLE_VERSIONS' ;
22+
23+ type Features = {
24+ [ K in SupportFeature ] : boolean ;
25+ } ;
26+
27+ export const getSupportFeature = ( ) : Features => {
28+ if ( window . GS_ENGINE_TYPE === 'groot' ) {
29+ return {
30+ BATCH_CREATE_SCHEMA : false ,
31+ LOAD_CSV_DATA : false ,
32+ MULTIPLE_GRAPHS : false ,
33+ QUERY_MULTIPLE_VERSIONS : false ,
34+ SCHEMA_UPDATE : true ,
35+ } ;
36+ }
37+ if ( window . GS_ENGINE_TYPE === 'gart' ) {
38+ return {
39+ BATCH_CREATE_SCHEMA : true ,
40+ LOAD_CSV_DATA : false ,
41+ MULTIPLE_GRAPHS : false ,
42+ QUERY_MULTIPLE_VERSIONS : true ,
43+ SCHEMA_UPDATE : false ,
44+ } ;
45+ }
46+ //interactive
47+ return {
48+ BATCH_CREATE_SCHEMA : true ,
49+ LOAD_CSV_DATA : true ,
50+ MULTIPLE_GRAPHS : true ,
51+ QUERY_MULTIPLE_VERSIONS : false ,
52+ SCHEMA_UPDATE : false ,
53+ } ;
54+ } ;
55+
1156export const listGraphs = async ( ) => {
1257 const status = await ServiceApiFactory ( undefined , location . origin )
1358 . listServiceStatus ( )
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import Section from '../../components/section';
55import { PlusOutlined } from '@ant-design/icons' ;
66import { FormattedMessage } from 'react-intl' ;
77import CreateInstance from './create' ;
8+ import FeatureCase from '../../components/feature-case' ;
89const Instance : React . FunctionComponent = ( ) => {
910 return (
1011 < Section
@@ -16,7 +17,9 @@ const Instance: React.FunctionComponent = () => {
1617 style = { { padding : '0px 20px' } }
1718 >
1819 < Flex align = "end" justify = "flex-start" style = { { padding : '16px 0px' } } >
19- < CreateInstance />
20+ < FeatureCase match = "MULTIPLE_GRAPHS" >
21+ < CreateInstance />
22+ </ FeatureCase >
2023 </ Flex >
2124 < InstanceLists />
2225 </ Section >
You can’t perform that action at this time.
0 commit comments