mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 06:56:38 +00:00
Fix table entity boolean and number type property values (#737)
This commit is contained in:
parent
5e0523c7d9
commit
9878bf0d5e
@ -328,7 +328,7 @@ export const EditTableEntityPanel: FunctionComponent<EditTableEntityPanelProps>
|
|||||||
selectedKey={entity.type}
|
selectedKey={entity.type}
|
||||||
entityPropertyPlaceHolder={detailedHelp}
|
entityPropertyPlaceHolder={detailedHelp}
|
||||||
entityValuePlaceholder={entity.entityValuePlaceholder}
|
entityValuePlaceholder={entity.entityValuePlaceholder}
|
||||||
entityValue={entity.value}
|
entityValue={entity.value?.toString()}
|
||||||
isEntityTypeDate={entity.isEntityTypeDate}
|
isEntityTypeDate={entity.isEntityTypeDate}
|
||||||
entityTimeValue={entity.entityTimeValue}
|
entityTimeValue={entity.entityTimeValue}
|
||||||
isEntityValueDisable={entity.isEntityValueDisable}
|
isEntityValueDisable={entity.isEntityValueDisable}
|
||||||
|
@ -165,7 +165,7 @@ export function convertEntityToNewDocument(entity: Entities.ITableEntityForTable
|
|||||||
$id: entity.RowKey._,
|
$id: entity.RowKey._,
|
||||||
id: entity.RowKey._,
|
id: entity.RowKey._,
|
||||||
};
|
};
|
||||||
for (var property in entity) {
|
for (const property in entity) {
|
||||||
if (
|
if (
|
||||||
property !== Constants.EntityKeyNames.PartitionKey &&
|
property !== Constants.EntityKeyNames.PartitionKey &&
|
||||||
property !== Constants.EntityKeyNames.RowKey &&
|
property !== Constants.EntityKeyNames.RowKey &&
|
||||||
@ -176,18 +176,30 @@ export function convertEntityToNewDocument(entity: Entities.ITableEntityForTable
|
|||||||
property !== keyProperties.attachments &&
|
property !== keyProperties.attachments &&
|
||||||
property !== keyProperties.Id2
|
property !== keyProperties.Id2
|
||||||
) {
|
) {
|
||||||
if (entity[property].$ === Constants.TableType.DateTime) {
|
const propertyValue = entity[property]._;
|
||||||
// Convert javascript date back to ticks with 20 zeros padding
|
let parsedValue;
|
||||||
document[property] = {
|
switch (entity[property].$) {
|
||||||
$t: (<any>DataTypes)[entity[property].$],
|
case Constants.TableType.DateTime:
|
||||||
$v: DateTimeUtilities.convertJSDateToTicksWithPadding(entity[property]._),
|
parsedValue = DateTimeUtilities.convertJSDateToTicksWithPadding(propertyValue);
|
||||||
};
|
break;
|
||||||
} else {
|
case Constants.TableType.Boolean:
|
||||||
document[property] = {
|
parsedValue = propertyValue.toLowerCase() === "true";
|
||||||
$t: (<any>DataTypes)[entity[property].$],
|
break;
|
||||||
$v: entity[property]._,
|
case Constants.TableType.Int32:
|
||||||
};
|
case Constants.TableType.Int64:
|
||||||
|
parsedValue = parseInt(propertyValue, 10);
|
||||||
|
break;
|
||||||
|
case Constants.TableType.Double:
|
||||||
|
parsedValue = parseFloat(propertyValue);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
parsedValue = propertyValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document[property] = {
|
||||||
|
$t: (<any>DataTypes)[entity[property].$],
|
||||||
|
$v: parsedValue,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return document;
|
return document;
|
||||||
|
Loading…
Reference in New Issue
Block a user