Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update UI dependencies #33

Merged
merged 24 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5eed6f8
Update ui dependencies and common files
deadlycoconuts Sep 2, 2022
be7838f
Update rest of the pages in xp to use EuiPageTemplate
deadlycoconuts Sep 2, 2022
77f89b2
Fix formatting in landing view imports
deadlycoconuts Sep 2, 2022
b6ddbe3
Fix package.json script
deadlycoconuts Sep 2, 2022
2539c3c
Fix flyout styling
deadlycoconuts Sep 4, 2022
1296ca4
Remove redundant styling to accommodate flyouts
deadlycoconuts Sep 4, 2022
18c1b94
Replace EuiPage with EuiPageTemplate for experiment history view
deadlycoconuts Sep 4, 2022
b165f31
Refactor UI pages to achieve consistent spacing
deadlycoconuts Sep 5, 2022
0f65075
Restore React imports
deadlycoconuts Sep 5, 2022
3104749
Update eui version
deadlycoconuts Sep 5, 2022
e3340e8
Replace arrow caret in segmenter card with gear icon
deadlycoconuts Sep 5, 2022
c7c5c42
Make experiment filters and playground flyout push out into the body
deadlycoconuts Sep 6, 2022
aec2f86
Hide per page option from all tables displaying results of list API c…
deadlycoconuts Sep 6, 2022
9610867
Remove deprecated popperProps prop of EuiDatePicker
deadlycoconuts Sep 7, 2022
5c5ffd7
Make reset button in experiments filter not grow automatically
deadlycoconuts Sep 7, 2022
1cd42c7
Remove autoFocus prop being set as true from EuiComponent
deadlycoconuts Sep 7, 2022
2a4839c
Hide per page option from list version tables for experiments, treatm…
deadlycoconuts Sep 7, 2022
4d0fc84
Refactor conditional component rendering
deadlycoconuts Sep 11, 2022
69f8070
Standardise extraction of config variables
deadlycoconuts Sep 11, 2022
637e2b2
Replace relative import paths with absolute paths
deadlycoconuts Sep 11, 2022
91d4c9b
Move flyout width styling to scss files
deadlycoconuts Sep 12, 2022
f38ffb3
Revert changes to segmenter scope badge colours
deadlycoconuts Sep 13, 2022
102585e
Remove healthColor values from experiment and segmenter status
deadlycoconuts Sep 13, 2022
0a6fa97
Refactor flyout custom styles separately as a special class
deadlycoconuts Sep 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand Down
2 changes: 1 addition & 1 deletion ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is the UI component of XP based on React web framework.

## Prerequisites

- [Node.js](https://nodejs.org/en/download/) v14
- [Node.js](https://nodejs.org/en/download/) v16
- yarn 1.22.x (`npm install --global yarn`)

## Install Dependencies
Expand Down
15 changes: 8 additions & 7 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@
"private": true,
"homepage": "/xp",
"dependencies": {
"@emotion/react": "^11.9.0",
"@elastic/datemath": "5.0.3",
"@elastic/eui": "32.3.0",
"@gojek/mlp-ui": "1.4.19",
"@elastic/eui": "66.0.0",
"@gojek/mlp-ui": "1.6.1",
"@reach/router": "1.3.4",
"@sentry/browser": "5.15.5",
"json-bigint": "1.0.0",
"lint-staged": "^11.1.2",
"moment": "^2.29.0",
"moment": "^2.29.4",
"object-assign-deep": "^0.4.0",
"react": "16.14.0",
"react-dom": "16.14.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-scripts": "^5.0.1",
"resize-observer-polyfill": "^1.5.1",
"yup": "^0.29.1"
},
Expand All @@ -28,8 +30,7 @@
"node-sass": "^6.0.1",
"postcss-normalize": "10.0.1",
"prettier": "^2.3.2",
"prettier-plugin-import-sort": "^0.0.7",
"react-scripts": "5.0.0-next.37"
"prettier-plugin-import-sort": "^0.0.7"
},
"resolutions": {
"react-scripts/**/postcss-normalize": "10.0.1",
Expand Down
75 changes: 39 additions & 36 deletions ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";

import {
AuthProvider,
Empty,
Page404,
ErrorBoundary,
Login,
MlpApiContextProvider,
Expand All @@ -15,45 +15,48 @@ import { useConfig } from "config";
import ExperimentsLandingPage from "experiments/ExperimentsLandingPage";
import Home from "Home";
import { PrivateLayout } from "PrivateLayout";
import { EuiProvider } from "@elastic/eui";

const App = () => {
const { apiConfig, appConfig, authConfig } = useConfig();
return (
<ErrorBoundary>
<MlpApiContextProvider
mlpApiUrl={apiConfig.mlpApiUrl}
timeout={apiConfig.apiTimeout}>
<AuthProvider clientId={authConfig.oauthClientId}>
<Router role="group">
<Login path="/login" />

<Redirect from="/" to={appConfig.homepage} noThrow />

<Redirect
from={`${appConfig.homepage}/projects/:projectId`}
to={`${appConfig.homepage}/projects/:projectId/experiments`}
noThrow
/>

{/* HOME */}
<PrivateRoute
path={appConfig.homepage}
render={PrivateLayout(Home)}
/>

{/* EXPERIMENTS */}
<PrivateRoute
path={`${appConfig.homepage}/projects/:projectId/experiments/*`}
render={PrivateLayout(ExperimentsLandingPage)}
/>

{/* DEFAULT */}
<Empty default />
</Router>
<Toast />
</AuthProvider>
</MlpApiContextProvider>
</ErrorBoundary>
<EuiProvider>
<ErrorBoundary>
<MlpApiContextProvider
mlpApiUrl={apiConfig.mlpApiUrl}
timeout={apiConfig.apiTimeout}>
<AuthProvider clientId={authConfig.oauthClientId}>
<Router role="group">
<Login path="/login" />

<Redirect from="/" to={appConfig.homepage} noThrow />

<Redirect
from={`${appConfig.homepage}/projects/:projectId`}
to={`${appConfig.homepage}/projects/:projectId/experiments`}
noThrow
/>

{/* HOME */}
<PrivateRoute
path={appConfig.homepage}
render={PrivateLayout(Home)}
/>

{/* EXPERIMENTS */}
<PrivateRoute
path={`${appConfig.homepage}/projects/:projectId/experiments/*`}
render={PrivateLayout(ExperimentsLandingPage)}
/>

{/* DEFAULT */}
<Page404 default />
</Router>
<Toast />
</AuthProvider>
</MlpApiContextProvider>
</ErrorBoundary>
</EuiProvider>
);
};

Expand Down
22 changes: 12 additions & 10 deletions ui/src/Home.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import React, { Fragment } from "react";

import { EuiEmptyPrompt } from "@elastic/eui";
import { EuiPageTemplate } from "@elastic/eui";

import { useConfig } from "config";

const Home = () => {
const { appConfig } = useConfig();

return (
<EuiEmptyPrompt
iconType={appConfig.appIcon}
title={<h2>XP: Experimentation Platform</h2>}
body={
<Fragment>
<p>To start off, please select a project from the dropdown.</p>
</Fragment>
}
/>
<EuiPageTemplate>
<EuiPageTemplate.EmptyPrompt
iconType={appConfig.appIcon}
title={<h2>XP: Experimentation Platform</h2>}
body={
<Fragment>
<p>To start off, please select a project from the dropdown.</p>
</Fragment>
}
/>
</EuiPageTemplate>
);
};

Expand Down
4 changes: 1 addition & 3 deletions ui/src/PrivateLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export const PrivateLayout = (Component) => {
}
docLinks={appConfig.docsUrl}
/>
<div className="main-component-layout">
<Component {...props} />
</div>
<Component {...props} />
</CurrentProjectContextProvider>
</ProjectsContextProvider>
</ApplicationsContextProvider>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/style.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "~@elastic/eui/src/theme_light.scss";
@import "~@elastic/eui/dist/eui_theme_light.css";
@import "~@gojek/mlp-ui/dist/index.css";

// don't stretch all the way
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/config_section/ConfigPanel.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import "node_modules/@elastic/eui/src/global_styling/mixins/typography";

.euiPanel--detailedConfigSection {
.euiDescriptionList.euiDescriptionList--responsiveColumn {
.euiDescriptionList {
krithika369 marked this conversation as resolved.
Show resolved Hide resolved
> * {
@include euiTextBreakWord;

Expand Down
21 changes: 12 additions & 9 deletions ui/src/components/config_section/ConfigSectionTitle.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import React from "react";

import { EuiIcon, EuiTextColor, EuiTitle } from "@elastic/eui";
import { EuiIcon, EuiTextColor, EuiTitle, EuiSpacer } from "@elastic/eui";

export const ConfigSectionTitle = ({ title, iconType }) => (
<EuiTitle size="s">
<EuiTextColor color="secondary">
<span>
{!!iconType && (
<EuiIcon className="eui-alignBaseline" type={iconType} size="m" />
)}
&nbsp;{title}
</span>
</EuiTextColor>
<span>
<EuiTextColor color="success">
<span>
{!!iconType && (
<EuiIcon className="eui-alignBaseline" type={iconType} size="m" />
)}
&nbsp;{title}
</span>
<EuiSpacer size="s" />
</EuiTextColor>
</span>
</EuiTitle>
);
39 changes: 22 additions & 17 deletions ui/src/components/page/LandingView.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { useContext } from "react";
import React, { Fragment, useContext } from "react";

import {
EuiLink,
EuiLoadingChart,
EuiPage,
EuiPanel,
EuiSpacer,
EuiText,
EuiTextAlign,
EuiPageTemplate
} from "@elastic/eui";

import ProjectContext from "providers/project/context";
Expand All @@ -22,21 +21,27 @@ const LandingView = ({ Component, name, projectId, ...props }) => {
<EuiLoadingChart size="xl" mono />
</EuiTextAlign>
) : !isProjectOnboarded(projectId) ? (
<EuiPage>
<EuiPanel>
<EuiText>
Welcome to {name}.{"\n\n"}
</EuiText>
<EuiSpacer />
<EuiText>
This project has not been set up. Get started{" "}
<EuiLink onClick={() => props.navigate("./settings/create")}>
<EuiPageTemplate panelled={false}>
<EuiPageTemplate.EmptyPrompt
title={
<EuiText>
Welcome to {name}.{"\n\n"}
</EuiText>
}
body={
<Fragment>
<EuiSpacer />
<EuiText>
This project has not been set up. Get started{" "}
<EuiLink onClick={() => props.navigate("./settings/create")}>
here
</EuiLink>
.
</EuiText>
</EuiPanel>
</EuiPage>
</EuiLink>
.
</EuiText>
</Fragment>
}
/>
</EuiPageTemplate>
) : (
<Component projectId={projectId} {...props} />
)}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/table/BasicTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const BasicTable = ({
iconType="alert">
<p>{error.message}</p>
</EuiCallOut>
) : !!onPaginationChange && !!totalItemCount & !!page ? (
) : !!onPaginationChange && !!totalItemCount && !!page ? (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. 😅

<EuiBasicTable
items={items}
columns={tableColumns}
Expand All @@ -43,8 +43,8 @@ export const BasicTable = ({
pagination={{
pageIndex: page.index,
pageSize: page.size,
showPerPageOptions: false,
totalItemCount,
hidePerPageOptions: true,
}}
onChange={({ page = {} }) => onPaginationChange(page)}
/>
Expand Down
8 changes: 8 additions & 0 deletions ui/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ export const appConfig = {
tzOffsetMinutes: 0,
tz: "UTC",
},
// Specifies a set of page templating configurations that will soon be controlled by the mlp-ui package
// TO-DO: to review if these set of specifications are still needed after the update to mlp-ui
pageTemplate: {
// Width of page template
restrictWidth: "90%",
// Padding of page template
paddingSize: "none",
},
};

const sentryConfig = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ export const ScheduleConfigPanel = ({
aria-label="Start Time"
showTimeSelect
utcOffset={appConfig.datetime.tzOffsetMinutes}
popperProps={{
positionFixed: true,
}}
/>
}
endDateControl={
Expand All @@ -101,9 +98,6 @@ export const ScheduleConfigPanel = ({
aria-label="End Time"
showTimeSelect
utcOffset={appConfig.datetime.tzOffsetMinutes}
popperProps={{
positionFixed: true,
}}
/>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ export const SegmentConfigPanel = ({
options={segmentSelectionOptions}
onChange={onCustomOrTemplateSelection}
selectedOptions={!!segmentTemplate ? [segmentTemplate] : []}
autoFocus
/>
</EuiFormRow>
<EuiSpacer />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export const TreatmentCard = ({
selectedOptions={
!!treatment.template ? [treatment.template] : []
}
autoFocus
/>
</EuiFormRow>
<EuiSpacer size="m" />
Expand Down
Loading