Skip to content

Commit

Permalink
Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
shzlw committed Jun 6, 2019
1 parent b761745 commit 205a5c4
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 78 deletions.
127 changes: 67 additions & 60 deletions web-app/src/components/ComponentEditPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,70 +629,77 @@ class ComponentEditPanel extends React.Component {
options={jdbcDataSources}
optionDisplay={'name'}
optionValue={'id'}
/>
<div className="row">
<label className="float-left inline-text-label" style={{width: '200px'}}>
{queryTitle}
</label>
<div className="float-right">
{!showSchema && (
<button className="button" style={{marginRight: '5px'}} onClick={this.runQuery}>Run Query</button>
)}
<button className="button" onClick={this.toggleSchemaPanel}>
{schemaButtonValue}
</button>
</div>
</div>

{showSchema ? (
<div className="schema-panel">
<div>
<SearchInput
name={'searchSchemaName'}
value={searchSchemaName}
onChange={this.handleInputChange}
inputWidth={200}
/>
</div>
<div style={{marginTop: '5px'}}>
{schemaItems}
/>

{ this.state.jdbcDataSourceId !== '' && (
<React.Fragment>
<div className="row">
<label className="float-left inline-text-label" style={{width: '200px'}}>
{queryTitle}
</label>
<div className="float-right">
{!showSchema && (
<button className="button" style={{marginRight: '5px'}} onClick={this.runQuery}>Run Query</button>
)}
<button className="button" onClick={this.toggleSchemaPanel}>
{schemaButtonValue}
</button>
</div>
</div>
</div>
): (
<div>
<AceEditor
value={this.state.sqlQuery}
mode="mysql"
theme="xcode"
name="blah2"
onChange={this.handleAceEditorChange}
height={'300px'}
width={'100%'}
fontSize={15}
showPrintMargin={false}
showGutter={true}
highlightActiveLine={true}
setOptions={{
showLineNumbers: true,
tabSize: 2
}}
/>

<label style={{marginTop: '10px'}}>Result</label>
{ error ? (

<React.Fragment>
{showSchema ? (
<div className="schema-panel">
<div>
<SearchInput
name={'searchSchemaName'}
value={searchSchemaName}
onChange={this.handleInputChange}
inputWidth={200}
/>
</div>
<div style={{marginTop: '5px'}}>
{schemaItems}
</div>
</div>
): (
<div>
{error}
<AceEditor
value={this.state.sqlQuery}
mode="mysql"
theme="xcode"
name="blah2"
onChange={this.handleAceEditorChange}
height={'300px'}
width={'100%'}
fontSize={15}
showPrintMargin={false}
showGutter={true}
highlightActiveLine={true}
setOptions={{
showLineNumbers: true,
tabSize: 2
}}
/>

<label style={{marginTop: '10px'}}>Result</label>
{ error ? (
<div>
{error}
</div>
) : (
<Table
data={data}
defaultPageSize={10}
columns={columns}
/>
)}
</div>
) : (
<Table
data={data}
defaultPageSize={10}
columns={columns}
/>
)}
</div>
)}
</React.Fragment>
</React.Fragment>
)}

</div>

</div>
Expand Down
12 changes: 12 additions & 0 deletions web-app/src/components/ComponentViewPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import './ComponentViewPanel.css';
import Checkbox from './Checkbox';
import ColorPicker from './ColorPicker';
import InputRange from './filters/InputRange';
import Toast from './Toast';


const BASE_WIDTH = 1200;

Expand Down Expand Up @@ -411,6 +413,16 @@ class ComponentViewPanel extends React.Component {
const index = components.findIndex(w => w.id === selectedComponentId);
if (index !== -1) {
const selectedComponent = {...components[index]};
const {
x,
y,
width,
height
} = selectedComponent;
if (x <= 0 || y <= 0 || width < 50 || height < 50 || height > this.props.height) {
Toast.showError('Invalid position value');
return;
}
this.resizeComponentToBase(selectedComponent, gridWidth);
// Save position information and style
axios.put('/ws/component/style/', selectedComponent)
Expand Down
38 changes: 20 additions & 18 deletions web-app/src/views/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class User extends React.Component {
} = this.state;

const {
sysRole
sysRole: currentUserSysRole
} = this.props;

const mode = id === null ? 'New' : 'Edit';
Expand Down Expand Up @@ -389,7 +389,7 @@ class User extends React.Component {
)}

<label>System Role</label>
{ Constants.SYS_ROLE_ADMIN === sysRole && (
{ Constants.SYS_ROLE_ADMIN === currentUserSysRole && (
<Select
name={'sysRole'}
value={this.state.sysRole}
Expand All @@ -398,28 +398,30 @@ class User extends React.Component {
/>
)}

{ Constants.SYS_ROLE_DEVELOPER === sysRole && (
{ Constants.SYS_ROLE_DEVELOPER === currentUserSysRole && (
<div>{Constants.SYS_ROLE_VIEWER}</div>
)}

</div>
<div className="form-panel float-right" style={{width: '240px'}}>

{ Constants.SYS_ROLE_VIEWER === this.state.sysRole && (
<div className="form-panel float-right" style={{width: '240px'}}>

<label>Groups</label>
<Select
name={'userGroupId'}
value={this.state.userGroupId}
onChange={this.handleIntegerOptionChange}
options={groups}
optionDisplay={'name'}
optionValue={'id'}
/>
<button className="button" onClick={this.addUserGroup}>Add</button>
<div style={{marginTop: '8px'}}>
{userGroupItems}
<label>Groups</label>
<Select
name={'userGroupId'}
value={this.state.userGroupId}
onChange={this.handleIntegerOptionChange}
options={groups}
optionDisplay={'name'}
optionValue={'id'}
/>
<button className="button" onClick={this.addUserGroup}>Add</button>
<div style={{marginTop: '8px'}}>
{userGroupItems}
</div>
</div>
</div>

)}
</div>
<button className="button mt-3 button-green" onClick={this.save}>
<FontAwesomeIcon icon="save" size="lg" fixedWidth /> Save
Expand Down

0 comments on commit 205a5c4

Please sign in to comment.