mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-03-13 05:15:30 +00:00
Remove OpenActionsStubs (#106)
This commit is contained in:
parent
46cca859e3
commit
4f86015be7
@ -24,6 +24,7 @@ import { MessageHandler } from "./MessageHandler";
|
||||
import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||
import { OfferUtils } from "../Utils/OfferUtils";
|
||||
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
||||
import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
||||
|
||||
export function getCommonQueryOptions(options: FeedOptions): any {
|
||||
const storedItemPerPageSetting: number = LocalStorageUtility.getEntryNumber(StorageKey.ActualItemPerPage);
|
||||
@ -142,7 +143,7 @@ export abstract class DataAccessUtilityBase {
|
||||
|
||||
public executeStoredProcedure(
|
||||
collection: ViewModels.Collection,
|
||||
storedProcedure: ViewModels.StoredProcedure,
|
||||
storedProcedure: StoredProcedure,
|
||||
partitionKeyValue: any,
|
||||
params: any[]
|
||||
): Q.Promise<any> {
|
||||
|
@ -12,6 +12,7 @@ import { MessageTypes } from "../Contracts/ExplorerContracts";
|
||||
import { MinimalQueryIterator, nextPage } from "./IteratorUtilities";
|
||||
import { NotificationConsoleUtils } from "../Utils/NotificationConsoleUtils";
|
||||
import { RequestOptions } from "@azure/cosmos/dist-esm";
|
||||
import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
||||
|
||||
// TODO: Log all promise resolutions and errors with verbosity levels
|
||||
export default class DocumentClientUtilityBase {
|
||||
@ -164,7 +165,7 @@ export default class DocumentClientUtilityBase {
|
||||
|
||||
public executeStoredProcedure(
|
||||
collection: ViewModels.Collection,
|
||||
storedProcedure: ViewModels.StoredProcedure,
|
||||
storedProcedure: StoredProcedure,
|
||||
partitionKeyValue: any,
|
||||
params: any[]
|
||||
): Q.Promise<any> {
|
||||
|
@ -12,6 +12,10 @@ import { NotebookContentItem } from "../Explorer/Notebook/NotebookContentItem";
|
||||
import { QueryMetrics } from "@azure/cosmos";
|
||||
import { UploadDetails } from "../workers/upload/definitions";
|
||||
import Explorer from "../Explorer/Explorer";
|
||||
import UserDefinedFunction from "../Explorer/Tree/UserDefinedFunction";
|
||||
import StoredProcedure from "../Explorer/Tree/StoredProcedure";
|
||||
import ConflictsTab from "../Explorer/Tabs/ConflictsTab";
|
||||
import Trigger from "../Explorer/Tree/Trigger";
|
||||
|
||||
export interface ExplorerOptions {
|
||||
documentClientUtility: DocumentClientUtilityBase;
|
||||
@ -27,34 +31,12 @@ export interface NavbarButtonConfig extends CommandButtonComponentProps {}
|
||||
|
||||
export interface DatabaseAccount extends DataModels.DatabaseAccount {}
|
||||
|
||||
export interface NotebookWorkspaceManager {
|
||||
getNotebookWorkspacesAsync(cosmosAccountResourceId: string): Promise<DataModels.NotebookWorkspace[]>;
|
||||
getNotebookWorkspaceAsync(
|
||||
cosmosAccountResourceId: string,
|
||||
notebookWorkspaceId: string
|
||||
): Promise<DataModels.NotebookWorkspace>;
|
||||
createNotebookWorkspaceAsync(cosmosdbResourceId: string, notebookWorkspaceId: string): Promise<void>;
|
||||
deleteNotebookWorkspaceAsync(cosmosdbResourceId: string, notebookWorkspaceId: string): Promise<void>;
|
||||
getNotebookConnectionInfoAsync(
|
||||
cosmosAccountResourceId: string,
|
||||
notebookWorkspaceId: string
|
||||
): Promise<DataModels.NotebookWorkspaceConnectionInfo>;
|
||||
startNotebookWorkspaceAsync(cosmosdbResourceId: string, notebookWorkspaceId: string): Promise<void>;
|
||||
}
|
||||
|
||||
export interface KernelConnectionMetadata {
|
||||
name: string;
|
||||
configurationEndpoints: DataModels.NotebookConfigurationEndpoints;
|
||||
notebookConnectionInfo: DataModels.NotebookWorkspaceConnectionInfo;
|
||||
}
|
||||
|
||||
export interface ArcadiaResourceManager {
|
||||
getWorkspacesAsync(arcadiaResourceId: string): Promise<DataModels.ArcadiaWorkspace[]>;
|
||||
getWorkspaceAsync(arcadiaResourceId: string, workspaceId: string): Promise<DataModels.ArcadiaWorkspace>;
|
||||
listWorkspacesAsync(subscriptionIds: string[]): Promise<DataModels.ArcadiaWorkspace[]>;
|
||||
listSparkPoolsAsync(resourceId: string): Promise<DataModels.SparkPool[]>;
|
||||
}
|
||||
|
||||
export interface TokenProvider {
|
||||
getAuthHeader(): Promise<Headers>;
|
||||
}
|
||||
@ -258,48 +240,6 @@ export interface ConflictId {
|
||||
loadConflict(): Q.Promise<any>;
|
||||
}
|
||||
|
||||
export interface StoredProcedure extends TreeNode {
|
||||
container: Explorer;
|
||||
collection: Collection;
|
||||
rid: string;
|
||||
self: string;
|
||||
id: ko.Observable<string>;
|
||||
body: ko.Observable<string>;
|
||||
|
||||
delete(): void;
|
||||
open: () => void;
|
||||
select(): void;
|
||||
execute(params: string[], partitionKeyValue?: string): void;
|
||||
}
|
||||
|
||||
export interface UserDefinedFunction extends TreeNode {
|
||||
container: Explorer;
|
||||
collection: Collection;
|
||||
rid: string;
|
||||
self: string;
|
||||
id: ko.Observable<string>;
|
||||
body: ko.Observable<string>;
|
||||
|
||||
delete(): void;
|
||||
open: () => void;
|
||||
select(): void;
|
||||
}
|
||||
|
||||
export interface Trigger extends TreeNode {
|
||||
container: Explorer;
|
||||
collection: Collection;
|
||||
rid: string;
|
||||
self: string;
|
||||
id: ko.Observable<string>;
|
||||
body: ko.Observable<string>;
|
||||
triggerType: ko.Observable<string>;
|
||||
triggerOperation: ko.Observable<string>;
|
||||
|
||||
delete(): void;
|
||||
open: () => void;
|
||||
select(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options used to initialize pane
|
||||
*/
|
||||
@ -623,111 +563,6 @@ export interface DocumentsTab extends Tab {
|
||||
loadNextPage(): Q.Promise<any>;
|
||||
}
|
||||
|
||||
export interface ConflictsTab extends Tab {
|
||||
/* Conflicts Grid */
|
||||
selectedConflictId: ko.Observable<ConflictId>;
|
||||
selectedConflictContent: Editable<any>;
|
||||
selectedConflictCurrent: Editable<any>;
|
||||
onConflictIdClick(conflictId: ConflictId): Q.Promise<any>;
|
||||
dataContentsGridScrollHeight: ko.Observable<string>;
|
||||
accessibleDocumentList: AccessibleVerticalList;
|
||||
documentContentsGridId: string;
|
||||
|
||||
partitionKey: DataModels.PartitionKey;
|
||||
partitionKeyPropertyHeader: string;
|
||||
partitionKeyProperty: string;
|
||||
conflictIds: ko.ObservableArray<ConflictId>;
|
||||
|
||||
/* Document Editor */
|
||||
isEditorDirty: ko.Computed<boolean>;
|
||||
editorState: ko.Observable<DocumentExplorerState>;
|
||||
onValidDocumentEdit(content: any): Q.Promise<any>;
|
||||
onInvalidDocumentEdit(content: any): Q.Promise<any>;
|
||||
loadingConflictData: ko.Observable<boolean>;
|
||||
|
||||
onAcceptChangesClick(): Q.Promise<any>;
|
||||
onDiscardClick(): Q.Promise<any>;
|
||||
|
||||
initDocumentEditorForCreate(documentId: ConflictId, documentToInsert: any): Q.Promise<any>;
|
||||
initDocumentEditorForReplace(documentId: ConflictId, conflictContent: any, currentContent: any): Q.Promise<any>;
|
||||
initDocumentEditorForDelete(documentId: ConflictId, documentToDelete: any): Q.Promise<any>;
|
||||
initDocumentEditorForNoOp(conflictId: ConflictId): Q.Promise<any>;
|
||||
loadNextPage(): Q.Promise<any>;
|
||||
}
|
||||
|
||||
export interface SettingsTab extends Tab {
|
||||
/*state*/
|
||||
throughput: ko.Observable<number>;
|
||||
timeToLive: ko.Observable<string>;
|
||||
timeToLiveSeconds: ko.Observable<number>;
|
||||
geospatialVisible: ko.Computed<boolean>;
|
||||
geospatialConfigType: ko.Observable<string>;
|
||||
indexingPolicyContent: ko.Observable<DataModels.IndexingPolicy>;
|
||||
rupm: ko.Observable<string>;
|
||||
requestUnitsUsageCost: ko.Computed<string>;
|
||||
canThroughputExceedMaximumValue: ko.Computed<boolean>;
|
||||
shouldDisplayPortalUsePrompt: ko.Computed<boolean>;
|
||||
warningMessage: ko.Computed<string>;
|
||||
ttlOffFocused: ko.Observable<boolean>;
|
||||
ttlOnDefaultFocused: ko.Observable<boolean>;
|
||||
ttlOnFocused: ko.Observable<boolean>;
|
||||
indexingPolicyElementFocused: ko.Observable<boolean>;
|
||||
notificationStatusInfo: ko.Observable<string>;
|
||||
shouldShowNotificationStatusPrompt: ko.Computed<boolean>;
|
||||
shouldShowStatusBar: ko.Computed<boolean>;
|
||||
pendingNotification: ko.Observable<DataModels.Notification>;
|
||||
|
||||
conflictResolutionPolicyMode: ko.Observable<string>;
|
||||
conflictResolutionPolicyPath: ko.Observable<string>;
|
||||
conflictResolutionPolicyProcedure: ko.Observable<string>;
|
||||
|
||||
rupmVisible: ko.Computed<boolean>;
|
||||
costsVisible: ko.Computed<boolean>;
|
||||
minRUAnotationVisible: ko.Computed<boolean>;
|
||||
|
||||
/* Command Bar */
|
||||
saveSettingsButton: Button;
|
||||
discardSettingsChangesButton: Button;
|
||||
onSaveClick(): Q.Promise<any>;
|
||||
onRevertClick(): Q.Promise<any>;
|
||||
|
||||
/* Indexing Policy Editor */
|
||||
isIndexingPolicyEditorInitializing: ko.Observable<boolean>;
|
||||
indexingPolicyEditor: ko.Observable<monaco.editor.IStandaloneCodeEditor>;
|
||||
onValidIndexingPolicyEdit(content: any): Q.Promise<any>;
|
||||
onInvalidIndexingPolicyEdit(content: any): Q.Promise<any>;
|
||||
|
||||
onSaveClick(): Q.Promise<any>;
|
||||
onRevertClick(): Q.Promise<any>;
|
||||
}
|
||||
|
||||
export interface DatabaseSettingsTab extends Tab {
|
||||
/*state*/
|
||||
throughput: ko.Observable<number>;
|
||||
requestUnitsUsageCost: ko.PureComputed<string>;
|
||||
canThroughputExceedMaximumValue: ko.Computed<boolean>;
|
||||
warningMessage: ko.Computed<string>;
|
||||
notificationStatusInfo: ko.Observable<string>;
|
||||
shouldShowNotificationStatusPrompt: ko.Computed<boolean>;
|
||||
shouldShowStatusBar: ko.Computed<boolean>;
|
||||
pendingNotification: ko.Observable<DataModels.Notification>;
|
||||
|
||||
costsVisible: ko.Computed<boolean>;
|
||||
minRUAnotationVisible: ko.Computed<boolean>;
|
||||
|
||||
/* Command Bar */
|
||||
saveSettingsButton: Button;
|
||||
discardSettingsChangesButton: Button;
|
||||
onSaveClick(): Q.Promise<any>;
|
||||
onRevertClick(): Q.Promise<any>;
|
||||
|
||||
/* Errors */
|
||||
displayedError: ko.Observable<string>;
|
||||
|
||||
onSaveClick(): Q.Promise<any>;
|
||||
onRevertClick(): Q.Promise<any>;
|
||||
}
|
||||
|
||||
export interface WaitsForTemplate {
|
||||
isTemplateReady: ko.Observable<boolean>;
|
||||
}
|
||||
|
@ -13,6 +13,9 @@ import DeleteTriggerIcon from "../../images/DeleteTrigger.svg";
|
||||
import DeleteUDFIcon from "../../images/DeleteUDF.svg";
|
||||
import DeleteSprocIcon from "../../images/DeleteSproc.svg";
|
||||
import Explorer from "./Explorer";
|
||||
import UserDefinedFunction from "./Tree/UserDefinedFunction";
|
||||
import StoredProcedure from "./Tree/StoredProcedure";
|
||||
import Trigger from "./Tree/Trigger";
|
||||
|
||||
export interface CollectionContextMenuButtonParams {
|
||||
databaseId: string;
|
||||
@ -117,7 +120,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
||||
|
||||
public static createStoreProcedureContextMenuItems(
|
||||
container: Explorer,
|
||||
storedProcedure: ViewModels.StoredProcedure
|
||||
storedProcedure: StoredProcedure
|
||||
): TreeNodeMenuItem[] {
|
||||
if (container.isPreferredApiCassandra()) {
|
||||
return [];
|
||||
@ -132,7 +135,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
||||
];
|
||||
}
|
||||
|
||||
public static createTriggerContextMenuItems(container: Explorer, trigger: ViewModels.Trigger): TreeNodeMenuItem[] {
|
||||
public static createTriggerContextMenuItems(container: Explorer, trigger: Trigger): TreeNodeMenuItem[] {
|
||||
if (container.isPreferredApiCassandra()) {
|
||||
return [];
|
||||
}
|
||||
@ -148,7 +151,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
||||
|
||||
public static createUserDefinedFunctionContextMenuItems(
|
||||
container: Explorer,
|
||||
userDefinedFunction: ViewModels.UserDefinedFunction
|
||||
userDefinedFunction: UserDefinedFunction
|
||||
): TreeNodeMenuItem[] {
|
||||
if (container.isPreferredApiCassandra()) {
|
||||
return [];
|
||||
|
@ -3,7 +3,6 @@ import * as sinon from "sinon";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import DocumentClientUtilityBase from "../../Common/DocumentClientUtilityBase";
|
||||
import Q from "q";
|
||||
import { CollectionStub, DatabaseStub } from "../OpenActionsStubs";
|
||||
import { ContainerSampleGenerator } from "./ContainerSampleGenerator";
|
||||
import { CosmosClient } from "../../Common/CosmosClient";
|
||||
import { GremlinClient } from "../Graph/GraphExplorerComponent/GremlinClient";
|
||||
@ -54,11 +53,11 @@ describe("ContainerSampleGenerator", () => {
|
||||
}
|
||||
]
|
||||
};
|
||||
const collection = new CollectionStub({ id: ko.observable(sampleCollectionId) });
|
||||
const database = new DatabaseStub({
|
||||
const collection = { id: ko.observable(sampleCollectionId) } as ViewModels.Collection;
|
||||
const database = {
|
||||
id: ko.observable(sampleDatabaseId),
|
||||
collections: ko.observableArray([collection])
|
||||
});
|
||||
collections: ko.observableArray<ViewModels.Collection>([collection])
|
||||
} as ViewModels.Database;
|
||||
database.findCollectionWithId = () => collection;
|
||||
|
||||
const explorerStub = createExplorerStub(database);
|
||||
@ -99,11 +98,11 @@ describe("ContainerSampleGenerator", () => {
|
||||
"g.addV('person').property(id, '1').property('_partitionKey','pk').property('name', 'Eva').property('age', 44)"
|
||||
]
|
||||
};
|
||||
const collection = new CollectionStub({ id: ko.observable(sampleCollectionId) });
|
||||
const database = new DatabaseStub({
|
||||
const collection = { id: ko.observable(sampleCollectionId) } as ViewModels.Collection;
|
||||
const database = {
|
||||
id: ko.observable(sampleDatabaseId),
|
||||
collections: ko.observableArray([collection])
|
||||
});
|
||||
collections: ko.observableArray<ViewModels.Collection>([collection])
|
||||
} as ViewModels.Database;
|
||||
database.findCollectionWithId = () => collection;
|
||||
collection.databaseId = database.id();
|
||||
|
||||
|
@ -1,20 +1,20 @@
|
||||
import { DatabaseStub, CollectionStub } from "../OpenActionsStubs";
|
||||
import { DataSamplesUtil } from "./DataSamplesUtil";
|
||||
import * as sinon from "sinon";
|
||||
import { ContainerSampleGenerator } from "./ContainerSampleGenerator";
|
||||
import * as ko from "knockout";
|
||||
import Explorer from "../Explorer";
|
||||
import { Database, Collection } from "../../Contracts/ViewModels";
|
||||
|
||||
describe("DataSampleUtils", () => {
|
||||
const sampleCollectionId = "sampleCollectionId";
|
||||
const sampleDatabaseId = "sampleDatabaseId";
|
||||
|
||||
it("should not create sample collection if collection already exists", async () => {
|
||||
const collection = new CollectionStub({ id: ko.observable(sampleCollectionId) });
|
||||
const database = new DatabaseStub({
|
||||
const collection = { id: ko.observable(sampleCollectionId) } as Collection;
|
||||
const database = {
|
||||
id: ko.observable(sampleDatabaseId),
|
||||
collections: ko.observableArray([collection])
|
||||
});
|
||||
collections: ko.observableArray<Collection>([collection])
|
||||
} as Database;
|
||||
const explorer = {} as Explorer;
|
||||
explorer.nonSystemDatabases = ko.computed(() => [database]);
|
||||
explorer.showOkModalDialog = () => {};
|
||||
|
@ -79,6 +79,9 @@ import { UploadItemsPane } from "./Panes/UploadItemsPane";
|
||||
import { UploadItemsPaneAdapter } from "./Panes/UploadItemsPaneAdapter";
|
||||
import { ReactAdapter } from "../Bindings/ReactBindingHandler";
|
||||
import { toRawContentUri, fromContentUri } from "../Utils/GitHubUtils";
|
||||
import UserDefinedFunction from "./Tree/UserDefinedFunction";
|
||||
import StoredProcedure from "./Tree/StoredProcedure";
|
||||
import Trigger from "./Tree/Trigger";
|
||||
|
||||
BindingHandlersRegisterer.registerBindingHandlers();
|
||||
// Hold a reference to ComponentRegisterer to prevent transpiler to ignore import
|
||||
@ -214,7 +217,7 @@ export default class Explorer {
|
||||
public isNotebookEnabled: ko.Observable<boolean>;
|
||||
public isNotebooksEnabledForAccount: ko.Observable<boolean>;
|
||||
public notebookServerInfo: ko.Observable<DataModels.NotebookWorkspaceConnectionInfo>;
|
||||
public notebookWorkspaceManager: ViewModels.NotebookWorkspaceManager;
|
||||
public notebookWorkspaceManager: NotebookWorkspaceManager;
|
||||
public sparkClusterConnectionInfo: ko.Observable<DataModels.SparkClusterConnectionInfo>;
|
||||
public isSparkEnabled: ko.Observable<boolean>;
|
||||
public isSparkEnabledForAccount: ko.Observable<boolean>;
|
||||
@ -231,7 +234,7 @@ export default class Explorer {
|
||||
private _isInitializingNotebooks: boolean;
|
||||
private _isInitializingSparkConnectionInfo: boolean;
|
||||
private notebookBasePath: ko.Observable<string>;
|
||||
private _arcadiaManager: ViewModels.ArcadiaResourceManager;
|
||||
private _arcadiaManager: ArcadiaResourceManager;
|
||||
private notebookToImport: {
|
||||
name: string;
|
||||
content: string;
|
||||
@ -1955,9 +1958,9 @@ export default class Explorer {
|
||||
}
|
||||
|
||||
// TODO: Refactor below methods, minimize dependencies and add unit tests where necessary
|
||||
public findSelectedStoredProcedure(): ViewModels.StoredProcedure {
|
||||
public findSelectedStoredProcedure(): StoredProcedure {
|
||||
const selectedCollection: ViewModels.Collection = this.findSelectedCollection();
|
||||
return _.find(selectedCollection.storedProcedures(), (storedProcedure: ViewModels.StoredProcedure) => {
|
||||
return _.find(selectedCollection.storedProcedures(), (storedProcedure: StoredProcedure) => {
|
||||
const openedSprocTab = this.tabsManager.getTabs(
|
||||
ViewModels.CollectionTabKind.StoredProcedures,
|
||||
(tab: ViewModels.Tab) => tab.node && tab.node.rid === storedProcedure.rid
|
||||
@ -1969,9 +1972,9 @@ export default class Explorer {
|
||||
});
|
||||
}
|
||||
|
||||
public findSelectedUDF(): ViewModels.UserDefinedFunction {
|
||||
public findSelectedUDF(): UserDefinedFunction {
|
||||
const selectedCollection: ViewModels.Collection = this.findSelectedCollection();
|
||||
return _.find(selectedCollection.userDefinedFunctions(), (userDefinedFunction: ViewModels.UserDefinedFunction) => {
|
||||
return _.find(selectedCollection.userDefinedFunctions(), (userDefinedFunction: UserDefinedFunction) => {
|
||||
const openedUdfTab = this.tabsManager.getTabs(
|
||||
ViewModels.CollectionTabKind.UserDefinedFunctions,
|
||||
(tab: ViewModels.Tab) => tab.node && tab.node.rid === userDefinedFunction.rid
|
||||
@ -1983,9 +1986,9 @@ export default class Explorer {
|
||||
});
|
||||
}
|
||||
|
||||
public findSelectedTrigger(): ViewModels.Trigger {
|
||||
public findSelectedTrigger(): Trigger {
|
||||
const selectedCollection: ViewModels.Collection = this.findSelectedCollection();
|
||||
return _.find(selectedCollection.triggers(), (trigger: ViewModels.Trigger) => {
|
||||
return _.find(selectedCollection.triggers(), (trigger: Trigger) => {
|
||||
const openedTriggerTab = this.tabsManager.getTabs(
|
||||
ViewModels.CollectionTabKind.Triggers,
|
||||
(tab: ViewModels.Tab) => tab.node && tab.node.rid === trigger.rid
|
||||
|
@ -1,7 +1,6 @@
|
||||
import * as ko from "knockout";
|
||||
import { handleOpenAction } from "./OpenActions";
|
||||
import * as ViewModels from "../Contracts/ViewModels";
|
||||
import { DatabaseStub, CollectionStub } from "./OpenActionsStubs";
|
||||
import { ActionContracts } from "../Contracts/ExplorerContracts";
|
||||
import Explorer from "./Explorer";
|
||||
import CassandraAddCollectionPane from "./Panes/CassandraAddCollectionPane";
|
||||
@ -14,14 +13,6 @@ describe("OpenActions", () => {
|
||||
let collection: ViewModels.Collection;
|
||||
let databases: ViewModels.Database[];
|
||||
|
||||
let expandCollection: jasmine.Spy;
|
||||
let onDocumentDBDocumentsClick: jasmine.Spy;
|
||||
let onMongoDBDocumentsClick: jasmine.Spy;
|
||||
let onTableEntitiesClick: jasmine.Spy;
|
||||
let onGraphDocumentsClick: jasmine.Spy;
|
||||
let onNewQueryClick: jasmine.Spy;
|
||||
let onSettingsClick: jasmine.Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
explorer = {} as Explorer;
|
||||
explorer.addCollectionPane = {} as AddCollectionPane;
|
||||
@ -31,22 +22,22 @@ describe("OpenActions", () => {
|
||||
explorer.closeAllPanes = () => {};
|
||||
explorer.isConnectExplorerVisible = () => false;
|
||||
|
||||
database = new DatabaseStub({
|
||||
database = {
|
||||
id: ko.observable("db"),
|
||||
collections: ko.observableArray<ViewModels.Collection>([])
|
||||
});
|
||||
} as ViewModels.Database;
|
||||
databases = [database];
|
||||
collection = new CollectionStub({
|
||||
collection = {
|
||||
id: ko.observable("coll")
|
||||
});
|
||||
} as ViewModels.Collection;
|
||||
|
||||
expandCollection = spyOn(collection, "expandCollection");
|
||||
onDocumentDBDocumentsClick = spyOn(collection, "onDocumentDBDocumentsClick");
|
||||
onMongoDBDocumentsClick = spyOn(collection, "onMongoDBDocumentsClick");
|
||||
onTableEntitiesClick = spyOn(collection, "onTableEntitiesClick");
|
||||
onGraphDocumentsClick = spyOn(collection, "onGraphDocumentsClick");
|
||||
onNewQueryClick = spyOn(collection, "onNewQueryClick");
|
||||
onSettingsClick = spyOn(collection, "onSettingsClick");
|
||||
collection.expandCollection = jest.fn();
|
||||
collection.onDocumentDBDocumentsClick = jest.fn();
|
||||
collection.onMongoDBDocumentsClick = jest.fn();
|
||||
collection.onTableEntitiesClick = jest.fn();
|
||||
collection.onGraphDocumentsClick = jest.fn();
|
||||
collection.onNewQueryClick = jest.fn();
|
||||
collection.onSettingsClick = jest.fn();
|
||||
});
|
||||
|
||||
describe("unknown action type", () => {
|
||||
@ -146,10 +137,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(expandCollection).not.toHaveBeenCalled();
|
||||
expect(collection.expandCollection).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(expandCollection).toHaveBeenCalled();
|
||||
expect(collection.expandCollection).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should expand collection node when handleOpenAction is called", () => {
|
||||
@ -161,7 +152,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(expandCollection).toHaveBeenCalled();
|
||||
expect(collection.expandCollection).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe("SQLDocuments tab kind", () => {
|
||||
@ -174,10 +165,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onDocumentDBDocumentsClick).not.toHaveBeenCalled();
|
||||
expect(collection.onDocumentDBDocumentsClick).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(onDocumentDBDocumentsClick).toHaveBeenCalled();
|
||||
expect(collection.onDocumentDBDocumentsClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("string value should call onDocumentDBDocumentsClick", () => {
|
||||
@ -190,7 +181,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onDocumentDBDocumentsClick).toHaveBeenCalled();
|
||||
expect(collection.onDocumentDBDocumentsClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enum value should call onDocumentDBDocumentsClick before collections are fetched", () => {
|
||||
@ -202,10 +193,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onDocumentDBDocumentsClick).not.toHaveBeenCalled();
|
||||
expect(collection.onDocumentDBDocumentsClick).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(onDocumentDBDocumentsClick).toHaveBeenCalled();
|
||||
expect(collection.onDocumentDBDocumentsClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enum value should call onDocumentDBDocumentsClick", () => {
|
||||
@ -218,7 +209,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onDocumentDBDocumentsClick).toHaveBeenCalled();
|
||||
expect(collection.onDocumentDBDocumentsClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@ -232,10 +223,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onMongoDBDocumentsClick).not.toHaveBeenCalled();
|
||||
expect(collection.onMongoDBDocumentsClick).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(onMongoDBDocumentsClick).toHaveBeenCalled();
|
||||
expect(collection.onMongoDBDocumentsClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("string value should call onMongoDBDocumentsClick", () => {
|
||||
@ -248,7 +239,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onMongoDBDocumentsClick).toHaveBeenCalled();
|
||||
expect(collection.onMongoDBDocumentsClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enum value should call onMongoDBDocumentsClick before collections are fetched", () => {
|
||||
@ -260,10 +251,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onMongoDBDocumentsClick).not.toHaveBeenCalled();
|
||||
expect(collection.onMongoDBDocumentsClick).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(onMongoDBDocumentsClick).toHaveBeenCalled();
|
||||
expect(collection.onMongoDBDocumentsClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enum value should call onMongoDBDocumentsClick", () => {
|
||||
@ -276,7 +267,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onMongoDBDocumentsClick).toHaveBeenCalled();
|
||||
expect(collection.onMongoDBDocumentsClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@ -290,10 +281,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onTableEntitiesClick).not.toHaveBeenCalled();
|
||||
expect(collection.onTableEntitiesClick).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(onTableEntitiesClick).toHaveBeenCalled();
|
||||
expect(collection.onTableEntitiesClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("string value should call onTableEntitiesClick", () => {
|
||||
@ -306,7 +297,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onTableEntitiesClick).toHaveBeenCalled();
|
||||
expect(collection.onTableEntitiesClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enum value should call onTableEntitiesClick before collections are fetched", () => {
|
||||
@ -319,7 +310,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onTableEntitiesClick).toHaveBeenCalled();
|
||||
expect(collection.onTableEntitiesClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enum value should call onTableEntitiesClick", () => {
|
||||
@ -331,10 +322,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onTableEntitiesClick).not.toHaveBeenCalled();
|
||||
expect(collection.onTableEntitiesClick).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(onTableEntitiesClick).toHaveBeenCalled();
|
||||
expect(collection.onTableEntitiesClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@ -348,10 +339,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onGraphDocumentsClick).not.toHaveBeenCalled();
|
||||
expect(collection.onGraphDocumentsClick).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(onGraphDocumentsClick).toHaveBeenCalled();
|
||||
expect(collection.onGraphDocumentsClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("string value should call onGraphDocumentsClick", () => {
|
||||
@ -364,7 +355,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onGraphDocumentsClick).toHaveBeenCalled();
|
||||
expect(collection.onGraphDocumentsClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enum value should call onGraphDocumentsClick before collections are fetched", () => {
|
||||
@ -376,10 +367,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onGraphDocumentsClick).not.toHaveBeenCalled();
|
||||
expect(collection.onGraphDocumentsClick).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(onGraphDocumentsClick).toHaveBeenCalled();
|
||||
expect(collection.onGraphDocumentsClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enum value should call onGraphDocumentsClick", () => {
|
||||
@ -392,7 +383,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onGraphDocumentsClick).toHaveBeenCalled();
|
||||
expect(collection.onGraphDocumentsClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@ -406,10 +397,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onNewQueryClick).not.toHaveBeenCalled();
|
||||
expect(collection.onNewQueryClick).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(onNewQueryClick).toHaveBeenCalled();
|
||||
expect(collection.onNewQueryClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("string value should call onNewQueryClick", () => {
|
||||
@ -422,7 +413,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onNewQueryClick).toHaveBeenCalled();
|
||||
expect(collection.onNewQueryClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enum value should call onNewQueryClick before collections are fetched", () => {
|
||||
@ -434,10 +425,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onNewQueryClick).not.toHaveBeenCalled();
|
||||
expect(collection.onNewQueryClick).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(onNewQueryClick).toHaveBeenCalled();
|
||||
expect(collection.onNewQueryClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enum value should call onNewQueryClick", () => {
|
||||
@ -450,7 +441,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onNewQueryClick).toHaveBeenCalled();
|
||||
expect(collection.onNewQueryClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@ -464,10 +455,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onSettingsClick).not.toHaveBeenCalled();
|
||||
expect(collection.onSettingsClick).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(onSettingsClick).toHaveBeenCalled();
|
||||
expect(collection.onSettingsClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("string value should call onSettingsClick", () => {
|
||||
@ -480,7 +471,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onSettingsClick).toHaveBeenCalled();
|
||||
expect(collection.onSettingsClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enum value should call onSettingsClick before collections are fetched", () => {
|
||||
@ -492,10 +483,10 @@ describe("OpenActions", () => {
|
||||
};
|
||||
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onSettingsClick).not.toHaveBeenCalled();
|
||||
expect(collection.onSettingsClick).not.toHaveBeenCalled();
|
||||
|
||||
database.collections([collection]);
|
||||
expect(onSettingsClick).toHaveBeenCalled();
|
||||
expect(collection.onSettingsClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("enum value should call onSettingsClick", () => {
|
||||
@ -508,7 +499,7 @@ describe("OpenActions", () => {
|
||||
|
||||
database.collections([collection]);
|
||||
handleOpenAction(action, [database], explorer);
|
||||
expect(onSettingsClick).toHaveBeenCalled();
|
||||
expect(collection.onSettingsClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,349 +0,0 @@
|
||||
import * as DataModels from "../../src/Contracts/DataModels";
|
||||
import * as ko from "knockout";
|
||||
import * as ViewModels from "../../src/Contracts/ViewModels";
|
||||
import DocumentClientUtilityBase from "../Common/DocumentClientUtilityBase";
|
||||
import Q from "q";
|
||||
import { CassandraTableKey, CassandraTableKeys } from "../../src/Explorer/Tables/TableDataClient";
|
||||
import { UploadDetails } from "../workers/upload/definitions";
|
||||
import Explorer from "./Explorer";
|
||||
|
||||
export class DatabaseStub implements ViewModels.Database {
|
||||
public nodeKind: string;
|
||||
public container: Explorer;
|
||||
public self: string;
|
||||
public rid: string;
|
||||
public id: ko.Observable<string>;
|
||||
public collections: ko.ObservableArray<ViewModels.Collection>;
|
||||
public isDatabaseExpanded: ko.Observable<boolean>;
|
||||
public isDatabaseShared: ko.Computed<boolean>;
|
||||
public selectedSubnodeKind: ko.Observable<ViewModels.CollectionTabKind>;
|
||||
public offer: ko.Observable<DataModels.Offer>;
|
||||
|
||||
constructor(options?: any) {
|
||||
this.nodeKind = options.nodeKind;
|
||||
this.container = options.container;
|
||||
this.self = options.self;
|
||||
this.rid = options.rid;
|
||||
this.id = options.id;
|
||||
this.collections = options.collections;
|
||||
this.isDatabaseExpanded = options.isDatabaseExpanded;
|
||||
this.offer = options.offer;
|
||||
this.selectedSubnodeKind = options.selectedSubnodeKind;
|
||||
}
|
||||
|
||||
public onKeyPress = (source: any, event: KeyboardEvent): boolean => {
|
||||
throw new Error("Not implemented");
|
||||
};
|
||||
|
||||
public onKeyDown = (source: any, event: KeyboardEvent): boolean => {
|
||||
throw new Error("Not implemented");
|
||||
};
|
||||
|
||||
public onMenuKeyDown = (source: any, event: KeyboardEvent): boolean => {
|
||||
throw new Error("Not implemented");
|
||||
};
|
||||
|
||||
public onDeleteDatabaseContextMenuClick(source: ViewModels.Database, event: MouseEvent | KeyboardEvent) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public selectDatabase() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public expandCollapseDatabase() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public expandDatabase() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public collapseDatabase() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public loadCollections(): Q.Promise<void> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public findCollectionWithId(collectionId: string): ViewModels.Collection {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public openAddCollection(database: ViewModels.Database, event: MouseEvent) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public readSettings() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onSettingsClick(): void {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
export class CollectionStub implements ViewModels.Collection {
|
||||
public nodeKind: string;
|
||||
public container: Explorer;
|
||||
public rawDataModel: DataModels.Collection;
|
||||
public self: string;
|
||||
public rid: string;
|
||||
public databaseId: string;
|
||||
public partitionKey: DataModels.PartitionKey;
|
||||
public partitionKeyPropertyHeader: string;
|
||||
public partitionKeyProperty: string;
|
||||
public id: ko.Observable<string>;
|
||||
public defaultTtl: ko.Observable<number>;
|
||||
public analyticalStorageTtl: ko.Observable<number>;
|
||||
public indexingPolicy: ko.Observable<DataModels.IndexingPolicy>;
|
||||
public uniqueKeyPolicy: DataModels.UniqueKeyPolicy;
|
||||
public quotaInfo: ko.Observable<DataModels.CollectionQuotaInfo>;
|
||||
public offer: ko.Observable<DataModels.Offer>;
|
||||
public partitions: ko.Computed<number>;
|
||||
public throughput: ko.Computed<number>;
|
||||
public cassandraKeys: CassandraTableKeys;
|
||||
public cassandraSchema: CassandraTableKey[];
|
||||
public documentIds: ko.ObservableArray<ViewModels.DocumentId>;
|
||||
public children: ko.ObservableArray<ViewModels.TreeNode>;
|
||||
public storedProcedures: ko.Computed<ViewModels.StoredProcedure[]>;
|
||||
public userDefinedFunctions: ko.Computed<ViewModels.UserDefinedFunction[]>;
|
||||
public triggers: ko.Computed<ViewModels.Trigger[]>;
|
||||
public showStoredProcedures: ko.Observable<boolean>;
|
||||
public showTriggers: ko.Observable<boolean>;
|
||||
public showUserDefinedFunctions: ko.Observable<boolean>;
|
||||
public selectedDocumentContent: ViewModels.Editable<any>;
|
||||
public selectedSubnodeKind: ko.Observable<ViewModels.CollectionTabKind>;
|
||||
public focusedSubnodeKind: ko.Observable<ViewModels.CollectionTabKind>;
|
||||
public isCollectionExpanded: ko.Observable<boolean>;
|
||||
public isStoredProceduresExpanded: ko.Observable<boolean>;
|
||||
public isUserDefinedFunctionsExpanded: ko.Observable<boolean>;
|
||||
public isTriggersExpanded: ko.Observable<boolean>;
|
||||
public documentsFocused: ko.Observable<boolean>;
|
||||
public settingsFocused: ko.Observable<boolean>;
|
||||
public storedProceduresFocused: ko.Observable<boolean>;
|
||||
public userDefinedFunctionsFocused: ko.Observable<boolean>;
|
||||
public triggersFocused: ko.Observable<boolean>;
|
||||
public conflictResolutionPolicy: ko.Observable<DataModels.ConflictResolutionPolicy>;
|
||||
public changeFeedPolicy: ko.Observable<DataModels.ChangeFeedPolicy>;
|
||||
public geospatialConfig: ko.Observable<DataModels.GeospatialConfig>;
|
||||
|
||||
constructor(options: any) {
|
||||
this.nodeKind = options.nodeKind;
|
||||
this.container = options.container;
|
||||
this.self = options.self;
|
||||
this.rid = options.rid;
|
||||
this.databaseId = options.databaseId;
|
||||
this.partitionKey = options.partitionKey;
|
||||
this.partitionKeyPropertyHeader = options.partitionKeyPropertyHeader;
|
||||
this.partitionKeyProperty = options.partitionKeyProperty;
|
||||
this.id = options.id;
|
||||
this.defaultTtl = options.defaultTtl;
|
||||
this.analyticalStorageTtl = options.analyticalStorageTtl;
|
||||
this.indexingPolicy = options.indexingPolicy;
|
||||
this.uniqueKeyPolicy = options.uniqueKeyPolicy;
|
||||
this.quotaInfo = options.quotaInfo;
|
||||
this.offer = options.offer;
|
||||
this.partitions = options.partitions;
|
||||
this.throughput = options.throughput;
|
||||
this.cassandraKeys = options.cassandraKeys;
|
||||
this.cassandraSchema = options.cassandraSchema;
|
||||
this.documentIds = options.documentIds;
|
||||
this.children = options.children;
|
||||
this.storedProcedures = options.storedProcedures;
|
||||
this.userDefinedFunctions = options.userDefinedFunctions;
|
||||
this.triggers = options.triggers;
|
||||
this.showStoredProcedures = options.showStoredProcedures;
|
||||
this.showTriggers = options.showTriggers;
|
||||
this.showUserDefinedFunctions = options.showUserDefinedFunctions;
|
||||
this.selectedDocumentContent = options.selectedDocumentContent;
|
||||
this.selectedSubnodeKind = options.selectedSubnodeKind;
|
||||
this.focusedSubnodeKind = options.focusedSubnodeKind;
|
||||
this.isCollectionExpanded = options.isCollectionExpanded;
|
||||
this.isStoredProceduresExpanded = options.isStoredProceduresExpanded;
|
||||
this.isUserDefinedFunctionsExpanded = options.isUserDefinedFunctionsExpanded;
|
||||
this.isTriggersExpanded = options.isTriggersExpanded;
|
||||
this.documentsFocused = options.documentsFocused;
|
||||
this.settingsFocused = options.settingsFocused;
|
||||
this.storedProceduresFocused = options.storedProceduresFocused;
|
||||
this.userDefinedFunctionsFocused = options.userDefinedFunctionsFocused;
|
||||
this.triggersFocused = options.triggersFocused;
|
||||
}
|
||||
|
||||
public expandCollapseCollection() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public collapseCollection() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public expandCollection(): Q.Promise<void> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onDocumentDBDocumentsClick() {
|
||||
throw new Error("onDocumentDBDocumentsClick");
|
||||
}
|
||||
|
||||
public onTableEntitiesClick() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onGraphDocumentsClick() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onMongoDBDocumentsClick = () => {
|
||||
throw new Error("Not implemented");
|
||||
};
|
||||
|
||||
public openTab = () => {
|
||||
throw new Error("Not implemented");
|
||||
};
|
||||
|
||||
public onSettingsClick() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onConflictsClick() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public readSettings(): Q.Promise<void> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onNewQueryClick(source: any, event: MouseEvent, queryText?: string) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onNewMongoQueryClick(source: any, event: MouseEvent, queryText?: string) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onNewGraphClick() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onNewMongoShellClick() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onNewStoredProcedureClick(source: ViewModels.Collection, event: MouseEvent) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onNewUserDefinedFunctionClick(source: ViewModels.Collection, event: MouseEvent) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onNewTriggerClick(source: ViewModels.Collection, event: MouseEvent) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public createStoredProcedureNode(data: DataModels.StoredProcedure): ViewModels.StoredProcedure {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public createUserDefinedFunctionNode(data: DataModels.UserDefinedFunction): ViewModels.UserDefinedFunction {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public createTriggerNode(data: DataModels.Trigger): ViewModels.Trigger {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public expandCollapseStoredProcedures() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public expandStoredProcedures() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public collapseStoredProcedures() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public expandCollapseUserDefinedFunctions() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public expandUserDefinedFunctions() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public collapseUserDefinedFunctions() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public expandCollapseTriggers() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public expandTriggers() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public collapseTriggers() {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public loadStoredProcedures(): Q.Promise<any> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public loadUserDefinedFunctions(): Q.Promise<any> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public loadTriggers(): Q.Promise<any> {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onDragOver(source: ViewModels.Collection, event: { originalEvent: DragEvent }) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onDrop(source: ViewModels.Collection, event: { originalEvent: DragEvent }) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public isCollectionNodeSelected(): boolean {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public isSubNodeSelected(nodeKind: ViewModels.CollectionTabKind): boolean {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public onDeleteCollectionContextMenuClick(source: ViewModels.Collection, event: MouseEvent | KeyboardEvent) {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public findStoredProcedureWithId(sprocId: string): ViewModels.StoredProcedure {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public findTriggerWithId(triggerId: string): ViewModels.Trigger {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public findUserDefinedFunctionWithId(userDefinedFunctionId: string): ViewModels.UserDefinedFunction {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public uploadFiles = (fileList: FileList): Q.Promise<UploadDetails> => {
|
||||
throw new Error("Not implemented");
|
||||
};
|
||||
|
||||
public getLabel(): string {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
public getDatabase(): ViewModels.Database {
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
}
|
@ -9,7 +9,6 @@ import DeleteFeedback from "../../Common/DeleteFeedback";
|
||||
import DocumentClientUtilityBase from "../../Common/DocumentClientUtilityBase";
|
||||
import Explorer from "../Explorer";
|
||||
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { DatabaseStub } from "../OpenActionsStubs";
|
||||
import { TreeNode } from "../../Contracts/ViewModels";
|
||||
|
||||
describe("Delete Collection Confirmation Pane", () => {
|
||||
@ -21,14 +20,14 @@ describe("Delete Collection Confirmation Pane", () => {
|
||||
});
|
||||
|
||||
it("should be true if 1 database and 1 collection", () => {
|
||||
let database: ViewModels.Database = new DatabaseStub({});
|
||||
let database = {} as ViewModels.Database;
|
||||
database.collections = ko.observableArray<ViewModels.Collection>([{} as ViewModels.Collection]);
|
||||
explorer.databases = ko.observableArray<ViewModels.Database>([database]);
|
||||
expect(explorer.isLastCollection()).toBe(true);
|
||||
});
|
||||
|
||||
it("should be false if if 1 database and 2 collection", () => {
|
||||
let database: ViewModels.Database = new DatabaseStub({});
|
||||
let database = {} as ViewModels.Database;
|
||||
database.collections = ko.observableArray<ViewModels.Collection>([
|
||||
{} as ViewModels.Collection,
|
||||
{} as ViewModels.Collection
|
||||
@ -38,16 +37,16 @@ describe("Delete Collection Confirmation Pane", () => {
|
||||
});
|
||||
|
||||
it("should be false if 2 database and 1 collection each", () => {
|
||||
let database: ViewModels.Database = new DatabaseStub({});
|
||||
let database = {} as ViewModels.Database;
|
||||
database.collections = ko.observableArray<ViewModels.Collection>([{} as ViewModels.Collection]);
|
||||
let database2: ViewModels.Database = new DatabaseStub({});
|
||||
let database2 = {} as ViewModels.Database;
|
||||
database2.collections = ko.observableArray<ViewModels.Collection>([{} as ViewModels.Collection]);
|
||||
explorer.databases = ko.observableArray<ViewModels.Database>([database, database2]);
|
||||
expect(explorer.isLastCollection()).toBe(false);
|
||||
});
|
||||
|
||||
it("should be false if 0 databases", () => {
|
||||
let database: ViewModels.Database = new DatabaseStub({});
|
||||
let database = {} as ViewModels.Database;
|
||||
explorer.databases = ko.observableArray<ViewModels.Database>();
|
||||
database.collections = ko.observableArray<ViewModels.Collection>();
|
||||
expect(explorer.isLastCollection()).toBe(false);
|
||||
|
@ -8,7 +8,6 @@ import DeleteDatabaseConfirmationPane from "./DeleteDatabaseConfirmationPane";
|
||||
import DeleteFeedback from "../../Common/DeleteFeedback";
|
||||
import DocumentClientUtilityBase from "../../Common/DocumentClientUtilityBase";
|
||||
import Explorer from "../Explorer";
|
||||
import { CollectionStub, DatabaseStub } from "../OpenActionsStubs";
|
||||
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import { TreeNode } from "../../Contracts/ViewModels";
|
||||
import { TabsManager } from "../Tabs/TabsManager";
|
||||
@ -22,27 +21,27 @@ describe("Delete Database Confirmation Pane", () => {
|
||||
});
|
||||
|
||||
it("should be true if only 1 database", () => {
|
||||
let database: ViewModels.Database = new DatabaseStub({});
|
||||
let database = {} as ViewModels.Database;
|
||||
explorer.databases = ko.observableArray<ViewModels.Database>([database]);
|
||||
expect(explorer.isLastDatabase()).toBe(true);
|
||||
});
|
||||
|
||||
it("should be false if only 2 databases", () => {
|
||||
let database: ViewModels.Database = new DatabaseStub({});
|
||||
let database2: ViewModels.Database = new DatabaseStub({});
|
||||
let database = {} as ViewModels.Database;
|
||||
let database2 = {} as ViewModels.Database;
|
||||
explorer.databases = ko.observableArray<ViewModels.Database>([database, database2]);
|
||||
expect(explorer.isLastDatabase()).toBe(false);
|
||||
});
|
||||
|
||||
it("should be false if not last empty database", () => {
|
||||
let database: ViewModels.Database = new DatabaseStub({});
|
||||
let database = {} as ViewModels.Database;
|
||||
explorer.databases = ko.observableArray<ViewModels.Database>([database]);
|
||||
expect(explorer.isLastNonEmptyDatabase()).toBe(false);
|
||||
});
|
||||
|
||||
it("should be true if last non empty database", () => {
|
||||
let database: ViewModels.Database = new DatabaseStub({});
|
||||
database.collections = ko.observableArray<ViewModels.Collection>([new CollectionStub({})]);
|
||||
let database = {} as ViewModels.Database;
|
||||
database.collections = ko.observableArray<ViewModels.Collection>([{} as ViewModels.Collection]);
|
||||
explorer.databases = ko.observableArray<ViewModels.Database>([database]);
|
||||
expect(explorer.isLastNonEmptyDatabase()).toBe(true);
|
||||
});
|
||||
@ -94,12 +93,13 @@ describe("Delete Database Confirmation Pane", () => {
|
||||
let fakeDocumentClientUtility = {} as DocumentClientUtilityBase;
|
||||
fakeDocumentClientUtility.deleteDatabase = () => Q.resolve(null);
|
||||
let fakeExplorer = {} as Explorer;
|
||||
fakeExplorer.findSelectedDatabase = () =>
|
||||
new DatabaseStub({
|
||||
fakeExplorer.findSelectedDatabase = () => {
|
||||
return {
|
||||
id: ko.observable<string>(selectedDatabaseId),
|
||||
rid: "test",
|
||||
collections: ko.observableArray<ViewModels.Collection>()
|
||||
});
|
||||
} as ViewModels.Database;
|
||||
};
|
||||
fakeExplorer.refreshAllDatabases = () => Q.resolve();
|
||||
fakeExplorer.isNotificationConsoleExpanded = ko.observable<boolean>(false);
|
||||
fakeExplorer.selectedDatabaseId = ko.computed<string>(() => selectedDatabaseId);
|
||||
|
@ -3,6 +3,7 @@ import * as _ from "underscore";
|
||||
import * as Constants from "../../Common/Constants";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { ContextualPaneBase } from "./ContextualPaneBase";
|
||||
import StoredProcedure from "../Tree/StoredProcedure";
|
||||
|
||||
export interface ExecuteSprocParam {
|
||||
type: ko.Observable<string>;
|
||||
@ -22,7 +23,7 @@ export class ExecuteSprocParamsPane extends ContextualPaneBase {
|
||||
public addNewParamLabel: string = "Add New Param";
|
||||
public executeButtonEnabled: ko.Computed<boolean>;
|
||||
|
||||
private _selectedSproc: ViewModels.StoredProcedure;
|
||||
private _selectedSproc: StoredProcedure;
|
||||
|
||||
constructor(options: ViewModels.PaneOptions) {
|
||||
super(options);
|
||||
@ -39,8 +40,7 @@ export class ExecuteSprocParamsPane extends ContextualPaneBase {
|
||||
|
||||
public open() {
|
||||
super.open();
|
||||
const currentSelectedSproc: ViewModels.StoredProcedure =
|
||||
this.container && this.container.findSelectedStoredProcedure();
|
||||
const currentSelectedSproc = this.container && this.container.findSelectedStoredProcedure();
|
||||
if (!!currentSelectedSproc && !!this._selectedSproc && this._selectedSproc.rid !== currentSelectedSproc.rid) {
|
||||
this.params([]);
|
||||
this.partitionKeyValue("");
|
||||
|
@ -22,7 +22,7 @@ import { QueryIterator, ItemDefinition, Resource, ConflictDefinition } from "@az
|
||||
import { MinimalQueryIterator } from "../../Common/IteratorUtilities";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
export default class ConflictsTab extends TabsBase implements ViewModels.ConflictsTab {
|
||||
export default class ConflictsTab extends TabsBase {
|
||||
public selectedConflictId: ko.Observable<ViewModels.ConflictId>;
|
||||
public selectedConflictContent: ViewModels.Editable<string>;
|
||||
public selectedConflictCurrent: ViewModels.Editable<string>;
|
||||
|
@ -48,8 +48,7 @@ const throughputApplyLongDelayMessage = (isAutoscale: boolean, throughput: numbe
|
||||
This operation will take 1-3 business days to complete. View the latest status in Notifications.<br />
|
||||
Database: ${databaseName}, ${currentThroughput(isAutoscale, throughput)}`;
|
||||
|
||||
export default class DatabaseSettingsTab extends TabsBase
|
||||
implements ViewModels.DatabaseSettingsTab, ViewModels.WaitsForTemplate {
|
||||
export default class DatabaseSettingsTab extends TabsBase implements ViewModels.WaitsForTemplate {
|
||||
// editables
|
||||
public isAutoPilotSelected: ViewModels.Editable<boolean>;
|
||||
public throughput: ViewModels.Editable<number>;
|
||||
|
@ -2,21 +2,22 @@ import * as ko from "knockout";
|
||||
import * as Constants from "../../Common/Constants";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import Explorer from "../Explorer";
|
||||
import { CollectionStub, DatabaseStub } from "../../Explorer/OpenActionsStubs";
|
||||
import QueryTab from "./QueryTab";
|
||||
import { View } from "@nteract/data-explorer/lib/utilities/types";
|
||||
import { PartitionKey } from "../../Contracts/DataModels";
|
||||
|
||||
describe("Query Tab", () => {
|
||||
function getNewQueryTabForContainer(container: Explorer): ViewModels.QueryTab {
|
||||
const database: ViewModels.Database = new DatabaseStub({
|
||||
const database = {
|
||||
container: container,
|
||||
id: ko.observable<string>("test"),
|
||||
isDatabaseShared: () => false
|
||||
});
|
||||
const collection: ViewModels.Collection = new CollectionStub({
|
||||
} as ViewModels.Database;
|
||||
const collection = {
|
||||
container: container,
|
||||
databaseId: "test",
|
||||
id: ko.observable<string>("test")
|
||||
});
|
||||
} as ViewModels.Collection;
|
||||
|
||||
return new QueryTab({
|
||||
tabKind: ViewModels.CollectionTabKind.Query,
|
||||
@ -33,19 +34,12 @@ describe("Query Tab", () => {
|
||||
}
|
||||
|
||||
describe("shouldSetSystemPartitionKeyContainerPartitionKeyValueUndefined", () => {
|
||||
const collection: ViewModels.Collection = new CollectionStub({
|
||||
id: "withoutsystempk",
|
||||
const collection = {
|
||||
id: ko.observable<string>("withoutsystempk"),
|
||||
partitionKey: {
|
||||
systemKey: true
|
||||
}
|
||||
});
|
||||
|
||||
const collectionSystemPK: ViewModels.Collection = new CollectionStub({
|
||||
id: "withsystempk",
|
||||
partitionKey: {
|
||||
systemKey: true
|
||||
}
|
||||
});
|
||||
} as ViewModels.Collection;
|
||||
|
||||
it("no container with system pk, should not set partition key option", () => {
|
||||
const iteratorOptions = QueryTab.getIteratorOptions(collection);
|
||||
|
@ -125,7 +125,7 @@ enum ChangeFeedPolicyToggledState {
|
||||
On = "On"
|
||||
}
|
||||
|
||||
export default class SettingsTab extends TabsBase implements ViewModels.SettingsTab, ViewModels.WaitsForTemplate {
|
||||
export default class SettingsTab extends TabsBase implements ViewModels.WaitsForTemplate {
|
||||
public GEOGRAPHY: string = "Geography";
|
||||
public GEOMETRY: string = "Geometry";
|
||||
|
||||
|
@ -9,6 +9,7 @@ import editable from "../../Common/EditableUtility";
|
||||
import ScriptTabBase from "./ScriptTabBase";
|
||||
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import ExecuteQueryIcon from "../../../images/ExecuteQuery.svg";
|
||||
import StoredProcedure from "../Tree/StoredProcedure";
|
||||
|
||||
enum ToggleState {
|
||||
Result = "result",
|
||||
@ -17,7 +18,7 @@ enum ToggleState {
|
||||
|
||||
export default class StoredProcedureTab extends ScriptTabBase implements ViewModels.StoredProcedureTab {
|
||||
public collection: ViewModels.Collection;
|
||||
public node: ViewModels.StoredProcedure;
|
||||
public node: StoredProcedure;
|
||||
public executeResultsEditorId: string;
|
||||
public executeLogsEditorId: string;
|
||||
public toggleState: ko.Observable<ToggleState>;
|
||||
|
@ -1,6 +1,5 @@
|
||||
import * as ko from "knockout";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { CollectionStub, DatabaseStub } from "../../Explorer/OpenActionsStubs";
|
||||
import { DataAccessUtility } from "../../Platform/Portal/DataAccessUtility";
|
||||
import { TabsManager } from "./TabsManager";
|
||||
import DocumentClientUtilityBase from "../../Common/DocumentClientUtilityBase";
|
||||
@ -28,19 +27,19 @@ describe("Tabs manager tests", () => {
|
||||
properties: undefined
|
||||
});
|
||||
|
||||
database = new DatabaseStub({
|
||||
database = {
|
||||
container: explorer,
|
||||
id: ko.observable<string>("test"),
|
||||
isDatabaseShared: () => false
|
||||
});
|
||||
} as ViewModels.Database;
|
||||
database.isDatabaseExpanded = ko.observable<boolean>(true);
|
||||
database.selectedSubnodeKind = ko.observable<ViewModels.CollectionTabKind>();
|
||||
|
||||
collection = new CollectionStub({
|
||||
collection = {
|
||||
container: explorer,
|
||||
databaseId: "test",
|
||||
id: ko.observable<string>("test")
|
||||
});
|
||||
} as ViewModels.Collection;
|
||||
collection.getDatabase = (): ViewModels.Database => database;
|
||||
collection.isCollectionExpanded = ko.observable<boolean>(true);
|
||||
collection.selectedSubnodeKind = ko.observable<ViewModels.CollectionTabKind>();
|
||||
|
@ -6,10 +6,11 @@ import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
import ScriptTabBase from "./ScriptTabBase";
|
||||
import editable from "../../Common/EditableUtility";
|
||||
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import Trigger from "../Tree/Trigger";
|
||||
|
||||
export default class TriggerTab extends ScriptTabBase implements ViewModels.TriggerTab {
|
||||
public collection: ViewModels.Collection;
|
||||
public node: ViewModels.Trigger;
|
||||
public node: Trigger;
|
||||
public triggerType: ViewModels.Editable<string>;
|
||||
public triggerOperation: ViewModels.Editable<string>;
|
||||
|
||||
|
@ -5,10 +5,11 @@ import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
import ScriptTabBase from "./ScriptTabBase";
|
||||
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import UserDefinedFunction from "../Tree/UserDefinedFunction";
|
||||
|
||||
export default class UserDefinedFunctionTab extends ScriptTabBase implements ViewModels.UserDefinedFunctionTab {
|
||||
public collection: ViewModels.Collection;
|
||||
public node: ViewModels.UserDefinedFunction;
|
||||
public node: UserDefinedFunction;
|
||||
constructor(options: ViewModels.ScriptTabOption) {
|
||||
super(options);
|
||||
this.ariaLabel("User Defined Function Body");
|
||||
|
@ -63,9 +63,9 @@ export default class Collection implements ViewModels.Collection {
|
||||
|
||||
public documentIds: ko.ObservableArray<DocumentId>;
|
||||
public children: ko.ObservableArray<ViewModels.TreeNode>;
|
||||
public storedProcedures: ko.Computed<ViewModels.StoredProcedure[]>;
|
||||
public userDefinedFunctions: ko.Computed<ViewModels.UserDefinedFunction[]>;
|
||||
public triggers: ko.Computed<ViewModels.Trigger[]>;
|
||||
public storedProcedures: ko.Computed<StoredProcedure[]>;
|
||||
public userDefinedFunctions: ko.Computed<UserDefinedFunction[]>;
|
||||
public triggers: ko.Computed<Trigger[]>;
|
||||
|
||||
public showStoredProcedures: ko.Observable<boolean>;
|
||||
public showTriggers: ko.Observable<boolean>;
|
||||
@ -180,19 +180,19 @@ export default class Collection implements ViewModels.Collection {
|
||||
this.storedProcedures = ko.computed(() => {
|
||||
return this.children()
|
||||
.filter(node => node.nodeKind === "StoredProcedure")
|
||||
.map(node => <ViewModels.StoredProcedure>node);
|
||||
.map(node => <StoredProcedure>node);
|
||||
});
|
||||
|
||||
this.userDefinedFunctions = ko.computed(() => {
|
||||
return this.children()
|
||||
.filter(node => node.nodeKind === "UserDefinedFunction")
|
||||
.map(node => <ViewModels.UserDefinedFunction>node);
|
||||
.map(node => <UserDefinedFunction>node);
|
||||
});
|
||||
|
||||
this.triggers = ko.computed(() => {
|
||||
return this.children()
|
||||
.filter(node => node.nodeKind === "Trigger")
|
||||
.map(node => <ViewModels.Trigger>node);
|
||||
.map(node => <Trigger>node);
|
||||
});
|
||||
|
||||
const showScriptsMenus: boolean = container.isPreferredApiDocumentDB() || container.isPreferredApiGraph();
|
||||
@ -880,21 +880,18 @@ export default class Collection implements ViewModels.Collection {
|
||||
return node;
|
||||
}
|
||||
|
||||
public findStoredProcedureWithId(sprocId: string): ViewModels.StoredProcedure {
|
||||
return _.find(
|
||||
this.storedProcedures(),
|
||||
(storedProcedure: ViewModels.StoredProcedure) => storedProcedure.id() === sprocId
|
||||
);
|
||||
public findStoredProcedureWithId(sprocId: string): StoredProcedure {
|
||||
return _.find(this.storedProcedures(), (storedProcedure: StoredProcedure) => storedProcedure.id() === sprocId);
|
||||
}
|
||||
|
||||
public findTriggerWithId(triggerId: string): ViewModels.Trigger {
|
||||
return _.find(this.triggers(), (trigger: ViewModels.Trigger) => trigger.id() === triggerId);
|
||||
public findTriggerWithId(triggerId: string): Trigger {
|
||||
return _.find(this.triggers(), (trigger: Trigger) => trigger.id() === triggerId);
|
||||
}
|
||||
|
||||
public findUserDefinedFunctionWithId(userDefinedFunctionId: string): ViewModels.UserDefinedFunction {
|
||||
public findUserDefinedFunctionWithId(userDefinedFunctionId: string): UserDefinedFunction {
|
||||
return _.find(
|
||||
this.userDefinedFunctions(),
|
||||
(userDefinedFunction: ViewModels.Trigger) => userDefinedFunction.id() === userDefinedFunctionId
|
||||
(userDefinedFunction: Trigger) => userDefinedFunction.id() === userDefinedFunctionId
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,10 @@ import DocumentId from "./DocumentId";
|
||||
import * as DataModels from "../../Contracts/DataModels";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { extractPartitionKey } from "@azure/cosmos";
|
||||
import ConflictsTab from "../Tabs/ConflictsTab";
|
||||
|
||||
export default class ConflictId implements ViewModels.ConflictId {
|
||||
public container: ViewModels.ConflictsTab;
|
||||
public container: ConflictsTab;
|
||||
public rid: string;
|
||||
public self: string;
|
||||
public ts: string;
|
||||
@ -23,7 +24,7 @@ export default class ConflictId implements ViewModels.ConflictId {
|
||||
public parsedContent: any;
|
||||
public isDirty: ko.Observable<boolean>;
|
||||
|
||||
constructor(container: ViewModels.ConflictsTab, data: any) {
|
||||
constructor(container: ConflictsTab, data: any) {
|
||||
this.container = container;
|
||||
this.self = data._self;
|
||||
this.rid = data._rid;
|
||||
|
@ -27,6 +27,9 @@ import GalleryIcon from "../../../images/GalleryIcon.svg";
|
||||
import { Callout, Text, Link, DirectionalHint, Stack, ICalloutProps, ILinkProps } from "office-ui-fabric-react";
|
||||
import { LocalStorageUtility, StorageKey } from "../../Shared/StorageUtility";
|
||||
import Explorer from "../Explorer";
|
||||
import UserDefinedFunction from "./UserDefinedFunction";
|
||||
import StoredProcedure from "./StoredProcedure";
|
||||
import Trigger from "./Trigger";
|
||||
|
||||
export class ResourceTreeAdapter implements ReactAdapter {
|
||||
private static readonly DataTitle = "DATA";
|
||||
@ -290,7 +293,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
private buildStoredProcedureNode(collection: ViewModels.Collection): TreeNode {
|
||||
return {
|
||||
label: "Stored Procedures",
|
||||
children: collection.storedProcedures().map((sp: ViewModels.StoredProcedure) => ({
|
||||
children: collection.storedProcedures().map((sp: StoredProcedure) => ({
|
||||
label: sp.id(),
|
||||
onClick: sp.open.bind(sp),
|
||||
isSelected: () =>
|
||||
@ -309,7 +312,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
private buildUserDefinedFunctionsNode(collection: ViewModels.Collection): TreeNode {
|
||||
return {
|
||||
label: "User Defined Functions",
|
||||
children: collection.userDefinedFunctions().map((udf: ViewModels.UserDefinedFunction) => ({
|
||||
children: collection.userDefinedFunctions().map((udf: UserDefinedFunction) => ({
|
||||
label: udf.id(),
|
||||
onClick: udf.open.bind(udf),
|
||||
isSelected: () =>
|
||||
@ -328,7 +331,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
private buildTriggerNode(collection: ViewModels.Collection): TreeNode {
|
||||
return {
|
||||
label: "Triggers",
|
||||
children: collection.triggers().map((trigger: ViewModels.Trigger) => ({
|
||||
children: collection.triggers().map((trigger: Trigger) => ({
|
||||
label: trigger.id(),
|
||||
onClick: trigger.open.bind(trigger),
|
||||
isSelected: () => this.isDataNodeSelected(collection.rid, "Collection", ViewModels.CollectionTabKind.Triggers),
|
||||
|
@ -35,7 +35,7 @@ function sample(prefix) {
|
||||
if (!isAccepted) throw new Error('The query was not accepted by the server.');
|
||||
}`;
|
||||
|
||||
export default class StoredProcedure implements ViewModels.StoredProcedure {
|
||||
export default class StoredProcedure {
|
||||
public nodeKind: string;
|
||||
public container: Explorer;
|
||||
public collection: ViewModels.Collection;
|
||||
|
@ -7,7 +7,7 @@ import TriggerTab from "../Tabs/TriggerTab";
|
||||
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
export default class Trigger implements ViewModels.Trigger {
|
||||
export default class Trigger {
|
||||
public nodeKind: string;
|
||||
public container: Explorer;
|
||||
public collection: ViewModels.Collection;
|
||||
|
@ -7,7 +7,7 @@ import UserDefinedFunctionTab from "../Tabs/UserDefinedFunctionTab";
|
||||
import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||
import Explorer from "../Explorer";
|
||||
|
||||
export default class UserDefinedFunction implements ViewModels.UserDefinedFunction {
|
||||
export default class UserDefinedFunction {
|
||||
public nodeKind: string;
|
||||
public container: Explorer;
|
||||
public collection: ViewModels.Collection;
|
||||
|
@ -1,4 +1,3 @@
|
||||
import * as ViewModels from "../Contracts/ViewModels";
|
||||
import { ArmApiVersions } from "../Common/Constants";
|
||||
import { IResourceProviderClient, IResourceProviderClientFactory } from "../ResourceProvider/IResourceProviderClient";
|
||||
import * as Logger from "../Common/Logger";
|
||||
@ -9,7 +8,7 @@ import {
|
||||
} from "../Contracts/DataModels";
|
||||
import { ResourceProviderClientFactory } from "../ResourceProvider/ResourceProviderClientFactory";
|
||||
|
||||
export class NotebookWorkspaceManager implements ViewModels.NotebookWorkspaceManager {
|
||||
export class NotebookWorkspaceManager {
|
||||
private resourceProviderClientFactory: IResourceProviderClientFactory<any>;
|
||||
|
||||
constructor(private _armEndpoint: string) {
|
||||
|
@ -290,8 +290,7 @@ export class TabRouteHandler {
|
||||
const collection: ViewModels.Collection = this._findMatchingCollectionForResource(databaseId, collectionId);
|
||||
collection &&
|
||||
collection.expandCollection().then(() => {
|
||||
const storedProcedure: ViewModels.StoredProcedure =
|
||||
collection && collection.findStoredProcedureWithId(sprocId);
|
||||
const storedProcedure = collection && collection.findStoredProcedureWithId(sprocId);
|
||||
storedProcedure && storedProcedure.open();
|
||||
});
|
||||
});
|
||||
@ -322,7 +321,7 @@ export class TabRouteHandler {
|
||||
const collection: ViewModels.Collection = this._findMatchingCollectionForResource(databaseId, collectionId);
|
||||
collection &&
|
||||
collection.expandCollection().then(() => {
|
||||
const trigger: ViewModels.Trigger = collection && collection.findTriggerWithId(triggerId);
|
||||
const trigger = collection && collection.findTriggerWithId(triggerId);
|
||||
trigger && trigger.open();
|
||||
});
|
||||
});
|
||||
@ -353,8 +352,7 @@ export class TabRouteHandler {
|
||||
const collection: ViewModels.Collection = this._findMatchingCollectionForResource(databaseId, collectionId);
|
||||
collection &&
|
||||
collection.expandCollection().then(() => {
|
||||
const userDefinedFunction: ViewModels.UserDefinedFunction =
|
||||
collection && collection.findUserDefinedFunctionWithId(udfId);
|
||||
const userDefinedFunction = collection && collection.findUserDefinedFunctionWithId(udfId);
|
||||
userDefinedFunction && userDefinedFunction.open();
|
||||
});
|
||||
});
|
||||
|
@ -11,7 +11,7 @@ import * as Logger from "../Common/Logger";
|
||||
import { ResourceProviderClientFactory } from "../ResourceProvider/ResourceProviderClientFactory";
|
||||
import { config } from "../Config";
|
||||
|
||||
export class ArcadiaResourceManager implements ViewModels.ArcadiaResourceManager {
|
||||
export class ArcadiaResourceManager {
|
||||
private resourceProviderClientFactory: IResourceProviderClientFactory<any>;
|
||||
|
||||
constructor(private armEndpoint = config.ARM_ENDPOINT) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user