mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 04:39:27 +08:00
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:
@ -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}`,
|
||||
|
Reference in New Issue
Block a user