// The CreateProject component is a two-step wizard. // // The first step sets up basic project details, with the option of selecting // a depot location for the project. // // The second step is basically our user management view. var AppActions = require('../actions/AppActions'); var DepotTree = require('./DepotTree.jsx'); var Projects = require('../stores/Projects'); var React = require('react'); var ReactBootstrap = require('react-bootstrap'); var ButtonInput = ReactBootstrap.ButtonInput; var Col = ReactBootstrap.Col; var Grid = ReactBootstrap.Grid; var Input = ReactBootstrap.Input; var Panel = ReactBootstrap.Panel; var Row = ReactBootstrap.Row; var CreateProject = React.createClass({ getInitialState: function() { return { useDepot: false }; }, componentDidMount: function() { Projects.addProjectCreatedListener(this.handleProjectCreated); Projects.addProjectCreationFailedListener(this.handleProjectCreationFailed); }, componentWillUnmount: function() { Projects.removeProjectCreatedListener(this.handleProjectCreated); Projects.removeProjectCreationFailedListener(this.handleProjectCreationFailed); }, render: function() { var existingForm; if (this.state.useDepot) { existingForm = ( <div> <Input type='checkbox' label='Use an existing location in the depot' onChange={this.changeUseDepot} checked /> <DepotTree dirsOnly='true' onSelect={this.depotDirSelected} /> </div> ) } else { existingForm = ( <div> <Input type='checkbox' label='Use an existing location in the depot' onChange={this.changeUseDepot} /> </div> ); } return ( <Panel> <Row> <Col md={6}> <h3> Create Project </h3> </Col> <Col md={6}> </Col> </Row> <Row> <Col md={12}> <form onSubmit={this.handleFormSubmit}> <Input ref='name' type='text' label='Name' placeholder='Enter Name (required)' /> <Input ref='description' type='textarea' label='Description' placeholder='Enter Description (optional)' /> {existingForm} <ButtonInput className='pull-right' type='submit' value='Create' /> </form> </Col> </Row> </Panel> ); }, handleFormSubmit: function(event) { // TODO we likely want to update local state and trigger validation instead // of passing values directly to the callback if (this.state.useDepot) { AppActions.createProject( this.refs.name.getValue(), this.refs.description.getValue(), "//" + this.state.depotDir.pathId.join('/') ); } else { AppActions.createProject( this.refs.name.getValue(), this.refs.description.getValue()); } event.stopPropagation(); event.preventDefault(); }, handleProjectCreated: function() { AppActions.changeLocation({ projectList: 'my' }); }, handleProjectCreationFailed: function() { alert('Oops, project creation failed!'); }, changeUseDepot: function() { this.setState({ useDepot: !this.state.useDepot }); }, depotDirSelected: function(dir) { this.setState({ depotDir: dir }); } }); module.exports = CreateProject;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15688 | Doug Scheirer |
Populate -o //guest/perforce_software/helix-web-services/... //guest/doug_scheirer/helix-web-services/.... |
||
//guest/perforce_software/helix-web-services/main/source/helix_web_components/project_management/components/CreateProject.jsx | |||||
#1 | 15622 | tjuricek |
Move source code to 'source/' subdirectory of branch. build/ will remain where it is. |
||
//guest/perforce_software/helix-web-services/main/helix_web_components/project_management/components/CreateProject.jsx | |||||
#3 | 14151 | tjuricek |
Add depot tree control and selection to the create projects page. Styling and error checking is kept to a minimum for the time being. Our goal is just internal workflow and feedback. |
||
#2 | 14020 | tjuricek | Simple project creation for the Project Management UI | ||
#1 | 13974 | tjuricek |
Moving 'ui/static' to 'helix_web_components' project, and altering some notes. Also, removed obsolete top-level Rake tasks. The "Helix Web Components" project will likely get moved elsewhere in the future. |
||
//guest/perforce_software/helix-web-services/main/ui/static/project_management/components/CreateProject.jsx | |||||
#2 | 13973 | tjuricek | Some initial documentation | ||
#1 | 13962 | tjuricek |
Add 'location' store and integrate "Jest" for unit testing. The location will trigger different views of the main ProjectManagement component. The Jest framework allows us to create headless tests of the React component logic. It's a little tricky, and right now has a dependency on node 0.10. |