-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/1339
- Loading branch information
Showing
17 changed files
with
1,263 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
frontend/src/components/admin/searchIndexManagement/SearchIndexManagement.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import React, { useState, useContext } from "react"; | ||
import { Button, Loading, Grid, Column, Section, Heading } from "@carbon/react"; | ||
import { FormattedMessage, useIntl, injectIntl } from "react-intl"; | ||
import { getFromOpenElisServer } from "../../utils/Utils"; | ||
import PageBreadCrumb from "../../common/PageBreadCrumb"; | ||
import { NotificationContext } from "../../layout/Layout"; | ||
import { | ||
AlertDialog, | ||
NotificationKinds, | ||
} from "../../common/CustomNotification"; | ||
|
||
function SearchIndexManagement() { | ||
const [loading, setLoading] = useState(false); | ||
const { notificationVisible, setNotificationVisible, addNotification } = | ||
useContext(NotificationContext); | ||
const intl = useIntl(); | ||
const rebuildIndex = async (res) => { | ||
setNotificationVisible(true); | ||
if (res) { | ||
addNotification({ | ||
kind: NotificationKinds.success, | ||
title: intl.formatMessage({ id: "notification.title" }), | ||
message: intl.formatMessage({ | ||
id: "searchindexmanagement.reindex.success", | ||
}), | ||
}); | ||
} else { | ||
addNotification({ | ||
kind: NotificationKinds.error, | ||
title: intl.formatMessage({ id: "notification.title" }), | ||
message: intl.formatMessage({ | ||
id: "searchindexmanagement.reindex.error", | ||
}), | ||
}); | ||
} | ||
setLoading(false); | ||
}; | ||
const handleReindexClick = async () => { | ||
setLoading(true); | ||
getFromOpenElisServer("/rest/reindex", rebuildIndex); | ||
}; | ||
|
||
const breadcrumbs = [ | ||
{ label: "home.label", link: "/" }, | ||
{ | ||
label: "breadcrums.admin.managment", | ||
link: "/MasterListsPage", | ||
}, | ||
{ | ||
label: "searchindexmanagement.label", | ||
link: "/MasterListsPage#SearchIndexManagement", | ||
}, | ||
]; | ||
|
||
return ( | ||
<> | ||
{notificationVisible === true ? <AlertDialog /> : ""} | ||
{loading && <Loading />} | ||
<div className="adminPageContent"> | ||
<PageBreadCrumb breadcrumbs={breadcrumbs} /> | ||
<Grid fullWidth={true}> | ||
<Column lg={16} md={8} sm={4}> | ||
<Section> | ||
<Heading> | ||
<FormattedMessage id="searchindexmanagement.label" /> | ||
</Heading> | ||
</Section> | ||
</Column> | ||
</Grid> | ||
<div className="orderLegendBody"> | ||
<Grid> | ||
<Column lg={16} md={8} sm={4}> | ||
<Section> | ||
<Section> | ||
<Heading> | ||
<FormattedMessage id="searchindexmanagement.reindex" /> | ||
</Heading> | ||
</Section> | ||
</Section> | ||
<br /> | ||
<Section> | ||
<FormattedMessage id="searchindexmanagement.description" /> | ||
</Section> | ||
<br /> | ||
<Button onClick={handleReindexClick} disabled={loading}> | ||
<FormattedMessage id="searchindexmanagement.reindex" /> | ||
</Button> | ||
</Column> | ||
</Grid> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default injectIntl(SearchIndexManagement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.