mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-24 09:40:21 -06:00
Fixed an issue where Generate Script button should be disabled if no objects are selected in the schema diff result. #7638
This commit is contained in:
parent
8578acd915
commit
721a5da895
@ -17,7 +17,7 @@ import { SchemaDiffEventsContext } from './SchemaDiffComponent';
|
||||
import { SCHEMA_DIFF_EVENT } from '../SchemaDiffConstants';
|
||||
|
||||
|
||||
export function InputComponent({ label, serverList, databaseList, schemaList, diff_type, selectedSid = null, selectedDid=null, selectedScid=null }) {
|
||||
export function InputComponent({ label, serverList, databaseList, schemaList, diff_type, selectedSid = null, selectedDid=null, selectedScid=null, onServerSchemaChange }) {
|
||||
|
||||
const [selectedServer, setSelectedServer] = useState(selectedSid);
|
||||
const [selectedDatabase, setSelectedDatabase] = useState(selectedDid);
|
||||
@ -35,7 +35,6 @@ export function InputComponent({ label, serverList, databaseList, schemaList, di
|
||||
setSelectedSchema(null);
|
||||
setDisableSchemaSelection(true);
|
||||
}
|
||||
|
||||
eventBus.fireEvent(SCHEMA_DIFF_EVENT.TRIGGER_SELECT_SERVER, { selectedOption, diff_type, serverList });
|
||||
};
|
||||
|
||||
@ -48,11 +47,13 @@ export function InputComponent({ label, serverList, databaseList, schemaList, di
|
||||
setDisableSchemaSelection(true);
|
||||
}
|
||||
eventBus.fireEvent(SCHEMA_DIFF_EVENT.TRIGGER_SELECT_DATABASE, {selectedServer, selectedDB, diff_type, databaseList});
|
||||
onServerSchemaChange();
|
||||
};
|
||||
|
||||
const changeSchema = (selectedSC) => {
|
||||
setSelectedSchema(selectedSC);
|
||||
eventBus.fireEvent(SCHEMA_DIFF_EVENT.TRIGGER_SELECT_SCHEMA, { selectedSC, diff_type });
|
||||
onServerSchemaChange();
|
||||
};
|
||||
|
||||
return (
|
||||
@ -125,4 +126,5 @@ InputComponent.propTypes = {
|
||||
selectedSid: PropTypes.number,
|
||||
selectedDid: PropTypes.number,
|
||||
selectedScid:PropTypes.number,
|
||||
onServerSchemaChange:PropTypes.func
|
||||
};
|
||||
|
@ -62,7 +62,7 @@ const Root = styled('div')(({theme}) => ({
|
||||
},
|
||||
}));
|
||||
|
||||
export function SchemaDiffButtonComponent({ sourceData, targetData, selectedRowIds, rows, compareParams, filterParams = [FILTER_NAME.DIFFERENT, FILTER_NAME.SOURCE_ONLY, FILTER_NAME.TARGET_ONLY] }) {
|
||||
export function SchemaDiffButtonComponent({ sourceData, targetData, selectedRowIds, onServerSchemaChange, rows, compareParams, filterParams = [FILTER_NAME.DIFFERENT, FILTER_NAME.SOURCE_ONLY, FILTER_NAME.TARGET_ONLY] }) {
|
||||
const filterRef = useRef(null);
|
||||
const compareRef = useRef(null);
|
||||
|
||||
@ -149,6 +149,7 @@ export function SchemaDiffButtonComponent({ sourceData, targetData, selectedRowI
|
||||
targetSQL: null,
|
||||
SQLdiff: null,
|
||||
});
|
||||
onServerSchemaChange();
|
||||
};
|
||||
|
||||
const generateScript = () => {
|
||||
@ -218,6 +219,7 @@ SchemaDiffButtonComponent.propTypes = {
|
||||
sourceData: PropTypes.object,
|
||||
targetData: PropTypes.object,
|
||||
selectedRowIds: PropTypes.array,
|
||||
onServerSchemaChange:PropTypes.func,
|
||||
rows: PropTypes.array,
|
||||
compareParams: PropTypes.object,
|
||||
filterParams: PropTypes.array
|
||||
|
@ -177,6 +177,10 @@ export function SchemaDiffCompare({ params }) {
|
||||
|
||||
}
|
||||
|
||||
const handleServerSchemaChange = () => {
|
||||
setSelectedRowIds([]);
|
||||
};
|
||||
|
||||
function setSourceTargetSid(diff_type, selectedOption) {
|
||||
if (diff_type == TYPE.SOURCE) {
|
||||
setSelectedSourceSid(selectedOption);
|
||||
@ -699,6 +703,7 @@ export function SchemaDiffCompare({ params }) {
|
||||
selectedDid={selectedSourceDid}
|
||||
selectedScid={selectedSourceScid}
|
||||
diff_type={TYPE.SOURCE}
|
||||
onServerSchemaChange={handleServerSchemaChange}
|
||||
></InputComponent>
|
||||
</Grid>
|
||||
<Grid item lg={5} md={5} sm={2} xs={2} sx={{ display: 'flex',flexDirection: 'row-reverse',paddingRight: '0.3rem'}}>
|
||||
@ -722,6 +727,7 @@ export function SchemaDiffCompare({ params }) {
|
||||
selectedDid={selectedTargetDid}
|
||||
selectedScid={selectedTargetScid}
|
||||
diff_type={TYPE.TARGET}
|
||||
onServerSchemaChange={handleServerSchemaChange}
|
||||
></InputComponent>
|
||||
</Grid>
|
||||
|
||||
@ -733,6 +739,7 @@ export function SchemaDiffCompare({ params }) {
|
||||
'scid': selectedSourceScid,
|
||||
}}
|
||||
selectedRowIds={selectedRowIds}
|
||||
onServerSchemaChange={handleServerSchemaChange}
|
||||
rows={apiResult}
|
||||
targetData={{
|
||||
'sid': selectedTargetSid,
|
||||
|
Loading…
Reference in New Issue
Block a user