-
Notifications
You must be signed in to change notification settings - Fork 20
/
entry_page.jsx
66 lines (61 loc) · 2.12 KB
/
entry_page.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import React from 'react';
import layout from '@splunk/react-page';
import { SplunkThemeProvider } from '@splunk/themes';
import { defaultTheme } from '@splunk/splunk-utils/themes';
import { StyledContainer } from './EntryPageStyle';
import ConfigManager from '../util/configManager';
import InputPage from './Input/InputPage';
import ConfigurationPage from './Configuration/ConfigurationPage';
import { InputRowContextProvider } from '../context/InputRowContext';
const defaultThemeSplunkThemeProviderMap = {
enterprise: {
family: 'enterprise',
colorScheme: 'light',
density: 'comfortable',
},
enterpriseDark: {
family: 'enterprise',
colorScheme: 'dark',
density: 'comfortable',
},
lite: {
family: 'enterprise',
colorScheme: 'light',
density: 'comfortable',
},
};
const themeProviderSettings =
defaultThemeSplunkThemeProviderMap[defaultTheme()] ||
defaultThemeSplunkThemeProviderMap.enterprise;
const url = window.location.pathname;
const urlParts = url.substring(1).split('/');
const page = urlParts[urlParts.length - 1];
if (page === 'inputs') {
layout(
<InputRowContextProvider value={null}>
<SplunkThemeProvider {...themeProviderSettings}>
<StyledContainer>
<ConfigManager>
{({ loading, appData }) => {
return !loading && appData && <InputPage isInput serviceName="" />
}}
</ConfigManager>
</StyledContainer>
</SplunkThemeProvider>
</InputRowContextProvider>,
{ pageTitle: 'Inputs' }
);
} else if (page === 'configuration') {
layout(
<SplunkThemeProvider {...themeProviderSettings}>
<StyledContainer>
<ConfigManager>
{({ loading, appData }) => {
return !loading && appData && <ConfigurationPage />
}}
</ConfigManager>
</StyledContainer>
</SplunkThemeProvider>,
{ pageTitle: 'Configuration' }
);
}