This commit is contained in:
Kevin Carter 2025-11-14 14:46:55 +00:00
parent 47d47d44c7
commit 5804f644ea
9 changed files with 97 additions and 101 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
node_modules
.env

View File

@ -3,7 +3,7 @@ export interface BaseNodeInterface {
h: number;
color: string;
__primarylabel__: string;
unique_id: string;
uuid_string: string;
path: string;
created: string;
merged: string;
@ -91,9 +91,8 @@ export interface CalendarTimeChunkNodeInterface extends BaseNodeInterface {
// School
export interface SchoolNodeInterface extends BaseNodeInterface
{
school_name: string;
school_website: string;
school_uuid: string;
name: string;
website: string;
}
export interface DepartmentNodeInterface extends BaseNodeInterface

View File

@ -14,7 +14,7 @@ const stateProps = T.object({
const graphBaseProps = {
...baseShapeProps,
__primarylabel__: T.string,
unique_id: T.string,
uuid_string: T.string,
path: T.string,
created: T.string,
merged: T.string,
@ -84,9 +84,8 @@ export const ccGraphShapeProps = {
},
'cc-school-node': {
...graphBaseProps,
school_uuid: T.string,
school_name: T.string,
school_website: T.string,
name: T.string,
website: T.string,
},
'cc-department-node': {
...graphBaseProps,
@ -283,7 +282,7 @@ export const getDefaultBaseProps = () => ({
backgroundColor: '#f0f0f0' as string,
title: 'Untitled' as string,
isLocked: false as boolean,
unique_id: '' as string,
uuid_string: '' as string,
path: '' as string,
created: '' as string,
merged: '' as string,
@ -382,9 +381,8 @@ export const getDefaultCCSchoolNodeProps = () => ({
...getDefaultBaseProps(),
title: 'School',
__primarylabel__: 'School',
school_uuid: '',
school_name: '',
school_website: '',
name: '',
website: '',
})
export const getDefaultCCDepartmentNodeProps = () => ({

View File

@ -15,7 +15,7 @@ export interface ShapeState {
export type CCGraphShapeProps = CCBaseProps & {
__primarylabel__: string
unique_id: string
uuid_string: string
path: string
created: string
merged: string
@ -26,7 +26,7 @@ export type CCGraphShapeProps = CCBaseProps & {
// Define the base shape type for graph shapes
export type CCGraphShape = CCBaseShape & TLBaseShape<GraphShapeType, {
__primarylabel__: CCGraphShapeProps['__primarylabel__']
unique_id: CCGraphShapeProps['unique_id']
uuid_string: CCGraphShapeProps['uuid_string']
path: CCGraphShapeProps['path']
created: CCGraphShapeProps['created']
merged: CCGraphShapeProps['merged']
@ -93,9 +93,8 @@ export type CCCalendarTimeChunkNodeProps = CCGraphShapeProps & {
}
export type CCSchoolNodeProps = CCGraphShapeProps & {
school_uuid: string
school_name: string
school_website: string
name: string
website: string
}
export type CCDepartmentNodeProps = CCGraphShapeProps & {
@ -332,7 +331,7 @@ export const getShapeType = (nodeType: keyof CCNodeTypes): string => {
// Helper function to get allowed props from node type
export const getAllowedProps = (): string[] => {
return ['__primarylabel__', 'unique_id'];
return ['__primarylabel__', 'uuid_string'];
}
// Helper function to get node configuration

View File

@ -121,9 +121,9 @@ const createNodeComponent = (shape: AllNodeShapes, theme: TLDefaultColorTheme, e
}
isFetchingConnectedNodes = true;
console.log("Getting connected nodes for:", shape.props.unique_id);
console.log("Getting connected nodes for:", shape.props.uuid_string);
try {
const response = await axios.get(`/api/database/tools/get-connected-nodes-and-edges?unique_id=${shape.props.unique_id}`);
const response = await axios.get(`/api/database/tools/get-connected-nodes-and-edges?uuid_string=${shape.props.uuid_string}`);
console.log("Connected nodes response:", response.data);
if (response.data.status === "success") {
const mainNode = response.data.main_node;
@ -133,7 +133,7 @@ const createNodeComponent = (shape: AllNodeShapes, theme: TLDefaultColorTheme, e
// Add nodes to the graph
[mainNode, ...connectedNodes].forEach((node: any) => {
console.log("Node:", node);
const newShapeId = createShapeId(node.node_data.unique_id);
const newShapeId = createShapeId(node.node_data.uuid_string);
const doesShapeExist = editor.getShape(newShapeId);
if (!doesShapeExist) {
console.log("Creating new shape with ID:", newShapeId);
@ -177,7 +177,7 @@ const createNodeComponent = (shape: AllNodeShapes, theme: TLDefaultColorTheme, e
// Add edges to the graph
relationships.forEach((relationship: any) => {
graphState.addEdge(relationship.start_node.unique_id, relationship.end_node.unique_id);
graphState.addEdge(relationship.start_node.uuid_string, relationship.end_node.uuid_string);
});
// Create edge shapes

View File

@ -43,7 +43,7 @@ const baseNodeShapeProps = {
h: T.number,
color: DefaultColorStyle,
__primarylabel__: T.string,
unique_id: T.string,
uuid_string: T.string,
path: T.string,
created: T.string,
merged: T.string,
@ -126,9 +126,8 @@ export const calendarTimeChunkNodeShapeProps: RecordProps<CalendarTimeChunkNodeS
// School
export const schoolNodeShapeProps: RecordProps<SchoolNodeShape> = {
...baseNodeShapeProps,
school_name: T.string,
school_website: T.string,
school_uuid: T.string,
name: T.string,
website: T.string,
}
export const departmentNodeShapeProps: RecordProps<DepartmentNodeShape> = {

View File

@ -126,13 +126,13 @@ export class UserNodeShapeUtil extends BaseNodeShapeUtil<UserNodeShape> {
h: 200,
color: 'blue',
__primarylabel__: 'User',
unique_id: '',
uuid_string: '',
user_name: '',
user_email: '',
user_type: '',
user_id: '',
worker_node_data: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -150,12 +150,12 @@ export class DeveloperNodeShapeUtil extends BaseNodeShapeUtil<DeveloperNodeShape
h: 200,
color: 'white',
__primarylabel__: 'Developer',
unique_id: '',
uuid_string: '',
user_name: '',
user_email: '',
user_type: '',
user_id: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -173,12 +173,12 @@ export class TeacherNodeShapeUtil extends BaseNodeShapeUtil<TeacherNodeShape> {
h: 200,
color: 'white',
__primarylabel__: 'Teacher',
unique_id: '',
uuid_string: '',
teacher_code: '',
teacher_name_formal: '',
teacher_email: '',
worker_db_name: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -196,12 +196,12 @@ export class StudentNodeShapeUtil extends BaseNodeShapeUtil<StudentNodeShape> {
h: 200,
color: 'white',
__primarylabel__: 'Student',
unique_id: '',
uuid_string: '',
student_code: '',
student_name_formal: '',
student_email: '',
worker_db_name: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -220,11 +220,11 @@ export class CalendarNodeShapeUtil extends BaseNodeShapeUtil<CalendarNodeShape>
h: 200,
color: 'white',
__primarylabel__: 'Calendar',
unique_id: '',
uuid_string: '',
name: '',
start_date: '',
end_date: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -242,9 +242,9 @@ export class CalendarYearNodeShapeUtil extends BaseNodeShapeUtil<CalendarYearNod
h: 200,
color: 'white',
__primarylabel__: 'Calendar Year',
unique_id: '',
uuid_string: '',
year: '',
path: '',
node_storage_path: '',
created: '',
merged: ''
}
@ -262,11 +262,11 @@ export class CalendarMonthNodeShapeUtil extends BaseNodeShapeUtil<CalendarMonthN
h: 200,
color: 'white',
__primarylabel__: 'Calendar Month',
unique_id: '',
uuid_string: '',
year: '',
month: '',
month_name: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -284,11 +284,11 @@ export class CalendarWeekNodeShapeUtil extends BaseNodeShapeUtil<CalendarWeekNod
h: 200,
color: 'white',
__primarylabel__: 'Calendar Week',
unique_id: '',
uuid_string: '',
start_date: '',
week_number: '',
iso_week: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -306,11 +306,11 @@ export class CalendarDayNodeShapeUtil extends BaseNodeShapeUtil<CalendarDayNodeS
h: 200,
color: 'white',
__primarylabel__: 'Calendar Day',
unique_id: '',
uuid_string: '',
date: '',
day_of_week: '',
iso_day: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -328,10 +328,10 @@ export class CalendarTimeChunkNodeShapeUtil extends BaseNodeShapeUtil<CalendarTi
h: 200,
color: 'white',
__primarylabel__: 'Calendar Time Chunk',
unique_id: '',
uuid_string: '',
start_time: '',
end_time: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -350,12 +350,12 @@ export class SubjectClassNodeShapeUtil extends BaseNodeShapeUtil<SubjectClassNod
h: 200,
color: 'white',
__primarylabel__: 'Subject Class',
unique_id: '',
uuid_string: '',
subject_class_code: '',
year_group: '',
subject: '',
subject_code: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -373,11 +373,10 @@ export class SchoolNodeShapeUtil extends BaseNodeShapeUtil<SchoolNodeShape> {
h: 200,
color: 'white',
__primarylabel__: 'School',
unique_id: '',
school_uuid: '',
school_name: '',
school_website: '',
path: '',
uuid_string: '',
name: '',
website: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -395,9 +394,9 @@ export class DepartmentNodeShapeUtil extends BaseNodeShapeUtil<DepartmentNodeSha
h: 200,
color: 'white',
__primarylabel__: 'Department',
unique_id: '',
uuid_string: '',
department_name: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -415,10 +414,10 @@ export class RoomNodeShapeUtil extends BaseNodeShapeUtil<RoomNodeShape> {
h: 200,
color: 'white',
__primarylabel__: 'Room',
unique_id: '',
uuid_string: '',
room_name: '',
room_code: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -438,8 +437,8 @@ export class PastoralStructureNodeShapeUtil extends BaseNodeShapeUtil<PastoralSt
h: 130,
color: 'white',
__primarylabel__: 'Pastoral Structure',
unique_id: '',
path: '',
uuid_string: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -457,10 +456,10 @@ export class YearGroupNodeShapeUtil extends BaseNodeShapeUtil<YearGroupNodeShape
h: 150,
color: 'white',
__primarylabel__: 'Year Group',
unique_id: '',
uuid_string: '',
year_group: '',
year_group_name: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -478,8 +477,8 @@ export class CurriculumStructureNodeShapeUtil extends BaseNodeShapeUtil<Curricul
h: 130,
color: 'white',
__primarylabel__: 'Curriculum Structure',
unique_id: '',
path: '',
uuid_string: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -497,10 +496,10 @@ export class KeyStageNodeShapeUtil extends BaseNodeShapeUtil<KeyStageNodeShape>
h: 150,
color: 'white',
__primarylabel__: 'Key Stage',
unique_id: '',
uuid_string: '',
key_stage_name: '',
key_stage: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -518,13 +517,13 @@ export class KeyStageSyllabusNodeShapeUtil extends BaseNodeShapeUtil<KeyStageSyl
h: 200,
color: 'white',
__primarylabel__: 'Key Stage Syllabus',
unique_id: '',
uuid_string: '',
ks_syllabus_id: '',
ks_syllabus_name: '',
ks_syllabus_key_stage: '',
ks_syllabus_subject: '',
ks_syllabus_subject_code: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -542,13 +541,13 @@ export class YearGroupSyllabusNodeShapeUtil extends BaseNodeShapeUtil<YearGroupS
h: 200,
color: 'white',
__primarylabel__: 'Year Group Syllabus',
unique_id: '',
uuid_string: '',
yr_syllabus_id: '',
yr_syllabus_name: '',
yr_syllabus_year_group: '',
yr_syllabus_subject: '',
yr_syllabus_subject_code: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -566,10 +565,10 @@ export class SubjectNodeShapeUtil extends BaseNodeShapeUtil<SubjectNodeShape> {
h: 200,
color: 'white',
__primarylabel__: 'Subject',
unique_id: '',
uuid_string: '',
subject_code: '',
subject_name: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -587,13 +586,13 @@ export class TopicNodeShapeUtil extends BaseNodeShapeUtil<TopicNodeShape> {
h: 400,
color: 'white',
__primarylabel__: 'Topic',
unique_id: '',
uuid_string: '',
topic_id: '',
topic_title: '',
total_number_of_lessons_for_topic: '',
topic_type: '',
topic_assessment_type: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -611,7 +610,7 @@ export class TopicLessonNodeShapeUtil extends BaseNodeShapeUtil<TopicLessonNodeS
h: 500,
color: 'white',
__primarylabel__: 'Topic Lesson',
unique_id: '',
uuid_string: '',
topic_lesson_id: '',
topic_lesson_title: '',
topic_lesson_type: '',
@ -619,7 +618,7 @@ export class TopicLessonNodeShapeUtil extends BaseNodeShapeUtil<TopicLessonNodeS
topic_lesson_skills_learned: '',
topic_lesson_suggested_activities: '',
topic_lesson_weblinks: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -637,11 +636,11 @@ export class LearningStatementNodeShapeUtil extends BaseNodeShapeUtil<LearningSt
h: 300,
color: 'light-blue',
__primarylabel__: 'Learning Statement',
unique_id: '',
uuid_string: '',
lesson_learning_statement_id: '',
lesson_learning_statement: '',
lesson_learning_statement_type: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -659,7 +658,7 @@ export class ScienceLabNodeShapeUtil extends BaseNodeShapeUtil<ScienceLabNodeSha
h: 400,
color: 'white',
__primarylabel__: 'Science Lab',
unique_id: '',
uuid_string: '',
science_lab_id: '',
science_lab_title: '',
science_lab_summary: '',
@ -667,7 +666,7 @@ export class ScienceLabNodeShapeUtil extends BaseNodeShapeUtil<ScienceLabNodeSha
science_lab_procedure: '',
science_lab_safety: '',
science_lab_weblinks: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -687,10 +686,10 @@ export class SchoolTimetableNodeShapeUtil extends BaseNodeShapeUtil<SchoolTimeta
h: 200,
color: 'white',
__primarylabel__: 'School Timetable',
unique_id: '',
uuid_string: '',
start_date: '',
end_date: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -708,9 +707,9 @@ export class AcademicYearNodeShapeUtil extends BaseNodeShapeUtil<AcademicYearNod
h: 200,
color: 'white',
__primarylabel__: 'Academic Year',
unique_id: '',
uuid_string: '',
year: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -728,12 +727,12 @@ export class AcademicTermNodeShapeUtil extends BaseNodeShapeUtil<AcademicTermNod
h: 200,
color: 'white',
__primarylabel__: 'Academic Term',
unique_id: '',
uuid_string: '',
term_name: '',
term_number: '',
start_date: '',
end_date: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -751,11 +750,11 @@ export class AcademicWeekNodeShapeUtil extends BaseNodeShapeUtil<AcademicWeekNod
h: 200,
color: 'white',
__primarylabel__: 'Academic Week',
unique_id: '',
uuid_string: '',
start_date: '',
week_type: '',
academic_week_number: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -773,12 +772,12 @@ export class AcademicDayNodeShapeUtil extends BaseNodeShapeUtil<AcademicDayNodeS
h: 200,
color: 'white',
__primarylabel__: 'Academic Day',
unique_id: '',
uuid_string: '',
academic_day: '',
date: '',
day_of_week: '',
day_type: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -796,13 +795,13 @@ export class AcademicPeriodNodeShapeUtil extends BaseNodeShapeUtil<AcademicPerio
h: 300,
color: 'white',
__primarylabel__: 'Academic Period',
unique_id: '',
uuid_string: '',
name: '',
date: '',
start_time: '',
end_time: '',
period_code: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -820,13 +819,13 @@ export class RegistrationPeriodNodeShapeUtil extends BaseNodeShapeUtil<Registrat
h: 200,
color: 'white',
__primarylabel__: 'Registration Period',
unique_id: '',
uuid_string: '',
name: '',
date: '',
start_time: '',
end_time: '',
period_code: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -845,8 +844,8 @@ export class TeacherTimetableNodeShapeUtil extends BaseNodeShapeUtil<TeacherTime
h: 130,
color: 'white',
__primarylabel__: 'Teacher Timetable',
unique_id: '',
path: '',
uuid_string: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -867,13 +866,13 @@ export class TimetableLessonNodeShapeUtil extends BaseNodeShapeUtil<TimetableLes
h: 250,
color: 'white',
__primarylabel__: 'Timetable Lesson',
unique_id: '',
uuid_string: '',
subject_class: '',
date: '',
start_time: '',
end_time: '',
period_code: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}
@ -891,7 +890,7 @@ export class PlannedLessonNodeShapeUtil extends BaseNodeShapeUtil<PlannedLessonN
h: 250,
color: 'white',
__primarylabel__: 'Planned Lesson',
unique_id: '',
uuid_string: '',
date: '',
start_time: '',
end_time: '',
@ -909,7 +908,7 @@ export class PlannedLessonNodeShapeUtil extends BaseNodeShapeUtil<PlannedLessonN
learning_statements: '',
learning_resource_codes: '',
learning_resources: '',
path: '',
node_storage_path: '',
created: '',
merged: '',
}

View File

@ -63,7 +63,7 @@ const graphState = {
addNode: (shape: any) => {
console.log("Adding shape to graphState:", shape);
const id = shape.props.unique_id;
const id = shape.props.uuid_string;
console.log("Adding node to graphState:", id);
graphState.g.setNode(id, {
label: id,

View File

@ -8,7 +8,7 @@ interface NodeComponentProps<T extends AllNodeShapes = AllNodeShapes> {
interface BaseNodeProps {
__primarylabel__: string;
unique_id: string;
uuid_string: string;
}
interface TeacherNodeProps extends BaseNodeProps {