Skip to content

Commit

Permalink
refactor(data-studio): clean up from migration to @leav/ui + new eyes…
Browse files Browse the repository at this point in the history
… on code
  • Loading branch information
P0ppoff committed Oct 29, 2024
1 parent 33d6bf9 commit 2b92b97
Show file tree
Hide file tree
Showing 44 changed files with 97 additions and 523 deletions.
122 changes: 2 additions & 120 deletions apps/data-studio/src/_types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt

import {GET_ATTRIBUTES_BY_LIB_attributes_list_StandardAttribute_embedded_fields} from '_gqlTypes/GET_ATTRIBUTES_BY_LIB';
import {AttributeFormat, AttributeType, RecordFilterCondition, RecordFilterOperator} from '_gqlTypes/globalTypes';
import {RecordIdentity, RecordIdentity_whoAmI} from '_gqlTypes/RecordIdentity';
import {TREE_NODE_CHILDREN_treeNodeChildren_list_permissions} from '_gqlTypes/TREE_NODE_CHILDREN';
import {AttributeFormat, AttributeType, RecordFilterCondition} from '_gqlTypes/globalTypes';
import {RecordIdentity_whoAmI} from '_gqlTypes/RecordIdentity';
import {
ILibraryDetailExtendedAttributeParentLinkedLibrary,
ILibraryDetailExtendedAttributeParentLinkedTree
Expand All @@ -20,11 +19,6 @@ export interface ILibrary {
label: ISystemTranslation;
}

export enum LinkedType {
library = 'library',
tree = 'tree'
}

export interface IItemBase {
fields: {[x: string]: any};
whoAmI: RecordIdentity_whoAmI;
Expand All @@ -38,15 +32,6 @@ export interface IRecordIdentityWhoAmI extends RecordIdentity_whoAmI {
index?: number;
}

export enum PreviewAttributes {
tiny = 'tiny',
small = 'small',
medium = 'medium',
big = 'big',
huge = 'huge',
pages = 'pages'
}

export enum PreviewSize {
tiny = 'tiny',
small = 'small',
Expand All @@ -59,16 +44,6 @@ export enum AvailableLanguage {
fr = 'fr'
}

export enum FilterTypes {
filter = 'filter',
separator = 'separator'
}

export interface IFilterSeparatorCommon {
key: number;
id: string;
}

export enum FilterType {
ATTRIBUTE = 'ATTRIBUTE',
TREE = 'TREE',
Expand All @@ -84,21 +59,6 @@ export interface IFilter {
condition: AttributeConditionType | TreeConditionFilter | ThroughConditionFilter;
}

export interface IFilterAttribute extends IFilter {
attribute: IAttribute; // Put the attribute in the filter to avoid having to fetch them multiple times
parentTreeLibrary?: IFilterLibrary; // on tree library attribute
}

export interface IFilterTree extends IFilter {
tree: {id: string; label?: ISystemTranslation | null};
}

// on library's tree
export interface IFilterLibrary extends IFilter {
library: {id: string; label?: ISystemTranslation | null};
parentAttribute: IAttribute;
}

export enum OperatorFilter {
AND = 'AND',
OR = 'OR',
Expand All @@ -124,14 +84,6 @@ export const AttributeConditionFilter = {

export type AttributeConditionType = ValueOf<typeof AttributeConditionFilter>;

export interface IQueryFilter {
field?: string;
value?: string;
condition?: RecordFilterCondition;
operator?: RecordFilterOperator;
treeId?: string;
}

export enum OrderSearch {
DESC = 'DESC',
ASC = 'ASC'
Expand All @@ -151,8 +103,6 @@ export interface IAttribute {
embedded_fields?: Array<GET_ATTRIBUTES_BY_LIB_attributes_list_StandardAttribute_embedded_fields | null> | null;
}

export type ExtendFormat = string | {[key: string]: ExtendFormat[]};

export interface IEmbeddedFieldData {
path: string;
format: AttributeFormat;
Expand Down Expand Up @@ -187,30 +137,6 @@ export interface IFieldTypeTree extends IFieldBase {

export type IField = IFieldTypeBasic | IFieldTypeLink | IFieldTypeTree;

export interface IRecordEdition {
show: boolean;
item?: IItem;
}

export interface IAccordionActive {
id: string;
library: string;
depth: number;
}

export interface ISelectedAttribute {
id: string;
library: string;
path: string;
label: SystemTranslation | null;
type: AttributeType;
format?: AttributeFormat | null;
multiple_values: boolean;
parentAttributeData?: IParentAttributeData;
embeddedFieldData?: IEmbeddedFields;
treeData?: ITreeData;
}

export interface IParentAttributeData {
id: string;
type: AttributeType;
Expand All @@ -221,27 +147,6 @@ export interface ITreeData {
libraryTypeName: string;
}

export interface IEmbeddedFields {
id: string;
format: AttributeFormat;
label: ISystemTranslation;
embedded_fields: IEmbeddedFields[];
}

export interface IGroupEmbeddedFields {
[attributeId: string]: {
embedded_fields: {[key: string]: IEmbeddedFields};
};
}

export interface IAttributeSelected {
id: string;
library: string;
originAttributeData?: IParentAttributeData;
extendedData?: IEmbeddedFieldData;
treeData?: ITreeData;
}

export interface ITree {
id: string;
label: ISystemTranslation | null;
Expand Down Expand Up @@ -288,12 +193,6 @@ export interface IInfo extends IBaseInfo {
channel?: InfoChannel;
}

export enum TypeSideItem {
filters = 'filters',
view = 'view',
versions = 'versions'
}

export interface ISharedStateSelectionSearch {
type: SharedStateSelectionType.search;
selected: ISharedSelected[];
Expand Down Expand Up @@ -321,12 +220,6 @@ export interface ISharedSelected {
nodeId?: string;
}

export interface IToggleSelection {
selectionType: SharedStateSelectionType;
elementSelected: ISharedSelected;
parent?: string;
}

export enum WorkspacePanels {
HOME = 'home',
LIBRARY = 'library',
Expand All @@ -339,17 +232,6 @@ export interface IDateRangeValue {

export type ValueOf<T> = T[keyof T];

export interface IPermissions {
[key: string]: boolean;
}

export interface ITreeContentRecordAndChildren {
id: string;
record: RecordIdentity;
children?: ITreeContentRecordAndChildren[];
permissions: TREE_NODE_CHILDREN_treeNodeChildren_list_permissions;
}

export interface IApplicationSettings {
libraries?: 'all' | 'none' | string[];
librariesOrder?: string[];
Expand Down
17 changes: 0 additions & 17 deletions apps/data-studio/src/assets/icons/IconClosePanel.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions apps/data-studio/src/assets/icons/IconEllipsisHorizontal.tsx

This file was deleted.

6 changes: 0 additions & 6 deletions apps/data-studio/src/assets/svg/svgChecked.svg

This file was deleted.

6 changes: 0 additions & 6 deletions apps/data-studio/src/assets/svg/svgCross.svg

This file was deleted.

6 changes: 0 additions & 6 deletions apps/data-studio/src/assets/svg/svgExpand.svg

This file was deleted.

19 changes: 0 additions & 19 deletions apps/data-studio/src/assets/svg/svgIconClosePanel.svg

This file was deleted.

15 changes: 0 additions & 15 deletions apps/data-studio/src/assets/svg/svgIconColumnChoice.svg

This file was deleted.

20 changes: 0 additions & 20 deletions apps/data-studio/src/assets/svg/svgViewList.svg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import {
} from '__mocks__/mockQuery/mockGetLibraryDetailExtendedQuery';

jest.mock('@leav/ui', () => ({
...jest.requireActual('@leav/ui'),
LibraryItemsList: () => <div>LibraryItemsList</div>
}));
...jest.requireActual('@leav/ui'),
LibraryItemsList: () => <div>LibraryItemsList</div>
}));

const mockUpdateActiveLib = jest.fn();

jest.mock('hooks/ActiveLibHook/ActiveLibHook', () => ({
jest.mock('hooks/useActiveLibrary', () => ({
useActiveLibrary: () => [mockActiveLibrary, mockUpdateActiveLib]
}));

Expand Down
Loading

0 comments on commit 2b92b97

Please sign in to comment.