Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #410

Merged
merged 29 commits into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
893c035
improve ESLint rules
akphi Aug 12, 2021
34cb08b
fix some dev scripts
akphi Aug 12, 2021
589c28a
document and cleanup for auto re-authenticate mechanism using iframe
akphi Aug 12, 2021
ce1c0f3
avoid exposing Engine in graph manager
akphi Aug 12, 2021
d294e3f
cleanup initialization in Legend Query
akphi Aug 12, 2021
9f2f9ed
rename init to initialize
akphi Aug 12, 2021
8faeffe
rename init to initialize (part 2)
akphi Aug 12, 2021
c24aaa1
encapsulate to remove direct reference to window.location and history…
akphi Aug 13, 2021
09138db
improve error message for url builder
akphi Aug 13, 2021
4f73f0b
minor fix to WebAppicationNavigator
akphi Aug 13, 2021
ccf418a
cleanup test
akphi Aug 13, 2021
6a6f1bd
minor test cleanups
akphi Aug 13, 2021
8520bbf
introduce AbstractLogger
akphi Aug 13, 2021
b4967e9
get rid of the usage of 'public' access modifier as it is implied
akphi Aug 13, 2021
3967dfc
rework Logger (part 1)
akphi Aug 13, 2021
ee29616
reorganize log event
akphi Aug 14, 2021
9df062f
reorganize log event
akphi Aug 14, 2021
3c93d6f
modularize logger
akphi Aug 14, 2021
b4bc796
reorganize log event (part 2)
akphi Aug 14, 2021
fb26881
move logic from Mapping to MappingHelper
akphi Aug 15, 2021
11d3cdb
bump dependencies
akphi Aug 15, 2021
5944550
minor cleanup
akphi Aug 15, 2021
c5008ed
cleanup @finos/legend-studio-components
akphi Aug 15, 2021
3df588c
remove usage of react-split-pane
akphi Aug 16, 2021
9de908b
bump dependencies
akphi Aug 16, 2021
684fc77
add changeset
akphi Aug 16, 2021
3fef3eb
fix test
akphi Aug 16, 2021
6eb53b1
minor fix to logger
akphi Aug 16, 2021
806181c
require LogEvent instead of log event name as first argument for logger
akphi Aug 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/big-kangaroos-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/legend-studio-shared': patch
---

Improve error message in URL builder for case where base URL is not specified and a non-absolute URL is provided.
14 changes: 14 additions & 0 deletions .changeset/dirty-jeans-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@finos/eslint-plugin-legend-studio': patch
'@finos/legend-query-app': patch
'@finos/legend-studio': patch
'@finos/legend-studio-app': patch
'@finos/legend-studio-components': patch
'@finos/legend-studio-manual-tests': patch
'@finos/legend-studio-network': patch
'@finos/legend-studio-plugin-management': patch
'@finos/legend-studio-plugin-tracer-zipkin': patch
'@finos/legend-studio-preset-dsl-text': patch
'@finos/legend-studio-preset-query-builder': patch
'@finos/legend-studio-shared': patch
---
5 changes: 5 additions & 0 deletions .changeset/five-files-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/legend-studio-shared': patch
---

Make `Logger` requires `LogEvent` instead of log event name as the first argument. This will make logger implementation more extensible as we can support features like `channel`, `timestamp`, etc.
5 changes: 5 additions & 0 deletions .changeset/neat-fireants-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/legend-studio': patch
---

No longer make engine re-authentication use SDLC authorize endpoint as this is very situational depending on the deployment context and how the servers are set up. We make this configurable instead.
5 changes: 5 additions & 0 deletions .changeset/ninety-moose-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/eslint-plugin-legend-studio': patch
---

Fix a problem with rules incorrectly scanning the protocol version due to the overly relaxed regex pattern.
14 changes: 14 additions & 0 deletions .changeset/shy-pianos-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@finos/eslint-plugin-legend-studio': patch
'@finos/legend-query-app': patch
'@finos/legend-studio': patch
'@finos/legend-studio-app': patch
'@finos/legend-studio-components': patch
'@finos/legend-studio-manual-tests': patch
'@finos/legend-studio-network': patch
'@finos/legend-studio-plugin-management': patch
'@finos/legend-studio-plugin-tracer-zipkin': patch
'@finos/legend-studio-preset-dsl-text': patch
'@finos/legend-studio-preset-query-builder': patch
'@finos/legend-studio-shared': patch
---
5 changes: 5 additions & 0 deletions .changeset/tricky-camels-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/eslint-plugin-legend-studio': patch
---

Enforce new lint rule to disallow importing hidden/unexposed exports from other modules.
5 changes: 5 additions & 0 deletions .changeset/wild-pots-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/legend-studio-network': patch
---

Document the auto re-authentication feature using `<iframe>`. Due to its situational usage, we realise that we should also rename the config for it.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
"@finos/legend-studio-dev-utils": "workspace:*",
"@finos/stylelint-config-legend-studio": "workspace:*",
"@juggle/resize-observer": "3.3.1",
"@types/jest": "27.0.0",
"@types/node": "16.4.14",
"@types/jest": "27.0.1",
"@types/node": "16.6.1",
"chalk": "4.1.2",
"cross-env": "7.0.3",
"eslint": "7.32.0",
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin/src/configs/recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ const STUDIO_RULES = {
'@finos/legend-studio/enforce-protocol-file-prefix': ERROR,
'@finos/legend-studio/no-cross-protocol-version-import': ERROR,
'@finos/legend-studio/no-cross-workspace-source-import': ERROR,
'@finos/legend-studio/no-cross-workspace-unexposed-import': ERROR,
'@finos/legend-studio/no-same-workspace-index-import': ERROR,
};

Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
'enforce-protocol-export-prefix': require('./rules/enforce-protocol-export-prefix'),
'enforce-protocol-file-prefix': require('./rules/enforce-protocol-file-prefix'),
'no-cross-protocol-version-import': require('./rules/no-cross-protocol-version-import'),
'no-cross-workspace-unexposed-import': require('./rules/no-cross-workspace-unexposed-import'),
'no-cross-workspace-source-import': require('./rules/no-cross-workspace-source-import'),
'no-same-workspace-index-import': require('./rules/no-same-workspace-index-import'),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
const micromatch = require('micromatch');

const protocolFileMatchPattern = '**/src/models/protocols/*/v*/**';
const protocolVersionMatchPattern = /[/\\]v(?<protocolVersion>.*?)[/\\]/u;
const protocolVersionMatchPattern =
/[/\\]src[/\\]models[/\\]protocols[/\\][^/\\]+[/\\]v(?<protocolVersion>.*?)[/\\]/u;

/**
* Enforce files related to a specific protocol version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const path = require('path');
const micromatch = require('micromatch');

const protocolFileMatchPattern = '**/src/models/protocols/*/v*/**';
const protocolVersionMatchPattern = /[/\\]v(?<protocolVersion>.*?)[/\\]/u;
const protocolVersionMatchPattern =
/[/\\]src[/\\]models[/\\]protocols[/\\][^/\\]+[/\\]v(?<protocolVersion>.*?)[/\\]/u;

/**
* Enforce files related to a specific protocol version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const path = require('path');
const micromatch = require('micromatch');

const protocolFileMatchPattern = '**/src/models/protocols/*/v*/**';
const protocolVersionMatchPattern = /[/\\]v(?<protocolVersion>.*?)[/\\]/u;
const protocolVersionMatchPattern =
/[/\\]src[/\\]models[/\\]protocols[/\\][^/\\]+[/\\]v(?<protocolVersion>.*?)[/\\]/u;

/**
* Enforce files related to a specific protocol version
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Disallow importing files published in /lib from another workspace.
* We do this so one workspace may only import exports exposed deliberately by another workspace.
*/
module.exports = {
meta: {
type: 'problem',
docs: {
recommended: false,
},
},
create(context) {
return {
ImportDeclaration(node) {
if (node.source.value.includes('/lib/')) {
context.report({
node: node.source,
message: 'Do not import unexposed exports from another workspace',
});
}
},
};
},
};
5 changes: 0 additions & 5 deletions packages/legend-query-app/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ export default {
...base.setupFiles,
'<rootDir>/scripts/jest/setupTests/setupPolyfills.js',
],
moduleNameMapper: {
...base.moduleNameMapper,
'^monaco-editor$':
'@finos/legend-studio/lib/testMocks/MockedMonacoEditor.js',
},
testMatch: [
'<rootDir>/packages/legend-query-app/src/**/__tests__/**/*(*.)test.[jt]s?(x)',
],
Expand Down
4 changes: 2 additions & 2 deletions packages/legend-query-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@finos/legend-studio": "workspace:*",
"@finos/legend-studio-preset-dsl-text": "workspace:*",
"@finos/legend-studio-preset-query-builder": "workspace:*",
"@types/react": "17.0.17",
"@types/react": "17.0.18",
"react": "17.0.2"
},
"devDependencies": {
Expand All @@ -54,7 +54,7 @@
"typescript": "4.3.5",
"webpack": "5.50.0",
"webpack-bundle-analyzer": "4.4.2",
"webpack-cli": "4.7.2",
"webpack-cli": "4.8.0",
"webpack-dev-server": "4.0.0-rc.0"
}
}
2 changes: 2 additions & 0 deletions packages/legend-query-app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ import {
import { DSLText_Preset } from '@finos/legend-studio-preset-dsl-text';
import appConfig from '../query.config';
import './index.scss';
import { BrowserConsole } from '@finos/legend-studio-shared';

LegendQuery.create()
.setup({ baseUrl: appConfig.baseUrl })
.withPresets([new DSLText_Preset(), new QueryBuilder_Preset()])
.withLoggers([new BrowserConsole()])
.start()
.catch((e) => {
throw e;
Expand Down
2 changes: 1 addition & 1 deletion packages/legend-studio-app/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {
moduleNameMapper: {
...base.moduleNameMapper,
'^monaco-editor$':
'@finos/legend-studio/lib/testMocks/MockedMonacoEditor.js',
'@finos/legend-studio-components/lib/testMocks/MockedMonacoEditor.js',
},
testMatch: [
'<rootDir>/packages/legend-studio-app/src/**/__tests__/**/*(*.)test.[jt]s?(x)',
Expand Down
4 changes: 2 additions & 2 deletions packages/legend-studio-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@finos/legend-studio-preset-dsl-text": "workspace:*",
"@finos/legend-studio-preset-external-format-json-schema": "workspace:*",
"@finos/legend-studio-preset-query-builder": "workspace:*",
"@types/react": "17.0.17",
"@types/react": "17.0.18",
"react": "17.0.2"
},
"devDependencies": {
Expand All @@ -56,7 +56,7 @@
"typescript": "4.3.5",
"webpack": "5.50.0",
"webpack-bundle-analyzer": "4.4.2",
"webpack-cli": "4.7.2",
"webpack-cli": "4.8.0",
"webpack-dev-server": "4.0.0-rc.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
MOBX__disableSpyOrMock,
MOBX__enableSpyOrMock,
} from '@finos/legend-studio-shared';
import studioConfig from '../../studio.config';

class Dummy_Preset extends AbstractPreset {
constructor() {
Expand All @@ -44,7 +43,7 @@ test(integrationTest('Application can start with a dummy preset'), async () => {
MOBX__disableSpyOrMock();

application
.setup({ baseUrl: studioConfig.baseUrl })
.setup({ baseUrl: '/' })
.withPresets([new Dummy_Preset()])
.start()
.catch((e) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/legend-studio-app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { QueryBuilder_Preset } from '@finos/legend-studio-preset-query-builder';
import { DSLText_Preset } from '@finos/legend-studio-preset-dsl-text';
import { EFJSONSchema_Preset } from '@finos/legend-studio-preset-external-format-json-schema';
import studioConfig from '../studio.config';
import { BrowserConsole } from '@finos/legend-studio-shared';
import './index.scss';

LegendStudio.create()
Expand All @@ -28,6 +29,7 @@ LegendStudio.create()
new EFJSONSchema_Preset(),
new QueryBuilder_Preset(),
])
.withLoggers([new BrowserConsole()])
.start()
.catch((e) => {
throw e;
Expand Down
4 changes: 3 additions & 1 deletion packages/legend-studio-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@
"dependencies": {
"@finos/legend-studio-shared": "workspace:*",
"@material-ui/core": "4.12.3",
"@types/react": "17.0.17",
"@types/react": "17.0.18",
"@types/react-select": "4.0.17",
"@types/react-window": "1.8.5",
"clsx": "1.1.1",
"mobx": "6.3.2",
"mobx-react-lite": "3.2.0",
"monaco-editor": "0.26.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-icons": "4.2.0",
"react-reflex": "4.0.3",
"react-resize-detector": "6.7.6",
"react-select": "4.3.1",
"react-window": "1.8.6"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const configureResizablePanelComponents = (): void => {
/**
* The following block is needed to inject `react-reflex` styling during development
* as HMR makes stylesheet loaded after layout calculation, throwing off `react-reflex`
* See https://github.com/leefsmp/Re-Flex/issues/27#issuecomment-718949629
*/
// eslint-disable-next-line no-process-env
if (process.env.NODE_ENV === 'development') {
const stylesheet = document.createElement('style');
stylesheet.innerHTML = `
/* For development, this needs to be injected before stylesheet, else \`react-reflex\` panel dimension calculation will be off */
.reflex-container { height: 100%; width: 100%; }
/* NOTE: we have to leave the min dimension as \`0.1rem\` to avoid re-calculation bugs due to HMR style injection order */
.reflex-container.horizontal { flex-direction: column; min-height: 0.1rem; }
.reflex-container.vertical { flex-direction: row; min-width: 0.1rem; }
.reflex-container > .reflex-element { height: 100%; width: 100%; }
`;
document.head.prepend(stylesheet);
}
};

export const configureComponents = (): void => {
configureResizablePanelComponents();
};
Loading