Skip to content

Commit 183048f

Browse files
committed
Update Registry Viewer after add/remove/edit Registry
Signed-off-by: Denis Golovin [email protected]
1 parent 050ce81 commit 183048f

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/componentTypesView.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,7 @@ export class ComponentTypesView implements TreeDataProvider<ComponentType> {
245245
const newRegistry = await OdoImpl.Instance.addRegistry(regName, regURL, token);
246246
ComponentTypesView.instance.addRegistry(newRegistry);
247247

248-
if (registryContext) {
249-
void ComponentTypesView.openRegistryInWebview();
250-
}
248+
RegistryViewLoader.refresh();
251249
}
252250

253251
@vsCommand('openshift.componentTypesView.registry.remove')
@@ -260,6 +258,7 @@ export class ComponentTypesView implements TreeDataProvider<ComponentType> {
260258
if (yesNo === 'Yes') {
261259
await OdoImpl.Instance.removeRegistry(registry.Name);
262260
ComponentTypesView.instance.removeRegistry(registry);
261+
RegistryViewLoader.refresh();
263262
}
264263
}
265264

src/webview/devfile-registry/app/home.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,12 @@ export const Home: React.FC<DefaultProps> = ({ }) => {
7373
setCompDescriptions(message.data.compDescriptions);
7474
setRegistries(message.data.registries);
7575
setFilteredcompDescriptions(getFilteredCompDesc(message.data.registries, message.data.compDescriptions, searchValue));
76-
7776
}
77+
} else if (message.data.action === 'loadingComponents') {
78+
setError('');
79+
setFilteredcompDescriptions([]);
80+
setCompDescriptions([]);
81+
setSearchValue('');
7882
}
7983
});
8084
});

src/webview/devfile-registry/registryViewLoader.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ export default class RegistryViewLoader {
107107
static async closeRegistryInWebview(): Promise<void> {
108108
panel?.dispose();
109109
}
110+
111+
static refresh(): void {
112+
if(panel) {
113+
panel.webview.postMessage({action: 'loadingComponents' });
114+
getAllComponents('getAllComponents');
115+
}
116+
}
110117
}
111118

112119
function getAllComponents(eventActionName: string) {

0 commit comments

Comments
 (0)