-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add standard ensembler component * Simplify react effects used in affected routes list panel * Add popover to list the affected experiments * Fix empty titles in EuiDescriptionList * Add context menu to display affected experiments * Fix styles in prop passing * Add tooltip and color to affected experiments menu * Add standard ensembler config view * Fix lint comments * Add help flyout to explain route name path prefix * Update deprecated subdued EUI colour with colour hex * Rename affected experiments and routes component to linked experiments and routes * Reword route path prefix explanation * Fix lint comments * Fix incorrect language type specified for code block * Replace style used to pass items to the list in RouteNamePathConfigGroup * Rename misleading variable names and remove redundant tags * Replace relative import path with absolute path * Replace colour hexes corresponding to subdued to default * Refactor experiments loading into a context provider * Standardise naming of all providers to be singular wherever logical * Make popover management distributed across each component * Refactor LinkedRoutesTable to utilise id from list of routes to render rows * Revert incorrect edit made to docstrings * Refactor LinkedRoutesTable * Consume route name path in flyout from config * Simplify effect dependency on routes in LinkedRoutesTable
- Loading branch information
1 parent
0419432
commit 734b0ab
Showing
40 changed files
with
606 additions
and
63 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
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
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
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,64 @@ | ||
import React, {useEffect, useMemo, useState} from "react"; | ||
|
||
import { useXpApi } from "hooks/useXpApi"; | ||
import moment from "moment"; | ||
import { useConfig } from "config"; | ||
|
||
const ExperimentContext = React.createContext({}); | ||
|
||
export const ExperimentContextProvider = ({ projectId, children }) => { | ||
const { appConfig } = useConfig(); | ||
|
||
const [isAllExperimentsLoaded, setIsAllExperimentsLoaded] = useState(false); | ||
const [pageIndex, setPageIndex] = useState(0); | ||
const [allExperiments, setAllExperiments] = useState([]); | ||
|
||
const { start_time, end_time } = useMemo( | ||
() => { | ||
let current_time = moment.utc(); | ||
let start_time = current_time.format(appConfig.datetime.format); | ||
let end_time = current_time.add(1000, "y").format(appConfig.datetime.format); | ||
return { start_time, end_time }; | ||
}, | ||
[appConfig] | ||
); | ||
|
||
const [{ data: { data: experiments, paging }, isLoaded }] = useXpApi( | ||
`/projects/${projectId}/experiments`, | ||
{ | ||
query: { | ||
start_time: start_time, | ||
end_time: end_time, | ||
page: pageIndex + 1, | ||
page_size: appConfig.pagination.defaultPageSize, | ||
status: "active" | ||
}, | ||
}, | ||
{ data: [], paging: { total: 0 } } | ||
); | ||
|
||
useEffect(() => { | ||
if (isLoaded) { | ||
if (!!experiments && !isAllExperimentsLoaded) { | ||
setAllExperiments((curExperiments) => [...curExperiments, ...experiments]); | ||
} | ||
if (paging.pages > paging.page) { | ||
setPageIndex(paging.page); | ||
} else { | ||
setIsAllExperimentsLoaded(true); | ||
} | ||
} | ||
}, [isLoaded, experiments, paging, isAllExperimentsLoaded]); | ||
|
||
return ( | ||
<ExperimentContext.Provider | ||
value={{ | ||
allExperiments, | ||
isAllExperimentsLoaded, | ||
}}> | ||
{children} | ||
</ExperimentContext.Provider> | ||
); | ||
}; | ||
|
||
export default ExperimentContext; |
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
File renamed without changes.
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.