Skip to content

Commit

Permalink
Merge pull request #5304 from specify/revert-5236-issue-5222
Browse files Browse the repository at this point in the history
Unhide all geo tables
  • Loading branch information
sharadsw authored Oct 14, 2024
2 parents 16f09ea + 4558db2 commit 0ba26b2
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 33 deletions.
4 changes: 2 additions & 2 deletions specifyweb/context/schema_localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def get_schema_localization(collection, schematype, lang):
cfields = ('format', 'ishidden', 'isuiformatter', 'picklistname', 'type', 'aggregator', 'defaultui', 'name', 'desc')

containers = {
row[0]: dict(items={}, **{field: row[i+1] for i, field in enumerate(cfields)})
row[0].lower(): dict(items={}, **{field: row[i+1] for i, field in enumerate(cfields)})
for row in cursor.fetchall()
}

Expand Down Expand Up @@ -172,7 +172,7 @@ def get_schema_localization(collection, schematype, lang):
ifields = ('format', 'ishidden', 'isuiformatter', 'picklistname', 'type', 'isrequired', 'weblinkname', 'name', 'desc')

for row in cursor.fetchall():
containers[row[0]]['items'][row[1].lower()] = {field: row[i+2] for i, field in enumerate(ifields)}
containers[row[0].lower()]['items'][row[1].lower()] = {field: row[i+2] for i, field in enumerate(ifields)}

return containers

Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,7 @@ export function SchemaConfigFields({

{relationships.length > 0 && (
<optgroup label={schemaText.relationships()}>
<SchemaConfigFieldsList
fields={
table.name === 'CollectionObject'
? relationships.filter(
({ name }) => name !== 'collectionObjectType'
)
: relationships
}
/>
<SchemaConfigFieldsList fields={relationships} />
</optgroup>
)}
</Select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ export function TableUniquenessRules(): JSX.Element {
(relationship) =>
(['many-to-one', 'one-to-one'] as RA<RelationshipType>).includes(
relationship.type
) &&
!relationship.isVirtual &&
relationship.name !== 'collectionObjectType'
) && !relationship.isVirtual
),
[table]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { Dialog } from '../Molecules/Dialog';
import { TableIcon } from '../Molecules/TableIcon';
import { hasTablePermission } from '../Permissions/helpers';
import { formatUrl } from '../Router/queryString';
import { HIDDEN_GEO_TABLES } from '../Toolbar/QueryTablesEdit';

export function SchemaConfigTables(): JSX.Element {
const { language = '' } = useParams();
Expand Down Expand Up @@ -127,8 +126,6 @@ export function TableList({
() =>
Object.values(genericTables)
.filter((table) => filter(showHiddenTables, table))
// TODO: temp fix, remove this, use to hide geo tables for COG until 9.8 release
.filter((table) => !HIDDEN_GEO_TABLES.has(table.name))
.sort(sortFunction(({ name }) => name)),
[filter, showHiddenTables]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function UniquenessRuleRow({
<Input.Text
form={formId}
forwardRef={index === 0 ? validationRef : undefined}
isReadOnly={!(index === 0 && hasDuplicates)}
isReadOnly
key={index}
value={
(fields.find(({ name }) => name === field) ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function UniquenessRuleScope({
isDefault: false,
isEnabled: true,
isRelationship: true,
optionLabel: relationship.localization.name!,
optionLabel: relationship.localization.name ?? relationship.name,
tableName: relationship.relatedTable.name,
},
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,7 @@ export function QueryTablesEdit({
/>
);
}
/*
* TODO: temp fix, remove this, use to hide geo tables for COG until 9.8 release
* TODO: Revert #5236 to unhide COType
*/
export const HIDDEN_GEO_TABLES = new Set([
'CollectionObjectType',
'CollectionObjectGroup',
'CollectionObjectGroupJoin',
'CollectionObjectGroupType',
]);

export function TablesListEdit({
isNoRestrictionMode,
defaultTables,
Expand All @@ -67,8 +58,6 @@ export function TablesListEdit({
.filter((table) =>
tablesFilter(isNoRestrictionMode, false, true, table, selectedValues)
)
// TODO: temp fix, remove this, use to hide geo tables for COG until 9.8 release
.filter((table) => !HIDDEN_GEO_TABLES.has(table.name))
.map(({ name, label }) => ({ name, label }));

const handleChanged = (items: RA<keyof Tables>): void =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ export function MappingElement({
fieldsData,
...props
}: MappingElementProps): JSX.Element {
const { collectionObjectType, ...rest } = fieldsData;
const fieldGroups = Object.entries(rest).reduce<
const fieldGroups = Object.entries(fieldsData).reduce<
R<R<CustomSelectElementOptionProps>>
>((fieldGroups, [fieldName, fieldData]) => {
const groupName = getFieldGroupName(
Expand Down

0 comments on commit 0ba26b2

Please sign in to comment.