forked from jenkinsci/pipeline-graph-view-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.tsx
More file actions
49 lines (45 loc) · 1.68 KB
/
app.tsx
File metadata and controls
49 lines (45 loc) · 1.68 KB
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
import "./app.scss";
import "./multi-pipeline-graph/styles/main.scss";
import { FunctionComponent } from "react";
import {
I18NProvider,
LocaleProvider,
ResourceBundleName,
} from "../common/i18n/index.ts";
import { UserPermissionsProvider } from "../common/user/user-permission-provider.tsx";
import { UserPreferencesProvider } from "../common/user/user-preferences-provider.tsx";
import { MultiPipelineGraph } from "./multi-pipeline-graph/main/MultiPipelineGraph.tsx";
import OverflowDropdown from "./multi-pipeline-graph/main/overfow-dropdown.tsx";
import SettingsButton from "./multi-pipeline-graph/main/settings-button.tsx";
const App: FunctionComponent = () => {
const locale = document.getElementById("multiple-pipeline-root")!.dataset
.userLocale!;
const settings = document.getElementById("pgv-settings");
const overflow = document.getElementById("multiple-pipeline-overflow-root");
if (!settings && !overflow) {
throw new Error("Failed to find the 'settings/overflow' element");
}
if (settings && overflow) {
throw new Error(
"Only one of the 'settings/overflow' elements should be defined",
);
}
return (
<div>
<LocaleProvider locale={locale}>
<I18NProvider bundles={[ResourceBundleName.messages]}>
<UserPreferencesProvider>
{settings && <SettingsButton buttonPortal={settings} />}
{overflow && (
<UserPermissionsProvider>
<OverflowDropdown buttonPortal={overflow} />
</UserPermissionsProvider>
)}
<MultiPipelineGraph />
</UserPreferencesProvider>
</I18NProvider>
</LocaleProvider>
</div>
);
};
export default App;