-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding MDS support for ISM Pages: Indices, Aliases, DataStreams, Temp…
…lates & Component Templates (#1006) * adding MDS support for ISM Pages: Indices, Aliases, DataStreams, Templates Signed-off-by: Ramakrishna Chilaka <[email protected]> * Reverting (not required) onCancel changes for forceMerge Signed-off-by: Ramakrishna Chilaka <[email protected]> * force mounting IndexDetail page Signed-off-by: Ramakrishna Chilaka <[email protected]> * force mounting template page Signed-off-by: Ramakrishna Chilaka <[email protected]> * clearing indexdetail on datasource change Signed-off-by: Ramakrishna Chilaka <[email protected]> * mounting data source menu as read only Signed-off-by: Ramakrishna Chilaka <[email protected]> * integrating with readonly data source Signed-off-by: Ramakrishna Chilaka <[email protected]> * re building services on page switches Signed-off-by: Ramakrishna Chilaka <[email protected]> * refactoring to common hooks and MDSEnabledComponent Signed-off-by: Ramakrishna Chilaka <[email protected]> * Update public/components/MDSEnabledComponent/MDSEnabledComponent.tsx Co-authored-by: SuZhou-Joe <[email protected]> Signed-off-by: Ramakrishna Chilaka <[email protected]> Signed-off-by: Ramakrishna Chilaka <[email protected]> * refactoring code for server & appending URL with datasourceId/datasourcelabel Signed-off-by: Ramakrishna Chilaka <[email protected]> * refactoring types & fixing tests Signed-off-by: Ramakrishna Chilaka <[email protected]> * resolving yarn.lock conflict Signed-off-by: Ramakrishna Chilaka <[email protected]> * flaky test flush action aliases Signed-off-by: Ramakrishna Chilaka <[email protected]> --------- Signed-off-by: Ramakrishna Chilaka <[email protected]> Signed-off-by: Ramakrishna Chilaka <[email protected]> Co-authored-by: SuZhou-Joe <[email protected]> (cherry picked from commit b151b85)
- Loading branch information
1 parent
ae71283
commit 2250709
Showing
48 changed files
with
1,915 additions
and
1,523 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,4 +84,4 @@ | |
"engines": { | ||
"yarn": "^1.21.1" | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
public/components/MDSEnabledComponent/MDSEnabledComponent.tsx
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,54 @@ | ||
import React, { useContext, useEffect } from "react"; | ||
import { DataSourceMenuContext, DataSourceMenuProperties } from "../../services/DataSourceMenuContext"; | ||
import { useHistory } from "react-router"; | ||
import queryString from "query-string"; | ||
|
||
export default class MDSEnabledComponent< | ||
Props extends DataSourceMenuProperties, | ||
State extends DataSourceMenuProperties | ||
> extends React.Component<Props, State> { | ||
constructor(props: Props) { | ||
super(props); | ||
this.state = { | ||
dataSourceId: props.dataSourceId, | ||
dataSourceLabel: props.dataSourceLabel, | ||
multiDataSourceEnabled: props.multiDataSourceEnabled, | ||
} as State; | ||
} | ||
|
||
static getDerivedStateFromProps<Props extends DataSourceMenuProperties, State extends DataSourceMenuProperties>( | ||
nextProps: Props, | ||
prevState: State | ||
) { | ||
// static members cannot reference class type parameters | ||
if ( | ||
nextProps.multiDataSourceEnabled && | ||
(nextProps.dataSourceId !== prevState.dataSourceId || nextProps.dataSourceLabel !== prevState.dataSourceLabel) | ||
) { | ||
return { | ||
dataSourceId: nextProps.dataSourceId, | ||
dataSourceLabel: nextProps.dataSourceLabel, | ||
}; | ||
} | ||
return null; | ||
} | ||
} | ||
|
||
export function useUpdateUrlWithDataSourceProperties() { | ||
const dataSourceMenuProps = useContext(DataSourceMenuContext); | ||
const { dataSourceId, dataSourceLabel, multiDataSourceEnabled } = dataSourceMenuProps; | ||
const history = useHistory(); | ||
const currentSearch = history.location.search; | ||
const currentQuery = queryString.parse(currentSearch); | ||
useEffect(() => { | ||
if (multiDataSourceEnabled) { | ||
history.replace({ | ||
search: queryString.stringify({ | ||
...currentQuery, | ||
dataSourceId, | ||
dataSourceLabel, | ||
}), | ||
}); | ||
} | ||
}, [dataSourceId, dataSourceLabel, multiDataSourceEnabled]); | ||
} |
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,4 @@ | ||
import MDSEnabledComponent from "./MDSEnabledComponent"; | ||
|
||
export default MDSEnabledComponent; | ||
export * from "./MDSEnabledComponent"; |
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
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.