mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 01:11:25 +00:00
Update prettier to latest. Remove tslint (#1641)
* Rev up prettier * Reformat * Remove deprecated tslint * Remove call to tslint and update package-lock.json
This commit is contained in:
@@ -90,7 +90,7 @@ export class AccessibleVerticalList {
|
||||
private scrollElementIntoContainerViewIfNeeded(
|
||||
element: Element,
|
||||
container: Element,
|
||||
scrollPosition: ScrollPosition
|
||||
scrollPosition: ScrollPosition,
|
||||
): void {
|
||||
if (!this.isElementVisibleInContainer(element, container)) {
|
||||
if (scrollPosition === ScrollPosition.Top) {
|
||||
|
||||
@@ -8,7 +8,7 @@ describe("Collection", () => {
|
||||
new Collection(container, databaseId, data);
|
||||
|
||||
const generateMockCollectionsDataModelWithPartitionKey = (
|
||||
partitionKey: DataModels.PartitionKey
|
||||
partitionKey: DataModels.PartitionKey,
|
||||
): DataModels.Collection => {
|
||||
return {
|
||||
defaultTtl: 1,
|
||||
|
||||
@@ -183,7 +183,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
return this;
|
||||
}
|
||||
return collection;
|
||||
})
|
||||
}),
|
||||
);
|
||||
useDatabases.getState().updateDatabase(database);
|
||||
});
|
||||
@@ -213,7 +213,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
this.showUserDefinedFunctions = ko.observable<boolean>(showScriptsMenus);
|
||||
|
||||
this.showConflicts = ko.observable<boolean>(
|
||||
userContext?.databaseAccount?.properties.enableMultipleWriteLocations && data && !!data.conflictResolutionPolicy
|
||||
userContext?.databaseAccount?.properties.enableMultipleWriteLocations && data && !!data.conflictResolutionPolicy,
|
||||
);
|
||||
|
||||
this.isStoredProceduresExpanded = ko.observable<boolean>(false);
|
||||
@@ -242,7 +242,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
useTabs
|
||||
.getState()
|
||||
.refreshActiveTab(
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id()
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
.getState()
|
||||
.getTabs(
|
||||
ViewModels.CollectionTabKind.Documents,
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id()
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id(),
|
||||
) as DocumentsTab[];
|
||||
let documentsTab: DocumentsTab = documentsTabs && documentsTabs[0];
|
||||
|
||||
@@ -341,7 +341,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
.getState()
|
||||
.getTabs(
|
||||
ViewModels.CollectionTabKind.Conflicts,
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id()
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id(),
|
||||
) as ConflictsTab[];
|
||||
let conflictsTab: ConflictsTab = conflictsTabs && conflictsTabs[0];
|
||||
|
||||
@@ -394,7 +394,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
.getState()
|
||||
.getTabs(
|
||||
ViewModels.CollectionTabKind.QueryTables,
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id()
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id(),
|
||||
) as QueryTablesTab[];
|
||||
let queryTablesTab: QueryTablesTab = queryTablesTabs && queryTablesTabs[0];
|
||||
|
||||
@@ -443,7 +443,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
.getState()
|
||||
.getTabs(
|
||||
ViewModels.CollectionTabKind.Graph,
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id()
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id(),
|
||||
) as GraphTab[];
|
||||
let graphTab: GraphTab = graphTabs && graphTabs[0];
|
||||
|
||||
@@ -496,7 +496,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
.getState()
|
||||
.getTabs(
|
||||
ViewModels.CollectionTabKind.Documents,
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id()
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id(),
|
||||
) as MongoDocumentsTab[];
|
||||
let mongoDocumentsTab: MongoDocumentsTab = mongoDocumentsTabs && mongoDocumentsTabs[0];
|
||||
|
||||
@@ -568,7 +568,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
collection: this,
|
||||
node: this,
|
||||
onLoadStartKey: startKey,
|
||||
})
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -614,7 +614,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
private launchSettingsTabV2 = (
|
||||
settingsTabV2: CollectionSettingsTabV2,
|
||||
traceStartData: any,
|
||||
settingsTabOptions: ViewModels.TabOptions
|
||||
settingsTabOptions: ViewModels.TabOptions,
|
||||
): void => {
|
||||
if (!settingsTabV2) {
|
||||
const startKey: number = TelemetryProcessor.traceStart(Action.Tab, traceStartData);
|
||||
@@ -651,8 +651,8 @@ export default class Collection implements ViewModels.Collection {
|
||||
partitionKey: collection.partitionKey,
|
||||
onLoadStartKey: startKey,
|
||||
},
|
||||
{ container: this.container }
|
||||
)
|
||||
{ container: this.container },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -682,7 +682,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
{
|
||||
container: this.container,
|
||||
viewModelcollection: this,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
useTabs.getState().activateNewTab(newMongoQueryTab);
|
||||
@@ -737,7 +737,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
},
|
||||
{
|
||||
container: this.container,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
useTabs.getState().activateNewTab(mongoShellTab);
|
||||
@@ -787,7 +787,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
public findUserDefinedFunctionWithId(userDefinedFunctionId: string): UserDefinedFunction {
|
||||
return _.find(
|
||||
this.userDefinedFunctions(),
|
||||
(userDefinedFunction: Trigger) => userDefinedFunction.id() === userDefinedFunctionId
|
||||
(userDefinedFunction: Trigger) => userDefinedFunction.id() === userDefinedFunctionId,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -801,7 +801,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
useTabs
|
||||
.getState()
|
||||
.refreshActiveTab(
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id()
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -832,7 +832,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
||||
error: getErrorMessage(error),
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -862,7 +862,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
useTabs
|
||||
.getState()
|
||||
.refreshActiveTab(
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id()
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -893,7 +893,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
||||
error: getErrorMessage(error),
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -923,7 +923,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
useTabs
|
||||
.getState()
|
||||
.refreshActiveTab(
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id()
|
||||
(tab) => tab.collection && tab.collection.databaseId === this.databaseId && tab.collection.id() === this.id(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -955,7 +955,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
||||
error: getErrorMessage(error),
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -978,7 +978,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
public loadStoredProcedures(): Promise<any> {
|
||||
return readStoredProcedures(this.databaseId, this.id()).then((storedProcedures) => {
|
||||
const storedProceduresNodes: ViewModels.TreeNode[] = storedProcedures.map(
|
||||
(storedProcedure) => new StoredProcedure(this.container, this, storedProcedure)
|
||||
(storedProcedure) => new StoredProcedure(this.container, this, storedProcedure),
|
||||
);
|
||||
const otherNodes = this.children().filter((node) => node.nodeKind !== "StoredProcedure");
|
||||
const allNodes = otherNodes.concat(storedProceduresNodes);
|
||||
@@ -989,7 +989,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
public loadUserDefinedFunctions(): Promise<any> {
|
||||
return readUserDefinedFunctions(this.databaseId, this.id()).then((userDefinedFunctions) => {
|
||||
const userDefinedFunctionsNodes: ViewModels.TreeNode[] = userDefinedFunctions.map(
|
||||
(udf) => new UserDefinedFunction(this.container, this, udf)
|
||||
(udf) => new UserDefinedFunction(this.container, this, udf),
|
||||
);
|
||||
const otherNodes = this.children().filter((node) => node.nodeKind !== "UserDefinedFunction");
|
||||
const allNodes = otherNodes.concat(userDefinedFunctionsNodes);
|
||||
@@ -1000,7 +1000,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
public loadTriggers(): Promise<any> {
|
||||
return readTriggers(this.databaseId, this.id()).then((triggers) => {
|
||||
const triggerNodes: ViewModels.TreeNode[] = triggers.map(
|
||||
(trigger: SqlTriggerResource | TriggerDefinition) => new Trigger(this.container, this, trigger)
|
||||
(trigger: SqlTriggerResource | TriggerDefinition) => new Trigger(this.container, this, trigger),
|
||||
);
|
||||
const otherNodes = this.children().filter((node) => node.nodeKind !== "Trigger");
|
||||
const allNodes = otherNodes.concat(triggerNodes);
|
||||
@@ -1047,7 +1047,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
databaseName: this.databaseId,
|
||||
collectionName: this.id(),
|
||||
}),
|
||||
"Settings tree node"
|
||||
"Settings tree node",
|
||||
);
|
||||
|
||||
return undefined;
|
||||
@@ -1098,7 +1098,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
if (Array.isArray(parsedContent)) {
|
||||
const chunkSize = 100; // 100 is the max # of bulk operations the SDK currently accepts
|
||||
const chunkedContent = Array.from({ length: Math.ceil(parsedContent.length / chunkSize) }, (_, index) =>
|
||||
parsedContent.slice(index * chunkSize, index * chunkSize + chunkSize)
|
||||
parsedContent.slice(index * chunkSize, index * chunkSize + chunkSize),
|
||||
);
|
||||
for (const chunk of chunkedContent) {
|
||||
let retryAttempts = 0;
|
||||
@@ -1122,7 +1122,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
break;
|
||||
}
|
||||
logConsoleInfo(
|
||||
`${documentsToAttempt.length} document creations were throttled. Waiting ${retryAttempts} seconds and retrying throttled documents`
|
||||
`${documentsToAttempt.length} document creations were throttled. Waiting ${retryAttempts} seconds and retrying throttled documents`,
|
||||
);
|
||||
retryAttempts++;
|
||||
await sleep(retryAttempts);
|
||||
@@ -1190,7 +1190,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
databaseName: this.databaseId,
|
||||
collectionName: this.id(),
|
||||
},
|
||||
startKey
|
||||
startKey,
|
||||
);
|
||||
} catch (error) {
|
||||
TelemetryProcessor.traceFailure(
|
||||
@@ -1202,7 +1202,7 @@ export default class Collection implements ViewModels.Collection {
|
||||
error: getErrorMessage(error),
|
||||
errorStack: getErrorStack(error),
|
||||
},
|
||||
startKey
|
||||
startKey,
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export default class ConflictId {
|
||||
"OK",
|
||||
() => this.loadConflict(),
|
||||
"Cancel",
|
||||
undefined
|
||||
undefined,
|
||||
);
|
||||
} else {
|
||||
this.loadConflict();
|
||||
@@ -78,7 +78,7 @@ export default class ConflictId {
|
||||
try {
|
||||
const currentDocumentContent = await readDocument(
|
||||
this.container.collection,
|
||||
this.buildDocumentIdFromConflict(this.partitionKeyValue)
|
||||
this.buildDocumentIdFromConflict(this.partitionKeyValue),
|
||||
);
|
||||
|
||||
if (this.operationType === Constants.ConflictOperationType.Replace) {
|
||||
@@ -126,7 +126,7 @@ export default class ConflictId {
|
||||
const conflictDocumentRid = Constants.HashRoutePrefixes.docsWithIds(
|
||||
this.container.collection.getDatabase().rid,
|
||||
this.container.collection.rid,
|
||||
this.resourceId
|
||||
this.resourceId,
|
||||
);
|
||||
const partitionKeyValueResolved = partitionKeyValue || this.partitionKeyValue;
|
||||
let id = this.resourceId;
|
||||
@@ -147,7 +147,7 @@ export default class ConflictId {
|
||||
partitionKeyProperty: this.partitionKeyProperty,
|
||||
partitionKey: this.partitionKey,
|
||||
},
|
||||
partitionKeyValueResolved
|
||||
partitionKeyValueResolved,
|
||||
);
|
||||
|
||||
documentId.partitionKeyProperties = [this.partitionKeyProperty];
|
||||
|
||||
@@ -80,7 +80,7 @@ describe("Add Schema", () => {
|
||||
userContext.resourceGroup,
|
||||
userContext.databaseAccount.name,
|
||||
database.id(),
|
||||
collection.id
|
||||
collection.id,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -116,11 +116,11 @@ export default class Database implements ViewModels.Database {
|
||||
error: errorMessage,
|
||||
errorStack: getErrorStack(error),
|
||||
},
|
||||
startKey
|
||||
startKey,
|
||||
);
|
||||
logConsoleError(`Error while fetching database settings for database ${this.id()}: ${errorMessage}`);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
pendingNotificationsPromise.then(
|
||||
@@ -131,7 +131,7 @@ export default class Database implements ViewModels.Database {
|
||||
() => {
|
||||
settingsTab.pendingNotification(undefined);
|
||||
useTabs.getState().activateTab(settingsTab);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -180,7 +180,7 @@ export default class Database implements ViewModels.Database {
|
||||
if (containerPaginationEnabled) {
|
||||
const collectionsWithPagination: DataModels.CollectionsWithPagination = await readCollectionsWithPagination(
|
||||
this.id(),
|
||||
this.collectionsContinuationToken
|
||||
this.collectionsContinuationToken,
|
||||
);
|
||||
|
||||
if (collectionsWithPagination.collections?.length === Constants.Queries.containersPerPage) {
|
||||
@@ -240,7 +240,7 @@ export default class Database implements ViewModels.Database {
|
||||
.getState()
|
||||
.openSidePanel(
|
||||
"New " + getCollectionName(),
|
||||
<AddCollectionPanel explorer={database.container} databaseId={database.id()} />
|
||||
<AddCollectionPanel explorer={database.container} databaseId={database.id()} />,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -288,32 +288,33 @@ export default class Database implements ViewModels.Database {
|
||||
databaseName: this.id(),
|
||||
collectionName: this.id(),
|
||||
}),
|
||||
"Settings tree node"
|
||||
"Settings tree node",
|
||||
);
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
private getDeltaCollections(
|
||||
updatedCollectionsList: DataModels.Collection[]
|
||||
): { toAdd: DataModels.Collection[]; toDelete: Collection[] } {
|
||||
private getDeltaCollections(updatedCollectionsList: DataModels.Collection[]): {
|
||||
toAdd: DataModels.Collection[];
|
||||
toDelete: Collection[];
|
||||
} {
|
||||
const collectionsToAdd: DataModels.Collection[] = _.filter(
|
||||
updatedCollectionsList,
|
||||
(collection: DataModels.Collection) => {
|
||||
const collectionExists = _.some(
|
||||
this.collections(),
|
||||
(existingCollection: Collection) => existingCollection.id() === collection.id
|
||||
(existingCollection: Collection) => existingCollection.id() === collection.id,
|
||||
);
|
||||
return !collectionExists;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const collectionsToDelete: Collection[] = [];
|
||||
ko.utils.arrayForEach(this.collections(), (collection: Collection) => {
|
||||
const collectionPresentInUpdatedList = _.some(
|
||||
updatedCollectionsList,
|
||||
(coll: DataModels.Collection) => coll.id === collection.id()
|
||||
(coll: DataModels.Collection) => coll.id === collection.id(),
|
||||
);
|
||||
if (!collectionPresentInUpdatedList) {
|
||||
collectionsToDelete.push(collection);
|
||||
@@ -327,7 +328,7 @@ export default class Database implements ViewModels.Database {
|
||||
this.collections(
|
||||
this.collections()
|
||||
.concat(collections)
|
||||
.sort((collection1, collection2) => collection1.id().localeCompare(collection2.id()))
|
||||
.sort((collection1, collection2) => collection1.id().localeCompare(collection2.id())),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -368,7 +369,7 @@ export default class Database implements ViewModels.Database {
|
||||
userContext.resourceGroup,
|
||||
userContext.databaseAccount.name,
|
||||
this.id(),
|
||||
collection.id
|
||||
collection.id,
|
||||
);
|
||||
|
||||
if (response.status >= 404) {
|
||||
|
||||
@@ -38,7 +38,7 @@ export default class DocumentId {
|
||||
"OK",
|
||||
() => this.loadDocument(),
|
||||
"Cancel",
|
||||
undefined
|
||||
undefined,
|
||||
);
|
||||
} else {
|
||||
this.loadDocument();
|
||||
|
||||
@@ -102,8 +102,8 @@ export default class ResourceTokenCollection implements ViewModels.CollectionBas
|
||||
partitionKey: collection.partitionKey,
|
||||
onLoadStartKey: startKey,
|
||||
},
|
||||
{ container: this.container }
|
||||
)
|
||||
{ container: this.container },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ export default class ResourceTokenCollection implements ViewModels.CollectionBas
|
||||
ViewModels.CollectionTabKind.Documents,
|
||||
(tab: TabsBase) =>
|
||||
tab.collection?.id() === this.id() &&
|
||||
(tab.collection as ViewModels.CollectionBase).databaseId === this.databaseId
|
||||
(tab.collection as ViewModels.CollectionBase).databaseId === this.databaseId,
|
||||
) as DocumentsTab[];
|
||||
let documentsTab: DocumentsTab = documentsTabs && documentsTabs[0];
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ export const ResourceTokenTree: React.FC = (): JSX.Element => {
|
||||
useTabs
|
||||
.getState()
|
||||
.refreshActiveTab(
|
||||
(tab) => tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId
|
||||
(tab) => tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId,
|
||||
);
|
||||
},
|
||||
isSelected: () => useSelectedNode.getState().isDataNodeSelected(collection.databaseId, collection.id()),
|
||||
|
||||
@@ -67,7 +67,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
gitHubNotebooksContentRoot: state.gitHubNotebooksContentRoot,
|
||||
updateNotebookItem: state.updateNotebookItem,
|
||||
}),
|
||||
shallow
|
||||
shallow,
|
||||
);
|
||||
const { activeTab, refreshActiveTab } = useTabs();
|
||||
const showScriptNodes =
|
||||
@@ -170,7 +170,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
myNotebooksContentRoot,
|
||||
(item: NotebookContentItem) => {
|
||||
container.openNotebook(item);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
myNotebooksTree.isExpanded = true;
|
||||
@@ -186,7 +186,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
(item: NotebookContentItem) => {
|
||||
container.openNotebook(item);
|
||||
},
|
||||
true
|
||||
true,
|
||||
);
|
||||
const manageGitContextMenu: TreeNodeMenuItem[] = [
|
||||
{
|
||||
@@ -200,7 +200,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
explorer={container}
|
||||
gitHubClientProp={container.notebookManager.gitHubClient}
|
||||
junoClientProp={container.notebookManager.junoClient}
|
||||
/>
|
||||
/>,
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -223,7 +223,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
const buildChildNodes = (
|
||||
item: NotebookContentItem,
|
||||
onFileClick: (item: NotebookContentItem) => void,
|
||||
isGithubTree?: boolean
|
||||
isGithubTree?: boolean,
|
||||
): TreeNode[] => {
|
||||
if (!item || !item.children) {
|
||||
return [];
|
||||
@@ -242,7 +242,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
const buildNotebookFileNode = (
|
||||
item: NotebookContentItem,
|
||||
onFileClick: (item: NotebookContentItem) => void,
|
||||
isGithubTree?: boolean
|
||||
isGithubTree?: boolean,
|
||||
): TreeNode => {
|
||||
return {
|
||||
label: item.name,
|
||||
@@ -267,7 +267,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
const createFileContextMenu = (
|
||||
container: Explorer,
|
||||
item: NotebookContentItem,
|
||||
isGithubTree?: boolean
|
||||
isGithubTree?: boolean,
|
||||
): TreeNodeMenuItem[] => {
|
||||
let items: TreeNodeMenuItem[] = [
|
||||
{
|
||||
@@ -287,7 +287,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
"Delete",
|
||||
() => container.deleteNotebookFile(item, isGithubTree),
|
||||
"Cancel",
|
||||
undefined
|
||||
undefined,
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -338,7 +338,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
const createDirectoryContextMenu = (
|
||||
container: Explorer,
|
||||
item: NotebookContentItem,
|
||||
isGithubTree?: boolean
|
||||
isGithubTree?: boolean,
|
||||
): TreeNodeMenuItem[] => {
|
||||
let items: TreeNodeMenuItem[] = [
|
||||
{
|
||||
@@ -358,7 +358,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
"Delete",
|
||||
() => container.deleteNotebookFile(item, isGithubTree),
|
||||
"Cancel",
|
||||
undefined
|
||||
undefined,
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -396,7 +396,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
item.label !== "Delete" &&
|
||||
item.label !== "Rename" &&
|
||||
item.label !== "New Directory" &&
|
||||
item.label !== "Upload File"
|
||||
item.label !== "Upload File",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
const buildNotebookDirectoryNode = (
|
||||
item: NotebookContentItem,
|
||||
onFileClick: (item: NotebookContentItem) => void,
|
||||
isGithubTree?: boolean
|
||||
isGithubTree?: boolean,
|
||||
): TreeNode => {
|
||||
return {
|
||||
label: item.name,
|
||||
@@ -479,7 +479,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
database
|
||||
.collections()
|
||||
.forEach((collection: ViewModels.Collection) =>
|
||||
databaseNode.children.push(buildCollectionNode(database, collection))
|
||||
databaseNode.children.push(buildCollectionNode(database, collection)),
|
||||
);
|
||||
|
||||
if (database.collectionsContinuationToken) {
|
||||
@@ -496,7 +496,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
|
||||
database.collections.subscribe((collections: ViewModels.Collection[]) => {
|
||||
collections.forEach((collection: ViewModels.Collection) =>
|
||||
databaseNode.children.push(buildCollectionNode(database, collection))
|
||||
databaseNode.children.push(buildCollectionNode(database, collection)),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -606,7 +606,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
useCommandBar.getState().setContextButtons([]);
|
||||
refreshActiveTab(
|
||||
(tab: TabsBase) =>
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId,
|
||||
);
|
||||
},
|
||||
onExpanded: () => {
|
||||
@@ -640,7 +640,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
collection.selectedSubnodeKind(ViewModels.CollectionTabKind.StoredProcedures);
|
||||
refreshActiveTab(
|
||||
(tab: TabsBase) =>
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId,
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -665,7 +665,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
collection.selectedSubnodeKind(ViewModels.CollectionTabKind.UserDefinedFunctions);
|
||||
refreshActiveTab(
|
||||
(tab: TabsBase) =>
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId,
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -688,7 +688,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
||||
collection.selectedSubnodeKind(ViewModels.CollectionTabKind.Triggers);
|
||||
refreshActiveTab(
|
||||
(tab: TabsBase) =>
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -65,11 +65,11 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
useSelectedNode.subscribe(() => this.triggerRender());
|
||||
useTabs.subscribe(
|
||||
() => this.triggerRender(),
|
||||
(state) => state.activeTab
|
||||
(state) => state.activeTab,
|
||||
);
|
||||
useNotebook.subscribe(
|
||||
() => this.triggerRender(),
|
||||
(state) => state.isNotebookEnabled
|
||||
(state) => state.isNotebookEnabled,
|
||||
);
|
||||
|
||||
useDatabases.subscribe(() => this.triggerRender());
|
||||
@@ -144,7 +144,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
this.container.refreshContentItem(this.myNotebooksContentRoot).then(() => {
|
||||
this.triggerRender();
|
||||
this.traceMyNotebookTreeInfo();
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
this.gitHubNotebooksContentRoot = {
|
||||
@@ -226,12 +226,12 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
database
|
||||
.collections()
|
||||
.forEach((collection: ViewModels.Collection) =>
|
||||
databaseNode.children.push(this.buildCollectionNode(database, collection))
|
||||
databaseNode.children.push(this.buildCollectionNode(database, collection)),
|
||||
);
|
||||
|
||||
database.collections.subscribe((collections: ViewModels.Collection[]) => {
|
||||
collections.forEach((collection: ViewModels.Collection) =>
|
||||
databaseNode.children.push(this.buildCollectionNode(database, collection))
|
||||
databaseNode.children.push(this.buildCollectionNode(database, collection)),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -343,7 +343,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
.getState()
|
||||
.refreshActiveTab(
|
||||
(tab: TabsBase) =>
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId,
|
||||
);
|
||||
},
|
||||
onExpanded: () => {
|
||||
@@ -378,7 +378,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
.getState()
|
||||
.refreshActiveTab(
|
||||
(tab: TabsBase) =>
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId,
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -398,7 +398,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
]),
|
||||
contextMenu: ResourceTreeContextMenuButtonFactory.createUserDefinedFunctionContextMenuItems(
|
||||
this.container,
|
||||
udf
|
||||
udf,
|
||||
),
|
||||
})),
|
||||
onClick: () => {
|
||||
@@ -407,7 +407,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
.getState()
|
||||
.refreshActiveTab(
|
||||
(tab: TabsBase) =>
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId,
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -431,7 +431,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
.getState()
|
||||
.refreshActiveTab(
|
||||
(tab: TabsBase) =>
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId
|
||||
tab.collection?.id() === collection.id() && tab.collection.databaseId === collection.databaseId,
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -598,7 +598,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
});
|
||||
},
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
myNotebooksTree.isExpanded = true;
|
||||
@@ -619,7 +619,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
});
|
||||
},
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
gitHubNotebooksTree.contextMenu = [
|
||||
@@ -634,7 +634,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
explorer={this.container}
|
||||
gitHubClientProp={this.container.notebookManager.gitHubClient}
|
||||
junoClientProp={this.container.notebookManager.junoClient}
|
||||
/>
|
||||
/>,
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -658,7 +658,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
item: NotebookContentItem,
|
||||
onFileClick: (item: NotebookContentItem) => void,
|
||||
createDirectoryContextMenu: boolean,
|
||||
createFileContextMenu: boolean
|
||||
createFileContextMenu: boolean,
|
||||
): TreeNode[] {
|
||||
if (!item || !item.children) {
|
||||
return [];
|
||||
@@ -677,7 +677,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
private buildNotebookFileNode(
|
||||
item: NotebookContentItem,
|
||||
onFileClick: (item: NotebookContentItem) => void,
|
||||
createFileContextMenu: boolean
|
||||
createFileContextMenu: boolean,
|
||||
): TreeNode {
|
||||
return {
|
||||
label: item.name,
|
||||
@@ -719,7 +719,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
"Delete",
|
||||
() => this.container.deleteNotebookFile(item).then(() => this.triggerRender()),
|
||||
"Cancel",
|
||||
undefined
|
||||
undefined,
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -786,7 +786,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
"Delete",
|
||||
() => this.container.deleteNotebookFile(item).then(() => this.triggerRender()),
|
||||
"Cancel",
|
||||
undefined
|
||||
undefined,
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -824,7 +824,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
item.label !== "Delete" &&
|
||||
item.label !== "Rename" &&
|
||||
item.label !== "New Directory" &&
|
||||
item.label !== "Upload File"
|
||||
item.label !== "Upload File",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -835,7 +835,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
item: NotebookContentItem,
|
||||
onFileClick: (item: NotebookContentItem) => void,
|
||||
createDirectoryContextMenu: boolean,
|
||||
createFileContextMenu: boolean
|
||||
createFileContextMenu: boolean,
|
||||
): TreeNode {
|
||||
return {
|
||||
label: item.name,
|
||||
|
||||
@@ -35,7 +35,7 @@ export const SampleDataTree = ({
|
||||
.refreshActiveTab(
|
||||
(tab: TabsBase) =>
|
||||
tab.collection?.id() === sampleDataResourceTokenCollection.id() &&
|
||||
tab.collection.databaseId === sampleDataResourceTokenCollection.databaseId
|
||||
tab.collection.databaseId === sampleDataResourceTokenCollection.databaseId,
|
||||
);
|
||||
},
|
||||
isSelected: () =>
|
||||
@@ -54,7 +54,7 @@ export const SampleDataTree = ({
|
||||
.isDataNodeSelected(
|
||||
sampleDataResourceTokenCollection.databaseId,
|
||||
sampleDataResourceTokenCollection.id(),
|
||||
[ViewModels.CollectionTabKind.Documents]
|
||||
[ViewModels.CollectionTabKind.Documents],
|
||||
),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -83,7 +83,7 @@ export default class StoredProcedure {
|
||||
{
|
||||
collection: source,
|
||||
container: source.container,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
useTabs.getState().activateNewTab(storedProcedureTab);
|
||||
@@ -105,7 +105,7 @@ export default class StoredProcedure {
|
||||
.getState()
|
||||
.getTabs(
|
||||
ViewModels.CollectionTabKind.StoredProcedures,
|
||||
(tab: TabsBase) => tab.node && tab.node.rid === this.rid
|
||||
(tab: TabsBase) => tab.node && tab.node.rid === this.rid,
|
||||
) as NewStoredProcedureTab[];
|
||||
let storedProcedureTab: NewStoredProcedureTab = storedProcedureTabs && storedProcedureTabs[0];
|
||||
|
||||
@@ -132,7 +132,7 @@ export default class StoredProcedure {
|
||||
{
|
||||
collection: this.collection,
|
||||
container: this.container,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
useTabs.getState().activateNewTab(storedProcedureTab);
|
||||
@@ -149,11 +149,11 @@ export default class StoredProcedure {
|
||||
useTabs.getState().closeTabsByComparator((tab: TabsBase) => tab.node && tab.node.rid === this.rid);
|
||||
this.collection.children.remove(this);
|
||||
},
|
||||
(reason) => {}
|
||||
(reason) => {},
|
||||
);
|
||||
},
|
||||
"Cancel",
|
||||
undefined
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ export default class StoredProcedure {
|
||||
.getState()
|
||||
.getTabs(
|
||||
ViewModels.CollectionTabKind.StoredProcedures,
|
||||
(tab: TabsBase) => tab.node && tab.node.rid === this.rid
|
||||
(tab: TabsBase) => tab.node && tab.node.rid === this.rid,
|
||||
) as NewStoredProcedureTab[];
|
||||
const sprocTab: NewStoredProcedureTab = sprocTabs && sprocTabs.length > 0 && sprocTabs[0];
|
||||
sprocTab.isExecuting(true);
|
||||
@@ -174,7 +174,7 @@ export default class StoredProcedure {
|
||||
},
|
||||
(error) => {
|
||||
sprocTab.onExecuteSprocsError(getErrorMessage(error));
|
||||
}
|
||||
},
|
||||
)
|
||||
.finally(() => {
|
||||
sprocTab.isExecuting(false);
|
||||
|
||||
@@ -113,11 +113,11 @@ export default class Trigger {
|
||||
this.collection.children.remove(this);
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
() => {}
|
||||
() => {},
|
||||
);
|
||||
},
|
||||
"Cancel",
|
||||
undefined
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export default class UserDefinedFunction {
|
||||
.getState()
|
||||
.getTabs(
|
||||
ViewModels.CollectionTabKind.UserDefinedFunctions,
|
||||
(tab) => tab.node?.rid === this.rid
|
||||
(tab) => tab.node?.rid === this.rid,
|
||||
) as UserDefinedFunctionTab[];
|
||||
let userDefinedFunctionTab: UserDefinedFunctionTab = userDefinedFunctionTabs && userDefinedFunctionTabs[0];
|
||||
|
||||
@@ -108,11 +108,11 @@ export default class UserDefinedFunction {
|
||||
},
|
||||
() => {
|
||||
/**/
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
"Cancel",
|
||||
undefined
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user