-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Queenie Ma
authored
Jun 3, 2020
1 parent
a38524f
commit db7f002
Showing
22 changed files
with
210 additions
and
90 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
66 changes: 31 additions & 35 deletions
66
src/webviews/configureJobSubmission/resources/components/App.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 |
---|---|---|
@@ -1,44 +1,40 @@ | ||
/* eslint-disable no-undef */ | ||
import ListItem from 'carbon-components-react/es/components/ListItem'; | ||
import UnorderedList from 'carbon-components-react/es/components/UnorderedList'; | ||
import * as React from 'react'; | ||
import React, { useState } from 'react'; | ||
import HeaderContainer from './HeaderContainer'; | ||
import JobInfoModal from './JobInfoModal'; | ||
import SubmitJobContainer from './SubmitJobContainer'; | ||
|
||
// submitJobParams is defined when setting the webview HTML content | ||
const App = () => ( | ||
<div className="app-container"> | ||
<div className="bx--grid bx--grid--no-gutter"> | ||
<div className="bx--row app-container__row"> | ||
<div className="bx--col"> | ||
<h1 className="app-container__heading"> | ||
{`Configure job for ${submitJobParams.name}`} | ||
</h1> | ||
{submitJobParams.details && Object.keys(submitJobParams.details).length | ||
? ( | ||
<UnorderedList className="app-container__list"> | ||
{Object.keys(submitJobParams.details).map((label) => ( | ||
<ListItem key={label}> | ||
{`${label}: ${submitJobParams.details[label]}`} | ||
</ListItem> | ||
))} | ||
<ListItem>{`Instance: ${submitJobParams.targetInstance.instanceName}`}</ListItem> | ||
</UnorderedList> | ||
) | ||
: ( | ||
<div> | ||
{`Instance: ${submitJobParams.targetInstance.instanceName}`} | ||
</div> | ||
) | ||
} | ||
/** | ||
* Note: `submitJobParams` is defined when setting the webview HTML content | ||
*/ | ||
const App = () => { | ||
const [isJobInfoModalOpen, setIsJobInfoModalOpen] = useState(false); | ||
|
||
return ( | ||
<div className="app-container"> | ||
<JobInfoModal | ||
isOpen={isJobInfoModalOpen} | ||
close={() => setIsJobInfoModalOpen(false)} | ||
instanceName={submitJobParams.targetInstance.instanceName} | ||
jobDetails={submitJobParams.details || null} | ||
/> | ||
<div className="bx--grid bx--grid--no-gutter"> | ||
<div className="bx--row app-container__header-container"> | ||
<div className="bx--col"> | ||
<HeaderContainer | ||
bundleName={submitJobParams.name} | ||
setIsJobInfoModalOpen={setIsJobInfoModalOpen} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="bx--row app-container__row app-container__main-container"> | ||
<div className="bx--col"> | ||
<SubmitJobContainer params={submitJobParams} /> | ||
<div className="bx--row app-container__main-container"> | ||
<div className="bx--col"> | ||
<SubmitJobContainer params={submitJobParams} /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
); | ||
}; | ||
|
||
export default App; |
31 changes: 31 additions & 0 deletions
31
src/webviews/configureJobSubmission/resources/components/HeaderContainer.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,31 @@ | ||
import InfoIcon16 from '@carbon/icons-react/es/information/16'; | ||
import Button from 'carbon-components-react/es/components/Button'; | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
|
||
const HeaderContainer = ({ bundleName, setIsJobInfoModalOpen }) => { | ||
return ( | ||
<div className="header-container--flex"> | ||
<h1 className="header-container__header"> | ||
{`Configure job for ${bundleName}`} | ||
</h1> | ||
<Button | ||
hasIconOnly | ||
kind="ghost" | ||
renderIcon={InfoIcon16} | ||
iconDescription="Show job submission details" | ||
tooltipAlignment="center" | ||
tooltipPosition="bottom" | ||
onClick={() => setIsJobInfoModalOpen(true)} | ||
className="header-container__info-button" | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
HeaderContainer.propTypes = { | ||
bundleName: PropTypes.string.isRequired, | ||
setIsJobInfoModalOpen: PropTypes.func.isRequired | ||
}; | ||
|
||
export default HeaderContainer; |
55 changes: 55 additions & 0 deletions
55
src/webviews/configureJobSubmission/resources/components/JobInfoModal.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,55 @@ | ||
import Modal from 'carbon-components-react/es/components/Modal'; | ||
import { | ||
StructuredListBody, | ||
StructuredListCell, | ||
StructuredListRow, | ||
StructuredListWrapper | ||
} from 'carbon-components-react/es/components/StructuredList'; | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
|
||
const JobInfoModal = ({ | ||
isOpen, close, instanceName, jobDetails | ||
}) => { | ||
return ( | ||
<Modal | ||
iconDescription="Close" | ||
modalAriaLabel="Job submission details modal" | ||
modalHeading="Job submission details" | ||
open={isOpen} | ||
size="lg" | ||
passiveModal | ||
onRequestClose={close} | ||
> | ||
<div className="job-details-container"> | ||
<StructuredListWrapper className="job-details-container__list"> | ||
<StructuredListBody> | ||
{jobDetails && Object.keys(jobDetails).length && Object.keys(jobDetails).map((label) => ( | ||
<StructuredListRow className="structured-row" key={label}> | ||
<StructuredListCell noWrap>{label}</StructuredListCell> | ||
<StructuredListCell className="job-details-container__list-value">{jobDetails[label]}</StructuredListCell> | ||
</StructuredListRow> | ||
))} | ||
<StructuredListRow className="structured-row"> | ||
<StructuredListCell noWrap>Instance</StructuredListCell> | ||
<StructuredListCell className="job-details-container__list-value">{instanceName}</StructuredListCell> | ||
</StructuredListRow> | ||
</StructuredListBody> | ||
</StructuredListWrapper> | ||
</div> | ||
</Modal> | ||
); | ||
}; | ||
|
||
JobInfoModal.defaultProps = { | ||
jobDetails: null | ||
}; | ||
|
||
JobInfoModal.propTypes = { | ||
isOpen: PropTypes.bool.isRequired, | ||
close: PropTypes.func.isRequired, | ||
instanceName: PropTypes.string.isRequired, | ||
jobDetails: PropTypes.objectOf(PropTypes.string) | ||
}; | ||
|
||
export default JobInfoModal; |
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
9 changes: 9 additions & 0 deletions
9
src/webviews/configureJobSubmission/resources/styles/_job-info-modal.scss
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,9 @@ | ||
.job-details-container { | ||
.job-details-container__list { | ||
margin-bottom: 0; | ||
|
||
.job-details-container__list-value { | ||
word-break: break-all; | ||
} | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
src/webviews/configureJobSubmission/resources/styles/_submit-job-container.scss
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
19 changes: 12 additions & 7 deletions
19
src/webviews/instanceSelection/resources/components/App.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
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
1 change: 1 addition & 0 deletions
1
src/webviews/instanceSelection/resources/styles/_buttonContainer.scss
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.