Skip to content
2 changes: 1 addition & 1 deletion src/components/projects/ProjectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function ProjectCard(props: ProjectCardProps) {
<span className="text-sm text-gray-900 ">{props.project.time}</span>
</>}
</div>}
{props.project.is_integration_project && <div className="absolute bottom-0 left-2/4 flex flex-row flex-nowrap gap-x-1 bg-gray-100 px-1 rounded-br rounded-bl" style={{ 'transform': 'translate(-50%' }}>
{props.project.isIntegrationProject && <div className="absolute bottom-0 left-2/4 flex flex-row flex-nowrap gap-x-1 bg-gray-100 px-1 rounded-tr rounded-tl" style={{ 'transform': 'translate(-50%' }}>
<span className="text-sm text-red-500">This is an integration project, please do not delete it unless the integration is deleted</span>
</div>}
{(isAdmin && props.project.status !== ProjectStatus.INIT_SAMPLE_PROJECT) &&
Expand Down
3 changes: 2 additions & 1 deletion src/components/projects/ProjectsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export default function ProjectsList() {
if (!organizationInactive) {
refetchProjectsAndPostProcess();
refetchStatsAndPostProcess();
} else {
setDataLoaded(true);
}
}, [organizationInactive, user]);

Expand All @@ -70,7 +72,6 @@ export default function ProjectsList() {

const orgId = useSelector(selectOrganizationId);
useWebsocket(orgId, Application.REFINERY, CurrentPage.PROJECTS, handleWebsocketNotification);

return (
<div>
{dataLoaded ? (<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export default function AttributeCalculation() {

return (projectId && <div className={`bg-white p-4 overflow-y-auto min-h-full h-[calc(100vh-4rem)]`} onScroll={(e: any) => onScrollEvent(e)}>
{currentAttribute && <div>
<div className={`sticky z-50 h-12 ${isHeaderNormal ? 'top-1' : '-top-5'}`}>
<div className={`sticky z-40 h-12 ${isHeaderNormal ? 'top-1' : '-top-5'}`}>
<div className={`bg-white flex-grow ${isHeaderNormal ? '' : 'shadow'}`}>
<div className={`flex-row justify-start items-center inline-block ${isHeaderNormal ? 'p-0' : 'flex py-2'}`} style={{ transition: 'all .25s ease-in-out' }}>
<a href={`/refinery/projects/${projectId}/settings`} onClick={goBack} className="text-green-800 text-sm font-medium">
Expand Down
13 changes: 11 additions & 2 deletions src/components/projects/projectId/edit-records/EditField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import { DataTypeEnum } from "@/src/types/shared/general";
import { ModalEnum } from "@/src/types/shared/modal";
import { buildAccessKey } from "@/src/util/components/projects/projectId/edit-records-helper";
import { jsonCopy } from "@/submodules/javascript-functions/general";
import { useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { useDispatch } from "react-redux";

export default function EditField(props: EditFieldProps) {
const dispatch = useDispatch();

const [inputValue, setInputValue] = useState(props.record.data[props.attribute.name]);

const [inputValue, setInputValue] = useState(null);

const inputRef = useRef(null);

Expand Down Expand Up @@ -67,6 +68,14 @@ export default function EditField(props: EditFieldProps) {
}
}

useEffect(() => {
if (props.subKey == undefined) setInputValue(props.record.data[props.attribute.name]);
else setInputValue(props.record.data[props.attribute.name][props.subKey]);
}, [props.record.data[props.attribute.name], props.subKey]);

if (!inputValue) return null;


return (<>
{(props.attribute.dataType == DataTypeEnum.TEXT || props.attribute.dataType == DataTypeEnum.LLM_RESPONSE) &&
<textarea value={inputValue} ref={inputRef}
Expand Down
41 changes: 24 additions & 17 deletions src/components/projects/projectId/edit-records/EditRecords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export default function EditRecords() {
}} id={record.id == erdData.data.selectedRecordId ? 'flash-it' : null}>
<div className="px-4 py-5 sm:p-6">
{erdData.data.attributes.map((attribute) => (<Fragment key={attribute.id}>

<div>
<div className="font-semibold text-sm text-gray-800">
<div className="flex flex-row items-center">
Expand All @@ -98,26 +99,32 @@ export default function EditRecords() {
<div className="text-gray-800 text-sm mb-4 overflow-anywhere flex">
{attribute.dataType == DataTypeEnum.EMBEDDING_LIST ? (<div className="flex flex-col gap-y-1 divide-y w-full">
{record.data[attribute.name].map((item, subKey) => (<div key={subKey} className="pt-1">
{(record.id == erdData.editRecordId && !attribute.isPrimaryKey) ? <EditField attribute={attribute} record={record} subKey={subKey} erdData={erdData} setErdData={(erdData) => setErdData(erdData)} /> : <>
{item != null && item !== '' ? (<span className="whitespace-pre-wrap">
<span>{item}</span>
</span>) : (<NotPresentInRecord />)}
</>}
{(record.id == erdData.editRecordId && !attribute.isPrimaryKey) ?
<EditField attribute={attribute} record={record} subKey={subKey} erdData={erdData} setErdData={(erdData) => setErdData(erdData)} /> : <>
{item != null && item !== '' ? (<span className="whitespace-pre-wrap" style={{ wordBreak: 'break-word' }}>
<span>{item}</span>
</span>) : (<NotPresentInRecord />)}
</>}
</div>))}
</div>) : (<>
{(record.id == erdData.editRecordId && !attribute.isPrimaryKey) ? <EditField attribute={attribute} record={record} erdData={erdData} setErdData={(erdData) => setErdData(erdData)} /> : <>
{record.data[attribute.name] != null && record.data[attribute.name] !== '' ? (<span className="whitespace-pre-wrap relative">
<span>{`${record.data[attribute.name]}`}</span>
{erdData.cachedRecordChanges[buildAccessKey(record.id, attribute.name)] && <div className="absolute -left-5 top-0 text-yellow-500">
<Tooltip content={TOOLTIPS_DICT.EDIT_RECORDS.CACHED_VALUES} color="invert" placement="right" className="cursor-auto">
<MemoIconAlertTriangleFilled size={16} stroke={2} />
</Tooltip>
</div>}
</span>) : <NotPresentInRecord />}
</>}
</>)}
</div>) :
attribute.dataType == DataTypeEnum.PERMISSION ? <span className="font-dmMono">Permissions are not editable</span> :
(
<>
{(record.id == erdData.editRecordId && !attribute.isPrimaryKey) ? <EditField attribute={attribute} record={record} erdData={erdData} setErdData={(erdData) => setErdData(erdData)} /> : <>
{record.data[attribute.name] != null && record.data[attribute.name] !== '' ? (<span className="whitespace-pre-wrap relative" style={{ wordBreak: 'break-word' }}>
<span>{`${record.data[attribute.name]}`}</span>
{erdData.cachedRecordChanges[buildAccessKey(record.id, attribute.name)] && <div className="absolute -left-5 top-0 text-yellow-500">
<Tooltip content={TOOLTIPS_DICT.EDIT_RECORDS.CACHED_VALUES} color="invert" placement="right" className="cursor-auto">
<MemoIconAlertTriangleFilled size={16} stroke={2} />
</Tooltip>
</div>}
</span>) : <NotPresentInRecord />}
</>}
</>)}

</div>
</div>

</Fragment>))}
<div className="absolute top-2 right-2 flex flex-row flex-nowrap items-center gap-x-2">
{record.rla_data && <Tooltip content={TOOLTIPS_DICT.EDIT_RECORDS.LABEL_ASSOCIATIONS} color="invert" placement="left" className="cursor-auto">
Expand Down
17 changes: 13 additions & 4 deletions src/components/projects/projectId/settings/ProjectMetaData.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { selectProject, setActiveProject } from "@/src/reduxStore/states/project";
import { updateProjectNameAndDescriptionPost } from "@/src/services/base/project";
import { selectAllProjects, selectProject, setActiveProject, setAllProjects } from "@/src/reduxStore/states/project";
import { getAllProjects, updateProjectNameAndDescriptionPost } from "@/src/services/base/project";
import { TOOLTIPS_DICT } from "@/src/util/tooltip-constants";
import { Tooltip } from "@nextui-org/react";
import { useRouter } from "next/router";
import { useState } from "react";
import { use, useEffect, useMemo, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { deleteProjectPost } from "@/src/services/base/project";
import KernButton from "@/submodules/react-components/components/kern-button/KernButton";
Expand All @@ -14,6 +14,7 @@ export default function ProjectMetaData() {
const dispatch = useDispatch();

const project = useSelector(selectProject);
const allProjects = useSelector(selectAllProjects);

const [projectName, setProjectName] = useState('');
const [projectDescription, setProjectDescription] = useState('');
Expand All @@ -39,6 +40,14 @@ export default function ProjectMetaData() {
});
}

useEffect(() => {
getAllProjects((projects) => dispatch(setAllProjects(projects)));
}, []);

const isIntegrationProject = useMemo(() => {
return allProjects && allProjects.find(p => p.id === project.id)?.isIntegrationProject;
}, [allProjects, project.id]);

return (<div>
<div className="mt-8">
<div className="text-gray-900 text-lg leading-6 font-medium">
Expand Down Expand Up @@ -85,7 +94,7 @@ export default function ProjectMetaData() {
<div className="text-gray-900 text-lg leading-6 font-medium">Danger zone</div>
<div className="text-sm leading-5 font-normal mt-2 text-gray-500 inline-block">This action can not be reversed.
Are you sure you want to delete this project?</div>
{project.is_integration_project && <div className="text-sm text-red-500 italic">
{isIntegrationProject && <div className="text-sm text-red-500 italic">
This is an integration project, please do not delete it unless the integration is deleted
</div>}
<div className="form-control">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export default function RenameLabelModal() {
const renameLabelDataCopy = { ...renameLabelData };
result.warnings.forEach(e => {
e.open = false;
e.oldParsed = LabelHelper.prepareSourceCode(e.old, e.information_source_name);
e.newParsed = LabelHelper.prepareSourceCode(e.new, e.information_source_name);
e.oldParsed = LabelHelper.prepareSourceCode(e.old, e.informationSourceName);
e.newParsed = LabelHelper.prepareSourceCode(e.new, e.informationSourceName);
});
renameLabelDataCopy.checkResults = result;
setRenameLabelData(renameLabelDataCopy);
Expand Down Expand Up @@ -172,16 +172,10 @@ export default function RenameLabelModal() {
<span className="text-sm">{warning.new}</span>
</div></div>}
{warning.key == 'HEURISTIC' && <div className="flex flex-col gap-y-2">
<span className="text-sm">
<Tooltip content={TOOLTIPS_DICT.PROJECT_SETTINGS.LABELING_TASK.OPEN_HEURISTICS} placement="right" color="invert">
<a href={'../heuristics/' + warning.id} target="_blank"
className="cursor-pointer underline font-medium">
Current source code:</a>
</Tooltip>
</span>
<Highlight text={warning.oldParsed} searchFor={warning.old_highlighting} />
<span className="text-sm font-medium text-left">Suggested changes:</span>
<Highlight text={warning.newParsed} searchFor={warning.new_highlighting} />
<span className="text-sm font-medium underline text-left">Current source code:</span>
<Highlight text={warning.oldParsed} searchFor={warning.oldHighlighting} />
<span className="text-sm font-medium underline text-left">Suggested changes:</span>
<Highlight text={warning.newParsed} searchFor={warning.newHighlighting} />
</div>}
<KernButton
text="Change"
Expand Down
5 changes: 2 additions & 3 deletions src/components/shared/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export default function Header() {
});
});
}

return (
<header className="sticky top-0 z-50 w-full">
<div className="relative z-10 flex-shrink-0 h-16 bg-white border-b border-gray-200 shadow-sm flex justify-between items-center">
Expand Down Expand Up @@ -92,7 +91,7 @@ export default function Header() {
</Tooltip>
</a>
</div>
{(user?.role == UserRole.ENGINEER) ? (
{(organizationInactive !== true && user?.role == UserRole.ENGINEER) ? (
<div className="flex items-center justify-center">
<a href="/refinery/users" onClick={(e: any) => { e.preventDefault(); dispatch(setProjectIdSampleProject(null)); router.push(`/users`) }}
className="flex mr-6">
Expand All @@ -105,7 +104,7 @@ export default function Header() {
<div className="flex items-center justify-center">
{displayComments && <Comments />}
</div>
{user?.role == UserRole.ENGINEER && <div className="flex items-center justify-center">
{organizationInactive !== true && user?.role == UserRole.ENGINEER && <div className="flex items-center justify-center">
<button className="flex mr-6 cursor-pointer" onClick={openModalAndRefetchNotifications}>
<Tooltip content={TOOLTIPS_DICT.GENERAL.NOTIFICATION_CENTER} placement="bottom" color="invert">
<MemoIconBell className="w-6 h-6" />
Expand Down
4 changes: 2 additions & 2 deletions src/components/shared/highlight/Highlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export default function Highlight(props: any) {
setParts(extendArrayElementsByUniqueId(rebuildText(props.text, finalRegEx)));
}, [finalRegEx, props.text]);

return (<span>
return (<pre className="text-left text-sm">
{parts && parts.map((part, index) => (<span key={part.id} className={`${part.isMatch ? highlightClass : null} ${addClassString}`}>
{part.text}
</span>))}
</span>)
</pre>)
}
2 changes: 1 addition & 1 deletion src/components/shared/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default function Sidebar() {
<Tooltip placement="right" trigger="hover" color="invert" content={TOOLTIPS_DICT.SIDEBAR.VERSION_OVERVIEW}>
<div onClick={requestVersionOverview} id="refineryVersion"
className="z-50 tooltip tooltip-right cursor-pointer select-none text-white flex items-center mr-1">
v1.19.0
v1.20.0
{hasUpdates && <Tooltip placement="right" trigger="hover" color="invert" content={TOOLTIPS_DICT.SIDEBAR.NEWER_VERSION_AVAILABLE} >
<MemoIconAlertCircle className="h-5 w-5 text-yellow-700" />
</Tooltip>}
Expand Down
Loading