Plugins: Plugin details right panel is added. All the details were moved from thee top to the right panel (#90325)

* PluginDetailsRight panel is added. All the details were moved from the top to the right panel

* Add feature toggle pluginsDetailsRightPanel,Fix build, fix review comments

* Fix the typo

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>

* hasAccessToExplore

* changes after review, add translations

* fix betterer

* fix betterer

* fix css error

* fix betterer

* fix translation labels, fix position of the right panel

* fix the build

* add condition to show updatedAt for plugin details

* add test to check 2 new fields at plugin details right panel;

* change the gap and remove report abuse button from core plugins

* add more tests

---------

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>
This commit is contained in:
Yulia Shanyrova
2024-08-13 11:55:30 +02:00
committed by GitHub
parent bac68069e0
commit 8044cb50f1
24 changed files with 362 additions and 85 deletions

View File

@ -18,10 +18,11 @@ export async function getPluginDetails(id: string): Promise<CatalogPluginDetails
const remote = await getRemotePlugin(id);
const isPublished = Boolean(remote);
const [localPlugins, versions, localReadme] = await Promise.all([
const [localPlugins, versions, localReadme, localChangelog] = await Promise.all([
getLocalPlugins(),
getPluginVersions(id, isPublished),
getLocalPluginReadme(id),
getLocalPluginChangelog(id),
]);
const local = localPlugins.find((p) => p.id === id);
@ -35,6 +36,7 @@ export async function getPluginDetails(id: string): Promise<CatalogPluginDetails
versions,
statusContext: remote?.statusContext ?? '',
iam: remote?.json?.iam,
changelog: localChangelog || remote?.changelog,
};
}
@ -116,6 +118,20 @@ async function getLocalPluginReadme(id: string): Promise<string> {
}
}
async function getLocalPluginChangelog(id: string): Promise<string> {
try {
const markdown: string = await getBackendSrv().get(`${API_ROOT}/${id}/markdown/CHANGELOG`);
const markdownAsHtml = markdown ? renderMarkdown(markdown) : '';
return markdownAsHtml;
} catch (error) {
if (isFetchError(error)) {
error.isHandled = true;
}
return '';
}
}
export async function getLocalPlugins(): Promise<LocalPlugin[]> {
const localPlugins: LocalPlugin[] = await getBackendSrv().get(
`${API_ROOT}`,