Skip to content

Commit 4d79286

Browse files
authored
feat(extensions): add row actions to installed packages (#1558)
* feat(extensions): add row actions to installed packages * added restart alert in the installed packages tab * handle rendering issue when there are no package examples * updated translations
1 parent 8fead3f commit 4d79286

30 files changed

+1274
-552
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-marketplace-backend': patch
3+
'@red-hat-developer-hub/backstage-plugin-marketplace': patch
4+
'@red-hat-developer-hub/backstage-plugin-marketplace-common': patch
5+
---
6+
7+
added row actions to the installed packages
8+
updated disablePackage Client API to make PATCH call instead of POST

workspaces/marketplace/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
"minimatch": "3",
5151
"node-gyp": "^9.0.0",
5252
"prettier": "^3.4.2",
53-
"typescript": "~5.3.0",
54-
"yaml": "^2.8.1"
53+
"typescript": "~5.3.0"
5554
},
5655
"resolutions": {
5756
"@backstage/app-defaults": "1.6.5",

workspaces/marketplace/plugins/marketplace-common/src/api/MarketplaceBackendClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export class MarketplaceBackendClient implements MarketplaceApi {
208208
): Promise<{ status: string }> {
209209
return this.request(
210210
`/package/${encodeURIComponent(namespace)}/${encodeURIComponent(name)}/configuration/disable`,
211-
'POST',
211+
'PATCH',
212212
undefined,
213213
{ disabled },
214214
);

workspaces/marketplace/plugins/marketplace/report-alpha.api.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ readonly "button.viewDocumentation": string;
2121
readonly "button.viewInstalledPlugins": string;
2222
readonly "button.restart": string;
2323
readonly "dialog.backendRestartRequired": string;
24-
readonly "dialog.restartMessage": string;
24+
readonly "dialog.packageRestartMessage": string;
25+
readonly "dialog.pluginRestartMessage": string;
2526
readonly "header.title": string;
2627
readonly "header.extensions": string;
2728
readonly "header.catalog": string;
@@ -57,10 +58,14 @@ readonly "table.packagesCount": string;
5758
readonly "table.pluginsTable": string;
5859
readonly "metadata.about": string;
5960
readonly "metadata.highlights": string;
61+
readonly "metadata.category": string;
6062
readonly "metadata.by": string;
63+
readonly "metadata.versions": string;
6164
readonly "metadata.pluginNotFound": string;
6265
readonly "metadata.publisher": string;
6366
readonly "metadata.supportProvider": string;
67+
readonly "metadata.entryName": string;
68+
readonly "metadata.bySomeone": string;
6469
readonly "role.backend": string;
6570
readonly "role.backendModule": string;
6671
readonly "role.frontend": string;
@@ -91,6 +96,8 @@ readonly "install.instructions": string;
9196
readonly "install.editInstructions": string;
9297
readonly "install.back": string;
9398
readonly "install.packageUpdated": string;
99+
readonly "install.packageEnabled": string;
100+
readonly "install.packageDisabled": string;
94101
readonly "install.errors.missingPluginsList": string;
95102
readonly "install.errors.missingPackageItem": string;
96103
readonly "install.errors.missingPackageField": string;
@@ -103,10 +110,17 @@ readonly "installedPackages.table.columns.role": string;
103110
readonly "installedPackages.table.columns.name": string;
104111
readonly "installedPackages.table.columns.actions": string;
105112
readonly "installedPackages.table.tooltips.enableActions": string;
113+
readonly "installedPackages.table.tooltips.noDownloadPermissions": string;
114+
readonly "installedPackages.table.tooltips.noEditPermissions": string;
115+
readonly "installedPackages.table.tooltips.noTogglePermissions": string;
116+
readonly "installedPackages.table.tooltips.editPackage": string;
117+
readonly "installedPackages.table.tooltips.downloadPackage": string;
118+
readonly "installedPackages.table.tooltips.enablePackage": string;
119+
readonly "installedPackages.table.tooltips.disablePackage": string;
106120
readonly "installedPackages.table.emptyMessages.noResults": string;
107121
readonly "installedPackages.table.emptyMessages.noRecords": string;
108-
readonly "status.installed": string;
109122
readonly "status.notInstalled": string;
123+
readonly "status.installed": string;
110124
readonly "status.disabled": string;
111125
readonly "status.partiallyInstalled": string;
112126
readonly "status.updateAvailable": string;
@@ -119,10 +133,12 @@ readonly "alert.installationDisabled": string;
119133
readonly "alert.extensionsExample": string;
120134
readonly "alert.singlePluginRestart": string;
121135
readonly "alert.multiplePluginRestart": string;
136+
readonly "alert.singlePackageRestart": string;
137+
readonly "alert.multiplePackageRestart": string;
122138
readonly "alert.restartRequired": string;
123139
readonly "alert.backendRestartRequired": string;
124-
readonly "alert.backendRestartMessage": string;
125140
readonly "alert.viewPlugins": string;
141+
readonly "alert.viewPackages": string;
126142
readonly "common.close": string;
127143
readonly "common.links": string;
128144
readonly "common.by": string;
@@ -135,6 +151,7 @@ readonly "plugin.version": string;
135151
readonly "plugin.author": string;
136152
readonly "plugin.installation": string;
137153
readonly "plugin.configuration": string;
154+
readonly "plugin.authors": string;
138155
readonly "plugin.description": string;
139156
readonly "plugin.documentation": string;
140157
readonly "plugin.repository": string;
@@ -160,8 +177,11 @@ readonly "actions.actions": string;
160177
readonly "actions.edit": string;
161178
readonly "actions.editConfiguration": string;
162179
readonly "actions.pluginConfigurations": string;
180+
readonly "actions.packageConfiguration": string;
163181
readonly "actions.pluginCurrentlyEnabled": string;
164182
readonly "actions.pluginCurrentlyDisabled": string;
183+
readonly "actions.packageCurrentlyEnabled": string;
184+
readonly "actions.packageCurrentlyDisabled": string;
165185
readonly "actions.installTitle": string;
166186
readonly "actions.editTitle": string;
167187
readonly "tooltips.productionDisabled": string;

workspaces/marketplace/plugins/marketplace/src/components/InstallationContext.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ export type InstallationType = { [pluginName: string]: string };
1919

2020
type InstallationContextType = {
2121
installedPlugins: InstallationType;
22+
installedPackages: InstallationType;
23+
setInstalledPackages: (plugins: InstallationType) => void;
2224
setInstalledPlugins: (plugins: InstallationType) => void;
2325
};
2426

2527
export const InstallationContext = createContext<InstallationContextType>({
2628
installedPlugins: {},
29+
installedPackages: {},
30+
setInstalledPackages: () => {},
2731
setInstalledPlugins: () => {},
2832
});
2933

@@ -37,13 +41,23 @@ export const InstallationContextProvider = ({
3741
const [installedPlugins, setInstalledPlugins] = useState<InstallationType>(
3842
{},
3943
);
44+
const [installedPackages, setInstalledPackages] = useState<InstallationType>(
45+
{},
46+
);
4047

4148
const installationContexttProviderValue = useMemo(
4249
() => ({
4350
installedPlugins,
51+
installedPackages,
52+
setInstalledPackages,
4453
setInstalledPlugins,
4554
}),
46-
[installedPlugins, setInstalledPlugins],
55+
[
56+
installedPlugins,
57+
installedPackages,
58+
setInstalledPlugins,
59+
setInstalledPackages,
60+
],
4761
);
4862
return (
4963
<InstallationContext.Provider value={installationContexttProviderValue}>

workspaces/marketplace/plugins/marketplace/src/components/InstalledPackages/InstalledPackagesTable.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ import { InstalledPackagesTable } from './InstalledPackagesTable';
2626
import { errorApiRef } from '@backstage/core-plugin-api';
2727
import { translationApiRef } from '@backstage/core-plugin-api/alpha';
2828

29+
jest.mock('@backstage/core-plugin-api', () => ({
30+
...jest.requireActual('@backstage/core-plugin-api'),
31+
useRouteRef: () => (params: any) =>
32+
`/packages/${params.namespace}/${params.name}`,
33+
}));
34+
2935
describe('InstalledPackagesTable', () => {
3036
const renderWithProviders = (apis: any) =>
3137
render(

0 commit comments

Comments
 (0)