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):
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\'',
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()
@click.pass_context
@raise_on_error
def serve(ctx, dev, debug, prefix, cache):
def serve(ctx, dev, debug, prefix, cache, port):
'''Run Flask server
To run the development server add option --dev
......@@ -127,6 +130,6 @@ def serve(ctx, dev, debug, prefix, cache):
if not dev:
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 {
Input,
InputGroupAddon,
InputGroup,
Button,
} from 'reactstrap';
import { connect } from 'react-redux';
......@@ -100,7 +101,7 @@ export class EntityDetail extends React.Component<Props, State> {
const usern = segs.shift();
const expn = segs.pop();
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 (
<Container>
......@@ -121,10 +122,26 @@ export class EntityDetail extends React.Component<Props, State> {
<InputGroup>
<InputGroupAddon addonType='prepend'>Path:</InputGroupAddon>
<Input
id='objectPath'
readOnly
width='80'
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>
</Col>
</Row>
......
......@@ -349,7 +349,7 @@ export default class ParameterCreate extends React.Component<Props, State> {
value={true}
onChange={(e) => updateParameter(name, {
...param,
default: JSON.parse(e.target.value)
default: true
})}
/>
True
......@@ -364,7 +364,7 @@ export default class ParameterCreate extends React.Component<Props, State> {
value={false}
onChange={(e) => updateParameter(name, {
...param,
default: JSON.parse(e.target.value)
default: false
})}
/>
False
......
//// @flow
//import React from 'react';
//import { expect } from 'chai';
//import { mount } from 'enzyme';
//import sinon from 'sinon';
//import { spies } from '@test';
//
//import C from './ParameterCreate.jsx';
//
//describe.only('<ParameterCreate />', () => {
// let wrapper;
// const name = 'parameter';
// // shortcut for a func to update just the parameter obj, not the name
// const _updateParameter = (name, p, oldName) => {
// wrapper.setProps({
// param: p,
// });
// };
// const params = [];
//
// afterEach(() => {
// if(wrapper && wrapper.unmount)
// wrapper.unmount();
// });
//
// it(`saves the default value of a boolean parameter`, () => {
// let param = {
// type: '',
// default: '',
// description: '',
// };
// const updateParameter = sinon.spy(_updateParameter);
//
// wrapper = mount(
// <C
// name={name}
// param={param}
// params={params}
// updateParameter={updateParameter}
// />
// );
//
// // sanity checks
// expect(wrapper.find('TypedField')).to.have.prop('name', name);
//
// wrapper.find('Input.custom-select').prop('onChange')( { target: { value: 'bool' }});
// wrapper.update();
// console.log(wrapper.props().param);
// expect(wrapper.props().param).to.deep.equal(
// {
// type: 'bool',
// default: '',
// description: '',
// }
// );
//
// // 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.update();
// expect(updateParameter.args[0]).to.deep.equal([
// name,
// {
// type: 'bool',
// default: 'true',
// description: '',
// }
// ]);
// });
//});
// @flow
import React from 'react';
import { expect } from 'chai';
import { mount } from 'enzyme';
import sinon from 'sinon';
import { spies } from '@test';
import C from './ParameterCreate.jsx';
describe('<ParameterCreate />', () => {
let wrapper;
const name = 'parameter';
// shortcut for a func to update just the parameter obj, not the name
const _updateParameter = (name, p, oldName) => {
wrapper.setProps({
param: p,
});
};
const params = [];
afterEach(() => {
if(wrapper && wrapper.unmount)
wrapper.unmount();
});
it(`saves the default value of a boolean parameter`, () => {
let param = {
type: '',
default: '',
description: '',
};
const updateParameter = sinon.spy(_updateParameter);
wrapper = mount(
<C
name={name}
param={param}
params={params}
updateParameter={updateParameter}
/>
);
// sanity checks
expect(wrapper.find('TypedField')).to.have.prop('name', name);
wrapper.find('Input.custom-select').prop('onChange')( { target: { value: 'bool' }});
wrapper.update();
expect(wrapper.props().param).to.deep.equal(
{
type: 'bool',
default: '',
description: '',
}
);
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.update();
expect(wrapper.props().param).to.deep.equal({
type: 'bool',
default: true,
description: '',
});
});
});