mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 00:41:31 +00:00
MostRecentActivity changes (#463)
This changes the public API a bit, so that recording activity (the most common use) is less involved.
This commit is contained in:
@@ -6,7 +6,7 @@ import { TreeComponent, TreeNode, TreeNodeMenuItem, TreeNodeComponent } from "..
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { NotebookContentItem, NotebookContentItemType } from "../Notebook/NotebookContentItem";
|
||||
import { ResourceTreeContextMenuButtonFactory } from "../ContextMenuButtonFactory";
|
||||
import * as MostRecentActivity from "../MostRecentActivity/MostRecentActivity";
|
||||
import { mostRecentActivity } from "../MostRecentActivity/MostRecentActivity";
|
||||
import CopyIcon from "../../../images/notebook/Notebook-copy.svg";
|
||||
import CosmosDBIcon from "../../../images/Azure-Cosmos-DB.svg";
|
||||
import CollectionIcon from "../../../images/tree-collection.svg";
|
||||
@@ -264,15 +264,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
onClick: () => {
|
||||
collection.openTab();
|
||||
// push to most recent
|
||||
MostRecentActivity.mostRecentActivity.addItem(userContext.databaseAccount?.id, {
|
||||
type: MostRecentActivity.Type.OpenCollection,
|
||||
title: collection.id(),
|
||||
description: "Data",
|
||||
data: {
|
||||
databaseId: collection.databaseId,
|
||||
collectionId: collection.id(),
|
||||
},
|
||||
});
|
||||
mostRecentActivity.collectionWasOpened(userContext.databaseAccount?.id, collection);
|
||||
},
|
||||
isSelected: () =>
|
||||
this.isDataNodeSelected(collection.databaseId, collection.id(), [
|
||||
@@ -573,7 +565,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
(item: NotebookContentItem) => {
|
||||
this.container.openNotebook(item).then((hasOpened) => {
|
||||
if (hasOpened) {
|
||||
this.pushItemToMostRecent(item);
|
||||
mostRecentActivity.notebookWasItemOpened(userContext.databaseAccount?.id, item);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -594,7 +586,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
(item: NotebookContentItem) => {
|
||||
this.container.openNotebook(item).then((hasOpened) => {
|
||||
if (hasOpened) {
|
||||
this.pushItemToMostRecent(item);
|
||||
mostRecentActivity.notebookWasItemOpened(userContext.databaseAccount?.id, item);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -624,18 +616,6 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
return gitHubNotebooksTree;
|
||||
}
|
||||
|
||||
private pushItemToMostRecent(item: NotebookContentItem) {
|
||||
MostRecentActivity.mostRecentActivity.addItem(userContext.databaseAccount?.id, {
|
||||
type: MostRecentActivity.Type.OpenNotebook,
|
||||
title: item.name,
|
||||
description: "Notebook",
|
||||
data: {
|
||||
name: item.name,
|
||||
path: item.path,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private buildChildNodes(
|
||||
item: NotebookContentItem,
|
||||
onFileClick: (item: NotebookContentItem) => void,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as ko from "knockout";
|
||||
import * as MostRecentActivity from "../MostRecentActivity/MostRecentActivity";
|
||||
import { mostRecentActivity } from "../MostRecentActivity/MostRecentActivity";
|
||||
import * as React from "react";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { NotebookContentItem } from "../Notebook/NotebookContentItem";
|
||||
@@ -44,15 +44,7 @@ export class ResourceTreeAdapterForResourceToken implements ReactAdapter {
|
||||
onClick: () => {
|
||||
collection.onDocumentDBDocumentsClick();
|
||||
// push to most recent
|
||||
MostRecentActivity.mostRecentActivity.addItem(userContext.databaseAccount?.id, {
|
||||
type: MostRecentActivity.Type.OpenCollection,
|
||||
title: collection.id(),
|
||||
description: "Data",
|
||||
data: {
|
||||
databaseId: collection.databaseId,
|
||||
collectionId: collection.id(),
|
||||
},
|
||||
});
|
||||
mostRecentActivity.collectionWasOpened(userContext.databaseAccount?.id, collection);
|
||||
},
|
||||
isSelected: () =>
|
||||
this.isDataNodeSelected(collection.databaseId, collection.id(), ViewModels.CollectionTabKind.Documents),
|
||||
|
||||
Reference in New Issue
Block a user