Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(resource): fix properties sorting (DEV-1204) #818

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/app/workspace/resource/resource.component.ts
Expand Up @@ -24,9 +24,6 @@ import {
ReadResourceSequence,
ReadStillImageFileValue,
ReadTextFileValue,
ResourceClassAndPropertyDefinitions,
ResourceClassDefinition,
ResourceClassDefinitionWithPropertyDefinition,
SystemPropertyDefinition
} from '@dasch-swiss/dsp-js';
import { Subscription } from 'rxjs';
Expand Down Expand Up @@ -415,9 +412,17 @@ export class ResourceComponent implements OnInit, OnChanges, OnDestroy {
);

// sort properties by guiOrder
props = props
.filter(prop => prop.propDef.objectType !== Constants.GeomValue)
.sort((a, b) => (a.guiDef.guiOrder > b.guiDef.guiOrder) ? 1 : -1);
props =
props
.filter(prop => prop.propDef.objectType !== Constants.GeomValue)
.sort((a, b) => (a.guiDef.guiOrder > b.guiDef.guiOrder) ? 1 : -1)
// to get equal results on all browser engines which implements sorting in different way
// properties list has to be sorted again, pushing all "has..." properties to the bottom
.sort((a, b) => {
if (a.guiDef.guiOrder === undefined) {
return 1;
}
});

return props;
}
Expand Down