compare model functions

This commit is contained in:
Jan Prochazka
2021-11-07 20:54:16 +01:00
parent e3ef332881
commit acbc2ea268
3 changed files with 28 additions and 4 deletions

View File

@@ -61,12 +61,37 @@
showSnackbarSuccess(`Saved to archive ${resp.data.archiveFolder}`);
};
const handleCompareWithCurrentDb = () => {
openNewTab(
{
title: 'Compare',
icon: 'img compare',
tabComponent: 'CompareModelTab',
},
{
editor: {
sourceConid: _.get($currentDatabase, 'connection._id'),
sourceDatabase: _.get($currentDatabase, 'name'),
targetConid: _.get(connection, '_id'),
targetDatabase: name,
},
}
);
};
return [
{ onClick: handleNewQuery, text: 'New query', isNewQuery: true },
{ onClick: handleImport, text: 'Import' },
{ onClick: handleExport, text: 'Export' },
{ onClick: handleSqlGenerator, text: 'SQL Generator' },
{ onClick: handleExportModel, text: 'Export DB model' },
_.get($currentDatabase, 'connection._id') &&
(_.get($currentDatabase, 'connection._id') != _.get(connection, '_id') ||
(_.get($currentDatabase, 'connection._id') == _.get(connection, '_id') &&
_.get($currentDatabase, 'name') != _.get(connection, 'name'))) && {
onClick: handleCompareWithCurrentDb,
text: `Compare with ${_.get($currentDatabase, 'name')}`,
},
_.get($currentDatabase, 'connection._id') == _.get(connection, '_id') &&
_.get($currentDatabase, 'name') == name && { onClick: handleDisconnect, text: 'Disconnect' },

View File

@@ -160,7 +160,8 @@ registerCommand({
id: 'new.modelCompare',
category: 'New',
icon: 'img compare',
name: 'Compare DB Models',
name: 'Compare DB',
toolbar: true,
onClick: () => {
openNewTab({
title: 'Compare',

View File

@@ -1,6 +1,4 @@
<script lang="ts" context="module">
export const matchingProps = [];
const getCurrentEditor = () => getActiveComponent('CompareModelTab');
registerCommand({
@@ -205,7 +203,7 @@
$: changeTab(tabid, tab => ({
...tab,
title: $values?.targetDatabase,
title: `${$values?.sourceDatabase || '???'}=>${$values?.targetDatabase || '???'}`,
props: {
...tab.props,
conid: $values?.targetConid,