From 22df309e6f6c5b671860a7449b9e7b96da1644b7 Mon Sep 17 00:00:00 2001
From: 2427021 <s.a.vink@students.uu.nl>
Date: Fri, 29 Mar 2024 13:56:21 +0100
Subject: [PATCH] feat(visManager): removed daisyui from dialog

---
 .../DatabaseManagement/forms/settings.tsx     |  2 +-
 libs/shared/lib/components/Dialog.tsx         |  5 +-
 .../lib/schema/schema-utils/flow-utils.ts     |  2 +-
 libs/shared/lib/vis/common/index.ts           |  2 +-
 libs/shared/lib/vis/common/types.ts           | 74 +++++++++++++++++++
 .../components/NLMachineLearning.tsx          |  2 -
 6 files changed, 78 insertions(+), 9 deletions(-)

diff --git a/apps/web/src/components/navbar/DatabaseManagement/forms/settings.tsx b/apps/web/src/components/navbar/DatabaseManagement/forms/settings.tsx
index eef51b9ed..233899f09 100644
--- a/apps/web/src/components/navbar/DatabaseManagement/forms/settings.tsx
+++ b/apps/web/src/components/navbar/DatabaseManagement/forms/settings.tsx
@@ -114,7 +114,7 @@ export const SettingsForm = (props: { onClose(): void; open: 'add' | 'update'; s
   return (
     <Dialog open={!!props.open} onClose={props.onClose} className="lg:min-w-[50rem]">
       <div className="flex justify-between align-center">
-        <h1 className="text-xl font-bold">{formTitle} Database Connection</h1>
+        <h2 className="text-xl font-bold">{formTitle} Database Connection</h2>
         <div>
           {sampleDataPanel === true ? (
             <Button variant="outline" label="Go back" onClick={() => setSampleDataPanel(false)} />
diff --git a/libs/shared/lib/components/Dialog.tsx b/libs/shared/lib/components/Dialog.tsx
index 0aecd77cc..75781e135 100644
--- a/libs/shared/lib/components/Dialog.tsx
+++ b/libs/shared/lib/components/Dialog.tsx
@@ -16,13 +16,10 @@ export const Dialog = (props: DialogProps) => {
   }, [props.open]);
 
   return (
-    <dialog className={'fixed inset-0 z-10 overflow-y-auto rounded p-4'} ref={ref} onClose={() => props.onClose()}>
+    <dialog className={'fixed inset-0 z-10 overflow-y-auto rounded p-4 bg-light border'} ref={ref} onClose={() => props.onClose()}>
       <form method="dialog" className={'flex flex-col gap-4 ' + (props?.className ? props?.className : '')}>
         {props.children}
       </form>
-      {/* <form method="dialog" className=""> */}
-      {/* <button>close</button> */}
-      {/* </form> */}
     </dialog>
   );
 };
diff --git a/libs/shared/lib/schema/schema-utils/flow-utils.ts b/libs/shared/lib/schema/schema-utils/flow-utils.ts
index 3c72a06ab..c7ff67e34 100644
--- a/libs/shared/lib/schema/schema-utils/flow-utils.ts
+++ b/libs/shared/lib/schema/schema-utils/flow-utils.ts
@@ -4,7 +4,7 @@
  * © Copyright Utrecht University (Department of Information and Computing Sciences)
  */
 import { Position } from 'reactflow';
-import { BoundingBox } from '../../vis/common/Types'; // TODO: MOVE ELSEWHERE
+import { BoundingBox } from '../../vis/common'; // TODO: MOVE ELSEWHERE
 
 /** This is the interface to get the center of an edge */
 export interface GetCenterParams {
diff --git a/libs/shared/lib/vis/common/index.ts b/libs/shared/lib/vis/common/index.ts
index 4e326e2b4..fcb073fef 100644
--- a/libs/shared/lib/vis/common/index.ts
+++ b/libs/shared/lib/vis/common/index.ts
@@ -1 +1 @@
-export type { VisualizationConfiguration, VISComponentType, VisualizationPropTypes } from './types';
+export * from './types';
diff --git a/libs/shared/lib/vis/common/types.ts b/libs/shared/lib/vis/common/types.ts
index 0a2de554b..52e1513b2 100644
--- a/libs/shared/lib/vis/common/types.ts
+++ b/libs/shared/lib/vis/common/types.ts
@@ -4,6 +4,7 @@ import { SchemaGraph } from '../../schema';
 import type { AppDispatch } from '../../data-access';
 import { FC } from 'react';
 import { Visualizations } from '../hooks';
+import { Edge, Node } from 'reactflow';
 
 export type VisualizationConfiguration = { [id: string]: any };
 
@@ -23,3 +24,76 @@ export type VisualizationPropTypes = {
   handleHover: (val: any) => void;
   handleSelect: (val: any) => void;
 };
+
+export type SchemaElements = {
+  nodes: Node[];
+  edges: Edge[];
+  selfEdges: Edge[];
+};
+
+export interface Point {
+  x: number;
+  y: number;
+}
+
+export interface BoundingBox {
+  topLeft: Point;
+  bottomRight: Point;
+}
+
+export interface NodeQualityDataForEntities {
+  nodeCount: number;
+  attributeNullCount: number;
+  notConnectedNodeCount: number;
+  isAttributeDataIn: boolean; // is true when the data to display has arrived
+  onClickCloseButton: () => void;
+}
+
+export interface NodeQualityDataForRelations {
+  nodeCount: number;
+  attributeNullCount: number;
+  fromRatio: number; // the ratio of from-entity nodes to nodes that have this relation
+  toRatio: number; // the ratio of to-entity nodes to nodes that have this relation
+  isAttributeDataIn: boolean; // is true when the data to display has arrived
+  onClickCloseButton: () => void;
+}
+
+export interface NodeQualityPopupNode extends Node {
+  data: NodeQualityDataForEntities | NodeQualityDataForRelations;
+  nodeID: string; //ID of the node for which the popup is
+}
+
+export interface AttributeAnalyticsData {
+  nodeType: NodeType;
+  nodeID: string;
+  attributes: AttributeWithData[];
+  isAttributeDataIn: boolean; // is true when the data to display has arrived
+  onClickCloseButton: () => void;
+  onClickPlaceInQueryBuilderButton: (name: string, type: string) => void;
+  searchForAttributes: (id: string, searchbarValue: string) => void;
+  resetAttributeFilters: (id: string) => void;
+  applyAttributeFilters: (id: string, category: AttributeCategory, predicate: string, percentage: number) => void;
+}
+
+export enum AttributeCategory {
+  categorical = 'Categorical',
+  numerical = 'Numerical',
+  other = 'Other',
+  undefined = 'undefined',
+}
+
+export enum NodeType {
+  entity = 'entity',
+  relation = 'relation',
+}
+
+export interface AttributeAnalyticsPopupMenuNode extends Node {
+  nodeID: string; //ID of the node for which the popup is
+  data: AttributeAnalyticsData;
+}
+
+export type AttributeWithData = {
+  attribute: any;
+  category: AttributeCategory;
+  nullAmount: number;
+};
diff --git a/libs/shared/lib/vis/visualizations/nodelinkvis/components/NLMachineLearning.tsx b/libs/shared/lib/vis/visualizations/nodelinkvis/components/NLMachineLearning.tsx
index f180fe776..6ac50ebe2 100644
--- a/libs/shared/lib/vis/visualizations/nodelinkvis/components/NLMachineLearning.tsx
+++ b/libs/shared/lib/vis/visualizations/nodelinkvis/components/NLMachineLearning.tsx
@@ -1,6 +1,4 @@
 import { useState } from 'react';
-import { AttributeData, NodeAttributeData } from '../../../common/InputDataTypes';
-import { AttributeCategory } from '../../../common/Types';
 import { GraphType, LinkType, NodeType } from '../types';
 import { ML } from '../../../../data-access/store/mlSlice';
 
-- 
GitLab