mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 01:03:58 +00:00
compare model functions
This commit is contained in:
@@ -61,12 +61,37 @@
|
|||||||
showSnackbarSuccess(`Saved to archive ${resp.data.archiveFolder}`);
|
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 [
|
return [
|
||||||
{ onClick: handleNewQuery, text: 'New query', isNewQuery: true },
|
{ onClick: handleNewQuery, text: 'New query', isNewQuery: true },
|
||||||
{ onClick: handleImport, text: 'Import' },
|
{ onClick: handleImport, text: 'Import' },
|
||||||
{ onClick: handleExport, text: 'Export' },
|
{ onClick: handleExport, text: 'Export' },
|
||||||
{ onClick: handleSqlGenerator, text: 'SQL Generator' },
|
{ onClick: handleSqlGenerator, text: 'SQL Generator' },
|
||||||
{ onClick: handleExportModel, text: 'Export DB model' },
|
{ 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, 'connection._id') == _.get(connection, '_id') &&
|
||||||
_.get($currentDatabase, 'name') == name && { onClick: handleDisconnect, text: 'Disconnect' },
|
_.get($currentDatabase, 'name') == name && { onClick: handleDisconnect, text: 'Disconnect' },
|
||||||
|
|||||||
@@ -160,7 +160,8 @@ registerCommand({
|
|||||||
id: 'new.modelCompare',
|
id: 'new.modelCompare',
|
||||||
category: 'New',
|
category: 'New',
|
||||||
icon: 'img compare',
|
icon: 'img compare',
|
||||||
name: 'Compare DB Models',
|
name: 'Compare DB',
|
||||||
|
toolbar: true,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
openNewTab({
|
openNewTab({
|
||||||
title: 'Compare',
|
title: 'Compare',
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<script lang="ts" context="module">
|
<script lang="ts" context="module">
|
||||||
export const matchingProps = [];
|
|
||||||
|
|
||||||
const getCurrentEditor = () => getActiveComponent('CompareModelTab');
|
const getCurrentEditor = () => getActiveComponent('CompareModelTab');
|
||||||
|
|
||||||
registerCommand({
|
registerCommand({
|
||||||
@@ -205,7 +203,7 @@
|
|||||||
|
|
||||||
$: changeTab(tabid, tab => ({
|
$: changeTab(tabid, tab => ({
|
||||||
...tab,
|
...tab,
|
||||||
title: $values?.targetDatabase,
|
title: `${$values?.sourceDatabase || '???'}=>${$values?.targetDatabase || '???'}`,
|
||||||
props: {
|
props: {
|
||||||
...tab.props,
|
...tab.props,
|
||||||
conid: $values?.targetConid,
|
conid: $values?.targetConid,
|
||||||
|
|||||||
Reference in New Issue
Block a user