mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-12 23:37:00 +08:00
* CB-4067 adds connection form state, service and options part * CB-4067 adds connection origin info tab to new form * CB-4067 adds SSH part * CB-4067 adds driver properties part * CB-4067 changes driverId and submitType location for connection form * CB-4067 adds SSL part * CB-4067 adds connection form access part * CB-4067 uses new form parts for connection form * CB-4067 resets form on open * CB-4067 fixes configure case for connection form * CB-4067 adds selected driver on edit mode form * CB-4067 reloads form when it is needed * CB-4067 adds button actions for the form * CB-4067 adds notifications on form save/error * CB-4067 fixes form ssl saving and driver properties * CB-4067 refactors some parts * CB-4067 refactors form options part so it works fine * CB-4067 fixes driver properties part * CB-4067 fixes SSH part * CB-4067 fixes SSL part * CB-4067 fixes Access part * CB-4067 refactors origin tab * CB-4067 refactors shared credentials part * CB-4067 fixes: secret providers, SSH, SSL, test - features * CB-4067 removes refactor postfix for new state, service and types * CB-4067 fixes connection test * CB-4067 cleanup * CB-4067 gets back ask credentials window and removes connectionCredentialsStateContext * CB-4067 adds translation to test connection success message * CB-4067 fixes ssh and ssl adding to networkHandlers. also fixes extra request for driver properties * CB-4067 fixes host and port for switching connections * CB-4067 removes redundant code * CB-4067 fixes exception error on retest connection + fixes SSH field key saved incorrect prop * CB-4067 cleanup testContext info * CB-4076 fixes SSH and SSL ask credentials and parameters saving for both: test and submit connection create/edit action * CB-4067 fixes access tab reminder * CB-4067 fixes handling of info message for cloud connection origin tabs * CB-4067 fixes checkboxes behavior for TE shared credentials feature * CB-4067 fixes create connection template popup SSH form * CB-4067 fixes notification for closing ask credentials popup if before we had an error of test submit * CB-6115 adds dispose API for forms * CB-6115 adds git workspace helper extension for repo recommendations * CB-4067 cleanup * CB-6115 pr fixes * CB-4067 gets back behavior with dispose connection form state * CB-4067 cleanup * СB-4067 splits states to ui and form part in access form part * СB-4067 pr fixes * CB-4067 removes config from form state * CB-4067 removes console warnings + clean up * CB-4067 moves synchronization mechanisms from ConnectionFormState to ConnectionOptionsFormPart * CB-4067 fixes bug with incorrect host or port during search or changing driverId during connection creation * CB-4067 fixes opening connection forms from different entry points so it shows consistent initial data * СB-4067 brings back saving the form * CB-4067 fixes logic of showing popup askCredentials * CB-4067 fixes origin tab name so it shows correctly + fixes unneeded loaders of resources * CB-4067 reverts isOutdated * CB-4067 fixes loading of driver properties * CB-4067 cleanup for connection access part * Revert "CB-4067 reverts isOutdated" This reverts commitecb195ee2a. * CB-4067 adds isOutdated to the parts * CB-4067 fixes origin tab info message * CB-4067 fixes driver properties state + origin info status message shows on load * CB-4067 fixes password autofill during form save * CB-4067 fixes linter * CB-4067 fixes linter * CB-4067 cleanup + fixes bug with search database host,name fields * CB-4067 linter fix * CB-4067 pr fixes * CB-4067 removes unused post handler for formstate loaded task * CB-4067 small pr fixes * CB-4067 adds setDriver + handles name autocomplete * chore: review * CB-4067 connection part correct loading * CB-4067 adds formState.state.connectionId default value * refactor: pr review * CB-4067 fixes bug with infinite loading of the origin info details * CB-4067 fix: allows askCredentials to edit fields + does not affects part state * CB-4067 resets driver properties if changed driverId * CB-4067 updates yarn lock for common-react * CB-4067 lint fix * CB-6265 fix: do not include index files for import/export eslint rules * CB-4067 fixes behavior for aksCredentials so it acts correctly during testing/saving/editing inputs for the form * CB-4067 cleanup * CB-4067 fixes connection templates initial loaded state * CB-4067 pr fixes: dialog credentials; adds todo to the ssh tab; eslint revert; cleanup * CB-4067 makes askCredentials to be part state independent * CB-4067 qa fixes: test translation + removes db name form connection name * CB-4067 adds readonly state for connection form * CB-4067 fixes application freezes on disconnect * CB-4067 fixes empty properties when switching cloud connections * CB-4067 connection is created -> connection was created * CB-4067 connection is updated -> connection was updated * CB-4067 fixes outdated logic for parts * CB-4067 build fix * CB-4067 fix: do not show askCredential popup for drivers with only anonymous access * CB-4067 removes includeCredentialsSaved * CB-4067 removes includeAuthProperties * CB-4067 removes customIncludeOptions * CB-4067 removes includeProperties * CB-4067 removes includeProviderProperties * CB-4067 removes includeNetworkHandlers * CB-4067 refactors isOutdated for originInfoPart and AccessPart * CB-4067 removes savedCredentials resource + updates CustomOptionsResource + reuses new include resources in connection form components * CB-4067 reverts spreading of new connectionInfoResources * CB-4067 fixes sharedCreds checkbox default value on form switch * CB-4067 closes connection form when layout closes * CB-4067 disposes connection form on change * CB-4067 handles closing of the connection form correctly * Revert "CB-4067 handles closing of the connection form correctly" This reverts commit3a6f1a6a0a. * CB-4067 handles closing of the connection form correctly [2] * CB-4067 fits info messages in one line * CB-4067 presaves isChanged state for form part before applying initialState to prevent bugs * CB-4067 fixes length of the error message for connection form top bar --------- Co-authored-by: Alexey <wrouds@gmail.com> Co-authored-by: mr-anton-t <42037741+mr-anton-t@users.noreply.github.com> Co-authored-by: Daria Marutkina <125263541+dariamarutkina@users.noreply.github.com>
88 lines
2.6 KiB
JavaScript
88 lines
2.6 KiB
JavaScript
/*
|
|
* CloudBeaver - Cloud Database Manager
|
|
* Copyright (C) 2020-2024 DBeaver Corp and others
|
|
*
|
|
* Licensed under the Apache License, Version 2.0.
|
|
* you may not use this file except in compliance with the License.
|
|
*/
|
|
|
|
import path from 'path';
|
|
import fs from 'fs';
|
|
|
|
export default {
|
|
meta: {
|
|
docs: {
|
|
description: 'Forbid importing .tsx files from .ts files directly, use React.lazy().',
|
|
},
|
|
},
|
|
create: function (context) {
|
|
function checkFileExtension(node) {
|
|
try {
|
|
const importerExtension = path.extname(context.filename).substring(1);
|
|
|
|
if (node.importKind === 'type' || node.exportKind === 'type' || importerExtension !== 'ts') {
|
|
return;
|
|
}
|
|
|
|
const source = node.source;
|
|
// bail if the declaration doesn't have a source, e.g. "export { foo };", or if it's only partially typed like in an editor
|
|
if (!source || !source.value) {
|
|
return;
|
|
}
|
|
|
|
const importPathWithQueryString = source.value;
|
|
const importPath = importPathWithQueryString.replace(/\?(.*)$/, '');
|
|
|
|
let resolvedPath = importPath;
|
|
|
|
if (importPath.startsWith('./') || importPath.startsWith('../')) {
|
|
resolvedPath = path.resolve(path.dirname(context.filename), importPath.replace('.js', ''));
|
|
|
|
if (path.extname(resolvedPath) === '') {
|
|
resolvedPath += '.tsx';
|
|
}
|
|
|
|
if (!fs.existsSync(resolvedPath)) {
|
|
return;
|
|
}
|
|
} // else {
|
|
// resolvedPath = pnpapi.resolveRequest(importPath, context.filename);
|
|
|
|
// if (resolvedPath === null) {
|
|
// return;
|
|
// }
|
|
|
|
// const possibleSrcFile = resolvedPath.replace('/dist/', '/src/').replace('.js', '.tsx');
|
|
// console.log(resolvedPath, possibleSrcFile);
|
|
// if (!fs.existsSync(possibleSrcFile)) {
|
|
// return;
|
|
// }
|
|
// }
|
|
|
|
if (!resolvedPath) {
|
|
return;
|
|
}
|
|
|
|
// get extension from resolved path, if possible.
|
|
// for unresolved, use source value.
|
|
const importExtension = path.extname(resolvedPath).substring(1);
|
|
|
|
if (importExtension === 'tsx') {
|
|
context.report({
|
|
node: source,
|
|
message: "Don't import/export .tsx files from .ts files directly, use React.lazy().",
|
|
});
|
|
}
|
|
} catch (e) {
|
|
console.error('@cloudbeaver/no-sync-component-import: ', e);
|
|
}
|
|
}
|
|
|
|
return {
|
|
ImportDeclaration: checkFileExtension,
|
|
ExportNamedDeclaration: checkFileExtension,
|
|
ExportAllDeclaration: checkFileExtension,
|
|
};
|
|
},
|
|
};
|