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

feat: add extension management apis #3978

Merged
merged 27 commits into from
Sep 8, 2020
Merged

Conversation

tonyanziano
Copy link
Contributor

@tonyanziano tonyanziano commented Sep 2, 2020

Description

This PR modifies the current Extension / Plugin infrastructure to add support for hosting custom extension UI in Composer.

/Composer/plugins/sample-ui-plugin/ includes a README.md with instructions on how to author one of these extensions with custom UI, as well as how to enable the plugin so that a user can experiment with the sample.

Task Item

refs #3991
refs #3997

Screenshots

Plugin management page (these are built-in / 1P plugins, so they can't be disabled or removed for now)

plugin-pr-1

Sample of a page plugin

plugin-pr-2

Sample of a publish plugin

plugin-pr-3

Comment on lines +16 to +19
const { fetchPlugins } = useRecoilValue(dispatcherState);
useEffect(() => {
fetchPlugins();
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a better place in the app to perform these client-side "on startup go and fetch some data" tasks?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think so. This seems to be the right place. We could make an action like bootstrapApplication() or something that other initialization code can go.

interface PublishAPI {
setConfigIsValid?: (valid: boolean) => void;
setPublishConfig?: (config: PublishConfig) => void;
useConfigBeingEdited?: (() => PublishConfig[]) | (() => void);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

could probably give this a better name

iconName: p.icon ?? 'StatusCircleQuestionMark',
labelName: p.label,
exact: true,
disabled: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

could possibly add some logic to the extension config here that says:

{
  "views": {
    "page": {
      "label": "Sample UI Plugin",
      ...
      "enabled": <some-condition>,
    }
  }
}

where <some-condition> could be something like "botProjectOpen" or another special Composer state that extensions can key off of.

@coveralls
Copy link

coveralls commented Sep 3, 2020

Coverage Status

Coverage decreased (-1.1%) to 55.622% when pulling 03f69bd on toanzian/feat/extensions into 664addc on main.

@a-b-r-o-w-n a-b-r-o-w-n marked this pull request as ready for review September 4, 2020 15:44
@a-b-r-o-w-n a-b-r-o-w-n changed the title feature: Support for Custom Extension UI feat: add extension management apis Sep 8, 2020
bundles: this.processBundles(pluginPath, packageJson.composer?.bundles ?? []),
contributes: packageJson.composer?.contributes,
});
this.manifest.updateExtensionConfig(name, getExtensionMetadata(pluginPath, packageJson));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice 👍 -- much cleaner

Copy link
Contributor Author

@tonyanziano tonyanziano left a comment

Choose a reason for hiding this comment

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

LGTM! 🚢

@a-b-r-o-w-n a-b-r-o-w-n merged commit dc986de into main Sep 8, 2020
@a-b-r-o-w-n a-b-r-o-w-n deleted the toanzian/feat/extensions branch September 8, 2020 16:25
@cwhitten cwhitten mentioned this pull request Nov 13, 2020
lei9444 pushed a commit to lei9444/BotFramework-Composer-1 that referenced this pull request Jun 15, 2021
* Improved plugin infrastructure -- render custom UI

* Aligned sample publish plugin with new publish api

* client-plugin-lib improvements

* Minor fixes for clarity and polish

* Updated sample-ui-plugin package with docs

* Removed logs

* Updated sample-ui-plugin docs

* Guarded against removing / disabling built-in plugins

* Minor fixes

* Linting

* Comment update

* More linting

* Added licenses and removed a comment.

* minor cleanup

* hide plugins page in client

* rename extension-manifest to just extensions

* run npm commands in a safe manner

* prettify extensions.json

* make PluginManager a singleton

* only spawn npm commands

Co-authored-by: Andy Brown <asbrown002@gmail.com>
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.

3 participants