mirror of https://github.com/buster-so/buster.git
start moving api interfaces to folder
This commit is contained in:
parent
731969aa49
commit
58551de620
|
@ -0,0 +1,4 @@
|
|||
export * from './chatInterfaces';
|
||||
export * from './config';
|
||||
export * from './chatMessageInterfaces';
|
||||
export * from './chatProgressInterfaces';
|
|
@ -1,6 +1,4 @@
|
|||
import { ShareRole } from '@/api/buster_socket/threads';
|
||||
import { BusterShareAssetType } from '../users';
|
||||
import { BusterShare } from '../threads';
|
||||
import { BusterShare, ShareAssetType, ShareRole } from '../share';
|
||||
|
||||
export interface BusterCollectionListItem {
|
||||
id: string;
|
||||
|
@ -14,7 +12,7 @@ export interface BusterCollectionListItem {
|
|||
id: string;
|
||||
name: string;
|
||||
};
|
||||
member: any[];
|
||||
member: [];
|
||||
}
|
||||
|
||||
export interface BusterCollection extends BusterShare {
|
||||
|
@ -38,7 +36,7 @@ export interface BusterCollection extends BusterShare {
|
|||
}
|
||||
|
||||
export interface BusterCollectionItemAsset {
|
||||
asset_type: BusterShareAssetType;
|
||||
asset_type: ShareAssetType;
|
||||
id: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterResizeableGridRow } from '@/components/grid';
|
||||
import type { BusterResizeableGridRow } from '@/components/grid/interfaces';
|
||||
|
||||
export interface DashboardConfig {
|
||||
rows?: (Omit<BusterResizeableGridRow, 'items'> & {
|
|
@ -0,0 +1,2 @@
|
|||
export * from './dashboardConfigInterfaces';
|
||||
export * from './interfaces';
|
|
@ -1,14 +1,9 @@
|
|||
import type { DashboardConfig } from '@/api/buster_socket/dashboards';
|
||||
import type { IBusterThreadMessageChartConfig } from '../threads/threadConfigInterfaces';
|
||||
import type {
|
||||
BusterShare,
|
||||
BusterThreadListItem,
|
||||
BusterThreadMessage,
|
||||
BusterVerificationStatus
|
||||
} from '../threads';
|
||||
import type { ShareRole } from '@/api/buster_socket/threads';
|
||||
import type { BusterCollectionListItem } from '../collection';
|
||||
import type { BusterChartConfigProps } from '@/components/charts';
|
||||
import type { BusterChartConfigProps } from '@/components/charts/interfaces';
|
||||
import type { BusterShare, ShareRole, VerificationStatus } from '../share';
|
||||
import type { DataMetadata, IBusterMetricChartConfig } from '../metric';
|
||||
import type { DashboardConfig } from './dashboardConfigInterfaces';
|
||||
|
||||
export interface BusterDashboardListItem {
|
||||
created_at: string;
|
||||
id: string;
|
||||
|
@ -24,7 +19,7 @@ export interface BusterDashboardListItem {
|
|||
id: string;
|
||||
name: string;
|
||||
};
|
||||
status: BusterVerificationStatus;
|
||||
status: VerificationStatus;
|
||||
is_shared: boolean;
|
||||
}
|
||||
|
||||
|
@ -54,7 +49,7 @@ export interface BusterDashboard
|
|||
name: string;
|
||||
updated_at: string | null;
|
||||
updated_by: string;
|
||||
status: BusterThreadListItem['status'];
|
||||
status: VerificationStatus;
|
||||
}
|
||||
|
||||
export interface BusterDashboardMetric {
|
||||
|
@ -63,7 +58,7 @@ export interface BusterDashboardMetric {
|
|||
name: string;
|
||||
id: string;
|
||||
description: string | null;
|
||||
data_metadata: BusterThreadMessage['data_metadata'];
|
||||
data_metadata: DataMetadata;
|
||||
error: string | null;
|
||||
code: string | null;
|
||||
}
|
||||
|
@ -76,5 +71,5 @@ export interface BusterMetricDataResponse {
|
|||
}
|
||||
|
||||
export interface IBusterDashboardMetric extends Omit<BusterDashboardMetric, 'chart_config'> {
|
||||
chart_config: IBusterThreadMessageChartConfig;
|
||||
chart_config: IBusterMetricChartConfig;
|
||||
}
|
|
@ -1 +1,6 @@
|
|||
export type * from './metric';
|
||||
export * from './metric';
|
||||
export * from './share';
|
||||
export type * from './collection';
|
||||
export type * from './dashboard';
|
||||
export type * from './chat';
|
||||
export type * from './search';
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
import type { IBusterMetricChartConfig } from './requireInterfaces';
|
||||
import type { ColumnSettings } from '../../../components/charts/interfaces/columnInterfaces';
|
||||
import { ChartType, ViewType } from '../../../components/charts/interfaces/enum';
|
||||
import { DEFAULT_CHART_THEME } from '../../../components/charts/configColors';
|
||||
import type { ColumnLabelFormat } from '../../../components/charts/interfaces/columnLabelInterfaces';
|
||||
import type { ColumnMetaData } from './interfaces';
|
||||
|
||||
export const DEFAULT_CHART_CONFIG: IBusterMetricChartConfig = {
|
||||
colors: DEFAULT_CHART_THEME,
|
||||
selectedChartType: ChartType.Table,
|
||||
selectedView: ViewType.Table,
|
||||
yAxisShowAxisLabel: true,
|
||||
yAxisShowAxisTitle: true,
|
||||
yAxisAxisTitle: null,
|
||||
yAxisStartAxisAtZero: null,
|
||||
yAxisScaleType: 'linear',
|
||||
y2AxisShowAxisLabel: true,
|
||||
y2AxisAxisTitle: null,
|
||||
y2AxisShowAxisTitle: true,
|
||||
y2AxisStartAxisAtZero: true,
|
||||
y2AxisScaleType: 'linear',
|
||||
xAxisShowAxisLabel: true,
|
||||
xAxisShowAxisTitle: true,
|
||||
xAxisAxisTitle: null,
|
||||
xAxisLabelRotation: 'auto',
|
||||
xAxisDataZoom: false,
|
||||
categoryAxisTitle: null,
|
||||
showLegend: null,
|
||||
gridLines: true,
|
||||
goalLines: [],
|
||||
trendlines: [],
|
||||
showLegendHeadline: false,
|
||||
disableTooltip: false,
|
||||
barAndLineAxis: {
|
||||
x: [],
|
||||
y: [],
|
||||
category: [],
|
||||
tooltip: null
|
||||
},
|
||||
scatterAxis: {
|
||||
x: [],
|
||||
y: [],
|
||||
size: [],
|
||||
tooltip: null
|
||||
},
|
||||
comboChartAxis: {
|
||||
x: [],
|
||||
y: [],
|
||||
y2: [],
|
||||
tooltip: null
|
||||
},
|
||||
pieChartAxis: {
|
||||
x: [],
|
||||
y: [],
|
||||
tooltip: null
|
||||
},
|
||||
//LINE
|
||||
lineGroupType: null,
|
||||
//SCATTER
|
||||
scatterDotSize: [3, 15],
|
||||
//BAR
|
||||
barSortBy: [],
|
||||
barLayout: 'vertical',
|
||||
barGroupType: 'group',
|
||||
barShowTotalAtTop: false,
|
||||
//PIE
|
||||
pieShowInnerLabel: true,
|
||||
pieInnerLabelAggregate: 'sum',
|
||||
pieInnerLabelTitle: 'Total',
|
||||
pieLabelPosition: null,
|
||||
pieDonutWidth: 40,
|
||||
pieMinimumSlicePercentage: 0,
|
||||
pieDisplayLabelAs: 'number',
|
||||
//METRIC
|
||||
metricColumnId: '',
|
||||
metricValueAggregate: 'sum',
|
||||
metricHeader: null,
|
||||
metricSubHeader: null,
|
||||
metricValueLabel: null,
|
||||
//TABLE
|
||||
tableColumnOrder: null,
|
||||
tableColumnWidths: null,
|
||||
tableHeaderBackgroundColor: null,
|
||||
tableHeaderFontColor: null,
|
||||
tableColumnFontColor: null,
|
||||
//MUST LOOP THROUGH ALL COLUMNS
|
||||
columnSettings: {},
|
||||
columnLabelFormats: {}
|
||||
};
|
||||
|
||||
export const DEFAULT_COLUMN_SETTINGS: Required<ColumnSettings> = {
|
||||
showDataLabels: false,
|
||||
columnVisualization: 'bar',
|
||||
lineWidth: 2,
|
||||
lineStyle: 'line',
|
||||
lineType: 'normal',
|
||||
lineSymbolSize: 0,
|
||||
barRoundness: 8,
|
||||
showDataLabelsAsPercentage: false
|
||||
};
|
||||
|
||||
export const DEFAULT_COLUMN_LABEL_FORMAT: Required<ColumnLabelFormat> = {
|
||||
style: 'string',
|
||||
compactNumbers: false,
|
||||
columnType: 'string',
|
||||
displayName: '',
|
||||
numberSeparatorStyle: ',',
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 2,
|
||||
currency: 'USD',
|
||||
convertNumberTo: null,
|
||||
dateFormat: 'auto',
|
||||
useRelativeTime: false,
|
||||
isUTC: false,
|
||||
multiplier: 1,
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
replaceMissingDataWith: 0,
|
||||
makeLabelHumanReadable: true
|
||||
};
|
||||
|
||||
export const ENABLED_DOTS_ON_LINE = 3.5;
|
||||
|
||||
export const DEFAULT_CHART_CONFIG_ENTRIES = Object.entries(DEFAULT_CHART_CONFIG);
|
||||
|
||||
export const DEFAULT_BAR_ROUNDNESS = DEFAULT_COLUMN_SETTINGS.barRoundness;
|
||||
|
||||
export const MIN_DONUT_WIDTH = 15;
|
||||
|
||||
export const DEFAULT_DAY_OF_WEEK_FORMAT = 'ddd';
|
||||
export const DEFAULT_DATE_FORMAT_DAY_OF_WEEK = 'dddd';
|
||||
export const DEFAULT_DATE_FORMAT_MONTH_OF_YEAR = 'MMMM';
|
||||
export const DEFAULT_DATE_FORMAT_QUARTER = 'YYYY [Q]Q';
|
||||
|
||||
export const ENABLED_DOTS_ON_LINE_SIZE = 8;
|
||||
|
||||
export const DEFAULT_COLUMN_METADATA: ColumnMetaData[] = [];
|
|
@ -1 +1,2 @@
|
|||
export * from './interfaces';
|
||||
export * from './requireInterfaces';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { BusterChartConfigProps } from '@/components/charts';
|
||||
import { BusterShare } from '../../buster_socket/share/shareInterfaces';
|
||||
import { BusterShare, VerificationStatus } from '../share';
|
||||
|
||||
export type BusterMetricAsset = {
|
||||
id: string;
|
||||
|
@ -11,12 +11,8 @@ export type BusterMetricAsset = {
|
|||
dataset_name: string | null;
|
||||
error: string | null;
|
||||
chart_config?: BusterChartConfigProps;
|
||||
data_metadata: {
|
||||
column_count: number;
|
||||
column_metadata: ColumnMetaData[];
|
||||
row_count: number;
|
||||
} | null;
|
||||
status: BusterVerificationStatus;
|
||||
data_metadata: DataMetadata;
|
||||
status: VerificationStatus;
|
||||
evaluation_score: 'Moderate' | 'High' | 'Low';
|
||||
evaluation_summary: string;
|
||||
file: string; //yaml file
|
||||
|
@ -36,16 +32,13 @@ export type BusterMetricAsset = {
|
|||
}[];
|
||||
} & BusterShare;
|
||||
|
||||
enum BusterVerificationStatus {
|
||||
notRequested = 'notRequested',
|
||||
requested = 'requested',
|
||||
inReview = 'inReview',
|
||||
verified = 'verified',
|
||||
backlogged = 'backlogged',
|
||||
notVerified = 'notVerified'
|
||||
}
|
||||
export type DataMetadata = {
|
||||
column_count: number;
|
||||
column_metadata: ColumnMetaData[];
|
||||
row_count: number;
|
||||
} | null;
|
||||
|
||||
type ColumnMetaData = {
|
||||
export type ColumnMetaData = {
|
||||
name: string;
|
||||
min_value: number | string;
|
||||
max_value: number | string;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
import type {
|
||||
BusterChartConfigProps,
|
||||
ColumnSettings,
|
||||
IColumnLabelFormat
|
||||
} from '@/components/charts/interfaces';
|
||||
|
||||
export type IBusterMetricChartConfig = Required<
|
||||
Omit<BusterChartConfigProps, 'columnLabelFormats'>
|
||||
> & {
|
||||
columnLabelFormats: Record<string, Required<IColumnLabelFormat>>;
|
||||
columnSettings: Required<Record<string, Required<ColumnSettings>>>;
|
||||
};
|
|
@ -1,10 +1,10 @@
|
|||
import { BusterShareAssetType } from '../users';
|
||||
import type { ShareAssetType } from '@/api/asset_interfaces';
|
||||
|
||||
export interface BusterSearchResult {
|
||||
id: string;
|
||||
highlights: string[];
|
||||
name: string;
|
||||
updated_at: string;
|
||||
type: BusterShareAssetType;
|
||||
type: ShareAssetType;
|
||||
score: number;
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
export * from './shareInterfaces';
|
||||
export * from './verificationInterfaces';
|
|
@ -4,6 +4,12 @@ export enum ShareRole {
|
|||
VIEWER = 'viewer'
|
||||
}
|
||||
|
||||
export enum ShareAssetType {
|
||||
METRIC = 'metric',
|
||||
DASHBOARD = 'dashboard',
|
||||
COLLECTION = 'collection'
|
||||
}
|
||||
|
||||
export interface BusterShare {
|
||||
sharingKey: string;
|
||||
individual_permissions: null | BusterShareIndividual[];
|
|
@ -0,0 +1,8 @@
|
|||
export enum VerificationStatus {
|
||||
notRequested = 'notRequested',
|
||||
requested = 'requested',
|
||||
inReview = 'inReview',
|
||||
verified = 'verified',
|
||||
backlogged = 'backlogged',
|
||||
notVerified = 'notVerified'
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
export * from './threads';
|
||||
export * from './dashboards';
|
||||
export * from './users';
|
||||
export * from './datasources';
|
||||
export * from './terms';
|
||||
export * from './search';
|
||||
export * from './assets';
|
||||
export * from './api_keys';
|
||||
export * from './sql';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { VerificationStatus } from '@/api/asset_interfaces';
|
||||
import type { ShareRole } from '@/api/buster_socket/threads';
|
||||
import type { BusterChartConfigProps } from '@/components/charts';
|
||||
|
||||
|
@ -11,19 +12,10 @@ export type BusterThreadListItem = {
|
|||
created_by_name: string;
|
||||
created_by_email: string;
|
||||
created_by_avatar: string;
|
||||
status: BusterVerificationStatus;
|
||||
status: VerificationStatus;
|
||||
is_shared: boolean;
|
||||
};
|
||||
|
||||
export enum BusterVerificationStatus {
|
||||
notRequested = 'notRequested',
|
||||
requested = 'requested',
|
||||
inReview = 'inReview',
|
||||
verified = 'verified',
|
||||
backlogged = 'backlogged',
|
||||
notVerified = 'notVerified'
|
||||
}
|
||||
|
||||
export type BusterThread = {
|
||||
created_at: string;
|
||||
created_by: string;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { BusterPermissionUser } from '../permissions';
|
||||
import type { ShareAssetType } from '../../asset_interfaces';
|
||||
|
||||
export interface BusterUserPalette {
|
||||
id: string;
|
||||
|
@ -35,7 +36,7 @@ export interface BusterUserTeam {
|
|||
|
||||
export interface BusterUserFavorite {
|
||||
id: string;
|
||||
type: BusterShareAssetType;
|
||||
type: ShareAssetType;
|
||||
index?: number;
|
||||
name: string;
|
||||
//collections
|
||||
|
@ -43,17 +44,11 @@ export interface BusterUserFavorite {
|
|||
collection_id?: string;
|
||||
assets?: {
|
||||
id: string;
|
||||
type: BusterShareAssetType;
|
||||
type: ShareAssetType;
|
||||
name: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export enum BusterShareAssetType {
|
||||
THREAD = 'thread',
|
||||
DASHBOARD = 'dashboard',
|
||||
COLLECTION = 'collection'
|
||||
}
|
||||
|
||||
export interface BusterUser {
|
||||
config: {};
|
||||
created_at: string;
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import { BusterShare } from '../../share/shareInterfaces';
|
||||
|
||||
export type BusterCollectionAsset = {
|
||||
id: string;
|
||||
type: 'collection';
|
||||
} & BusterShare;
|
|
@ -1,17 +0,0 @@
|
|||
import type { BusterDashboardMetric } from '../../../buster_rest/dashboards';
|
||||
import type { DashboardConfig } from '../../dashboards';
|
||||
import { BusterShare } from '../../share/shareInterfaces';
|
||||
|
||||
export type BusterDashboardAsset = {
|
||||
id: string;
|
||||
type: 'dashboard';
|
||||
metrics: BusterDashboardMetric[];
|
||||
config: DashboardConfig;
|
||||
created_at: string;
|
||||
created_by: string;
|
||||
deleted_at: string | null;
|
||||
description: string | null;
|
||||
title: string;
|
||||
updated_at: string | null;
|
||||
updated_by: string;
|
||||
} & BusterShare;
|
|
@ -1,6 +0,0 @@
|
|||
import type { FileType } from '../config';
|
||||
|
||||
export type BusterDatasetAsset = {
|
||||
id: string;
|
||||
type: 'dataset';
|
||||
};
|
|
@ -1,6 +0,0 @@
|
|||
import type { FileType } from '../config';
|
||||
|
||||
export type BusterTermAsset = {
|
||||
id: string;
|
||||
type: 'term';
|
||||
};
|
|
@ -1,6 +0,0 @@
|
|||
import type { FileType } from '../config';
|
||||
|
||||
export type BusterValueAsset = {
|
||||
id: string;
|
||||
type: 'value';
|
||||
};
|
|
@ -1,23 +0,0 @@
|
|||
import type { BusterCollectionAsset } from './chatAssetCollectionInterfaces';
|
||||
import type { BusterDashboardAsset } from './chatAssetDashboardInterfaces';
|
||||
import type { BusterDatasetAsset } from './chatAssetDatasetInterfaces';
|
||||
import type { BusterTermAsset } from './chatAssetTermInterfaces';
|
||||
import type { BusterValueAsset } from './chatAssetValueInterfaces';
|
||||
import type { BusterMetricAsset } from '@/api/asset_interfaces';
|
||||
export * from '../../share/shareInterfaces';
|
||||
|
||||
export type BusterChatAsset =
|
||||
| BusterMetricAsset
|
||||
| BusterDashboardAsset
|
||||
| BusterCollectionAsset
|
||||
| BusterDatasetAsset
|
||||
| BusterTermAsset
|
||||
| BusterValueAsset;
|
||||
|
||||
export {
|
||||
BusterCollectionAsset,
|
||||
BusterDashboardAsset,
|
||||
BusterDatasetAsset,
|
||||
BusterTermAsset,
|
||||
BusterValueAsset
|
||||
};
|
|
@ -1,5 +1,4 @@
|
|||
import type { BusterSocketRequestBase } from '../base_interfaces';
|
||||
import type { FileType } from './config';
|
||||
|
||||
export type ChatCreateNewChat = BusterSocketRequestBase<
|
||||
'/chats/post',
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { RustApiError } from '../../buster_rest/errors';
|
||||
import type { BusterChat, BusterChatListItem } from './chatInterfaces';
|
||||
import type { BusterChat, BusterChatListItem } from '../../asset_interfaces/chat';
|
||||
|
||||
export enum ChatsResponses {
|
||||
'/chats/list:getChatsList' = '/chats/list:getChatsList',
|
||||
|
|
|
@ -1,7 +1,2 @@
|
|||
export * from './chatAssetInterfaces';
|
||||
export * from './chatInterfaces';
|
||||
export * from './chatRequests';
|
||||
export * from './chatResponses';
|
||||
export * from './config';
|
||||
export * from './chatMessageInterfaces';
|
||||
export * from './chatAssetInterfaces';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '../../asset_interfaces';
|
||||
import { BusterSocketRequestBase } from '../base_interfaces';
|
||||
import { ShareRequest } from '../dashboards';
|
||||
|
||||
|
@ -28,7 +28,7 @@ export type CollectionUpdateCollection = BusterSocketRequestBase<
|
|||
id: string;
|
||||
name?: string;
|
||||
assets?: {
|
||||
type: BusterShareAssetType;
|
||||
type: ShareAssetType;
|
||||
id: string;
|
||||
}[];
|
||||
} & ShareRequest
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterCollection, BusterCollectionListItem } from '@/api/buster_rest/collection';
|
||||
import { BusterCollection, BusterCollectionListItem } from '@/api/asset_interfaces/collection';
|
||||
|
||||
export enum CollectionResponses {
|
||||
'/collections/list:listCollections' = '/collections/list:listCollections',
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { BusterVerificationStatus } from '@/api/buster_rest';
|
||||
import { BusterSocketRequestBase } from '../base_interfaces';
|
||||
import { ShareRole } from '../threads';
|
||||
import { DashboardConfig } from './dashboardConfigInterfaces';
|
||||
import type { ShareRole, DashboardConfig, VerificationStatus } from '@/api/asset_interfaces';
|
||||
import type { BusterSocketRequestBase } from '../base_interfaces';
|
||||
|
||||
export type DashboardsListEmitPayload = BusterSocketRequestBase<
|
||||
'/dashboards/list',
|
||||
|
@ -58,7 +56,7 @@ export type DashboardUpdate = BusterSocketRequestBase<
|
|||
name?: string;
|
||||
description?: string | null;
|
||||
config?: DashboardConfig;
|
||||
status?: BusterVerificationStatus;
|
||||
status?: VerificationStatus;
|
||||
add_to_collections?: string[]; // collection_id
|
||||
remove_from_collections?: string[]; // collection_id
|
||||
remove_users?: string[]; // user_id
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {
|
||||
import type {
|
||||
BusterDashboard,
|
||||
BusterDashboardListItem,
|
||||
BusterDashboardResponse,
|
||||
BusterMetricDataResponse
|
||||
} from '@/api/buster_rest';
|
||||
} from '@/api/asset_interfaces';
|
||||
|
||||
export enum DashboardResponses {
|
||||
'/dashboards/get:getDashboardState' = '/dashboards/get:getDashboardState',
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
export * from './dashboardRequests';
|
||||
export * from './dashboardResponses';
|
||||
export * from './dashboardConfigInterfaces';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterSocketRequestBase } from '../base_interfaces';
|
||||
import type { BusterSocketRequestBase } from '../base_interfaces';
|
||||
|
||||
export type BusterSearchRequest = BusterSocketRequestBase<
|
||||
'/search',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterSearchResult } from '@/api/buster_rest/search';
|
||||
import type { BusterSearchResult } from '@/api/asset_interfaces/search';
|
||||
|
||||
export enum SearchResponses {
|
||||
'/search:search' = '/search:search'
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
export * from './shareInterfaces';
|
|
@ -1,7 +1,7 @@
|
|||
import { BusterChartConfigProps } from '@/components/charts';
|
||||
import { BusterSocketRequestBase } from '../base_interfaces';
|
||||
import { ShareRequest } from '../dashboards';
|
||||
import type { BusterVerificationStatus } from '@/api/buster_rest';
|
||||
import { VerificationStatus } from '@/api/asset_interfaces';
|
||||
|
||||
export type ThreadListEmitPayload = BusterSocketRequestBase<
|
||||
'/threads/list',
|
||||
|
@ -9,7 +9,7 @@ export type ThreadListEmitPayload = BusterSocketRequestBase<
|
|||
page_token: number;
|
||||
page_size: number;
|
||||
admin_view: boolean;
|
||||
filters?: { status: BusterVerificationStatus[] | null };
|
||||
filters?: { status: VerificationStatus[] | null };
|
||||
}
|
||||
>;
|
||||
|
||||
|
@ -62,7 +62,7 @@ export type ThreadUpdateMessage = BusterSocketRequestBase<
|
|||
title?: string;
|
||||
sql?: string;
|
||||
feedback?: 'negative';
|
||||
status?: BusterVerificationStatus;
|
||||
status?: VerificationStatus;
|
||||
}
|
||||
>;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {
|
||||
import type {
|
||||
BusterThread,
|
||||
BusterThreadListItem,
|
||||
BusterThreadSearchItem,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterSocketRequestBase } from '../base_interfaces';
|
||||
import type { BusterSocketRequestBase } from '../base_interfaces';
|
||||
|
||||
export type TeamRequestsList = BusterSocketRequestBase<
|
||||
'/teams/list',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterUserTeam } from '@/api/buster_rest';
|
||||
import type { BusterUserTeam } from '@/api/buster_rest';
|
||||
|
||||
export enum TeamResponses {
|
||||
'/teams/list:listTeams' = '/teams/list:listTeams'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { BusterSocketRequestBase } from '../base_interfaces';
|
||||
import type { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import type { BusterSocketRequestBase } from '../base_interfaces';
|
||||
|
||||
export type UserColorsList = BusterSocketRequestBase<'/users/colors/list', {}>;
|
||||
|
||||
|
@ -29,7 +29,7 @@ export type UsersFavoritePost = BusterSocketRequestBase<
|
|||
'/users/favorites/post',
|
||||
{
|
||||
id: string;
|
||||
asset_type: BusterShareAssetType;
|
||||
asset_type: ShareAssetType;
|
||||
index?: number;
|
||||
}
|
||||
>;
|
||||
|
@ -40,7 +40,7 @@ export type UserFavoriteDelete = BusterSocketRequestBase<
|
|||
'/users/favorites/delete',
|
||||
{
|
||||
id: string;
|
||||
asset_type: BusterShareAssetType;
|
||||
asset_type: ShareAssetType;
|
||||
}
|
||||
>;
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { AppMaterialIcons } from '@/components';
|
||||
|
||||
const iconRecord: Record<BusterShareAssetType, string> = {
|
||||
[BusterShareAssetType.COLLECTION]: 'note_stack',
|
||||
[BusterShareAssetType.DASHBOARD]: 'grid_view',
|
||||
[BusterShareAssetType.THREAD]: 'monitoring'
|
||||
const iconRecord: Record<ShareAssetType, string> = {
|
||||
[ShareAssetType.COLLECTION]: 'note_stack',
|
||||
[ShareAssetType.DASHBOARD]: 'grid_view',
|
||||
[ShareAssetType.METRIC]: 'monitoring'
|
||||
};
|
||||
|
||||
export const asset_typeToIcon = (
|
||||
type: BusterShareAssetType,
|
||||
type: ShareAssetType,
|
||||
props?: { open?: boolean; size?: number }
|
||||
) => {
|
||||
const { open, size } = props || {};
|
||||
|
@ -16,11 +16,11 @@ export const asset_typeToIcon = (
|
|||
return <AppMaterialIcons icon={iconString as 'grid_view'} size={size} />;
|
||||
};
|
||||
|
||||
export const asset_typeToTranslation = (type: BusterShareAssetType) => {
|
||||
const asset_typeTranslation: Record<BusterShareAssetType, string> = {
|
||||
[BusterShareAssetType.COLLECTION]: 'collection',
|
||||
[BusterShareAssetType.DASHBOARD]: 'dashboard',
|
||||
[BusterShareAssetType.THREAD]: 'thread'
|
||||
export const asset_typeToTranslation = (type: ShareAssetType) => {
|
||||
const asset_typeTranslation: Record<ShareAssetType, string> = {
|
||||
[ShareAssetType.COLLECTION]: 'collection',
|
||||
[ShareAssetType.DASHBOARD]: 'dashboard',
|
||||
[ShareAssetType.METRIC]: 'thread'
|
||||
};
|
||||
return asset_typeTranslation[type];
|
||||
};
|
||||
|
|
|
@ -5,13 +5,13 @@ import { BusterList, BusterListColumn, BusterListRow } from '@/components/list';
|
|||
import { useMemoizedFn, useThrottleFn } from 'ahooks';
|
||||
import { boldHighlights, formatDate } from '@/utils';
|
||||
import {
|
||||
BusterDashboardResponse,
|
||||
BusterSearchResult,
|
||||
BusterShareAssetType
|
||||
} from '@/api/buster_rest';
|
||||
type BusterDashboardResponse,
|
||||
type BusterSearchResult,
|
||||
ShareAssetType
|
||||
} from '@/api/asset_interfaces';
|
||||
import { asset_typeToIcon } from '@/app/_helpers';
|
||||
import { CircleSpinnerLoaderContainer } from '@/components/loaders';
|
||||
import { BusterCollection } from '@/api/buster_rest/collection';
|
||||
import { BusterCollection } from '@/api/asset_interfaces/collection';
|
||||
import { useBusterSearchContextSelector } from '@/context/Search';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import { useDashboardContextSelector } from '@/context/Dashboards';
|
||||
|
@ -61,11 +61,11 @@ export const AddTypeModal: React.FC<{
|
|||
const searchItems = inputValue ? ongoingSearchItems : ongoingSearchItems;
|
||||
|
||||
const columns: BusterListColumn[] = useMemo(() => {
|
||||
const fallbackName = (name: string, type: BusterShareAssetType) => {
|
||||
if (type === BusterShareAssetType.DASHBOARD && !name) {
|
||||
const fallbackName = (name: string, type: ShareAssetType) => {
|
||||
if (type === ShareAssetType.DASHBOARD && !name) {
|
||||
return 'New dashboard';
|
||||
}
|
||||
if (type === BusterShareAssetType.THREAD && !name) {
|
||||
if (type === ShareAssetType.METRIC && !name) {
|
||||
return 'New metric';
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import { useMemoizedFn } from 'ahooks';
|
|||
import { Button } from 'antd';
|
||||
import React, { useMemo } from 'react';
|
||||
import { NewCollectionModal } from '../../collections/_NewCollectionModal';
|
||||
import { BusterCollectionListItem } from '@/api/buster_rest/collection';
|
||||
import type { BusterCollectionListItem } from '@/api/asset_interfaces';
|
||||
|
||||
export const SaveToCollectionsDropdown: React.FC<{
|
||||
children: React.ReactNode;
|
||||
|
|
|
@ -9,7 +9,7 @@ import { AppDropdownSelect } from '@/components/dropdown';
|
|||
import { AppTooltip } from '@/components/tooltip';
|
||||
import { AppMaterialIcons } from '@/components/icons';
|
||||
import type { BusterMetricAsset } from '@/api/asset_interfaces';
|
||||
import type { BusterDashboardListItem } from '@/api/buster_rest/dashboards';
|
||||
import type { BusterDashboardListItem } from '@/api/asset_interfaces';
|
||||
|
||||
export const SaveToDashboardDropdown: React.FC<{
|
||||
children: React.ReactNode;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { AppMaterialIcons, AppTooltip } from '@/components';
|
||||
import { useUserConfigContextSelector } from '@/context/Users';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { gold } from '@ant-design/colors/es/presets';
|
||||
import { css } from 'antd-style';
|
||||
import { createStyles } from 'antd-style';
|
||||
|
@ -28,7 +28,7 @@ const useStyles = createStyles(({ token }) => ({
|
|||
|
||||
export const FavoriteStar: React.FC<{
|
||||
id: string;
|
||||
type: BusterShareAssetType;
|
||||
type: ShareAssetType;
|
||||
name: string;
|
||||
className?: string;
|
||||
iconStyle?: 'default' | 'tertiary';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import { BusterThreadListItem, BusterVerificationStatus } from '@/api/buster_rest';
|
||||
import { BusterThreadListItem } from '@/api/buster_rest';
|
||||
import { VerificationStatus } from '@/api/asset_interfaces';
|
||||
import { AppMaterialIcons, AppPopoverMenu, AppTooltip } from '@/components';
|
||||
import { useDashboardContextSelector } from '@/context/Dashboards';
|
||||
import { useUserConfigContextSelector } from '@/context/Users';
|
||||
|
@ -17,7 +18,7 @@ export const StatusBadgeButton: React.FC<{
|
|||
disabled?: boolean;
|
||||
onChangedStatus?: () => Promise<void>;
|
||||
}> = React.memo(
|
||||
({ type, id, status = BusterVerificationStatus.notRequested, onChangedStatus, disabled }) => {
|
||||
({ type, id, status = VerificationStatus.notRequested, onChangedStatus, disabled }) => {
|
||||
const onVerifiedDashboard = useDashboardContextSelector((state) => state.onVerifiedDashboard);
|
||||
const onVerifiedThread = useBusterThreadsContextSelector((state) => state.onVerifiedThread);
|
||||
const isAdmin = useUserConfigContextSelector((state) => state.isAdmin);
|
||||
|
@ -28,11 +29,8 @@ export const StatusBadgeButton: React.FC<{
|
|||
setIsOpen(open);
|
||||
});
|
||||
|
||||
const onChangeStatus = useMemoizedFn(async (newStatus: BusterVerificationStatus) => {
|
||||
const userStatus = [
|
||||
BusterVerificationStatus.notRequested,
|
||||
BusterVerificationStatus.requested
|
||||
];
|
||||
const onChangeStatus = useMemoizedFn(async (newStatus: VerificationStatus) => {
|
||||
const userStatus = [VerificationStatus.notRequested, VerificationStatus.requested];
|
||||
|
||||
if ((!isAdmin && !userStatus.includes(newStatus)) || newStatus === status) {
|
||||
return;
|
||||
|
@ -52,46 +50,46 @@ export const StatusBadgeButton: React.FC<{
|
|||
() =>
|
||||
[
|
||||
{
|
||||
label: getTooltipText(BusterVerificationStatus.notRequested),
|
||||
icon: <StatusBadgeIndicator status={BusterVerificationStatus.notRequested} />,
|
||||
key: BusterVerificationStatus.notRequested,
|
||||
label: getTooltipText(VerificationStatus.notRequested),
|
||||
icon: <StatusBadgeIndicator status={VerificationStatus.notRequested} />,
|
||||
key: VerificationStatus.notRequested,
|
||||
onClick: () => {
|
||||
onChangeStatus(BusterVerificationStatus.notRequested);
|
||||
onChangeStatus(VerificationStatus.notRequested);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: getTooltipText(BusterVerificationStatus.requested),
|
||||
icon: <StatusBadgeIndicator status={BusterVerificationStatus.requested} />,
|
||||
key: BusterVerificationStatus.requested,
|
||||
label: getTooltipText(VerificationStatus.requested),
|
||||
icon: <StatusBadgeIndicator status={VerificationStatus.requested} />,
|
||||
key: VerificationStatus.requested,
|
||||
onClick: () => {
|
||||
onChangeStatus(BusterVerificationStatus.requested);
|
||||
onChangeStatus(VerificationStatus.requested);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: getTooltipText(BusterVerificationStatus.inReview),
|
||||
icon: <StatusBadgeIndicator status={BusterVerificationStatus.inReview} />,
|
||||
key: BusterVerificationStatus.inReview,
|
||||
label: getTooltipText(VerificationStatus.inReview),
|
||||
icon: <StatusBadgeIndicator status={VerificationStatus.inReview} />,
|
||||
key: VerificationStatus.inReview,
|
||||
disabled: !isAdmin,
|
||||
onClick: () => {
|
||||
isAdmin && onChangeStatus(BusterVerificationStatus.inReview);
|
||||
isAdmin && onChangeStatus(VerificationStatus.inReview);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: getTooltipText(BusterVerificationStatus.verified),
|
||||
icon: <StatusBadgeIndicator status={BusterVerificationStatus.verified} />,
|
||||
key: BusterVerificationStatus.verified,
|
||||
label: getTooltipText(VerificationStatus.verified),
|
||||
icon: <StatusBadgeIndicator status={VerificationStatus.verified} />,
|
||||
key: VerificationStatus.verified,
|
||||
disabled: !isAdmin,
|
||||
onClick: () => {
|
||||
isAdmin && onChangeStatus(BusterVerificationStatus.verified);
|
||||
isAdmin && onChangeStatus(VerificationStatus.verified);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: getTooltipText(BusterVerificationStatus.backlogged),
|
||||
icon: <StatusBadgeIndicator status={BusterVerificationStatus.backlogged} />,
|
||||
key: BusterVerificationStatus.backlogged,
|
||||
label: getTooltipText(VerificationStatus.backlogged),
|
||||
icon: <StatusBadgeIndicator status={VerificationStatus.backlogged} />,
|
||||
key: VerificationStatus.backlogged,
|
||||
disabled: !isAdmin,
|
||||
onClick: () => {
|
||||
isAdmin && onChangeStatus(BusterVerificationStatus.backlogged);
|
||||
isAdmin && onChangeStatus(VerificationStatus.backlogged);
|
||||
}
|
||||
}
|
||||
].map((item, index) => ({
|
||||
|
@ -140,7 +138,7 @@ export const StatusBadgeIndicator: React.FC<{
|
|||
showTooltip?: boolean;
|
||||
}> = ({
|
||||
showTooltip = true,
|
||||
status = BusterVerificationStatus.notRequested,
|
||||
status = VerificationStatus.notRequested,
|
||||
size = 16,
|
||||
className = ''
|
||||
}) => {
|
||||
|
@ -149,7 +147,7 @@ export const StatusBadgeIndicator: React.FC<{
|
|||
const colorClasses = getColorClasses(status);
|
||||
const tooltipText = getTooltipText(status);
|
||||
const isNotVerified =
|
||||
status === BusterVerificationStatus.notVerified || BusterVerificationStatus.notRequested;
|
||||
status === VerificationStatus.notVerified || VerificationStatus.notRequested;
|
||||
const sharedClass = `h-[16px] w-[16px] flex items-center justify-center rounded-full ${colorClasses}`;
|
||||
const _size = isNotVerified ? size : 16;
|
||||
|
||||
|
@ -172,19 +170,19 @@ export const StatusBadgeIndicator: React.FC<{
|
|||
);
|
||||
};
|
||||
|
||||
const statusRecordIcon: Record<BusterVerificationStatus, React.FC<any>> = {
|
||||
[BusterVerificationStatus.verified]: () => <AppMaterialIcons icon="check_circle" fill />,
|
||||
[BusterVerificationStatus.requested]: () => <AppMaterialIcons icon="contrast" />, //contrast
|
||||
[BusterVerificationStatus.inReview]: () => <AppMaterialIcons icon="timelapse" />,
|
||||
[BusterVerificationStatus.backlogged]: () => <AppMaterialIcons icon="cancel" fill />,
|
||||
[BusterVerificationStatus.notVerified]: () => <StatusNotRequestedIcon />,
|
||||
[BusterVerificationStatus.notRequested]: () => <StatusNotRequestedIcon />
|
||||
const statusRecordIcon: Record<VerificationStatus, React.FC<any>> = {
|
||||
[VerificationStatus.verified]: () => <AppMaterialIcons icon="check_circle" fill />,
|
||||
[VerificationStatus.requested]: () => <AppMaterialIcons icon="contrast" />, //contrast
|
||||
[VerificationStatus.inReview]: () => <AppMaterialIcons icon="timelapse" />,
|
||||
[VerificationStatus.backlogged]: () => <AppMaterialIcons icon="cancel" fill />,
|
||||
[VerificationStatus.notVerified]: () => <StatusNotRequestedIcon />,
|
||||
[VerificationStatus.notRequested]: () => <StatusNotRequestedIcon />
|
||||
};
|
||||
const getIcon = (status: BusterThreadListItem['status']) => {
|
||||
return statusRecordIcon[status] || (() => <AppMaterialIcons icon="motion_photos_on" />);
|
||||
};
|
||||
|
||||
const statusRecordColors: Record<BusterVerificationStatus, string> = {
|
||||
const statusRecordColors: Record<VerificationStatus, string> = {
|
||||
verified: '!text-[#34A32D]',
|
||||
requested: '!text-[#F2BE01]',
|
||||
inReview: '!text-[#7C3AED]',
|
||||
|
@ -196,7 +194,7 @@ const getColorClasses = (status: BusterThreadListItem['status']) => {
|
|||
return statusRecordColors[status] || statusRecordColors.notRequested;
|
||||
};
|
||||
|
||||
const statusRecordText: Record<BusterVerificationStatus, string> = {
|
||||
const statusRecordText: Record<VerificationStatus, string> = {
|
||||
verified: 'Verified',
|
||||
requested: 'Requested',
|
||||
inReview: 'In review',
|
||||
|
@ -205,7 +203,7 @@ const statusRecordText: Record<BusterVerificationStatus, string> = {
|
|||
notRequested: 'Not requested'
|
||||
};
|
||||
|
||||
const getTooltipText = (status: BusterVerificationStatus) => {
|
||||
const getTooltipText = (status: VerificationStatus) => {
|
||||
return statusRecordText[status] || statusRecordText.notRequested;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import { useAntToken } from '@/styles/useAntToken';
|
|||
import { useBusterNewThreadsContextSelector } from '@/context/Threads';
|
||||
import { inputHasText } from '@/utils';
|
||||
import { useBusterSearchContextSelector } from '@/context/Search';
|
||||
import { BusterSearchResult } from '@/api/buster_rest';
|
||||
import type { BusterSearchResult } from '@/api/asset_interfaces';
|
||||
import { useBusterNotifications } from '@/context/BusterNotifications';
|
||||
import { NewThreadModalDataSourceSelect } from './NewThreadModalDatasourceSelect';
|
||||
import { SuggestedPromptsContainer } from './SuggestedPromptsContainer';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BusterSearchResult } from '@/api/buster_rest';
|
||||
import type { BusterSearchResult } from '@/api/asset_interfaces';
|
||||
import { CircleSpinnerLoader } from '@/components';
|
||||
import { boldHighlights } from '@/utils/element';
|
||||
import { createStyles } from 'antd-style';
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import React, { useEffect } from 'react';
|
||||
import { motion } from 'framer-motion';
|
||||
|
||||
export const SuggestedPromptsContainer: React.FC<{
|
||||
prompts: BusterSearchResult[];
|
||||
|
|
|
@ -5,17 +5,16 @@ import { PopoverProps } from 'antd';
|
|||
import { AppPopover } from '@/components/tooltip/AppPopover';
|
||||
import { AppTooltip } from '@/components';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
import { BusterShareAssetType } from '@/api/buster_rest/users';
|
||||
import { BusterShare, ShareRole } from '@/api/buster_socket/chats';
|
||||
import { BusterShare, ShareAssetType, ShareRole } from '@/api/asset_interfaces';
|
||||
import { ShareMenuContent } from './ShareMenuContent';
|
||||
|
||||
export const ShareMenu: React.FC<
|
||||
PropsWithChildren<{
|
||||
placement?: PopoverProps['placement'];
|
||||
shareAssetConfig: BusterShare;
|
||||
shareType: BusterShareAssetType;
|
||||
shareType: ShareAssetType;
|
||||
assetId: string;
|
||||
assetType: BusterShareAssetType;
|
||||
assetType: ShareAssetType;
|
||||
}>
|
||||
> = ({ children, shareAssetConfig, shareType, assetId, assetType, placement = 'bottomLeft' }) => {
|
||||
const [isOpen, setIsOpen] = React.useState(false);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { BusterShareAssetType } from '@/api/buster_rest/users';
|
||||
import { BusterShare, ShareRole } from '@/api/buster_socket/chats';
|
||||
import { BusterShare, ShareRole, ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { useBusterNotifications } from '@/context/BusterNotifications';
|
||||
import React from 'react';
|
||||
import { ShareMenuTopBar, ShareMenuTopBarOptions } from './ShareMenuTopBar';
|
||||
|
@ -11,8 +10,8 @@ import { ShareMenuContentBody } from './ShareMenuContentBody';
|
|||
export const ShareMenuContent: React.FC<{
|
||||
shareAssetConfig: BusterShare;
|
||||
assetId: string;
|
||||
assetType: BusterShareAssetType;
|
||||
shareType: BusterShareAssetType;
|
||||
assetType: ShareAssetType;
|
||||
shareType: ShareAssetType;
|
||||
permission: ShareRole;
|
||||
}> = React.memo(({ assetId, assetType, shareAssetConfig, shareType, permission }) => {
|
||||
const { openSuccessMessage } = useBusterNotifications();
|
||||
|
@ -26,14 +25,14 @@ export const ShareMenuContent: React.FC<{
|
|||
|
||||
const onCopyLink = useMemoizedFn(() => {
|
||||
let url = '';
|
||||
if (shareType === BusterShareAssetType.THREAD && assetId) {
|
||||
if (shareType === ShareAssetType.METRIC && assetId) {
|
||||
url = createBusterRoute({ route: BusterRoutes.APP_THREAD_ID, threadId: assetId });
|
||||
} else if (shareType === BusterShareAssetType.DASHBOARD && assetId) {
|
||||
} else if (shareType === ShareAssetType.DASHBOARD && assetId) {
|
||||
url = createBusterRoute({
|
||||
route: BusterRoutes.APP_DASHBOARD_ID,
|
||||
dashboardId: assetId
|
||||
});
|
||||
} else if (shareType === BusterShareAssetType.COLLECTION && assetId) {
|
||||
} else if (shareType === ShareAssetType.COLLECTION && assetId) {
|
||||
url = createBusterRoute({
|
||||
route: BusterRoutes.APP_COLLECTIONS_ID,
|
||||
collectionId: assetId
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { BusterShare, ShareRole } from '@/api/buster_socket/chats';
|
||||
import { BusterShare, ShareRole } from '@/api/asset_interfaces';
|
||||
import { ShareMenuTopBarOptions } from './ShareMenuTopBar';
|
||||
import { BusterShareAssetType } from '@/api/buster_rest/users';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import React from 'react';
|
||||
import { ShareMenuContentPublish } from './ShareMenuContentPublish';
|
||||
import { ShareMenuContentEmbed } from './ShareMenuContentEmbed';
|
||||
|
@ -26,9 +26,9 @@ export const ShareMenuContentBody: React.FC<{
|
|||
goBack: () => void;
|
||||
onCopyLink: () => void;
|
||||
shareAssetConfig: BusterShare;
|
||||
shareType: BusterShareAssetType;
|
||||
shareType: ShareAssetType;
|
||||
assetId: string;
|
||||
assetType: BusterShareAssetType;
|
||||
assetType: ShareAssetType;
|
||||
}> = React.memo(
|
||||
({
|
||||
shareType,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { AppMaterialIcons } from '@/components';
|
||||
import { useCollectionsContextSelector } from '@/context/Collections';
|
||||
import { useDashboardContextSelector } from '@/context/Dashboards';
|
||||
|
@ -15,7 +15,7 @@ export const ShareMenuContentEmbed: React.FC<{
|
|||
publicExpirationDate: string;
|
||||
publicly_accessible: boolean;
|
||||
password: string | null;
|
||||
shareType: BusterShareAssetType;
|
||||
shareType: ShareAssetType;
|
||||
threadId?: string;
|
||||
dashboardId?: string;
|
||||
collectionId?: string;
|
||||
|
@ -40,21 +40,21 @@ export const ShareMenuContentEmbed: React.FC<{
|
|||
const embedURL = useMemo(() => {
|
||||
let url = '';
|
||||
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
url = createBusterRoute({
|
||||
route: BusterRoutes.APP_THREAD_ID,
|
||||
threadId: id
|
||||
});
|
||||
}
|
||||
|
||||
if (shareType === BusterShareAssetType.DASHBOARD) {
|
||||
if (shareType === ShareAssetType.DASHBOARD) {
|
||||
url = createBusterRoute({
|
||||
route: BusterRoutes.APP_DASHBOARD_ID,
|
||||
dashboardId: id
|
||||
});
|
||||
}
|
||||
|
||||
if (shareType === BusterShareAssetType.COLLECTION) {
|
||||
if (shareType === ShareAssetType.COLLECTION) {
|
||||
url = createBusterRoute({
|
||||
route: BusterRoutes.APP_COLLECTIONS_ID,
|
||||
collectionId: id
|
||||
|
@ -76,7 +76,7 @@ export const ShareMenuContentEmbed: React.FC<{
|
|||
publicly_accessible: true
|
||||
};
|
||||
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
await onShareThread(payload);
|
||||
} else if (shareType === 'dashboard') {
|
||||
await onShareDashboard(payload);
|
||||
|
|
|
@ -10,7 +10,7 @@ import { useDashboardContextSelector } from '@/context/Dashboards';
|
|||
import { useBusterThreadsContextSelector } from '@/context/Threads';
|
||||
import { BusterRoutes, createBusterRoute } from '@/routes';
|
||||
import { useCollectionsContextSelector } from '@/context/Collections';
|
||||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { Text } from '@/components';
|
||||
import { useBusterNotifications } from '@/context/BusterNotifications';
|
||||
import { Dayjs } from 'dayjs';
|
||||
|
@ -20,7 +20,7 @@ export const ShareMenuContentPublish: React.FC<{
|
|||
publicExpirationDate: string;
|
||||
publicly_accessible: boolean;
|
||||
password: string | null;
|
||||
shareType: BusterShareAssetType;
|
||||
shareType: ShareAssetType;
|
||||
threadId?: string;
|
||||
dashboardId?: string;
|
||||
collectionId?: string;
|
||||
|
@ -51,7 +51,7 @@ export const ShareMenuContentPublish: React.FC<{
|
|||
|
||||
const url = useMemo(() => {
|
||||
let url = '';
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
url = createBusterRoute({ route: BusterRoutes.APP_THREAD_ID, threadId: id });
|
||||
} else if (shareType === 'dashboard') {
|
||||
url = createBusterRoute({ route: BusterRoutes.APP_DASHBOARD_ID, dashboardId: id });
|
||||
|
@ -70,7 +70,7 @@ export const ShareMenuContentPublish: React.FC<{
|
|||
public_password: _password || null,
|
||||
public_expiry_date: linkExp
|
||||
};
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
await onShareThread(payload);
|
||||
} else if (shareType === 'dashboard') {
|
||||
await onShareDashboard(payload);
|
||||
|
@ -83,7 +83,7 @@ export const ShareMenuContentPublish: React.FC<{
|
|||
|
||||
const onSetPasswordProtected = useMemoizedFn(async (v: boolean) => {
|
||||
if (!v) {
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
await onShareThread({ id, public_password: null });
|
||||
} else if (shareType === 'dashboard') {
|
||||
await onShareDashboard({ id, public_password: null });
|
||||
|
@ -96,7 +96,7 @@ export const ShareMenuContentPublish: React.FC<{
|
|||
});
|
||||
|
||||
const onSetPassword = useMemoizedFn(async (password: string | null) => {
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
await onShareThread({ id, public_password: password });
|
||||
} else if (shareType === 'dashboard') {
|
||||
await onShareDashboard({ id, public_password: password });
|
||||
|
@ -109,7 +109,7 @@ export const ShareMenuContentPublish: React.FC<{
|
|||
|
||||
const onSetExpirationDate = useMemoizedFn(async (date: Date | null) => {
|
||||
const linkExp = date ? date.toISOString() : null;
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
await onShareThread({ id, public_expiry_date: linkExp });
|
||||
} else if (shareType === 'dashboard') {
|
||||
await onShareDashboard({ id, public_expiry_date: linkExp });
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { AppSegmented, AppSegmentedProps } from '@/components';
|
||||
import React, { useMemo } from 'react';
|
||||
import { CopyLinkButton } from './CopyLinkButton';
|
||||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { ShareRole } from '@/api/buster_socket/threads';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
import { SegmentedValue } from 'antd/es/segmented';
|
||||
|
@ -17,7 +17,7 @@ export const ShareMenuTopBar: React.FC<{
|
|||
selectedOptions: ShareMenuTopBarOptions;
|
||||
onChangeSelectedOption: (option: ShareMenuTopBarOptions) => void;
|
||||
onCopyLink: () => void;
|
||||
shareType: BusterShareAssetType;
|
||||
shareType: ShareAssetType;
|
||||
permission: ShareRole;
|
||||
}> = React.memo(
|
||||
({ shareType, onCopyLink, selectedOptions, onChangeSelectedOption, permission }) => {
|
||||
|
@ -33,12 +33,12 @@ export const ShareMenuTopBar: React.FC<{
|
|||
{
|
||||
value: ShareMenuTopBarOptions.Publish,
|
||||
label: 'Publish',
|
||||
show: shareType !== BusterShareAssetType.COLLECTION && isOwner
|
||||
show: shareType !== ShareAssetType.COLLECTION && isOwner
|
||||
},
|
||||
{
|
||||
value: ShareMenuTopBarOptions.Embed,
|
||||
label: 'Embed',
|
||||
show: shareType !== BusterShareAssetType.COLLECTION
|
||||
show: shareType !== ShareAssetType.COLLECTION
|
||||
}
|
||||
]
|
||||
.filter((o) => o.show)
|
||||
|
|
|
@ -12,11 +12,12 @@ import { ShareRequest } from '@/api/buster_socket/dashboards';
|
|||
import { useMemoizedFn } from 'ahooks';
|
||||
import { useCollectionsContextSelector, useIndividualCollection } from '@/context/Collections';
|
||||
import { Text } from '@/components';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
|
||||
export const ShareWithGroupAndTeam: React.FC<{
|
||||
goBack: () => void;
|
||||
onCopyLink: () => void;
|
||||
shareType: 'thread' | 'dashboard' | 'collection';
|
||||
shareType: ShareAssetType;
|
||||
threadId?: string;
|
||||
dashboardId?: string;
|
||||
collectionId?: string;
|
||||
|
@ -34,7 +35,7 @@ export const ShareWithGroupAndTeam: React.FC<{
|
|||
const { collection } = useIndividualCollection({ collectionId });
|
||||
|
||||
const thread = useMemo(
|
||||
() => (shareType === 'thread' && threadId ? getThread({ threadId }) : null),
|
||||
() => (shareType === 'metric' && threadId ? getThread({ threadId }) : null),
|
||||
[shareType, threadId]
|
||||
);
|
||||
|
||||
|
@ -47,7 +48,7 @@ export const ShareWithGroupAndTeam: React.FC<{
|
|||
} else {
|
||||
payload.team_permissions = [{ team_id: teamId, role }];
|
||||
}
|
||||
if (shareType === 'thread') {
|
||||
if (shareType === 'metric') {
|
||||
await onShareThread(payload);
|
||||
} else if (shareType === 'dashboard') {
|
||||
await onShareDashboard(payload);
|
||||
|
@ -59,7 +60,7 @@ export const ShareWithGroupAndTeam: React.FC<{
|
|||
|
||||
const listedTeam: { id: string; name: string; role: ShareRole | null }[] = useMemo(() => {
|
||||
const assosciatedPermissiongSearch = (teamId: string) => {
|
||||
if (shareType === 'thread' && thread) {
|
||||
if (shareType === 'metric' && thread) {
|
||||
return thread.team_permissions?.find((t) => t.id === teamId);
|
||||
} else if (shareType === 'dashboard' && dashboardResponse) {
|
||||
return dashboardResponse.team_permissions?.find((t) => t.id === teamId);
|
||||
|
|
|
@ -13,14 +13,18 @@ import { useStyles } from './useStyles';
|
|||
import { IndividualSharePerson } from './IndividualSharePerson';
|
||||
import { ShareMenuContentPublish } from './ShareMenuContentPublish';
|
||||
import { ShareMenuContentEmbed } from './ShareMenuContentEmbed';
|
||||
import { IBusterThread } from '@/context/Threads/interfaces';
|
||||
import type { IBusterThread } from '@/context/Threads/interfaces';
|
||||
import { BusterRoutes, createBusterRoute } from '@/routes';
|
||||
import { BusterDashboardResponse, BusterShare, BusterShareAssetType } from '@/api/buster_rest';
|
||||
import {
|
||||
BusterCollection,
|
||||
BusterDashboardResponse,
|
||||
BusterShare,
|
||||
ShareAssetType
|
||||
} from '@/api/asset_interfaces';
|
||||
import { useBusterThreadsContextSelector } from '@/context/Threads';
|
||||
import { AccessDropdown } from './AccessDropdown';
|
||||
import { ShareRole } from '@/api/buster_socket/threads';
|
||||
import { ShareRequest } from '@/api/buster_socket/dashboards';
|
||||
import { BusterCollection } from '@/api/buster_rest/collection';
|
||||
import { useCollectionsContextSelector } from '@/context/Collections';
|
||||
import { Text } from '@/components';
|
||||
import { useDashboardContextSelector } from '@/context/Dashboards';
|
||||
|
@ -33,7 +37,7 @@ export const ShareMenu: React.FC<
|
|||
thread?: IBusterThread;
|
||||
dashboardResponse?: BusterDashboardResponse;
|
||||
collection?: BusterCollection;
|
||||
shareType: BusterShareAssetType;
|
||||
shareType: ShareAssetType;
|
||||
}>
|
||||
> = ({ children, dashboardResponse, collection, thread, shareType, placement = 'bottomLeft' }) => {
|
||||
const [isOpen, setIsOpen] = React.useState(false);
|
||||
|
@ -79,7 +83,7 @@ const ShareMenuContent: React.FC<{
|
|||
thread?: IBusterThread;
|
||||
dashboardResponse?: BusterDashboardResponse;
|
||||
collection?: BusterCollection;
|
||||
shareType: BusterShareAssetType;
|
||||
shareType: ShareAssetType;
|
||||
permission: ShareRole;
|
||||
}> = React.memo(({ collection, thread, dashboardResponse, shareType, permission }) => {
|
||||
const { openSuccessMessage } = useBusterNotifications();
|
||||
|
@ -94,7 +98,7 @@ const ShareMenuContent: React.FC<{
|
|||
|
||||
const onCopyLink = useMemoizedFn(() => {
|
||||
let url = '';
|
||||
if (shareType === BusterShareAssetType.THREAD && thread) {
|
||||
if (shareType === ShareAssetType.METRIC && thread) {
|
||||
url = createBusterRoute({ route: BusterRoutes.APP_THREAD_ID, threadId: thread.id });
|
||||
} else if (shareType === 'dashboard' && dashboardResponse) {
|
||||
url = createBusterRoute({
|
||||
|
@ -163,7 +167,7 @@ const ShareMenuContentBody: React.FC<{
|
|||
thread?: IBusterThread;
|
||||
dashboardResponse?: BusterDashboardResponse;
|
||||
collection?: BusterCollection;
|
||||
shareType: BusterShareAssetType;
|
||||
shareType: ShareAssetType;
|
||||
}> = React.memo(
|
||||
({
|
||||
shareType,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { AppMaterialIcons } from '@/components';
|
||||
import { useCollectionsContextSelector } from '@/context/Collections';
|
||||
import { useDashboardContextSelector } from '@/context/Dashboards';
|
||||
|
@ -15,7 +15,7 @@ export const ShareMenuContentEmbed: React.FC<{
|
|||
publicExpirationDate: string;
|
||||
publicly_accessible: boolean;
|
||||
password: string | null;
|
||||
shareType: BusterShareAssetType;
|
||||
shareType: ShareAssetType;
|
||||
threadId?: string;
|
||||
dashboardId?: string;
|
||||
collectionId?: string;
|
||||
|
@ -40,21 +40,21 @@ export const ShareMenuContentEmbed: React.FC<{
|
|||
const embedURL = useMemo(() => {
|
||||
let url = '';
|
||||
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
url = createBusterRoute({
|
||||
route: BusterRoutes.APP_THREAD_ID,
|
||||
threadId: id
|
||||
});
|
||||
}
|
||||
|
||||
if (shareType === BusterShareAssetType.DASHBOARD) {
|
||||
if (shareType === ShareAssetType.DASHBOARD) {
|
||||
url = createBusterRoute({
|
||||
route: BusterRoutes.APP_DASHBOARD_ID,
|
||||
dashboardId: id
|
||||
});
|
||||
}
|
||||
|
||||
if (shareType === BusterShareAssetType.COLLECTION) {
|
||||
if (shareType === ShareAssetType.COLLECTION) {
|
||||
url = createBusterRoute({
|
||||
route: BusterRoutes.APP_COLLECTIONS_ID,
|
||||
collectionId: id
|
||||
|
@ -76,7 +76,7 @@ export const ShareMenuContentEmbed: React.FC<{
|
|||
publicly_accessible: true
|
||||
};
|
||||
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
await onShareThread(payload);
|
||||
} else if (shareType === 'dashboard') {
|
||||
await onShareDashboard(payload);
|
||||
|
|
|
@ -10,7 +10,7 @@ import { useDashboardContextSelector } from '@/context/Dashboards';
|
|||
import { useBusterThreadsContextSelector } from '@/context/Threads';
|
||||
import { BusterRoutes, createBusterRoute } from '@/routes';
|
||||
import { useCollectionsContextSelector } from '@/context/Collections';
|
||||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { Text } from '@/components';
|
||||
import { useBusterNotifications } from '@/context/BusterNotifications';
|
||||
import { Dayjs } from 'dayjs';
|
||||
|
@ -20,7 +20,7 @@ export const ShareMenuContentPublish: React.FC<{
|
|||
publicExpirationDate: string;
|
||||
publicly_accessible: boolean;
|
||||
password: string | null;
|
||||
shareType: BusterShareAssetType;
|
||||
shareType: ShareAssetType;
|
||||
threadId?: string;
|
||||
dashboardId?: string;
|
||||
collectionId?: string;
|
||||
|
@ -51,7 +51,7 @@ export const ShareMenuContentPublish: React.FC<{
|
|||
|
||||
const url = useMemo(() => {
|
||||
let url = '';
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
url = createBusterRoute({ route: BusterRoutes.APP_THREAD_ID, threadId: id });
|
||||
} else if (shareType === 'dashboard') {
|
||||
url = createBusterRoute({ route: BusterRoutes.APP_DASHBOARD_ID, dashboardId: id });
|
||||
|
@ -70,7 +70,7 @@ export const ShareMenuContentPublish: React.FC<{
|
|||
public_password: _password || null,
|
||||
public_expiry_date: linkExp
|
||||
};
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
await onShareThread(payload);
|
||||
} else if (shareType === 'dashboard') {
|
||||
await onShareDashboard(payload);
|
||||
|
@ -83,7 +83,7 @@ export const ShareMenuContentPublish: React.FC<{
|
|||
|
||||
const onSetPasswordProtected = useMemoizedFn(async (v: boolean) => {
|
||||
if (!v) {
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
await onShareThread({ id, public_password: null });
|
||||
} else if (shareType === 'dashboard') {
|
||||
await onShareDashboard({ id, public_password: null });
|
||||
|
@ -96,7 +96,7 @@ export const ShareMenuContentPublish: React.FC<{
|
|||
});
|
||||
|
||||
const onSetPassword = useMemoizedFn(async (password: string | null) => {
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
await onShareThread({ id, public_password: password });
|
||||
} else if (shareType === 'dashboard') {
|
||||
await onShareDashboard({ id, public_password: password });
|
||||
|
@ -109,7 +109,7 @@ export const ShareMenuContentPublish: React.FC<{
|
|||
|
||||
const onSetExpirationDate = useMemoizedFn(async (date: Date | null) => {
|
||||
const linkExp = date ? date.toISOString() : null;
|
||||
if (shareType === BusterShareAssetType.THREAD) {
|
||||
if (shareType === ShareAssetType.METRIC) {
|
||||
await onShareThread({ id, public_expiry_date: linkExp });
|
||||
} else if (shareType === 'dashboard') {
|
||||
await onShareDashboard({ id, public_expiry_date: linkExp });
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { AppSegmented, AppSegmentedProps } from '@/components';
|
||||
import React, { useMemo } from 'react';
|
||||
import { CopyLinkButton } from './CopyLinkButton';
|
||||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { ShareRole } from '@/api/buster_socket/threads';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
import { SegmentedValue } from 'antd/es/segmented';
|
||||
|
@ -17,7 +17,7 @@ export const ShareMenuTopBar: React.FC<{
|
|||
selectedOptions: ShareMenuTopBarOptions;
|
||||
onChangeSelectedOption: (option: ShareMenuTopBarOptions) => void;
|
||||
onCopyLink: () => void;
|
||||
shareType: BusterShareAssetType;
|
||||
shareType: ShareAssetType;
|
||||
permission: ShareRole;
|
||||
}> = React.memo(
|
||||
({ shareType, onCopyLink, selectedOptions, onChangeSelectedOption, permission }) => {
|
||||
|
@ -33,12 +33,12 @@ export const ShareMenuTopBar: React.FC<{
|
|||
{
|
||||
value: ShareMenuTopBarOptions.Publish,
|
||||
label: 'Publish',
|
||||
show: shareType !== BusterShareAssetType.COLLECTION && isOwner
|
||||
show: shareType !== ShareAssetType.COLLECTION && isOwner
|
||||
},
|
||||
{
|
||||
value: ShareMenuTopBarOptions.Embed,
|
||||
label: 'Embed',
|
||||
show: shareType !== BusterShareAssetType.COLLECTION
|
||||
show: shareType !== ShareAssetType.COLLECTION
|
||||
}
|
||||
]
|
||||
.filter((o) => o.show)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { asset_typeToTranslation } from '@/app/_helpers';
|
||||
import { BusterLogo } from '@/assets/svg/BusterLogo';
|
||||
import { Title } from '@/components/text';
|
||||
|
@ -12,7 +12,7 @@ import Link from 'next/link';
|
|||
import React from 'react';
|
||||
|
||||
export const AppNoPageAccess: React.FC<{
|
||||
asset_type: BusterShareAssetType;
|
||||
asset_type: ShareAssetType;
|
||||
threadId?: string;
|
||||
dashboardId?: string;
|
||||
}> = React.memo(({ asset_type, threadId, dashboardId }) => {
|
||||
|
|
|
@ -5,7 +5,7 @@ import React, { useRef } from 'react';
|
|||
import { Title } from '@/components/text';
|
||||
import { Button, Input, InputRef, Typography } from 'antd';
|
||||
import { LoginConfigProvider } from '@/app/auth/login/_components/LoginConfigProvider';
|
||||
import type { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { useBusterAssetsContextSelector } from '@/context/Assets/BusterAssetsProvider';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
|
||||
|
@ -14,7 +14,7 @@ const { Text } = Typography;
|
|||
export const AppPasswordAccess: React.FC<{
|
||||
threadId?: string;
|
||||
dashboardId?: string;
|
||||
type: BusterShareAssetType;
|
||||
type: ShareAssetType;
|
||||
children: React.ReactNode;
|
||||
}> = React.memo(({ children, threadId, dashboardId, type }) => {
|
||||
const getAssetPassword = useBusterAssetsContextSelector((state) => state.getAssetPassword);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { BusterShareAssetType, BusterUserFavorite } from '@/api/buster_rest';
|
||||
import type { BusterUserFavorite } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { AppMenuGroupSingleSortable } from '@/components/menu';
|
||||
import { useAppLayoutContextSelector } from '@/context/BusterAppLayout';
|
||||
import { useUserConfigContextSelector } from '@/context/Users';
|
||||
|
@ -112,7 +113,7 @@ const createListItem = ({
|
|||
});
|
||||
let name = item.name || item.collection_name;
|
||||
|
||||
if (item.type === BusterShareAssetType.THREAD) {
|
||||
if (item.type === ShareAssetType.METRIC) {
|
||||
link = createBusterRoute({
|
||||
route: BusterRoutes.APP_THREAD_ID,
|
||||
threadId: item.id
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { BusterDashboardListItem } from '@/api/buster_rest';
|
||||
import { BusterDashboardListItem } from '@/api/asset_interfaces';
|
||||
import { AppMaterialIcons, AppTooltip } from '@/components';
|
||||
import { AppDropdownSelect } from '@/components/dropdown';
|
||||
import { useAppLayoutContextSelector } from '@/context/BusterAppLayout';
|
||||
import { useDashboardContextSelector } from '@/context/Dashboards';
|
||||
import { useBusterThreadsContextSelector } from '@/context/Threads';
|
||||
import { IBusterThread } from '@/context/Threads/interfaces';
|
||||
import { BusterRootRoutes, BusterRoutes, createBusterRoute } from '@/routes';
|
||||
import { BusterRoutes, createBusterRoute } from '@/routes';
|
||||
import { useMemoizedFn, useMount, useUnmount } from 'ahooks';
|
||||
import { Button } from 'antd';
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
PreventNavigation
|
||||
} from '@/components';
|
||||
import { useUserConfigContextSelector } from '@/context/Users';
|
||||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { useMemoizedFn, useMount } from 'ahooks';
|
||||
import { BusterMessageData, IBusterThreadMessage } from '@/context/Threads/interfaces';
|
||||
import { useDisableSaveChanges } from './useDisableSaveChanges';
|
||||
|
@ -150,7 +150,7 @@ export const ThreadControllerHeaderPrimary: React.FC<{
|
|||
/>
|
||||
|
||||
<FavoriteStar
|
||||
type={BusterShareAssetType.THREAD}
|
||||
type={ShareAssetType.METRIC}
|
||||
id={threadId}
|
||||
name={currentThreadMessage?.title || thread.title}
|
||||
/>
|
||||
|
@ -197,7 +197,7 @@ export const ThreadControllerHeaderPrimary: React.FC<{
|
|||
disabled={disableButtons}
|
||||
/>
|
||||
|
||||
<ShareMenu shareType={BusterShareAssetType.THREAD} thread={thread}>
|
||||
<ShareMenu shareType={ShareAssetType.METRIC} thread={thread}>
|
||||
<Button
|
||||
disabled={disableButtons}
|
||||
type="text"
|
||||
|
|
|
@ -3,7 +3,7 @@ import { getAssetCheck } from '@/api/buster_rest/assets/requests';
|
|||
import { useSupabaseServerContext } from '@/context/Supabase/useSupabaseContext';
|
||||
import { AppPasswordAccess } from '../_controllers/AppPasswordAccess';
|
||||
import { AppNoPageAccess } from '../_controllers/AppNoPageAccess';
|
||||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { useBusterSupabaseAuthMethods } from '@/hooks/useBusterSupabaseAuthMethods';
|
||||
import { ClientSideAnonCheck } from './ClientSideAnonCheck';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
@ -63,7 +63,7 @@ export const AppAssetCheckLayout: React.FC<
|
|||
<AppPasswordAccess
|
||||
threadId={props.threadId}
|
||||
dashboardId={props.dashboardId}
|
||||
type={type as BusterShareAssetType}>
|
||||
type={type as ShareAssetType}>
|
||||
{children}
|
||||
</AppPasswordAccess>
|
||||
</ClientSideAnonCheck>
|
||||
|
@ -74,7 +74,7 @@ export const AppAssetCheckLayout: React.FC<
|
|||
return (
|
||||
<ClientSideAnonCheck jwtToken={jwtToken}>
|
||||
<AppNoPageAccess
|
||||
asset_type={type as BusterShareAssetType}
|
||||
asset_type={type as ShareAssetType}
|
||||
threadId={props.threadId}
|
||||
dashboardId={props.dashboardId}
|
||||
/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useState, useRef, useMemo } from 'react';
|
||||
import type { BusterChatMessageResponse } from '@/api/buster_socket/chats';
|
||||
import type { BusterChatMessageResponse } from '@/api/asset_interfaces';
|
||||
import { createStyles } from 'antd-style';
|
||||
import {
|
||||
ChatResponseMessageSelector,
|
||||
|
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import { ChatResponseMessage_File } from './ChatResponseMessage_File';
|
||||
import { ChatResponseMessage_Text } from './ChatResponseMessage_Text';
|
||||
import { ChatResponseMessage_Thought } from './ChatResponseMessage_Thought';
|
||||
import type { BusterChatMessageResponse } from '@/api/buster_socket/chats';
|
||||
import type { BusterChatMessageResponse } from '@/api/asset_interfaces';
|
||||
import { ChatResponseMessageHidden } from './ChatResponseMessageHidden';
|
||||
|
||||
export interface ChatResponseMessageProps {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { createStyles } from 'antd-style';
|
|||
import type {
|
||||
BusterChatMessage_file,
|
||||
BusterChatMessage_fileMetadata
|
||||
} from '@/api/buster_socket/chats';
|
||||
} from '@/api/asset_interfaces';
|
||||
import { Text } from '@/components/text';
|
||||
import { motion, AnimatePresence } from 'framer-motion';
|
||||
import { itemAnimationConfig } from '../animationConfig';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterChatMessage_text } from '@/api/buster_socket/chats';
|
||||
import { BusterChatMessage_text } from '@/api/asset_interfaces';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import { itemAnimationConfig } from './animationConfig';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterChatMessage_thought } from '@/api/buster_socket/chats';
|
||||
import { BusterChatMessage_thought } from '@/api/asset_interfaces';
|
||||
import React, { useRef } from 'react';
|
||||
import { ChatResponseMessageProps } from '../ChatResponseMessageSelector';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type {
|
||||
BusterChatMessage_thought,
|
||||
BusterChatMessage_thoughtPill
|
||||
} from '@/api/buster_socket/chats';
|
||||
} from '@/api/asset_interfaces';
|
||||
import { createStyles } from 'antd-style';
|
||||
import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useMemo } from 'react';
|
||||
import type { BusterChatMessageResponse } from '@/api/buster_socket/chats';
|
||||
import type { BusterChatMessageResponse } from '@/api/asset_interfaces';
|
||||
import { MessageContainer } from '../MessageContainer';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { BusterChatMessageRequest } from '@/api/buster_socket/chats';
|
||||
import type { BusterChatMessageRequest } from '@/api/asset_interfaces';
|
||||
import { createStyles } from 'antd-style';
|
||||
import React from 'react';
|
||||
import { Text } from '@/components/text';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { FileType } from '@/api/buster_socket/chats';
|
||||
import type { FileType } from '@/api/asset_interfaces';
|
||||
import { AppMaterialIcons } from '@/components/icons';
|
||||
import type { MenuProps } from 'antd';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { FileType } from '@/api/buster_socket/chats';
|
||||
import { FileType } from '@/api/asset_interfaces';
|
||||
import { useDashboardContextSelector, useIndividualDashboard } from '@/context/Dashboards';
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { FileType } from '@/api/buster_socket/chats';
|
||||
import type { FileType } from '@/api/asset_interfaces';
|
||||
import { BusterRoutes, createBusterRoute } from '@/routes';
|
||||
|
||||
const chatRouteRecord: Record<FileType, (chatId: string, assetId: string) => string> = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { FileType } from '@/api/buster_socket/chats';
|
||||
import { FileType } from '@/api/asset_interfaces';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { FileConfig, FileView, FileViewConfig, FileViewSecondary } from './interfaces';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
|
|
|
@ -2,7 +2,7 @@ import { appContentHeaderHeight } from '@/components/layout';
|
|||
import { createStyles } from 'antd-style';
|
||||
import React from 'react';
|
||||
import { CollapseFileButton } from './CollapseFileButton';
|
||||
import { FileType } from '@/api/buster_socket/chats';
|
||||
import { FileType } from '@/api/asset_interfaces';
|
||||
import { FileContainerSegmentProps, FileContainerButtonsProps } from './interfaces';
|
||||
import { MetricContainerHeaderButtons } from './MetricContainerHeaderButtons';
|
||||
import { ValueContainerHeaderButtons } from './ValueContainerHeaderButtons';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { FileType } from '@/api/buster_socket/chats';
|
||||
import type { FileType } from '@/api/asset_interfaces';
|
||||
|
||||
export type SelectedFile = {
|
||||
id: string;
|
||||
|
|
|
@ -9,11 +9,11 @@ import {
|
|||
BusterCollection,
|
||||
BusterCollectionItemAsset,
|
||||
BusterCollectionListItem
|
||||
} from '@/api/buster_rest/collection';
|
||||
} from '@/api/asset_interfaces';
|
||||
import { Text } from '@/components';
|
||||
import { ListEmptyStateWithButton } from '../../../../components/list';
|
||||
import { AddTypeModal } from '../../_components/AddTypeModal';
|
||||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
import { BusterList, BusterListColumn, BusterListRow } from '@/components/list';
|
||||
import { CollectionIndividualSelectedPopup } from './_CollectionsIndividualPopup';
|
||||
|
@ -186,7 +186,7 @@ const CollectionListSkeleton: React.FC<{}> = () => {
|
|||
};
|
||||
|
||||
const createAssetLink = (asset: BusterCollectionItemAsset, collectionId: string) => {
|
||||
if (asset.asset_type === BusterShareAssetType.THREAD) {
|
||||
if (asset.asset_type === ShareAssetType.METRIC) {
|
||||
return createBusterRoute({
|
||||
route: BusterRoutes.APP_COLLECTIONS_ID_THREADS_ID,
|
||||
collectionId,
|
||||
|
|
|
@ -15,8 +15,7 @@ import { useBusterThreadsContextSelector } from '@/context/Threads';
|
|||
import { AppMaterialIcons, EditableTitle } from '@/components';
|
||||
import { FavoriteStar } from '../../_components/Lists/FavoriteStar';
|
||||
import { ShareMenu } from '../../_components/ShareMenu_old';
|
||||
import { BusterCollection } from '@/api/buster_rest/collection';
|
||||
import { BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { BusterCollection, ShareAssetType } from '@/api/asset_interfaces';
|
||||
import { Text } from '@/components';
|
||||
import { useAntToken } from '@/styles/useAntToken';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
|
@ -110,7 +109,7 @@ export const CollectionsIndividualHeader: React.FC<{}> = () => {
|
|||
|
||||
<FavoriteStar
|
||||
id={collection.id}
|
||||
type={BusterShareAssetType.COLLECTION}
|
||||
type={ShareAssetType.COLLECTION}
|
||||
name={collectionTitle}
|
||||
/>
|
||||
</div>
|
||||
|
@ -140,7 +139,7 @@ const ContentRight: React.FC<{
|
|||
|
||||
return (
|
||||
<div className="flex items-center space-x-2">
|
||||
<ShareMenu shareType={BusterShareAssetType.COLLECTION} collection={collection}>
|
||||
<ShareMenu shareType={ShareAssetType.COLLECTION} collection={collection}>
|
||||
<Button type="text" icon={<AppMaterialIcons icon="share_windows" size={16} />} />
|
||||
</ShareMenu>
|
||||
<Button icon={<AppMaterialIcons icon="add" />} onClick={onButtonClick} type="default">
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import { BusterCollectionItemAsset } from '@/api/buster_rest/collection';
|
||||
import { AppMaterialIcons } from '@/components';
|
||||
import { BusterListSelectedOptionPopupContainer } from '@/components/list';
|
||||
import { useCollectionsContextSelector } from '@/context/Collections';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
import { Button } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
} from '@/components/list';
|
||||
import { useMemoizedFn, useMount, useUnmount } from 'ahooks';
|
||||
import { NewCollectionModal } from './_NewCollectionModal';
|
||||
import { BusterCollectionListItem } from '@/api/buster_rest/collection';
|
||||
import { BusterCollectionListItem } from '@/api/asset_interfaces';
|
||||
import { CollectionSelectedPopup } from './_CollectionSelectedPopup';
|
||||
|
||||
export const CollectionsListContent: React.FC<{}> = () => {
|
||||
|
|
|
@ -11,13 +11,13 @@ import { BusterRoutes } from '@/routes';
|
|||
import { useBusterThreadsContextSelector } from '@/context/Threads';
|
||||
import { FavoriteStar } from '../../_components/Lists/FavoriteStar';
|
||||
import { AppMaterialIcons } from '@/components';
|
||||
import { BusterDashboard, BusterDashboardResponse, BusterShareAssetType } from '@/api/buster_rest';
|
||||
import { ShareMenu } from '../../_components/ShareMenu_old';
|
||||
import { timeout } from '@/utils';
|
||||
import { AddTypeModal } from '../../_components/AddTypeModal';
|
||||
import { useCollectionsContextSelector } from '@/context/Collections';
|
||||
import { useMemoizedFn, useMount } from 'ahooks';
|
||||
import { useUserConfigContextSelector } from '@/context/Users';
|
||||
import { BusterDashboard, BusterDashboardResponse, ShareAssetType } from '@/api/asset_interfaces';
|
||||
|
||||
export const DashboardIndividualHeaderPrimary: React.FC<{}> = React.memo(() => {
|
||||
const openedDashboardId = useDashboardContextSelector((x) => x.openedDashboardId);
|
||||
|
@ -43,7 +43,7 @@ export const DashboardIndividualHeaderPrimary: React.FC<{}> = React.memo(() => {
|
|||
<ThreeDotMenu dashboardResponse={dashboardResponse} />
|
||||
<FavoriteStar
|
||||
id={dashboard.id}
|
||||
type={BusterShareAssetType.DASHBOARD}
|
||||
type={ShareAssetType.DASHBOARD}
|
||||
name={dashboardTitle}
|
||||
/>
|
||||
</div>
|
||||
|
@ -104,7 +104,7 @@ const RightContent: React.FC<{
|
|||
|
||||
return (
|
||||
<div className="flex items-center space-x-1">
|
||||
<ShareMenu shareType={BusterShareAssetType.DASHBOARD} dashboardResponse={dashboardResponse}>
|
||||
<ShareMenu shareType={ShareAssetType.DASHBOARD} dashboardResponse={dashboardResponse}>
|
||||
<Button type="text" icon={<AppMaterialIcons icon="share_windows" />} />
|
||||
</ShareMenu>
|
||||
<Button
|
||||
|
@ -199,7 +199,7 @@ const ThreeDotMenu: React.FC<{
|
|||
<AppMaterialIcons icon="star" />
|
||||
),
|
||||
onClick: async () => {
|
||||
const type = BusterShareAssetType.DASHBOARD;
|
||||
const type = ShareAssetType.DASHBOARD;
|
||||
|
||||
if (!isFavorited)
|
||||
return await addItemToFavorite({
|
||||
|
|
|
@ -8,12 +8,12 @@ import {
|
|||
useDashboardContextSelector,
|
||||
useIndividualDashboard
|
||||
} from '@/context/Dashboards';
|
||||
import { BusterDashboardResponse } from '@/api/buster_rest';
|
||||
import { DashboardIndividualDashboard } from './_DashboardIndividualDashboard';
|
||||
import { EditableTitle } from '@/components';
|
||||
import { useUserConfigContextSelector } from '@/context/Users';
|
||||
import { ShareRole } from '@/api/buster_socket/threads';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
import { BusterDashboardResponse } from '@/api/asset_interfaces';
|
||||
|
||||
export const DashboardIndividualContent: React.FC<{}> = ({}) => {
|
||||
const isAnonymousUser = useUserConfigContextSelector((state) => state.isAnonymousUser);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { BusterDashboardMetric, BusterDashboardResponse } from '@/api/buster_rest';
|
||||
import React, { useEffect, useMemo, useRef } from 'react';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import { Button } from 'antd';
|
||||
|
@ -6,10 +5,14 @@ import { BusterResizeableGrid, BusterResizeableGridRow } from '@/components/grid
|
|||
import { useDebounceFn, useMemoizedFn } from 'ahooks';
|
||||
import { hasRemovedThreads, hasUnmappedThreads, normalizeNewMetricsIntoGrid } from './_helpers';
|
||||
import { DashboardMetricItem } from './_DashboardMetricItem';
|
||||
import { DashboardConfig } from '@/api/buster_socket/dashboards/dashboardConfigInterfaces';
|
||||
import { useDashboards } from '@/context/Dashboards';
|
||||
import { AppMaterialIcons } from '@/components';
|
||||
import { DashboardIndividualProvider, useDashboardIndividual } from './_DashboardInvididualContext';
|
||||
import { DashboardIndividualProvider } from './_DashboardInvididualContext';
|
||||
import type {
|
||||
BusterDashboardMetric,
|
||||
BusterDashboardResponse,
|
||||
DashboardConfig
|
||||
} from '@/api/asset_interfaces/dashboard';
|
||||
|
||||
const DEFAULT_EMPTY_ROWS: DashboardConfig['rows'] = [];
|
||||
const DEFAULT_EMPTY_METRICS: BusterDashboardMetric[] = [];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import React, { useContext } from 'react';
|
||||
import React from 'react';
|
||||
import { DashboardIndividualHeaderPrimary } from './DashboardInvidualHeaderPrimary';
|
||||
import { AppContentHeader } from '../../../../components/layout/AppContentHeader';
|
||||
import { useDashboardContextSelector, useIndividualDashboard } from '@/context/Dashboards';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useRef, useState } from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
|
||||
import {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BusterDashboardMetric } from '@/api/buster_rest';
|
||||
import { BusterDashboardMetric } from '@/api/asset_interfaces';
|
||||
import { useStyles } from '@/app/app/_components/ShareMenu_old/useStyles';
|
||||
import { AppMaterialIcons, Title, Text } from '@/components';
|
||||
import { SortableItemContext } from '@/components/grid/_BusterSortableItemDragContainer';
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
import { DashboardConfig } from '@/api/buster_socket/dashboards/dashboardConfigInterfaces';
|
||||
import { BusterDashboardMetric } from '@/api/buster_rest';
|
||||
import { BusterResizeableGridRow } from '@/components/grid';
|
||||
import {
|
||||
NUMBER_OF_COLUMNS,
|
||||
MAX_NUMBER_OF_COLUMNS,
|
||||
MAX_NUMBER_OF_ITEMS,
|
||||
MIN_ROW_HEIGHT
|
||||
} from '@/components/grid/config';
|
||||
import type { BusterDashboardMetric, DashboardConfig } from '@/api/asset_interfaces/dashboard';
|
||||
import type { BusterResizeableGridRow } from '@/components/grid/interfaces';
|
||||
import { NUMBER_OF_COLUMNS, MAX_NUMBER_OF_ITEMS, MIN_ROW_HEIGHT } from '@/components/grid/config';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
export const normalizeNewMetricsIntoGrid = (
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import {
|
||||
BusterShareAssetType,
|
||||
BusterThreadListItem,
|
||||
BusterVerificationStatus
|
||||
} from '@/api/buster_rest';
|
||||
import { BusterThreadListItem } from '@/api/buster_rest';
|
||||
import { VerificationStatus } from '@/api/asset_interfaces';
|
||||
import { ShareAssetType } from '@/api/asset_interfaces';
|
||||
import {
|
||||
getNow,
|
||||
isDateSame,
|
||||
|
@ -229,7 +227,7 @@ const MetricsEmptyState: React.FC<{
|
|||
);
|
||||
};
|
||||
|
||||
const TitleCell = React.memo<{ title: string; status: BusterVerificationStatus; threadId: string }>(
|
||||
const TitleCell = React.memo<{ title: string; status: VerificationStatus; threadId: string }>(
|
||||
({ title, status, threadId }) => {
|
||||
const onFavoriteDivClick = useMemoizedFn((e: React.MouseEvent<HTMLDivElement>) => {
|
||||
e.stopPropagation();
|
||||
|
@ -244,7 +242,7 @@ const TitleCell = React.memo<{ title: string; status: BusterVerificationStatus;
|
|||
<div className="flex items-center" onClick={onFavoriteDivClick}>
|
||||
<FavoriteStar
|
||||
id={threadId}
|
||||
type={BusterShareAssetType.THREAD}
|
||||
type={ShareAssetType.METRIC}
|
||||
iconStyle="tertiary"
|
||||
name={title}
|
||||
className="opacity-0 group-hover:opacity-100"
|
||||
|
|
|
@ -3,7 +3,7 @@ import { AppMaterialIcons } from '@/components';
|
|||
import { BusterListSelectedOptionPopupContainer } from '@/components/list';
|
||||
import { Button, Dropdown, DropdownProps } from 'antd';
|
||||
import { StatusBadgeButton } from '../../_components/Lists';
|
||||
import { BusterVerificationStatus } from '@/api/buster_rest';
|
||||
import { VerificationStatus } from '@/api/asset_interfaces';
|
||||
import { useBusterThreadsContextSelector } from '@/context/Threads';
|
||||
import { useUserConfigContextSelector } from '@/context/Users';
|
||||
import { useCollectionsContextSelector } from '@/context/Collections';
|
||||
|
@ -136,7 +136,7 @@ const StatusButton: React.FC<{
|
|||
}> = ({ selectedRowKeys, onSelectChange }) => {
|
||||
return (
|
||||
<StatusBadgeButton
|
||||
status={BusterVerificationStatus.notRequested}
|
||||
status={VerificationStatus.notRequested}
|
||||
type="thread"
|
||||
id={selectedRowKeys}
|
||||
onChangedStatus={async () => {
|
||||
|
|
|
@ -7,21 +7,21 @@ import { ThreadItemsContainer } from './_ThreadItemsContainer';
|
|||
import { ThreadSidebarHeader } from './_ThreadSidebarHeader';
|
||||
import { useAppLayoutContextSelector } from '@/context/BusterAppLayout';
|
||||
import { useMemoizedFn, useMount } from 'ahooks';
|
||||
import { BusterVerificationStatus } from '@/api/buster_rest';
|
||||
import { VerificationStatus } from '@/api/asset_interfaces';
|
||||
|
||||
export const ThreadListContainer: React.FC<{
|
||||
className?: string;
|
||||
type: 'logs' | 'threads';
|
||||
}> = ({ type, className = '' }) => {
|
||||
const onToggleThreadsModal = useAppLayoutContextSelector((s) => s.onToggleThreadsModal);
|
||||
const [filters, setFilters] = useState<BusterVerificationStatus[]>([]);
|
||||
const [filters, setFilters] = useState<VerificationStatus[]>([]);
|
||||
const adminView = type === 'logs';
|
||||
const { list, threadListLoadingStatus } = useBusterThreadListByFilter({
|
||||
filters,
|
||||
admin_view: adminView
|
||||
});
|
||||
|
||||
const onSetFilters = useMemoizedFn((newFilters: BusterVerificationStatus[]) => {
|
||||
const onSetFilters = useMemoizedFn((newFilters: VerificationStatus[]) => {
|
||||
setFilters(newFilters);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
'use client';
|
||||
|
||||
import React, { useContext, useMemo } from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { AppContentHeader } from '../../../../components/layout/AppContentHeader';
|
||||
import { Button, Input } from 'antd';
|
||||
import { AppMaterialIcons, AppPopoverMenu, AppSegmented, AppTooltip } from '@/components';
|
||||
import { AppTooltipShortcutPill } from '@/components/tooltip/AppTooltipShortcutPill';
|
||||
import { useHotkeys } from 'react-hotkeys-hook';
|
||||
import type { InputRef } from 'antd';
|
||||
import { BusterVerificationStatus } from '@/api/buster_rest';
|
||||
import { Button } from 'antd';
|
||||
import { AppMaterialIcons, AppSegmented } from '@/components';
|
||||
import { VerificationStatus } from '@/api/asset_interfaces';
|
||||
import { Text } from '@/components';
|
||||
import { useAppLayoutContextSelector } from '@/context/BusterAppLayout';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
|
@ -15,8 +12,8 @@ import { SegmentedValue } from 'antd/lib/segmented';
|
|||
|
||||
export const ThreadSidebarHeader: React.FC<{
|
||||
type: 'logs' | 'threads';
|
||||
filters: BusterVerificationStatus[];
|
||||
onSetFilters: (filters: BusterVerificationStatus[]) => void;
|
||||
filters: VerificationStatus[];
|
||||
onSetFilters: (filters: VerificationStatus[]) => void;
|
||||
}> = ({ type, filters, onSetFilters }) => {
|
||||
const title = type === 'logs' ? 'Logs' : 'Metrics';
|
||||
const onToggleThreadsModal = useAppLayoutContextSelector((s) => s.onToggleThreadsModal);
|
||||
|
@ -55,23 +52,23 @@ const options = [
|
|||
},
|
||||
{
|
||||
label: 'Requested',
|
||||
value: BusterVerificationStatus.requested
|
||||
value: VerificationStatus.requested
|
||||
},
|
||||
{
|
||||
label: 'Verified',
|
||||
value: BusterVerificationStatus.verified
|
||||
value: VerificationStatus.verified
|
||||
}
|
||||
];
|
||||
|
||||
const ThreadsFilters: React.FC<{
|
||||
type: 'logs' | 'threads';
|
||||
filters: BusterVerificationStatus[];
|
||||
onSetFilters: (filters: BusterVerificationStatus[]) => void;
|
||||
filters: VerificationStatus[];
|
||||
onSetFilters: (filters: VerificationStatus[]) => void;
|
||||
}> = React.memo(({ type, filters, onSetFilters }) => {
|
||||
const selectedOption = useMemo(() => {
|
||||
return (
|
||||
options.find((option) => {
|
||||
return filters.includes(option.value as BusterVerificationStatus);
|
||||
return filters.includes(option.value as VerificationStatus);
|
||||
}) || options[0]
|
||||
);
|
||||
}, [filters]);
|
||||
|
@ -80,7 +77,7 @@ const ThreadsFilters: React.FC<{
|
|||
if (v === 'all') {
|
||||
onSetFilters([]);
|
||||
} else {
|
||||
onSetFilters([v as BusterVerificationStatus]);
|
||||
onSetFilters([v as VerificationStatus]);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SimplifiedColumnType } from '@/utils';
|
||||
import type { SimplifiedColumnType } from '@/utils/messages';
|
||||
|
||||
type ColumnLabelFormatBase = {
|
||||
style?: 'currency' | 'percent' | 'number' | 'date' | 'string';
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
import { BusterSocketResponseRoute } from '@/api/buster_socket';
|
||||
import {
|
||||
BusterSocketResponseBase,
|
||||
BusterSocketResponseMessage
|
||||
} from '@/api/buster_socket/baseInterfaces';
|
||||
import { ThreadResponses } from '@/api/buster_socket/threads';
|
||||
import { DashboardResponses } from '@/api/buster_socket/dashboards';
|
||||
import { isDev } from '@/config';
|
||||
|
@ -16,6 +12,10 @@ import { TeamResponses } from '@/api/buster_socket/user/teamResponses';
|
|||
import { SearchResponses } from '@/api/buster_socket/search';
|
||||
import { OrganizationResponses } from '@/api/buster_socket/organizations';
|
||||
import { SQLResponses } from '@/api/buster_socket/sql';
|
||||
import type {
|
||||
BusterSocketResponseBase,
|
||||
BusterSocketResponseMessage
|
||||
} from '@/api/buster_socket/base_interfaces';
|
||||
|
||||
export const createBusterResponse = (
|
||||
message: BusterSocketResponseMessage
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue