mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
46 lines
1002 B
TypeScript
46 lines
1002 B
TypeScript
import { defineModule } from '@/modules/define';
|
|
import InsightsOverview from './routes/overview.vue';
|
|
import InsightsDashboard from './routes/dashboard.vue';
|
|
import InsightsPanelConfiguration from './routes/panel-configuration.vue';
|
|
|
|
export default defineModule({
|
|
id: 'insights',
|
|
name: '$t:insights',
|
|
icon: 'dashboard',
|
|
routes: [
|
|
{
|
|
name: 'insights-overview',
|
|
path: '',
|
|
component: InsightsOverview,
|
|
},
|
|
{
|
|
name: 'insights-dashboard',
|
|
path: ':primaryKey',
|
|
component: InsightsDashboard,
|
|
props: true,
|
|
children: [
|
|
{
|
|
name: 'panel-detail',
|
|
path: ':panelKey',
|
|
props: true,
|
|
components: {
|
|
detail: InsightsPanelConfiguration,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
order: 20,
|
|
preRegisterCheck(user, permissions) {
|
|
const admin = user.role.admin_access;
|
|
|
|
if (admin) return true;
|
|
|
|
const permission = permissions.find(
|
|
(permission) => permission.collection === 'directus_dashboards' && permission.action === 'read'
|
|
);
|
|
|
|
return !!permission;
|
|
},
|
|
});
|