Skip to content

Commit

Permalink
Remove ID and remove PersistenceGridPopover
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryanseanlee committed Sep 27, 2024
1 parent afd6f7e commit 3ee7367
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 223 deletions.
5 changes: 2 additions & 3 deletions core/persist/persistenceManager/PersistenceManagerModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export class PersistenceManagerModel<T extends PlainObject = PlainObject> extend
});

return unbalancedStableGroupsAndViews.map(it => {
const {name, id, isMenuFolder, children, token} = it;
const {name, isMenuFolder, children, token} = it;
if (isMenuFolder) {
return {
type: 'directory',
Expand All @@ -385,8 +385,7 @@ export class PersistenceManagerModel<T extends PlainObject = PlainObject> extend
return {
type: 'view',
text: this.getHierarchyDisplayName(name),
selected: this.selectedView?.id === id,
id,
selected: this.selectedToken === token,
token
};
});
Expand Down
2 changes: 0 additions & 2 deletions core/persist/persistenceManager/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {PlainObject} from '@xh/hoist/core';
import {LocalDate} from '@xh/hoist/utils/datetime';

export interface PersistenceView<T extends PlainObject = PlainObject> {
id: number;
acl: string;
archived: boolean;
dateCreated: LocalDate;
Expand All @@ -28,7 +27,6 @@ export type PersistenceViewTree = {
}
| {
type: 'view';
id: number;
token: string;
}
);
7 changes: 4 additions & 3 deletions core/persist/persistenceManager/impl/ManageDialogModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ export class ManageDialogModel extends HoistModel {

async ensureGridHasSelection() {
const {gridModel} = this;
const {selectedView} = this.parentModel;
if (selectedView) {
gridModel.selModel.select(selectedView.id);
const {selectedToken} = this.parentModel;
if (selectedToken) {
gridModel.selModel.select(selectedToken);
} else {
await gridModel.preSelectFirstAsync();
}
Expand All @@ -201,6 +201,7 @@ export class ManageDialogModel extends HoistModel {
hideHeaders: true,
showGroupRowCounts: false,
store: {
idSpec: 'token',
fields: [
{name: 'token', type: 'string'},
{name: 'name', type: 'string'},
Expand Down
213 changes: 0 additions & 213 deletions desktop/cmp/persistenceManager/cmp/PersistenceGridPopover.ts

This file was deleted.

4 changes: 2 additions & 2 deletions desktop/cmp/persistenceManager/cmp/PersistenceMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const objMenu = hoistCmp.factory<PersistenceMenuProps>({
items.push(
...model.favoritedViews.map(it => {
return menuItem({
key: `${it.id}-isFavorite`,
key: `${it.token}-isFavorite`,
icon: model.selectedToken === it.token ? Icon.check() : Icon.placeholder(),
text: menuFavorite({
view: {...it, text: model.getHierarchyDisplayName(it.name)}
Expand Down Expand Up @@ -223,7 +223,7 @@ function buildView(view: PersistenceViewTree, model: PersistenceManagerModel): R
case 'view':
return menuItem({
className: 'xh-persistence-manager__menu-item',
key: view.id,
key: view.token,
icon,
text: menuFavorite({model, view}),
onClick: () => model.selectAsync(view.token).linkTo(model.loadModel)
Expand Down

0 comments on commit 3ee7367

Please sign in to comment.