Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(UI): Admin form to edit TPA #2182

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 3 additions & 30 deletions app/packs/src/apps/admin/ThirdPartyApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,31 +227,7 @@ export default class ThirdPartyApp extends React.Component {
}
};

const handleNameChange = (event) => {
// if current errorMessage start with Name, clear it
const newState = { currentName: event.target.value };
if (this.state.errorMessage.startsWith('Name')) {
newState.errorMessage = '';
}
this.setState(newState);
};

const handleIPChange = (event) => {
const newState = { currentIP: event.target.value };
if (this.state.errorMessage.startsWith('URL')) {
newState.errorMessage = '';
}
this.setState(newState);
};

const handleFileTypesChange = (event) => {
const newFileTypes = event.target.value;
const newState = { currentFileTypes: newFileTypes };
if (this.state.errorMessage && this.state.errorMessage.startsWith('FileTypes')) {
newState.errorMessage = '';
}
this.setState(newState);
};

return (
<Modal
Expand All @@ -271,8 +247,7 @@ export default class ThirdPartyApp extends React.Component {
<FormControl
type="text"
name="Name"
value={this.state.currentName}
onChange={handleNameChange}
defaultValue={this.state.currentName}
inputRef={(ref) => { nameRef = ref; }}
/>
</Col>
Expand All @@ -286,8 +261,7 @@ export default class ThirdPartyApp extends React.Component {
<FormControl
type="text"
name="IP address"
value={this.state.currentIP}
onChange={handleIPChange}
defaultValue={this.state.currentIP}
inputRef={(ref) => { urlRef = ref; }}
/>
</Col>
Expand All @@ -301,8 +275,7 @@ export default class ThirdPartyApp extends React.Component {
<FormControl
type="text"
name="Mime types list"
value={this.state.currentFileTypes}
onChange={handleFileTypesChange}
defaultValue={this.state.currentFileTypes}
inputRef={(ref) => { fileTypesRef = ref; }}
placeholder="* or comma separated list: image/png,text..."
/>
Expand Down
Loading