Skip to content
Permalink
Browse files
fix(resource): fix properties sorting (DEV-1204) (#818)
* fix proprties sorting

* review fixes

* remove more unused imports

* change the condition of the second sort
  • Loading branch information
mpro7 committed Sep 7, 2022
1 parent 36008c6 commit fbee603b5aefd61e76f39676af5c39d85389b7b0
Showing 1 changed file with 11 additions and 6 deletions.
@@ -24,9 +24,6 @@ import {
ReadResourceSequence,
ReadStillImageFileValue,
ReadTextFileValue,
ResourceClassAndPropertyDefinitions,
ResourceClassDefinition,
ResourceClassDefinitionWithPropertyDefinition,
SystemPropertyDefinition
} from '@dasch-swiss/dsp-js';
import { Subscription } from 'rxjs';
@@ -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;
}

0 comments on commit fbee603

Please sign in to comment.