Fix multiple Query Tool, ERD title related issues.

pull/6569/head
Aditya Toshniwal 2023-07-13 20:06:24 +05:30
parent de7eb73867
commit 4676961fc4
6 changed files with 13 additions and 11 deletions

View File

@ -21,7 +21,7 @@ import CustomPropTypes from '../custom_prop_types';
import { SelectRefresh } from '../components/SelectRefresh';
/* Control mapping for form view */
function MappedFormControlBase({ type, value, id, onChange, className, visible, inputRef, noLabel, onClick, ...props }) {
function MappedFormControlBase({ type, value, id, onChange, className, visible, inputRef, noLabel, onClick, withContainer, controlGridBasis, ...props }) {
const name = id;
const onTextChange = useCallback((e) => {
let val = e;
@ -61,6 +61,7 @@ function MappedFormControlBase({ type, value, id, onChange, className, visible,
case 'switch':
return <FormInputSwitch name={name} value={value}
onChange={(e) => onTextChange(e.target.checked, e.target.name)} className={className}
withContainer={withContainer} controlGridBasis={controlGridBasis}
{...props} />;
case 'checkbox':
return <FormInputCheckbox name={name} value={value}
@ -106,7 +107,9 @@ MappedFormControlBase.propTypes = {
visible: PropTypes.bool,
inputRef: CustomPropTypes.ref,
noLabel: PropTypes.bool,
onClick: PropTypes.func
onClick: PropTypes.func,
withContainer: PropTypes.bool,
controlGridBasis: PropTypes.number
};
/* Control mapping for grid cell view */

View File

@ -1042,11 +1042,10 @@ InputColor.propTypes = {
};
export function FormInputColor({
hasError, required, className, label, helpMessage, testcid, withContainer, controlGridBasis, ...props }) {
hasError, required, className, label, helpMessage, testcid, ...props }) {
return (
<FormInput required={required} label={label} error={hasError} className={className} helpMessage={helpMessage} testcid={testcid}
withContainer={withContainer} controlGridBasis={controlGridBasis}>
<FormInput required={required} label={label} error={hasError} className={className} helpMessage={helpMessage} testcid={testcid}>
<InputColor {...props} />
</FormInput>
);
@ -1057,9 +1056,7 @@ FormInputColor.propTypes = {
className: CustomPropTypes.className,
label: PropTypes.string,
helpMessage: PropTypes.string,
testcid: PropTypes.string,
withContainer: PropTypes.bool,
controlGridBasis: PropTypes.number,
testcid: PropTypes.string
};
export function PlainString({ controlProps, value }) {

View File

@ -961,7 +961,7 @@ class ERDTool extends React.Component {
return (
<Box ref={this.containerRef} height="100%">
<ConnectionBar status={this.state.conn_status} bgcolor={this.props.params.bgcolor}
fgcolor={this.props.params.fgcolor} title={this.props.params.title}/>
fgcolor={this.props.params.fgcolor} title={_.unescape(this.props.params.title)}/>
<MainToolBar preferences={this.state.preferences} eventBus={this.eventBus}
fillColor={this.state.fill_color} textColor={this.state.text_color}
notation={this.state.cardinality_notation} onNotationChange={this.onNotationChange}

View File

@ -331,7 +331,7 @@ export default class SQLEditor {
queryToolForm +=`
</form>
<script>
document.getElementById("title").value = "${_.escape(panel_title.replace('\\', '\\\\'))}";
document.getElementById("title").value = "${_.escape(panel_title)}";
document.getElementById("queryToolForm").submit();
</script>
`;

View File

@ -95,6 +95,7 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
connection_status_msg: '',
params: {
...params,
title: _.unescape(params.title),
is_query_tool: params.is_query_tool == 'true' ? true : false,
node_name: retrieveNodeName(selectedNodeInfo),
},
@ -684,6 +685,7 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
database: {
_id: selectedConn.did,
label: selectedConn.database_name,
_label: selectedConn.database_name,
},
};

View File

@ -15,7 +15,7 @@ import Notify from '../../../../static/js/helpers/Notifier';
const pgAdmin = pgWindow.pgAdmin;
export function getDatabaseLabel(parentData) {
return parentData.database ? parentData.database.label
return parentData.database ? parentData.database._label
: parentData.server?.db;
}