mirror of
https://github.com/nasa/openmct.git
synced 2025-05-03 17:22:56 +00:00
Pending fixes for Grid and List Folder views (#2247)
* fix view names, and persist sort order across list views by persisting in local storage * use keystring as key * add openmct namespace to localstorage persisted listview-sort-order to avoid name collision, rename key in composition-loader to objectKeyString
This commit is contained in:
parent
464e5de947
commit
b0917a9866
@ -30,7 +30,7 @@ define([
|
|||||||
function FolderGridView(openmct) {
|
function FolderGridView(openmct) {
|
||||||
return {
|
return {
|
||||||
key: 'grid',
|
key: 'grid',
|
||||||
name: 'Grid Vue',
|
name: 'Grid View',
|
||||||
cssClass: 'icon-thumbs-strip',
|
cssClass: 'icon-thumbs-strip',
|
||||||
canView: function (domainObject) {
|
canView: function (domainObject) {
|
||||||
return domainObject.type === 'folder';
|
return domainObject.type === 'folder';
|
||||||
|
@ -32,7 +32,7 @@ define([
|
|||||||
function FolderListView(openmct) {
|
function FolderListView(openmct) {
|
||||||
return {
|
return {
|
||||||
key: 'list-view',
|
key: 'list-view',
|
||||||
name: 'List Vue',
|
name: 'List View',
|
||||||
cssClass: 'icon-list-view',
|
cssClass: 'icon-list-view',
|
||||||
canView: function (domainObject) {
|
canView: function (domainObject) {
|
||||||
return domainObject.type === 'folder';
|
return domainObject.type === 'folder';
|
||||||
|
@ -42,7 +42,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<list-item v-for="(item,index) in sortedItems"
|
<list-item v-for="item in sortedItems"
|
||||||
|
:key="item.objectKeyString"
|
||||||
:item="item"
|
:item="item"
|
||||||
:object-path="item.objectPath">
|
:object-path="item.objectPath">
|
||||||
</list-item>
|
</list-item>
|
||||||
@ -99,9 +100,20 @@ export default {
|
|||||||
mixins: [compositionLoader],
|
mixins: [compositionLoader],
|
||||||
inject: ['domainObject', 'openmct'],
|
inject: ['domainObject', 'openmct'],
|
||||||
data() {
|
data() {
|
||||||
|
let sortBy = 'model.name',
|
||||||
|
ascending = true,
|
||||||
|
persistedSortOrder = window.localStorage.getItem('openmct-listview-sort-order');
|
||||||
|
|
||||||
|
if (persistedSortOrder) {
|
||||||
|
let parsed = JSON.parse(persistedSortOrder);
|
||||||
|
|
||||||
|
sortBy = parsed.sortBy;
|
||||||
|
ascending = parsed.ascending;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sortBy: 'model.name',
|
sortBy,
|
||||||
ascending: true
|
ascending
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -121,6 +133,17 @@ export default {
|
|||||||
this.sortBy = field;
|
this.sortBy = field;
|
||||||
this.ascending = defaultDirection;
|
this.ascending = defaultDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.localStorage
|
||||||
|
.setItem(
|
||||||
|
'openmct-listview-sort-order',
|
||||||
|
JSON.stringify(
|
||||||
|
{
|
||||||
|
sortBy: this.sortBy,
|
||||||
|
ascending: this.ascending
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@ export default {
|
|||||||
model: child,
|
model: child,
|
||||||
type: type.definition,
|
type: type.definition,
|
||||||
isAlias: this.domainObject.identifier.key !== child.location,
|
isAlias: this.domainObject.identifier.key !== child.location,
|
||||||
objectPath: [child].concat(openmct.router.path)
|
objectPath: [child].concat(this.openmct.router.path),
|
||||||
|
objectKeyString: this.openmct.objects.makeKeyString(child.identifier)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
remove(identifier) {
|
remove(identifier) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user