Skip to content

Commit

Permalink
Impl [Projects] New Menu and Project Page Revamp (#967)
Browse files Browse the repository at this point in the history
https://jira.iguazeng.com/browse/ML-1583
https://jira.iguazeng.com/browse/ML-1377

* new Projects Menu quick links

* Projects Cards Revamp
  • Loading branch information
ilan7empest authored Jan 2, 2022
1 parent a86259b commit 1047696
Show file tree
Hide file tree
Showing 89 changed files with 2,329 additions and 312 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"js-base64": "^2.5.2",
"js-yaml": "^3.13.1",
"lodash": "^4.17.15",
"moment": "^2.29.1",
"pretty-bytes": "^5.3.0",
"prismjs": "^1.19.0",
"prop-types": "^15.7.2",
Expand Down
19 changes: 17 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ const Functions = React.lazy(() =>
)
const Jobs = React.lazy(() => import('./components/JobsPage/Jobs'))
const Models = React.lazy(() => import('./components/Models/Models'))
const Project = React.lazy(() => import('./components/Project/Project'))
const Projects = React.lazy(() => import('./components/ProjectsPage/Projects'))
const ProjectMonitor = React.lazy(() =>
import('./components/Project/ProjectMonitor')
)
const ProjectOverview = React.lazy(() =>
import('./components/Project/ProjectOverview/ProjectOverview')
)
const ProjectSettings = React.lazy(() =>
import('./components/ProjectSettings/ProjectSettings')
)
Expand All @@ -52,10 +57,20 @@ const App = () => {
exact
render={routeProps => <Projects {...routeProps} />}
/>
<Redirect
exact
from="/projects/:projectName"
to="/projects/:projectName/monitor"
/>
<Route
path="/projects/:projectName"
exact
render={routeProps => <Project {...routeProps} />}
render={routeProps => <ProjectOverview {...routeProps} />}
/>
<Route
path="/projects/:projectName/monitor"
exact
render={routeProps => <ProjectMonitor {...routeProps} />}
/>
<Route
exact
Expand Down
6 changes: 4 additions & 2 deletions src/common/ActionsMenu/ActionsMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { isEmpty } from 'lodash'
import classnames from 'classnames'

import ActionsMenuItem from '../../elements/ActionMenuItem/ActionsMenuItem'
import RoundedIcon from '../RoundedIcon/RoundedIcon'

import { ACTIONS_MENU } from '../../types'

Expand Down Expand Up @@ -94,9 +95,10 @@ const ActionsMenu = ({ dataItem, menu, time }) => {
onMouseOver={handleMouseOver}
ref={actionMenuRef}
>
<button onClick={showActionsList}>
<RoundedIcon onClick={showActionsList}>
<ActionMenu />
</button>
</RoundedIcon>

{renderMenu &&
createPortal(
<div
Expand Down
32 changes: 32 additions & 0 deletions src/common/Backdrop.js/Backdrop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react'
import PropTypes from 'prop-types'
import { createPortal } from 'react-dom'
import { CSSTransition } from 'react-transition-group'

import './Backdrop.scss'

const Backdrop = ({ duration = 300, show, onClose }) => {
return createPortal(
<CSSTransition
in={show}
timeout={duration}
classNames="backdrop-transition"
mountOnEnter
unmountOnExit
>
<div className="backdrop" onClick={onClose}></div>
</CSSTransition>,
document.getElementById('overlay_container')
)
}

Backdrop.defaultProps = {
duration: 300,
show: false
}

Backdrop.propTypes = {
show: PropTypes.bool.isRequired
}

export default Backdrop
30 changes: 30 additions & 0 deletions src/common/Backdrop.js/Backdrop.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.backdrop {
position: fixed;
top: 0;
left: 0;
z-index: 1;
width: 100vw;
height: 100vh;
background-color: #000;

&-transition {
&-enter {
opacity: 0;
}

&-enter-active,
&-enter-done {
opacity: 0.5;
transition: opacity 0.3s ease-in-out;
}

&-exit {
opacity: 0.5;
}

&-exit-active {
opacity: 0;
transition: opacity 0.3s ease-in-out;
}
}
}
6 changes: 5 additions & 1 deletion src/common/Breadcrumbs/breadcrumbs.util.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
export const generateProjectScreens = (match, isDemoMode) => [
{ label: 'Models', id: 'models' },
{
label: 'Project Monitoring',
id: 'monitor'
},
{ label: 'Feature Store (Beta)', id: 'feature-store' },
{ label: 'Artifacts', id: 'files' },
{ label: 'Models', id: 'models' },
{ label: 'Jobs', id: 'jobs' },
{ label: 'ML functions', id: 'functions' },
{
Expand Down
2 changes: 0 additions & 2 deletions src/common/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import TextTooltipTemplate from '../../elements/TooltipTemplate/TextTooltipTempl
import { BUTTON_VARIANTS } from '../../types'
import { TERTIARY_BUTTON } from '../../constants'

import './button.scss'

const Button = forwardRef(
({ className, icon, label, tooltip, variant, ...restProps }, ref) => {
const buttonClassName = classNames('btn', `btn-${variant}`, className)
Expand Down
2 changes: 1 addition & 1 deletion src/common/EditorModal/EditorModalView.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const EditorModalView = ({ closeModal, data, handleSaveCode, setData }) =>
/>
</div>
</div>,
document.getElementById('root')
document.getElementById('overlay_container')
)

EditorModalView.propTypes = {
Expand Down
20 changes: 20 additions & 0 deletions src/common/Input/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@
border: $primaryBorder;
border-radius: 4px;

&::placeholder {
color: $spunPearl;
}
&::-webkit-input-placeholder {
/* Chrome/Opera/Safari */
color: $spunPearl;
}
&::-moz-placeholder {
/* Firefox 19+ */
color: $spunPearl;
}
&:-ms-input-placeholder {
/* IE 10+ */
color: $spunPearl;
}
&:-moz-placeholder {
/* Firefox 18- */
color: $spunPearl;
}

&.without-border {
border: none;
}
Expand Down
86 changes: 86 additions & 0 deletions src/common/Modal/Modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import React, { useEffect, useState } from 'react'
import PropTypes from 'prop-types'
import { createPortal } from 'react-dom'
import { CSSTransition } from 'react-transition-group'
import classNames from 'classnames'

import Backdrop from '../Backdrop.js/Backdrop'
import RoundedIcon from '../RoundedIcon/RoundedIcon'

import { ReactComponent as CloseIcon } from '../../images/close.svg'

import './Modal.scss'

const JSX_MODAL = ({ children, className, onClose, size, show, title }) => {
const [isModalOpen, setIsModalOpen] = useState(false)

const modalClassNames = classNames(
'modal',
className,
size && `modal-${size}`
)

const handleOnClose = () => {
setIsModalOpen(false)
onClose()
}

useEffect(() => {
setIsModalOpen(show)
return () => {
setIsModalOpen(false)
}
}, [show])
return (
<>
<Backdrop onClose={handleOnClose} show={isModalOpen} />
<CSSTransition
in={isModalOpen}
timeout={300}
classNames="modal-transition"
unmountOnExit
>
<div className={modalClassNames} data-testid="modal">
<RoundedIcon
className="modal__header-button"
onClick={handleOnClose}
tooltipText="Close"
data-testid="pop-up-close-btn"
>
<CloseIcon />
</RoundedIcon>
<div className="modal__content">
<div className="modal__header">
<h5 className="modal__header-title">{title}</h5>
</div>
<div className="modal__body">{children}</div>
<div className="modal__footer"></div>
</div>
</div>
</CSSTransition>
</>
)
}
const Modal = props => {
return createPortal(
<JSX_MODAL {...props} />,
document.getElementById('overlay_container')
)
}

Modal.defaultProps = {
show: false,
size: 'normal',
title: ''
}

Modal.propTypes = {
children: PropTypes.oneOfType([PropTypes.object, PropTypes.string])
.isRequired,
onClose: PropTypes.func.isRequired,
show: PropTypes.bool.isRequired,
size: PropTypes.oneOf(['sm', 'normal', 'lg']),
title: PropTypes.string
}

export default Modal
90 changes: 90 additions & 0 deletions src/common/Modal/Modal.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
@import '../../scss/variables';
@import '../../scss/colors';
@import '../../scss/borders';

.modal {
position: fixed;
top: 30%;
max-width: 600px;
width: 100%;
outline: 0;
z-index: 2;

&-sm {
max-width: 400px;
}

&-lg {
max-width: 800px;
}

&__content {
display: flex;
flex-flow: column nowrap;
position: relative;
min-height: 300px;
height: calc(100% - 3.5rem);
max-height: 90vh;
background-color: $white;
border-radius: $mainBorderRadius;
box-shadow: 0 6px 26px rgba($black, 0.2);
overflow: hidden;
text-align: center;
}

&__header {
position: relative;
padding: 2rem;
display: flex;
flex-shrink: 0;
justify-content: center;
align-items: center;
border-bottom: $primaryBorder;

&-title {
color: $primary;
font-size: 2em;
margin: 0;
}
&-button {
position: absolute;
top: 7px;
right: 2px;
}
}

&__body {
overflow-y: auto;
overflow-x: hidden;
flex: 1 1 auto;
}

&__footer {
flex-shrink: 0;
}

&-transition {
&-enter {
opacity: 0;
transform: translateY(calc(100vh));
transition: all 0.3s ease-in-out;
}

&-enter-active,
&-enter-done {
opacity: 1;
transform: translateY(-30%);
}

&-exit {
opacity: 1;
transform: translateY(-30%);
}

&-exit-active {
opacity: 0;
top: 20%;
transition: all 0.3s ease-in-out;
}
}
}
Loading

0 comments on commit 1047696

Please sign in to comment.