private loadHmi() { let hmi = this.projectService.getHmi(); if (hmi) { this.hmi = hmi; } if (this.hmi && this.hmi.views && this.hmi.views.length > 0) { this.startView = this.hmi.views.find(x => x.name === this.viewName); this.setBackground(); if (this.startView && this.fuxaview) { this.fuxaview.loadHmi(this.startView); } } }
// The name `constructor` is important here constructor(args, opts) { // Calling the super constructor is important so our generator is correctly set up super(args, opts) this.argument('viewName', { type: String, required: false }) if (this.options.viewName) { this.viewName = _.upperFirst(_.camelCase(this.options.viewName)) } }
async componentDidMount() { try { const data = await getFragment(this.config.queryName, this.props.id, this.config.viewName); this.setState(prevState => ({ data })); } catch (error) { this.setState(prevState => ({ error })); } }
const LeftNavButton = (props) => { const handleLeftNavItemClick = (event) => { props.onClick(event, props.viewName); }; return ( <li> <Link to={props.link} onClick={handleLeftNavItemClick} > {props.label} </Link> </li> ); }
prompting() { const prompts = [] if (!this.options.viewName) { prompts.push({ type: 'input', name: 'viewName', message: 'What would like to name this View?', validate: (input) => { if (input.length <= 0) { return 'You must provide a view name' } return true } }) } return this.prompt(prompts).then((answers) => { if (answers.viewName) { this.viewName = _.upperFirst(_.camelCase(answers.viewName)) } }) }
res.status(500); } finally { res.render(viewData.viewName, viewData);
this.destinationPath(`src/views/${this.viewName}/component.js`), viewName: this.viewName this.destinationPath(`src/views/${this.viewName}/styles.scss`), viewName: this.viewName this.destinationPath(`src/views/${this.viewName}/container.js`), viewName: this.viewName this.destinationPath(`src/views/${this.viewName}/__tests__/component.test.js`), viewName: this.viewName
const RightNavButton = (props) => { const handleRightNavItemClick = (event) => { props.onClick(event, props.viewName); }; return ( <li> <Link to={props.link} onClick={handleRightNavItemClick} > {props.label} </Link> </li> ); }