Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • beat/beat.editor
1 result
Show changes
Commits on Source (6)
...@@ -64,10 +64,13 @@ def editor(ctx): ...@@ -64,10 +64,13 @@ def editor(ctx):
type=click.STRING) type=click.STRING)
@click.option('--cache', '-c', help='Overrides the cache prefix. If not set, use the value from your RC file, otherwise defaults to `<prefix>/%(cache)s\'', @click.option('--cache', '-c', help='Overrides the cache prefix. If not set, use the value from your RC file, otherwise defaults to `<prefix>/%(cache)s\'',
type=click.STRING) type=click.STRING)
@click.option('--port', help='Overrides the port that the beat.editor server will listen on. By default will listen on port 5000.',
default=5000,
type=click.INT)
@verbosity_option() @verbosity_option()
@click.pass_context @click.pass_context
@raise_on_error @raise_on_error
def serve(ctx, dev, debug, prefix, cache): def serve(ctx, dev, debug, prefix, cache, port):
'''Run Flask server '''Run Flask server
To run the development server add option --dev To run the development server add option --dev
...@@ -127,6 +130,6 @@ def serve(ctx, dev, debug, prefix, cache): ...@@ -127,6 +130,6 @@ def serve(ctx, dev, debug, prefix, cache):
if not dev: if not dev:
import webbrowser import webbrowser
webbrowser.open('http://localhost:5000') webbrowser.open('http://localhost:{}'.format(port))
return app.run(debug=debug) return app.run(debug=debug, port=port)
...@@ -12,6 +12,7 @@ import { ...@@ -12,6 +12,7 @@ import {
Input, Input,
InputGroupAddon, InputGroupAddon,
InputGroup, InputGroup,
Button,
} from 'reactstrap'; } from 'reactstrap';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
...@@ -100,7 +101,7 @@ export class EntityDetail extends React.Component<Props, State> { ...@@ -100,7 +101,7 @@ export class EntityDetail extends React.Component<Props, State> {
const usern = segs.shift(); const usern = segs.shift();
const expn = segs.pop(); const expn = segs.pop();
const tcn = segs.join('/'); const tcn = segs.join('/');
expName = <span>{ usern }/<Link to={`/toolchain/${ tcn }`}>{ tcn }</Link>/{ expn }</span> expName = <span>{ usern }/<Link to={`/toolchain/${ tcn }`}>{ tcn }</Link>/{ expn }</span>;
} }
return ( return (
<Container> <Container>
...@@ -121,10 +122,26 @@ export class EntityDetail extends React.Component<Props, State> { ...@@ -121,10 +122,26 @@ export class EntityDetail extends React.Component<Props, State> {
<InputGroup> <InputGroup>
<InputGroupAddon addonType='prepend'>Path:</InputGroupAddon> <InputGroupAddon addonType='prepend'>Path:</InputGroupAddon>
<Input <Input
id='objectPath'
readOnly readOnly
width='80' width='80'
value={`${ this.props.prefix }/${ pluralize(this.props.entity) }/${ name }`} value={`${ this.props.prefix }/${ pluralize(this.props.entity) }/${ name }`}
/> />
<InputGroupAddon addonType='append'>
<Button
outline
color='secondary'
title={`Copy the object's path to the clipboard`}
onClick={(e) => {
const toCopy = document.querySelector('#objectPath');
toCopy.select();
document.execCommand('copy');
}}
>
{/*UTF8 char for the clipboard: 📋*/}
Copy Path
</Button>
</InputGroupAddon>
</InputGroup> </InputGroup>
</Col> </Col>
</Row> </Row>
......
...@@ -349,7 +349,7 @@ export default class ParameterCreate extends React.Component<Props, State> { ...@@ -349,7 +349,7 @@ export default class ParameterCreate extends React.Component<Props, State> {
value={true} value={true}
onChange={(e) => updateParameter(name, { onChange={(e) => updateParameter(name, {
...param, ...param,
default: JSON.parse(e.target.value) default: true
})} })}
/> />
True True
...@@ -364,7 +364,7 @@ export default class ParameterCreate extends React.Component<Props, State> { ...@@ -364,7 +364,7 @@ export default class ParameterCreate extends React.Component<Props, State> {
value={false} value={false}
onChange={(e) => updateParameter(name, { onChange={(e) => updateParameter(name, {
...param, ...param,
default: JSON.parse(e.target.value) default: false
})} })}
/> />
False False
......
//// @flow // @flow
//import React from 'react'; import React from 'react';
//import { expect } from 'chai'; import { expect } from 'chai';
//import { mount } from 'enzyme'; import { mount } from 'enzyme';
//import sinon from 'sinon'; import sinon from 'sinon';
//import { spies } from '@test'; import { spies } from '@test';
//
//import C from './ParameterCreate.jsx'; import C from './ParameterCreate.jsx';
//
//describe.only('<ParameterCreate />', () => { describe('<ParameterCreate />', () => {
// let wrapper; let wrapper;
// const name = 'parameter'; const name = 'parameter';
// // shortcut for a func to update just the parameter obj, not the name // shortcut for a func to update just the parameter obj, not the name
// const _updateParameter = (name, p, oldName) => { const _updateParameter = (name, p, oldName) => {
// wrapper.setProps({ wrapper.setProps({
// param: p, param: p,
// }); });
// }; };
// const params = []; const params = [];
//
// afterEach(() => { afterEach(() => {
// if(wrapper && wrapper.unmount) if(wrapper && wrapper.unmount)
// wrapper.unmount(); wrapper.unmount();
// }); });
//
// it(`saves the default value of a boolean parameter`, () => { it(`saves the default value of a boolean parameter`, () => {
// let param = { let param = {
// type: '', type: '',
// default: '', default: '',
// description: '', description: '',
// }; };
// const updateParameter = sinon.spy(_updateParameter); const updateParameter = sinon.spy(_updateParameter);
//
// wrapper = mount( wrapper = mount(
// <C <C
// name={name} name={name}
// param={param} param={param}
// params={params} params={params}
// updateParameter={updateParameter} updateParameter={updateParameter}
// /> />
// ); );
//
// // sanity checks // sanity checks
// expect(wrapper.find('TypedField')).to.have.prop('name', name); expect(wrapper.find('TypedField')).to.have.prop('name', name);
//
// wrapper.find('Input.custom-select').prop('onChange')( { target: { value: 'bool' }}); wrapper.find('Input.custom-select').prop('onChange')( { target: { value: 'bool' }});
// wrapper.update(); wrapper.update();
// console.log(wrapper.props().param); expect(wrapper.props().param).to.deep.equal(
// expect(wrapper.props().param).to.deep.equal( {
// { type: 'bool',
// type: 'bool', default: '',
// default: '', description: '',
// description: '', }
// } );
// );
// wrapper.find('input[type="radio"]').at(0).simulate('change', { target: { checked: 'true' }});;
// // wrapper.find('input[type="radio"]').at(0).simulate('change', { target: { checked: 'true' }});; //wrapper.find('input[type="radio"]').at(0).simulate('change', { target: { value: 'true' }});;
// wrapper.find('input[type="radio"]').at(0).simulate('change', { target: { value: 'true' }});; wrapper.update();
// wrapper.update(); expect(wrapper.props().param).to.deep.equal({
// expect(updateParameter.args[0]).to.deep.equal([ type: 'bool',
// name, default: true,
// { description: '',
// type: 'bool', });
// default: 'true', });
// description: '', });
// }
// ]);
// });
//});