mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -06:00
* Update TeamSettings.tsx * Update navModel.ts * Update ChangePasswordForm.tsx * Update UserProfileEditForm.tsx * Update DashboardImportPage.tsx * Update uploadDashboardDirective.ts * Update ImportDashboardForm.tsx * Update ImportDashboardOverview.tsx * Update validation.ts * Update PlaylistEditPage.tsx * ui text edits * text edits * Update buildCategories.ts * text edits * text edits * Fix formatting * Update test snapshots Co-authored-by: dsotirakis <sotirakis.dim@gmail.com>
65 lines
1.3 KiB
TypeScript
65 lines
1.3 KiB
TypeScript
import { FolderDTO } from 'app/types';
|
|
import { NavModelItem, NavModel } from '@grafana/data';
|
|
|
|
export function buildNavModel(folder: FolderDTO): NavModelItem {
|
|
const model = {
|
|
icon: 'folder',
|
|
id: 'manage-folder',
|
|
subTitle: 'Manage folder dashboards and permissions',
|
|
url: '',
|
|
text: folder.title,
|
|
breadcrumbs: [{ title: 'Dashboards', url: 'dashboards' }],
|
|
children: [
|
|
{
|
|
active: false,
|
|
icon: 'apps',
|
|
id: `folder-dashboards-${folder.uid}`,
|
|
text: 'Dashboards',
|
|
url: folder.url,
|
|
},
|
|
],
|
|
};
|
|
|
|
if (folder.canAdmin) {
|
|
model.children.push({
|
|
active: false,
|
|
icon: 'lock',
|
|
id: `folder-permissions-${folder.uid}`,
|
|
text: 'Permissions',
|
|
url: `${folder.url}/permissions`,
|
|
});
|
|
}
|
|
|
|
if (folder.canSave) {
|
|
model.children.push({
|
|
active: false,
|
|
icon: 'cog',
|
|
id: `folder-settings-${folder.uid}`,
|
|
text: 'Settings',
|
|
url: `${folder.url}/settings`,
|
|
});
|
|
}
|
|
|
|
return model;
|
|
}
|
|
|
|
export function getLoadingNav(tabIndex: number): NavModel {
|
|
const main = buildNavModel({
|
|
id: 1,
|
|
uid: 'loading',
|
|
title: 'Loading',
|
|
url: 'url',
|
|
canSave: true,
|
|
canEdit: true,
|
|
canAdmin: true,
|
|
version: 0,
|
|
});
|
|
|
|
main.children![tabIndex].active = true;
|
|
|
|
return {
|
|
main: main,
|
|
node: main.children![tabIndex],
|
|
};
|
|
}
|