EnxDev commented on code in PR #44101:
URL: https://github.com/apache/superset/pull/44101#discussion_r4329606091
##########
superset-frontend/packages/superset-core/src/index.ts:
##########
@@ -26,6 +26,7 @@ export * as menus from './menus';
export * as navigation from './navigation';
export * as sqlLab from './sqlLab';
export * as views from './views';
+export * as window from './window';
Review Comment:
Every other host namespace here has a matching subpath in the `package.json`
exports (`./views`, `./menus`, `./navigation`), but `window` doesn't, so
`import { showInformationMessage } from '@apache-superset/core/window'` won't
resolve.
Mind adding a `./window` entry next to the others?
##########
superset-frontend/src/features/home/RightMenu.tsx:
##########
@@ -521,6 +527,31 @@ const RightMenu = ({
}
});
+ const extensionSettingsItems = (settingsMenuExtension?.primary ?? [])
+ .map(menuItem => {
+ const command = commands.getCommand(menuItem.command);
+ if (!command) {
+ return null;
+ }
+ return {
+ key: `extension:${command.id}`,
+ label: command.title,
+ title: command.description,
+ onClick: () => commands.executeCommand(command.id),
Review Comment:
`executeCommand` is async and rejects when the extension's callback throws,
and nothing catches it here. A broken Settings entry just does nothing on
click, with an unhandled rejection in the console.
Could we catch it and show an error toast? The new `window.showErrorMessage`
would fit.
##########
superset-frontend/src/core/contributions.ts:
##########
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+/**
+ * Global (non-SQL-Lab-scoped) view/menu locations for extension
+ * integration. Unlike `src/SqlLab/contributions.ts`, these locations
+ * aren't declared via the manifest `contributions.views`/`contributions.menus`
+ * field -- `ViewContributions`/`MenuContributions` in `superset-core`
+ * only accept a `sqllab` scope today -- so extensions register against
Review Comment:
Nit, take it or leave it. Comments here are supposed to stay timeless, so
`today` can go.
```suggestion
* only accept a `sqllab` scope -- so extensions register against
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]