mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 15:06:55 +00:00
Remove Explorer collection/database text properties (#821)
Co-authored-by: Steve Faulkner <southpolesteve@gmail.com>
This commit is contained in:
parent
bfdeae56d9
commit
522fdc69ab
@ -11,12 +11,12 @@ import DeleteUDFIcon from "../../images/DeleteUDF.svg";
|
|||||||
import HostedTerminalIcon from "../../images/Hosted-Terminal.svg";
|
import HostedTerminalIcon from "../../images/Hosted-Terminal.svg";
|
||||||
import * as ViewModels from "../Contracts/ViewModels";
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
import { userContext } from "../UserContext";
|
import { userContext } from "../UserContext";
|
||||||
|
import { getCollectionName, getDatabaseName } from "../Utils/APITypeUtils";
|
||||||
import { TreeNodeMenuItem } from "./Controls/TreeComponent/TreeComponent";
|
import { TreeNodeMenuItem } from "./Controls/TreeComponent/TreeComponent";
|
||||||
import Explorer from "./Explorer";
|
import Explorer from "./Explorer";
|
||||||
import StoredProcedure from "./Tree/StoredProcedure";
|
import StoredProcedure from "./Tree/StoredProcedure";
|
||||||
import Trigger from "./Tree/Trigger";
|
import Trigger from "./Tree/Trigger";
|
||||||
import UserDefinedFunction from "./Tree/UserDefinedFunction";
|
import UserDefinedFunction from "./Tree/UserDefinedFunction";
|
||||||
|
|
||||||
export interface CollectionContextMenuButtonParams {
|
export interface CollectionContextMenuButtonParams {
|
||||||
databaseId: string;
|
databaseId: string;
|
||||||
collectionId: string;
|
collectionId: string;
|
||||||
@ -34,7 +34,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
|||||||
{
|
{
|
||||||
iconSrc: AddCollectionIcon,
|
iconSrc: AddCollectionIcon,
|
||||||
onClick: () => container.onNewCollectionClicked(databaseId),
|
onClick: () => container.onNewCollectionClicked(databaseId),
|
||||||
label: container.addCollectionText(),
|
label: `New ${getCollectionName()}`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
|||||||
items.push({
|
items.push({
|
||||||
iconSrc: DeleteDatabaseIcon,
|
iconSrc: DeleteDatabaseIcon,
|
||||||
onClick: () => container.openDeleteDatabaseConfirmationPane(),
|
onClick: () => container.openDeleteDatabaseConfirmationPane(),
|
||||||
label: container.deleteDatabaseText(),
|
label: `Delete ${getDatabaseName()}`,
|
||||||
styleClass: "deleteDatabaseMenuItem",
|
styleClass: "deleteDatabaseMenuItem",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ export class ResourceTreeContextMenuButtonFactory {
|
|||||||
items.push({
|
items.push({
|
||||||
iconSrc: DeleteCollectionIcon,
|
iconSrc: DeleteCollectionIcon,
|
||||||
onClick: () => container.openDeleteCollectionConfirmationPane(),
|
onClick: () => container.openDeleteCollectionConfirmationPane(),
|
||||||
label: container.deleteCollectionText(),
|
label: `Delete ${getCollectionName()}`,
|
||||||
styleClass: "deleteCollectionMenuItem",
|
styleClass: "deleteCollectionMenuItem",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
"_refreshSparkEnabledStateForAccount": [Function],
|
"_refreshSparkEnabledStateForAccount": [Function],
|
||||||
"_resetNotebookWorkspace": [Function],
|
"_resetNotebookWorkspace": [Function],
|
||||||
"addCollectionText": [Function],
|
|
||||||
"arcadiaToken": [Function],
|
"arcadiaToken": [Function],
|
||||||
"canExceedMaximumValue": [Function],
|
"canExceedMaximumValue": [Function],
|
||||||
"canSaveQueries": [Function],
|
"canSaveQueries": [Function],
|
||||||
@ -48,8 +47,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"unlimitedmin": 400,
|
"unlimitedmin": 400,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"collectionTitle": [Function],
|
|
||||||
"collectionTreeNodeAltText": [Function],
|
|
||||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"isNotebookTabActive": [Function],
|
"isNotebookTabActive": [Function],
|
||||||
@ -57,8 +54,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"tabsButtons": Array [],
|
"tabsButtons": Array [],
|
||||||
},
|
},
|
||||||
"databases": [Function],
|
"databases": [Function],
|
||||||
"deleteCollectionText": [Function],
|
|
||||||
"deleteDatabaseText": [Function],
|
|
||||||
"gitHubClient": GitHubClient {
|
"gitHubClient": GitHubClient {
|
||||||
"errorCallback": [Function],
|
"errorCallback": [Function],
|
||||||
"ocktokit": OctokitWithDefaults {
|
"ocktokit": OctokitWithDefaults {
|
||||||
@ -858,7 +853,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
},
|
},
|
||||||
"refreshNotebookList": [Function],
|
"refreshNotebookList": [Function],
|
||||||
"refreshTreeTitle": [Function],
|
|
||||||
"resourceTokenCollection": [Function],
|
"resourceTokenCollection": [Function],
|
||||||
"resourceTokenCollectionId": [Function],
|
"resourceTokenCollectionId": [Function],
|
||||||
"resourceTokenDatabaseId": [Function],
|
"resourceTokenDatabaseId": [Function],
|
||||||
@ -923,7 +917,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
"_refreshSparkEnabledStateForAccount": [Function],
|
"_refreshSparkEnabledStateForAccount": [Function],
|
||||||
"_resetNotebookWorkspace": [Function],
|
"_resetNotebookWorkspace": [Function],
|
||||||
"addCollectionText": [Function],
|
|
||||||
"arcadiaToken": [Function],
|
"arcadiaToken": [Function],
|
||||||
"canExceedMaximumValue": [Function],
|
"canExceedMaximumValue": [Function],
|
||||||
"canSaveQueries": [Function],
|
"canSaveQueries": [Function],
|
||||||
@ -939,8 +932,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"unlimitedmin": 400,
|
"unlimitedmin": 400,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"collectionTitle": [Function],
|
|
||||||
"collectionTreeNodeAltText": [Function],
|
|
||||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"isNotebookTabActive": [Function],
|
"isNotebookTabActive": [Function],
|
||||||
@ -948,8 +939,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"tabsButtons": Array [],
|
"tabsButtons": Array [],
|
||||||
},
|
},
|
||||||
"databases": [Function],
|
"databases": [Function],
|
||||||
"deleteCollectionText": [Function],
|
|
||||||
"deleteDatabaseText": [Function],
|
|
||||||
"gitHubClient": GitHubClient {
|
"gitHubClient": GitHubClient {
|
||||||
"errorCallback": [Function],
|
"errorCallback": [Function],
|
||||||
"ocktokit": OctokitWithDefaults {
|
"ocktokit": OctokitWithDefaults {
|
||||||
@ -1749,7 +1738,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
},
|
},
|
||||||
"refreshNotebookList": [Function],
|
"refreshNotebookList": [Function],
|
||||||
"refreshTreeTitle": [Function],
|
|
||||||
"resourceTokenCollection": [Function],
|
"resourceTokenCollection": [Function],
|
||||||
"resourceTokenCollectionId": [Function],
|
"resourceTokenCollectionId": [Function],
|
||||||
"resourceTokenDatabaseId": [Function],
|
"resourceTokenDatabaseId": [Function],
|
||||||
@ -1827,7 +1815,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
"_refreshSparkEnabledStateForAccount": [Function],
|
"_refreshSparkEnabledStateForAccount": [Function],
|
||||||
"_resetNotebookWorkspace": [Function],
|
"_resetNotebookWorkspace": [Function],
|
||||||
"addCollectionText": [Function],
|
|
||||||
"arcadiaToken": [Function],
|
"arcadiaToken": [Function],
|
||||||
"canExceedMaximumValue": [Function],
|
"canExceedMaximumValue": [Function],
|
||||||
"canSaveQueries": [Function],
|
"canSaveQueries": [Function],
|
||||||
@ -1843,8 +1830,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"unlimitedmin": 400,
|
"unlimitedmin": 400,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"collectionTitle": [Function],
|
|
||||||
"collectionTreeNodeAltText": [Function],
|
|
||||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"isNotebookTabActive": [Function],
|
"isNotebookTabActive": [Function],
|
||||||
@ -1852,8 +1837,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"tabsButtons": Array [],
|
"tabsButtons": Array [],
|
||||||
},
|
},
|
||||||
"databases": [Function],
|
"databases": [Function],
|
||||||
"deleteCollectionText": [Function],
|
|
||||||
"deleteDatabaseText": [Function],
|
|
||||||
"gitHubClient": GitHubClient {
|
"gitHubClient": GitHubClient {
|
||||||
"errorCallback": [Function],
|
"errorCallback": [Function],
|
||||||
"ocktokit": OctokitWithDefaults {
|
"ocktokit": OctokitWithDefaults {
|
||||||
@ -2653,7 +2636,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
},
|
},
|
||||||
"refreshNotebookList": [Function],
|
"refreshNotebookList": [Function],
|
||||||
"refreshTreeTitle": [Function],
|
|
||||||
"resourceTokenCollection": [Function],
|
"resourceTokenCollection": [Function],
|
||||||
"resourceTokenCollectionId": [Function],
|
"resourceTokenCollectionId": [Function],
|
||||||
"resourceTokenDatabaseId": [Function],
|
"resourceTokenDatabaseId": [Function],
|
||||||
@ -2718,7 +2700,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
"_refreshSparkEnabledStateForAccount": [Function],
|
"_refreshSparkEnabledStateForAccount": [Function],
|
||||||
"_resetNotebookWorkspace": [Function],
|
"_resetNotebookWorkspace": [Function],
|
||||||
"addCollectionText": [Function],
|
|
||||||
"arcadiaToken": [Function],
|
"arcadiaToken": [Function],
|
||||||
"canExceedMaximumValue": [Function],
|
"canExceedMaximumValue": [Function],
|
||||||
"canSaveQueries": [Function],
|
"canSaveQueries": [Function],
|
||||||
@ -2734,8 +2715,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"unlimitedmin": 400,
|
"unlimitedmin": 400,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"collectionTitle": [Function],
|
|
||||||
"collectionTreeNodeAltText": [Function],
|
|
||||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"isNotebookTabActive": [Function],
|
"isNotebookTabActive": [Function],
|
||||||
@ -2743,8 +2722,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"tabsButtons": Array [],
|
"tabsButtons": Array [],
|
||||||
},
|
},
|
||||||
"databases": [Function],
|
"databases": [Function],
|
||||||
"deleteCollectionText": [Function],
|
|
||||||
"deleteDatabaseText": [Function],
|
|
||||||
"gitHubClient": GitHubClient {
|
"gitHubClient": GitHubClient {
|
||||||
"errorCallback": [Function],
|
"errorCallback": [Function],
|
||||||
"ocktokit": OctokitWithDefaults {
|
"ocktokit": OctokitWithDefaults {
|
||||||
@ -3544,7 +3521,6 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
},
|
},
|
||||||
"refreshNotebookList": [Function],
|
"refreshNotebookList": [Function],
|
||||||
"refreshTreeTitle": [Function],
|
|
||||||
"resourceTokenCollection": [Function],
|
"resourceTokenCollection": [Function],
|
||||||
"resourceTokenCollectionId": [Function],
|
"resourceTokenCollectionId": [Function],
|
||||||
"resourceTokenDatabaseId": [Function],
|
"resourceTokenDatabaseId": [Function],
|
||||||
|
@ -97,12 +97,6 @@ export interface ExplorerParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default class Explorer {
|
export default class Explorer {
|
||||||
public addCollectionText: ko.Observable<string>;
|
|
||||||
public collectionTitle: ko.Observable<string>;
|
|
||||||
public deleteCollectionText: ko.Observable<string>;
|
|
||||||
public deleteDatabaseText: ko.Observable<string>;
|
|
||||||
public collectionTreeNodeAltText: ko.Observable<string>;
|
|
||||||
public refreshTreeTitle: ko.Observable<string>;
|
|
||||||
public collapsedResourceTreeWidth: number = ExplorerMetrics.CollapsedResourceTreeWidth;
|
public collapsedResourceTreeWidth: number = ExplorerMetrics.CollapsedResourceTreeWidth;
|
||||||
|
|
||||||
public collectionCreationDefaults: ViewModels.CollectionCreationDefaults = SharedConstants.CollectionCreationDefaults;
|
public collectionCreationDefaults: ViewModels.CollectionCreationDefaults = SharedConstants.CollectionCreationDefaults;
|
||||||
@ -199,13 +193,6 @@ export default class Explorer {
|
|||||||
const startKey: number = TelemetryProcessor.traceStart(Action.InitializeDataExplorer, {
|
const startKey: number = TelemetryProcessor.traceStart(Action.InitializeDataExplorer, {
|
||||||
dataExplorerArea: Constants.Areas.ResourceTree,
|
dataExplorerArea: Constants.Areas.ResourceTree,
|
||||||
});
|
});
|
||||||
this.addCollectionText = ko.observable<string>("New Collection");
|
|
||||||
this.collectionTitle = ko.observable<string>("Collections");
|
|
||||||
this.collectionTreeNodeAltText = ko.observable<string>("Collection");
|
|
||||||
this.deleteCollectionText = ko.observable<string>("Delete Collection");
|
|
||||||
this.deleteDatabaseText = ko.observable<string>("Delete Database");
|
|
||||||
this.refreshTreeTitle = ko.observable<string>("Refresh collections");
|
|
||||||
|
|
||||||
this.isAccountReady = ko.observable<boolean>(false);
|
this.isAccountReady = ko.observable<boolean>(false);
|
||||||
this._isInitializingNotebooks = false;
|
this._isInitializingNotebooks = false;
|
||||||
this.arcadiaToken = ko.observable<string>();
|
this.arcadiaToken = ko.observable<string>();
|
||||||
@ -420,46 +407,10 @@ export default class Explorer {
|
|||||||
});
|
});
|
||||||
|
|
||||||
switch (userContext.apiType) {
|
switch (userContext.apiType) {
|
||||||
case "SQL":
|
|
||||||
this.addCollectionText("New Container");
|
|
||||||
this.collectionTitle("SQL API");
|
|
||||||
this.collectionTreeNodeAltText("Container");
|
|
||||||
this.deleteCollectionText("Delete Container");
|
|
||||||
this.deleteDatabaseText("Delete Database");
|
|
||||||
this.refreshTreeTitle("Refresh containers");
|
|
||||||
break;
|
|
||||||
case "Mongo":
|
|
||||||
this.addCollectionText("New Collection");
|
|
||||||
this.collectionTitle("Collections");
|
|
||||||
this.collectionTreeNodeAltText("Collection");
|
|
||||||
this.deleteCollectionText("Delete Collection");
|
|
||||||
this.deleteDatabaseText("Delete Database");
|
|
||||||
this.refreshTreeTitle("Refresh collections");
|
|
||||||
break;
|
|
||||||
case "Gremlin":
|
|
||||||
this.addCollectionText("New Graph");
|
|
||||||
this.deleteCollectionText("Delete Graph");
|
|
||||||
this.deleteDatabaseText("Delete Database");
|
|
||||||
this.collectionTitle("Gremlin API");
|
|
||||||
this.collectionTreeNodeAltText("Graph");
|
|
||||||
this.refreshTreeTitle("Refresh graphs");
|
|
||||||
break;
|
|
||||||
case "Tables":
|
case "Tables":
|
||||||
this.addCollectionText("New Table");
|
|
||||||
this.deleteCollectionText("Delete Table");
|
|
||||||
this.deleteDatabaseText("Delete Database");
|
|
||||||
this.collectionTitle("Azure Table API");
|
|
||||||
this.collectionTreeNodeAltText("Table");
|
|
||||||
this.refreshTreeTitle("Refresh tables");
|
|
||||||
this.tableDataClient = new TablesAPIDataClient();
|
this.tableDataClient = new TablesAPIDataClient();
|
||||||
break;
|
break;
|
||||||
case "Cassandra":
|
case "Cassandra":
|
||||||
this.addCollectionText("New Table");
|
|
||||||
this.deleteCollectionText("Delete Table");
|
|
||||||
this.deleteDatabaseText("Delete Keyspace");
|
|
||||||
this.collectionTitle("Cassandra API");
|
|
||||||
this.collectionTreeNodeAltText("Table");
|
|
||||||
this.refreshTreeTitle("Refresh tables");
|
|
||||||
this.tableDataClient = new CassandraAPIDataClient();
|
this.tableDataClient = new CassandraAPIDataClient();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,6 @@ export class CommandBarComponentAdapter implements ReactAdapter {
|
|||||||
|
|
||||||
// These are the parameters watched by the react binding that will trigger a renderComponent() if one of the ko mutates
|
// These are the parameters watched by the react binding that will trigger a renderComponent() if one of the ko mutates
|
||||||
const toWatch = [
|
const toWatch = [
|
||||||
container.deleteCollectionText,
|
|
||||||
container.deleteDatabaseText,
|
|
||||||
container.addCollectionText,
|
|
||||||
container.isDatabaseNodeOrNoneSelected,
|
container.isDatabaseNodeOrNoneSelected,
|
||||||
container.isDatabaseNodeSelected,
|
container.isDatabaseNodeSelected,
|
||||||
container.isNoneSelected,
|
container.isNoneSelected,
|
||||||
|
@ -15,7 +15,6 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount: {
|
databaseAccount: {
|
||||||
properties: {
|
properties: {
|
||||||
@ -58,7 +57,6 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount: {
|
databaseAccount: {
|
||||||
properties: {
|
properties: {
|
||||||
@ -126,7 +124,6 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount: {
|
databaseAccount: {
|
||||||
properties: {
|
properties: {
|
||||||
@ -226,7 +223,6 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount: {
|
databaseAccount: {
|
||||||
properties: {
|
properties: {
|
||||||
@ -318,7 +314,6 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
databaseAccount: {
|
databaseAccount: {
|
||||||
properties: {
|
properties: {
|
||||||
@ -380,7 +375,6 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
describe("Resource token", () => {
|
describe("Resource token", () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
mockExplorer = {} as Explorer;
|
mockExplorer = {} as Explorer;
|
||||||
mockExplorer.addCollectionText = ko.observable("mockText");
|
|
||||||
mockExplorer.isDatabaseNodeOrNoneSelected = () => true;
|
mockExplorer.isDatabaseNodeOrNoneSelected = () => true;
|
||||||
mockExplorer.isResourceTokenCollectionNodeSelected = ko.computed(() => true);
|
mockExplorer.isResourceTokenCollectionNodeSelected = ko.computed(() => true);
|
||||||
mockExplorer.isServerlessEnabled = ko.computed<boolean>(() => false);
|
mockExplorer.isServerlessEnabled = ko.computed<boolean>(() => false);
|
||||||
|
@ -22,7 +22,7 @@ import * as Constants from "../../../Common/Constants";
|
|||||||
import { configContext, Platform } from "../../../ConfigContext";
|
import { configContext, Platform } from "../../../ConfigContext";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
import { userContext } from "../../../UserContext";
|
import { userContext } from "../../../UserContext";
|
||||||
import { getDatabaseName } from "../../../Utils/APITypeUtils";
|
import { getCollectionName, getDatabaseName } from "../../../Utils/APITypeUtils";
|
||||||
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import { OpenFullScreen } from "../../OpenFullScreen";
|
import { OpenFullScreen } from "../../OpenFullScreen";
|
||||||
@ -215,7 +215,7 @@ function areScriptsSupported(): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createNewCollectionGroup(container: Explorer): CommandButtonComponentProps {
|
function createNewCollectionGroup(container: Explorer): CommandButtonComponentProps {
|
||||||
const label = container.addCollectionText();
|
const label = `New ${getCollectionName()}`;
|
||||||
return {
|
return {
|
||||||
iconSrc: AddCollectionIcon,
|
iconSrc: AddCollectionIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
|
@ -21,7 +21,6 @@ exports[`GitHub Repos Panel should render Default properly 1`] = `
|
|||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
"_refreshSparkEnabledStateForAccount": [Function],
|
"_refreshSparkEnabledStateForAccount": [Function],
|
||||||
"_resetNotebookWorkspace": [Function],
|
"_resetNotebookWorkspace": [Function],
|
||||||
"addCollectionText": [Function],
|
|
||||||
"arcadiaToken": [Function],
|
"arcadiaToken": [Function],
|
||||||
"canExceedMaximumValue": [Function],
|
"canExceedMaximumValue": [Function],
|
||||||
"canSaveQueries": [Function],
|
"canSaveQueries": [Function],
|
||||||
@ -37,8 +36,6 @@ exports[`GitHub Repos Panel should render Default properly 1`] = `
|
|||||||
"unlimitedmin": 400,
|
"unlimitedmin": 400,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"collectionTitle": [Function],
|
|
||||||
"collectionTreeNodeAltText": [Function],
|
|
||||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"isNotebookTabActive": [Function],
|
"isNotebookTabActive": [Function],
|
||||||
@ -46,8 +43,6 @@ exports[`GitHub Repos Panel should render Default properly 1`] = `
|
|||||||
"tabsButtons": Array [],
|
"tabsButtons": Array [],
|
||||||
},
|
},
|
||||||
"databases": [Function],
|
"databases": [Function],
|
||||||
"deleteCollectionText": [Function],
|
|
||||||
"deleteDatabaseText": [Function],
|
|
||||||
"gitHubClient": GitHubClient {
|
"gitHubClient": GitHubClient {
|
||||||
"errorCallback": [Function],
|
"errorCallback": [Function],
|
||||||
"ocktokit": OctokitWithDefaults {
|
"ocktokit": OctokitWithDefaults {
|
||||||
@ -847,7 +842,6 @@ exports[`GitHub Repos Panel should render Default properly 1`] = `
|
|||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
},
|
},
|
||||||
"refreshNotebookList": [Function],
|
"refreshNotebookList": [Function],
|
||||||
"refreshTreeTitle": [Function],
|
|
||||||
"resourceTokenCollection": [Function],
|
"resourceTokenCollection": [Function],
|
||||||
"resourceTokenCollectionId": [Function],
|
"resourceTokenCollectionId": [Function],
|
||||||
"resourceTokenDatabaseId": [Function],
|
"resourceTokenDatabaseId": [Function],
|
||||||
|
@ -11,7 +11,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
"_refreshSparkEnabledStateForAccount": [Function],
|
"_refreshSparkEnabledStateForAccount": [Function],
|
||||||
"_resetNotebookWorkspace": [Function],
|
"_resetNotebookWorkspace": [Function],
|
||||||
"addCollectionText": [Function],
|
|
||||||
"arcadiaToken": [Function],
|
"arcadiaToken": [Function],
|
||||||
"canExceedMaximumValue": [Function],
|
"canExceedMaximumValue": [Function],
|
||||||
"canSaveQueries": [Function],
|
"canSaveQueries": [Function],
|
||||||
@ -27,8 +26,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
"unlimitedmin": 400,
|
"unlimitedmin": 400,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"collectionTitle": [Function],
|
|
||||||
"collectionTreeNodeAltText": [Function],
|
|
||||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"isNotebookTabActive": [Function],
|
"isNotebookTabActive": [Function],
|
||||||
@ -36,8 +33,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
"tabsButtons": Array [],
|
"tabsButtons": Array [],
|
||||||
},
|
},
|
||||||
"databases": [Function],
|
"databases": [Function],
|
||||||
"deleteCollectionText": [Function],
|
|
||||||
"deleteDatabaseText": [Function],
|
|
||||||
"gitHubClient": GitHubClient {
|
"gitHubClient": GitHubClient {
|
||||||
"errorCallback": [Function],
|
"errorCallback": [Function],
|
||||||
"ocktokit": OctokitWithDefaults {
|
"ocktokit": OctokitWithDefaults {
|
||||||
@ -837,7 +832,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
|||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
},
|
},
|
||||||
"refreshNotebookList": [Function],
|
"refreshNotebookList": [Function],
|
||||||
"refreshTreeTitle": [Function],
|
|
||||||
"resourceTokenCollection": [Function],
|
"resourceTokenCollection": [Function],
|
||||||
"resourceTokenCollectionId": [Function],
|
"resourceTokenCollectionId": [Function],
|
||||||
"resourceTokenDatabaseId": [Function],
|
"resourceTokenDatabaseId": [Function],
|
||||||
|
@ -9,7 +9,6 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
|
|||||||
"_isInitializingNotebooks": false,
|
"_isInitializingNotebooks": false,
|
||||||
"_refreshSparkEnabledStateForAccount": [Function],
|
"_refreshSparkEnabledStateForAccount": [Function],
|
||||||
"_resetNotebookWorkspace": [Function],
|
"_resetNotebookWorkspace": [Function],
|
||||||
"addCollectionText": [Function],
|
|
||||||
"arcadiaToken": [Function],
|
"arcadiaToken": [Function],
|
||||||
"canExceedMaximumValue": [Function],
|
"canExceedMaximumValue": [Function],
|
||||||
"canSaveQueries": [Function],
|
"canSaveQueries": [Function],
|
||||||
@ -25,8 +24,6 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
|
|||||||
"unlimitedmin": 400,
|
"unlimitedmin": 400,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"collectionTitle": [Function],
|
|
||||||
"collectionTreeNodeAltText": [Function],
|
|
||||||
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
"commandBarComponentAdapter": CommandBarComponentAdapter {
|
||||||
"container": [Circular],
|
"container": [Circular],
|
||||||
"isNotebookTabActive": [Function],
|
"isNotebookTabActive": [Function],
|
||||||
@ -34,8 +31,6 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
|
|||||||
"tabsButtons": Array [],
|
"tabsButtons": Array [],
|
||||||
},
|
},
|
||||||
"databases": [Function],
|
"databases": [Function],
|
||||||
"deleteCollectionText": [Function],
|
|
||||||
"deleteDatabaseText": [Function],
|
|
||||||
"gitHubClient": GitHubClient {
|
"gitHubClient": GitHubClient {
|
||||||
"errorCallback": [Function],
|
"errorCallback": [Function],
|
||||||
"ocktokit": OctokitWithDefaults {
|
"ocktokit": OctokitWithDefaults {
|
||||||
@ -839,7 +834,6 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
|
|||||||
},
|
},
|
||||||
"refreshAllDatabases": [Function],
|
"refreshAllDatabases": [Function],
|
||||||
"refreshNotebookList": [Function],
|
"refreshNotebookList": [Function],
|
||||||
"refreshTreeTitle": [Function],
|
|
||||||
"resourceTokenCollection": [Function],
|
"resourceTokenCollection": [Function],
|
||||||
"resourceTokenCollectionId": [Function],
|
"resourceTokenCollectionId": [Function],
|
||||||
"resourceTokenDatabaseId": [Function],
|
"resourceTokenDatabaseId": [Function],
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import { DataSamplesUtil } from "../DataSamples/DataSamplesUtil";
|
import { DataSamplesUtil } from "../DataSamples/DataSamplesUtil";
|
||||||
import { SplashScreen } from "./SplashScreen";
|
|
||||||
import { TabsManager } from "../Tabs/TabsManager";
|
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
|
import { TabsManager } from "../Tabs/TabsManager";
|
||||||
|
import { SplashScreen } from "./SplashScreen";
|
||||||
jest.mock("../Explorer");
|
jest.mock("../Explorer");
|
||||||
|
|
||||||
const createExplorer = () => {
|
const createExplorer = () => {
|
||||||
const mock = new Explorer();
|
const mock = new Explorer();
|
||||||
mock.selectedNode = ko.observable();
|
mock.selectedNode = ko.observable();
|
||||||
mock.isNotebookEnabled = ko.observable(false);
|
mock.isNotebookEnabled = ko.observable(false);
|
||||||
mock.addCollectionText = ko.observable("add collection");
|
|
||||||
mock.tabsManager = new TabsManager();
|
mock.tabsManager = new TabsManager();
|
||||||
return mock as jest.Mocked<Explorer>;
|
return mock as jest.Mocked<Explorer>;
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,7 @@ import { AuthType } from "../../AuthType";
|
|||||||
import * as Constants from "../../Common/Constants";
|
import * as Constants from "../../Common/Constants";
|
||||||
import * as ViewModels from "../../Contracts/ViewModels";
|
import * as ViewModels from "../../Contracts/ViewModels";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import { getDatabaseName } from "../../Utils/APITypeUtils";
|
import { getCollectionName, getDatabaseName } from "../../Utils/APITypeUtils";
|
||||||
import { FeaturePanelLauncher } from "../Controls/FeaturePanel/FeaturePanelLauncher";
|
import { FeaturePanelLauncher } from "../Controls/FeaturePanel/FeaturePanelLauncher";
|
||||||
import { DataSamplesUtil } from "../DataSamples/DataSamplesUtil";
|
import { DataSamplesUtil } from "../DataSamples/DataSamplesUtil";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
@ -192,7 +192,7 @@ export class SplashScreen extends React.Component<SplashScreenProps> {
|
|||||||
const heroes: SplashScreenItem[] = [
|
const heroes: SplashScreenItem[] = [
|
||||||
{
|
{
|
||||||
iconSrc: NewContainerIcon,
|
iconSrc: NewContainerIcon,
|
||||||
title: this.container.addCollectionText(),
|
title: `New ${getCollectionName()}`,
|
||||||
description: "Create a new container for storage and throughput",
|
description: "Create a new container for storage and throughput",
|
||||||
onClick: () => this.container.onNewCollectionClicked(),
|
onClick: () => this.container.onNewCollectionClicked(),
|
||||||
},
|
},
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import * as ko from "knockout";
|
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import Collection from "./Collection";
|
import Collection from "./Collection";
|
||||||
@ -36,8 +35,6 @@ describe("Collection", () => {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
mockContainer.deleteCollectionText = ko.observable<string>("delete collection");
|
|
||||||
|
|
||||||
return generateCollection(mockContainer, "abc", data, {} as DataModels.Offer);
|
return generateCollection(mockContainer, "abc", data, {} as DataModels.Offer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
src/Main.tsx
12
src/Main.tsx
@ -55,6 +55,7 @@ import { useTabs } from "./hooks/useTabs";
|
|||||||
import "./Libs/jquery";
|
import "./Libs/jquery";
|
||||||
import "./Shared/appInsights";
|
import "./Shared/appInsights";
|
||||||
import { userContext } from "./UserContext";
|
import { userContext } from "./UserContext";
|
||||||
|
import { getCollectionName } from "./Utils/APITypeUtils";
|
||||||
|
|
||||||
initializeIcons();
|
initializeIcons();
|
||||||
|
|
||||||
@ -83,6 +84,8 @@ const App: React.FunctionComponent = () => {
|
|||||||
return <LoadingExplorer />;
|
return <LoadingExplorer />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const collectionTitle = `${getCollectionName()} API`;
|
||||||
|
const refreshTreeTitle = `Refresh ${getCollectionName()}`;
|
||||||
return (
|
return (
|
||||||
<div className="flexContainer">
|
<div className="flexContainer">
|
||||||
<div id="divExplorer" className="flexContainer hideOverflows">
|
<div id="divExplorer" className="flexContainer hideOverflows">
|
||||||
@ -105,7 +108,7 @@ const App: React.FunctionComponent = () => {
|
|||||||
{/* Collections Window Title/Command Bar - Start */}
|
{/* Collections Window Title/Command Bar - Start */}
|
||||||
<div className="collectiontitle">
|
<div className="collectiontitle">
|
||||||
<div className="coltitle">
|
<div className="coltitle">
|
||||||
<span className="titlepadcol" data-bind="text: collectionTitle" />
|
<span className="titlepadcol">{collectionTitle}</span>
|
||||||
<div className="float-right">
|
<div className="float-right">
|
||||||
<span
|
<span
|
||||||
className="padimgcolrefresh"
|
className="padimgcolrefresh"
|
||||||
@ -117,7 +120,7 @@ const App: React.FunctionComponent = () => {
|
|||||||
aria-label="Refresh tree"
|
aria-label="Refresh tree"
|
||||||
title="Refresh tree"
|
title="Refresh tree"
|
||||||
>
|
>
|
||||||
<img className="refreshcol" src={refreshImg} data-bind="attr: { alt: refreshTreeTitle }" />
|
<img className="refreshcol" src={refreshImg} alt={refreshTreeTitle} />
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className="padimgcolrefresh1"
|
className="padimgcolrefresh1"
|
||||||
@ -172,10 +175,7 @@ const App: React.FunctionComponent = () => {
|
|||||||
data-bind="
|
data-bind="
|
||||||
click: toggleLeftPaneExpanded"
|
click: toggleLeftPaneExpanded"
|
||||||
>
|
>
|
||||||
<span
|
<span>{collectionTitle}</span>
|
||||||
data-bind="
|
|
||||||
text: collectionTitle"
|
|
||||||
/>
|
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user