mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Update types/structure
This commit is contained in:
@@ -13,6 +13,7 @@ export function getCacheKey(req: Request): string {
|
||||
query: isGraphQl ? pick(req.query, ['query', 'variables']) : req.sanitizedQuery,
|
||||
};
|
||||
|
||||
const key = hash(info);
|
||||
const key = hash(info) as string;
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export function getColumn(
|
||||
}
|
||||
}
|
||||
|
||||
if (column !== alias) {
|
||||
if (alias && column !== alias) {
|
||||
return knex.ref(`${table}.${column}`).as(alias);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ item_revision: Item Revision
|
||||
duplicate_field: Duplicate Field
|
||||
half_width: Half Width
|
||||
full_width: Full Width
|
||||
limit: Limit
|
||||
group: Group
|
||||
and: And
|
||||
or: Or
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { defineModule } from '@/modules/define';
|
||||
import InsightsOverview from './routes/overview.vue';
|
||||
import InsightsDashboard from './routes/dashboard.vue';
|
||||
import InsightsPanelConfiguration from './routes/panel-configuration.vue';
|
||||
import { defineModule } from '@directus/shared/utils';
|
||||
|
||||
export default defineModule({
|
||||
id: 'insights',
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { PanelConfig, PanelDefineParam } from './types';
|
||||
|
||||
export function definePanel(config: PanelDefineParam): PanelConfig {
|
||||
let options: PanelConfig;
|
||||
|
||||
if (typeof config === 'function') {
|
||||
options = config();
|
||||
} else {
|
||||
options = config;
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { shallowRef, Ref } from 'vue';
|
||||
import { PanelConfig } from './types';
|
||||
import { PanelConfig } from '@directus/shared/types';
|
||||
|
||||
const panelsRaw: Ref<PanelConfig[]> = shallowRef([]);
|
||||
const panels: Ref<PanelConfig[]> = shallowRef([]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { definePanel } from '../define';
|
||||
import PanelLabel from './label.vue';
|
||||
import { definePanel } from '@directus/shared/utils';
|
||||
|
||||
export default definePanel({
|
||||
id: 'label',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { definePanel } from '../define';
|
||||
import { definePanel } from '@directus/shared/utils';
|
||||
import PanelMetric from './metric.vue';
|
||||
|
||||
export default definePanel({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getRootPath } from '@/utils/get-root-path';
|
||||
import { App } from 'vue';
|
||||
import { getPanels } from './index';
|
||||
import { PanelConfig } from './types';
|
||||
import { PanelConfig } from '@directus/shared/types';
|
||||
|
||||
const { panelsRaw } = getPanels();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { definePanel } from '../define';
|
||||
import { definePanel } from '@directus/shared/utils';
|
||||
import PanelTimeSeries from './time-series.vue';
|
||||
|
||||
export default definePanel({
|
||||
|
||||
6
app/src/shims.d.ts
vendored
6
app/src/shims.d.ts
vendored
@@ -54,3 +54,9 @@ declare module '@directus-extensions-module' {
|
||||
const modules: ModuleConfig[];
|
||||
export default modules;
|
||||
}
|
||||
|
||||
declare module '@directus-extensions-panel' {
|
||||
import { PanelConfig } from '@directus/shared/types';
|
||||
const modules: PanelConfig[];
|
||||
export default modules;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export const APP_SHARED_DEPS = ['@directus/extensions-sdk', 'vue', 'vue-router'];
|
||||
export const API_SHARED_DEPS = ['@directus/extensions-sdk', 'axios'];
|
||||
|
||||
export const APP_EXTENSION_TYPES = ['interface', 'display', 'layout', 'module'] as const;
|
||||
export const APP_EXTENSION_TYPES = ['interface', 'display', 'layout', 'module', 'panel'] as const;
|
||||
export const API_EXTENSION_TYPES = ['hook', 'endpoint'] as const;
|
||||
export const EXTENSION_TYPES = [...APP_EXTENSION_TYPES, ...API_EXTENSION_TYPES] as const;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ export * from './items';
|
||||
export * from './layouts';
|
||||
export * from './misc';
|
||||
export * from './modules';
|
||||
export * from './panels';
|
||||
export * from './permissions';
|
||||
export * from './presets';
|
||||
export * from './users';
|
||||
|
||||
14
packages/shared/src/types/panels.ts
Normal file
14
packages/shared/src/types/panels.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Component } from 'vue';
|
||||
import { DeepPartial } from './misc';
|
||||
import { Field } from './fields';
|
||||
|
||||
export interface PanelConfig {
|
||||
id: string;
|
||||
name: string;
|
||||
icon: string;
|
||||
description?: string;
|
||||
component: Component;
|
||||
options: DeepPartial<Field>[] | Component;
|
||||
minWidth: number;
|
||||
minHeight: number;
|
||||
}
|
||||
@@ -1,4 +1,12 @@
|
||||
import { InterfaceConfig, DisplayConfig, LayoutConfig, ModuleConfig, HookConfig, EndpointConfig } from '../types';
|
||||
import {
|
||||
InterfaceConfig,
|
||||
DisplayConfig,
|
||||
LayoutConfig,
|
||||
ModuleConfig,
|
||||
HookConfig,
|
||||
EndpointConfig,
|
||||
PanelConfig,
|
||||
} from '../types';
|
||||
|
||||
export function defineInterface(config: InterfaceConfig): InterfaceConfig {
|
||||
return config;
|
||||
@@ -25,3 +33,7 @@ export function defineHook(config: HookConfig): HookConfig {
|
||||
export function defineEndpoint(config: EndpointConfig): EndpointConfig {
|
||||
return config;
|
||||
}
|
||||
|
||||
export function definePanel(config: PanelConfig): PanelConfig {
|
||||
return config;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user