-
Notifications
You must be signed in to change notification settings - Fork 8.3k
/
index.js
67 lines (59 loc) · 1.85 KB
/
index.js
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
67
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import {
EuiPage,
EuiPageBody,
EuiSpacer,
EuiCodeBlock,
EuiPanel
} from '@elastic/eui';
import { LicenseStatus, AddLicense } from 'plugins/xpack_main/components';
const LicenseUpdateInfoForPrimary = ({ isPrimaryCluster, uploadLicensePath }) => {
if (!isPrimaryCluster) {
return null;
}
// viewed license is for the cluster directly connected to Kibana
return <AddLicense uploadPath={uploadLicensePath} />;
};
const LicenseUpdateInfoForRemote = ({ isPrimaryCluster }) => {
if (isPrimaryCluster) {
return null;
}
// viewed license is for a remote monitored cluster not directly connected to Kibana
return (
<EuiPanel>
<p>
To update the license for this cluster, provide the license file through
the Elasticsearch API:
</p>
<EuiSpacer />
<EuiCodeBlock>
{`curl -XPUT -u <user> 'https://<host>:<port>/_xpack/license' -H 'Content-Type: application/json' -d @license.json`}
</EuiCodeBlock>
</EuiPanel>
);
};
export function License(props) {
const { status, type, isExpired, expiryDate } = props;
return (
<EuiPage className="licenseManagement">
<EuiPageBody className="licenseManagement__pageBody">
<div className="licenseManagement__contain">
<LicenseStatus
isExpired={isExpired}
status={status}
type={type}
expiryDate={expiryDate}
/>
<EuiSpacer size="l" />
<LicenseUpdateInfoForPrimary {...props} />
<LicenseUpdateInfoForRemote {...props} />
</div>
</EuiPageBody>
</EuiPage>
);
}