Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Remove the detail page and some requirement when creating data templa…
Browse files Browse the repository at this point in the history
…te (#193)
  • Loading branch information
yiyione authored Jan 12, 2021
1 parent 5134774 commit 457dbe2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 193 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
import styled from 'styled-components';
import { cloneDeep, isEmpty } from 'lodash';
import { useBoolean } from '@uifabric/react-hooks';
import { createItem } from 'App/utils/marketplace_api';
import generateDataTemplate from './data_template';

const BasicInformationArea = styled.div`
margin-bottom: 50px;
Expand Down Expand Up @@ -76,6 +78,30 @@ const BasicInformation = props => {
);
}

function submit() {
const dataTemplateObject = {
dockerImage: 'openpai/standard:python_3.6-pytorch_1.2.0-gpu',
storageType: 'data',
storageName: 'data',
storagePath: state.itemObject.dataUrl,
commands: '',
};
state.itemObject.protocol = generateDataTemplate(
dataTemplateObject,
state.itemObject,
);
createItem(state.itemObject)
.then(id =>
setState({
itemId: id,
step: 'completed',
}),
)
.catch(err => {
throw err;
});
}

return (
<BasicInformationArea>
<Stack {...columnProps}>
Expand Down Expand Up @@ -109,7 +135,6 @@ const BasicInformation = props => {
<TextField
label='Short summary'
description='(No more than 100 characters)'
required
value={state.itemObject.summary}
onChange={(event, newValue) => {
const itemObject = cloneDeep(state.itemObject);
Expand All @@ -125,7 +150,6 @@ const BasicInformation = props => {
/>
<TextField
label='Description'
required
multiline={true}
rows={2}
value={state.itemDescription.description}
Expand Down Expand Up @@ -234,9 +258,7 @@ const BasicInformation = props => {
if (
isEmpty(state.itemObject.name) ||
isEmpty(state.itemObject.type) ||
isEmpty(state.itemObject.summary) ||
isEmpty(state.itemObject.dataUrl) ||
isEmpty(state.itemDescription.description)
isEmpty(state.itemObject.dataUrl)
) {
setErrorMessage(true);
alert('please enter all required fields.');
Expand All @@ -247,6 +269,7 @@ const BasicInformation = props => {
step: 'detail',
itemObject: state.itemObject,
});
submit();
}
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import PropTypes from 'prop-types';
import { Stack } from 'office-ui-fabric-react';

import BasicInformation from './basic_information';
import Detail from './detail';
import CreateCompleted from '../create_completed';

const CreateData = props => {
Expand All @@ -22,9 +21,6 @@ const CreateData = props => {
itemDescription={itemDescription}
/>
)}
{state.step === 'detail' && (
<Detail user={user} state={state} setState={setState} />
)}
{state.step === 'completed' && <CreateCompleted state={state} />}
</Stack>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const dataTemplate = {
function generateDataTemplate(dataTemplateObject, itemObject) {
dataTemplate.prerequisites[0].uri = dataTemplateObject.dockerImage;
dataTemplate.prerequisites[1].name = dataTemplateObject.storageName;
dataTemplate.prerequisites[1].uri = [dataTemplateObject.storageName];
dataTemplate.prerequisites[1].uri = [dataTemplateObject.storagePath];
dataTemplate.taskRoles.taskrole.data = dataTemplateObject.storageName;
dataTemplate.taskRoles.taskrole.commands = dataTemplateObject.commands.split(
'\n',
Expand Down
173 changes: 0 additions & 173 deletions webportal/src/app/create_item/components/create_data/detail.jsx

This file was deleted.

10 changes: 0 additions & 10 deletions webportal/src/app/create_item/components/create_step.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ const CreateStep = props => {
<Text>Basic information</Text>
</StepText>
</StepArea>
<StepArea left='calc(50% - 8px)'>
<CircleDot
color={
props.step === 'detail' ? palette.themePrimary : 'LightGray'
}
/>
<StepText color={props.step === 'detail' ? 'black' : 'gray'}>
<Text>Detail</Text>
</StepText>
</StepArea>
<StepArea left='calc(100% - 8px)'>
<CircleDot
color={
Expand Down

0 comments on commit 457dbe2

Please sign in to comment.