Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
Signed-off-by: Qxisylolo <[email protected]>
  • Loading branch information
Qxisylolo committed Oct 31, 2024
1 parent fa77ff3 commit 495fe77
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const dataSource: SavedObjectsType = {
namespaceType: 'agnostic',
hidden: false,
management: {
icon: 'database', // todo: pending ux #2034
icon: 'database',
defaultSearchField: 'title',
importableAndExportable: true,
getTitle(obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const defaultProps: TableProps = {
canGoInApp: () => true,
pageIndex: 1,
pageSize: 2,
workspaceIdNameMap: new Map([
workspaceNameIdLookup: new Map([
['test1', 'jVyiM7'],
['test2', '8rZ0OL'],
['test3', 'evIuNZ'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export interface TableProps {
pageIndex: number;
pageSize: number;
items: SavedObjectWithMetadata[];
workspaceIdNameMap: Map<string, string>;
workspaceNameIdLookup: Map<string, string>;
itemId: string | (() => string);
totalItemCount: number;
onQueryChange: (query: any, filterFields: string[]) => void;
Expand Down Expand Up @@ -188,7 +188,7 @@ export class Table extends PureComponent<TableProps, TableState> {
pageSize,
itemId,
items,
workspaceIdNameMap,
workspaceNameIdLookup,
totalItemCount,
isSearching,
filters,
Expand Down Expand Up @@ -313,7 +313,7 @@ export class Table extends PureComponent<TableProps, TableState> {
const displayedWorkspaces = workspaces.slice(0, 1);
const remainingWorkspaces = workspaces.length - 1;
const getWorkspaceNameById = (workspaceId: string) => {
for (const [name, id] of workspaceIdNameMap) {
for (const [name, id] of workspaceNameIdLookup) {
if (id === workspaceId) {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ export interface SavedObjectsTableState {
isIncludeReferencesDeepChecked: boolean;
currentWorkspace?: WorkspaceObject;
workspaceEnabled: boolean;
workspaceIdNameMap: Map<string, string>;
availableWorkspaces?: WorkspaceAttribute[];
isShowingDuplicateResultFlyout: boolean;
failedCopies: SavedObjectsImportError[];
Expand Down Expand Up @@ -202,7 +201,6 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb
exportAllOptions: [],
exportAllSelectedOptions: {},
isIncludeReferencesDeepChecked: true,
workspaceIdNameMap: new Map<string, string>(),
currentWorkspace: this.props.workspaces.currentWorkspace$.getValue(),
availableWorkspaces: this.props.workspaces.workspaceList$.getValue(),
workspaceEnabled: this.props.applications.capabilities.workspaces.enabled,
Expand Down Expand Up @@ -380,7 +378,6 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb
this.workspacesSubscription = workspace.workspaceList$.subscribe((workspaceList) => {
this.setState({ availableWorkspaces: workspaceList });
});
this.setState({ workspaceIdNameMap: this.workspaceNameIdLookup });
};

unSubscribeWorkspace = () => {
Expand Down Expand Up @@ -1085,7 +1082,6 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb
page,
perPage,
savedObjects,
workspaceIdNameMap,
filteredItemCount,
isSearching,
savedObjectCounts,
Expand Down Expand Up @@ -1225,7 +1221,7 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb
pageIndex={page}
pageSize={perPage}
items={savedObjects}
workspaceIdNameMap={workspaceIdNameMap}
workspaceIdNameMap={this.workspaceNameIdLookup}
totalItemCount={filteredItemCount}
isSearching={isSearching}
onShowRelationships={this.onShowRelationships}
Expand Down

0 comments on commit 495fe77

Please sign in to comment.