fix(neo4j): correct label grids typed saves and menus
This commit is contained in:
1 parent
8d9e2dc49f
commit
6a2a15796e
14 files changed
+394
-112
No files matched your search
@@ -64,6 +64,13 @@ describe("dataGridCellDisplayText", () => {
|
||||
});
|
||||
|
||||
describe("coerceDataGridCellValue", () => {
|
||||
it.each(["Integer", "Long", "int"])("keeps Neo4j %s edits as exact text for the Cypher builder", (data_type) => {
|
||||
for (const value of ["1001", "9007199254740999", "9223372036854775807", "-9223372036854775808"]) {
|
||||
expect(coerceDataGridCellValue({ value, oldValue: "1", databaseType: "neo4j", columnInfo: { data_type } })).toBe(value);
|
||||
expect(coerceDataGridCellValue({ value: `${value}\n`, oldValue: "1", databaseType: "neo4j", columnInfo: { data_type } })).toBe(value);
|
||||
}
|
||||
});
|
||||
|
||||
it.each(["null", "NULL", "Null", "nUlL"])("preserves literal %s input as text", (value) => {
|
||||
expect(
|
||||
coerceDataGridCellValue({
|
||||
|
||||
@@ -323,6 +323,7 @@ describe("quoteTableIdentifier", () => {
|
||||
expect(requiresEagerTableMetadataForDataOpen("mysql")).toBe(true);
|
||||
expect(requiresEagerTableMetadataForDataOpen("postgres")).toBe(true);
|
||||
expect(requiresEagerTableMetadataForDataOpen("nebula")).toBe(true);
|
||||
expect(requiresEagerTableMetadataForDataOpen("neo4j")).toBe(true);
|
||||
// Drivers whose preview works from `SELECT *` keep loading metadata lazily.
|
||||
expect(requiresEagerTableMetadataForDataOpen("sqlite")).toBe(false);
|
||||
expect(requiresEagerTableMetadataForDataOpen(undefined)).toBe(false);
|
||||
|
||||
@@ -37,6 +37,9 @@ export function coerceDataGridCellValue(options: CoerceDataGridCellValueOptions)
|
||||
const useSampledValueType = normalizeDataType(options.columnInfo?.data_type) === "";
|
||||
const numericInput = isNumericColumnType(options.columnInfo?.data_type) || (useSampledValueType && typeof oldValue === "number");
|
||||
const numericText = normalizeGroupedNumberText(value, options.columnInfo, oldValue, options.numberFormat ?? runtimeNumberFormat());
|
||||
// Neo4j INTEGER is always signed 64-bit. Keep its input as text until the
|
||||
// Cypher builder validates it, including values outside JavaScript's range.
|
||||
if (options.databaseType === "neo4j" && ["integer", "long", "int"].includes(normalizeDataType(options.columnInfo?.data_type))) return numericText.trim();
|
||||
if (isBooleanInputColumn(options) || (useSampledValueType && typeof oldValue === "boolean")) {
|
||||
// MySQL exposes TINYINT(1) as an integer in the grid. Keep its numeric
|
||||
// 0/1 edits numeric while still accepting explicit TRUE/FALSE aliases.
|
||||
|
||||
@@ -268,6 +268,7 @@ export function supportsTableTruncate(dbType?: DatabaseType): boolean {
|
||||
dbType !== "victoriametrics" &&
|
||||
dbType !== "manticoresearch" &&
|
||||
dbType !== "salesforce" &&
|
||||
dbType !== "neo4j" &&
|
||||
dbType !== "nebula"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -447,11 +447,11 @@ export function normalizeWhereInput(whereInput?: string): string {
|
||||
* * Salesforce: SOQL has no `SELECT *`. With no known fields the backend builder
|
||||
* falls back to the `FIELDS(ALL)` selector, which the org only accepts with
|
||||
* `LIMIT 200` or less — awaiting the describe keeps every page size working.
|
||||
* * NebulaGraph: without tag/edge properties, the grid can only show a single
|
||||
* * Neo4j/NebulaGraph: without node/tag/edge properties, the grid can only show a single
|
||||
* vertex/edge value instead of separate property columns.
|
||||
*/
|
||||
export function requiresEagerTableMetadataForDataOpen(databaseType: DatabaseType | undefined): boolean {
|
||||
return databaseType === "mysql" || databaseType === "postgres" || databaseType === "salesforce" || databaseType === "nebula";
|
||||
return databaseType === "mysql" || databaseType === "postgres" || databaseType === "salesforce" || databaseType === "neo4j" || databaseType === "nebula";
|
||||
}
|
||||
|
||||
export async function buildTableSelectSql(options: BuildTableSelectSqlOptions): Promise<string> {
|
||||
|
||||
Reference in new issue
Block a user