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

[WIP] Allow the open source orchestra to be injected with closed source components #620

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

elstonayx
Copy link
Contributor

@elstonayx elstonayx commented Jun 4, 2020

This PR extends the functionality of the new Orchestra frontend to allow closed source components to be injected in the respective places, and to use a singular source of React and ReactRedux packages so that both the open source and the closed source can share the same package.

@coveralls
Copy link

coveralls commented Jun 5, 2020

Coverage Status

Coverage decreased (-0.01%) to 93.749% when pulling 15400d7 on orchestra-hacks into ab39b92 on master.

@@ -8,6 +8,11 @@ module.exports = override(
// the metronome design system has not been compiled before exporting.
path.resolve('node_modules/@b12/metronome'),
path.resolve('src/')
])
]),
addWebpackExternals({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes the React/ReactRedux packages from the build phase, so that all apps would rely on the global React/ReactRedux package in the global object.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this as an explanatory comment :)

@elstonayx elstonayx changed the title [WIP] Orchestra Hacks [POC] Allow the open source orchestra to be injected with closed source components Jun 8, 2020
########

Below, we'll walk through the frontend portion of the codebase written in
React.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
React.
React. Note: the current Orchestra frontend is written in Angular.js. This
document describes a currently experimental migration to React.

***********

The frontend codebase uses the create-react-app starter as the base, so as to
ease the configuration process. As of current, we use an add-on called
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ease the configuration process. As of current, we use an add-on called
ease the configuration process. We currently use an add-on called

The frontend codebase uses the create-react-app starter as the base, so as to
ease the configuration process. As of current, we use an add-on called
``customize-cra`` to customize some of the webpack features that we need, so that
we don't have to 'eject' from create-react-app just to use those functionality.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
we don't have to 'eject' from create-react-app just to use those functionality.
we don't have to 'eject' from create-react-app just to use that functionality.

``customize-cra`` to customize some of the webpack features that we need, so that
we don't have to 'eject' from create-react-app just to use those functionality.

Features that we use as of current:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Features that we use as of current:
Features that we override:


Features that we use as of current:
- ``babelInclude`` - this is to include compilation of our open-source design
system, as we do not precompile the design system before releasing an npm
Copy link
Member

@marcua marcua Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
system, as we do not precompile the design system before releasing an npm
system (`metronome`), as we do not precompile the design system before
releasing an npm

package.
- ``addWebpackExternals`` - this allows us to exclude certain packages from the
webpack compilation. Right now, we are excluding React, ReactDOM, and ReactRedux
as these packages are depended on for both the closed source portion of the
Copy link
Member

@marcua marcua Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
as these packages are depended on for both the closed source portion of the
so as to not duplicate the import of these packages in both the open and
closed source portions of the

******************************

We integrate Orchestra with our closed-source product, and we had to figure out
a way to inject closed source components in the open source world. Here are some
Copy link
Member

@marcua marcua Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
a way to inject closed source components in the open source world. Here are some
a way to inject closed source step components in the open source shell. Here is how to


We integrate Orchestra with our closed-source product, and we had to figure out
a way to inject closed source components in the open source world. Here are some
advice on how you can implement this feature.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
advice on how you can implement this feature.
implement this for your closed source step components.

The closed source portion of the codebase would be compiled, and the compiled
scripts would be included in the open source portion of the codebase. We include
these scripts programmatically, by injecting the script tags into the compiled
``index.html`` You can customize which scripts to be injected by modifying the
Copy link
Member

@marcua marcua Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...modifying the VARIABLE_NAME variable of the orchestra/settings.py file.

return render(request, 'orchestra/newindex.html')
return render(request, 'orchestra/newindex.html', {
'javascript_includes': [
_get_script_tag(static(file)) for file in ORCHESTRA_JS_INCLUDES
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will we not need css here?

@@ -0,0 +1,5 @@
ORCHESTRA_JS_INCLUDES = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

examples go in
/example_project/example_project/settings.py :)

@@ -0,0 +1,6 @@
interface Window {
orchestra?: {
tasks: React.FC<{ id: string }>;
Copy link
Member

@marcua marcua Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use a similar format to the Angular version

orchestra:
   workflows:
     workflow_slug:
         version_slug:
             step_slug:
                 Component

e.g.,
window.orchestra.workflows.example_workflow.v3.example_step = StepComponent

@marcua marcua changed the base branch from master to main June 19, 2020 13:51
@marcua marcua changed the title [POC] Allow the open source orchestra to be injected with closed source components [WIP] Allow the open source orchestra to be injected with closed source components Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants