Skip to content

Commit

Permalink
fix(resource): fix properties sorting (DEV-1204) (#818)
Browse files Browse the repository at this point in the history
* 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 fbee603
Showing 1 changed file with 11 additions and 6 deletions.
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

0 comments on commit fbee603

Please sign in to comment.