nucleuscloud / neosync

Open source data anonymization and synthetic data orchestration for developers. Create high fidelity synthetic data and sync it across your environments.
https://www.neosync.dev
Other
3.41k stars 125 forks source link

[NEOS-1583] Remove invalid column button is broken #2966

Open nickzelei opened 2 days ago

nickzelei commented 2 days ago

image.png

The warning is a button and when you click it, it's supposed to remove it from the job mappings. This worked at some point…

It no longer does. May be fixed when we start refactoring out the form from nested components.

From SyncLinear.com | NEOS-1583

nickzelei commented 2 days ago

It would be great if this ticket also surfaced the error in the validations pane.

nickzelei commented 2 days ago

My refactor (https://github.com/nucleuscloud/neosync/pull/2960) has removed this feature. This ticket should re-add it.

import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger,
} from '@/components/ui/tooltip';
import { ExclamationTriangleIcon } from '@radix-ui/react-icons';
import { ReactElement } from 'react';
import {
  ColumnKey,
  SchemaConstraintHandler,
} from './schema-constraint-handler';

interface Props {
  rowKey: ColumnKey;
  handler: SchemaConstraintHandler;
  onRemoveClick(): void;
}

export default function SchemaRowAlert(props: Props): ReactElement {
  const { rowKey, handler, onRemoveClick } = props;
  const isInSchema = handler.getIsInSchema(rowKey);

  const messages: string[] = [];

  if (!isInSchema) {
    messages.push('This column was not found in the backing source schema');
  }

  if (messages.length === 0) {
    return <div className="hidden" />;
  }

  return (
    <TooltipProvider delayDuration={100}>
      <Tooltip>
        <TooltipTrigger asChild>
          <div className="cursor-default">
            <ExclamationTriangleIcon
              className="text-yellow-600 dark:text-yellow-300 cursor-pointer"
              onClick={() => onRemoveClick()}
            />
          </div>
        </TooltipTrigger>
        <TooltipContent>
          <p>{messages.join('\n')}</p>
        </TooltipContent>
      </Tooltip>
    </TooltipProvider>
  );
}