Fix panel registration

This commit is contained in:
rijkvanzanten
2021-06-23 19:22:49 -04:00
parent fc7356b4a7
commit f9fba64154
3 changed files with 11 additions and 7 deletions

View File

@@ -6,13 +6,13 @@ import { PanelConfig } from './types';
const { panelsRaw } = getPanels();
export async function registerPanels(app: App): Promise<void> {
const interfaceModules = import.meta.globEager('./*/**/index.ts');
const panelModules = import.meta.globEager('./*/**/index.ts');
const panels: PanelConfig[] = Object.values(interfaceModules).map((module) => module.default);
const panels: PanelConfig[] = Object.values(panelModules).map((module) => module.default);
try {
const customPanels: { default: PanelConfig[] } = import.meta.env.DEV
? await import('@directus-extensions-interface')
? await import('@directus-extensions-panel')
: await import(/* @vite-ignore */ `${getRootPath()}extensions/panels/index.js`);
panels.push(...customPanels.default);
@@ -24,10 +24,10 @@ export async function registerPanels(app: App): Promise<void> {
panelsRaw.value = panels;
panelsRaw.value.forEach((inter: PanelConfig) => {
app.component('interface-' + inter.id, inter.component);
app.component('panel-' + inter.id, inter.component);
if (typeof inter.options !== 'function' && Array.isArray(inter.options) === false) {
app.component(`interface-options-${inter.id}`, inter.options);
app.component(`panel-options-${inter.id}`, inter.options);
}
});
}

View File

@@ -99,6 +99,10 @@ export default definePanel({
text: 'Day',
value: 'day',
},
{
text: 'Week',
value: 'week',
},
{
text: 'Month',
value: 'month',

View File

@@ -10,7 +10,7 @@ import { adjustDate } from '@/utils/adjust-date';
import { useI18n } from 'vue-i18n';
import { isEqual } from 'lodash';
import { useFieldsStore } from '@/stores';
import { Filter } from '@/types';
import { Filter } from '@directus/shared/types';
import { abbreviateNumber } from '@/utils/abbreviate-number';
type TimeSeriesOptions = {
@@ -21,7 +21,7 @@ type TimeSeriesOptions = {
range: string; // 1 week, etc
color: string;
decimals: number;
precision: 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second';
precision: 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
min?: number;
max?: number;
filter: Filter | null;