mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-26 04:11:24 +00:00
Compare commits
3 Commits
eslint/Not
...
eslint/fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6eedcbd123 | ||
|
|
55837db65b | ||
|
|
9f27cb95b9 |
@@ -84,7 +84,6 @@ src/Explorer/Tables/DataTable/DataTableOperationManager.ts
|
|||||||
src/Explorer/Tables/DataTable/DataTableViewModel.ts
|
src/Explorer/Tables/DataTable/DataTableViewModel.ts
|
||||||
src/Explorer/Tables/DataTable/TableEntityListViewModel.ts
|
src/Explorer/Tables/DataTable/TableEntityListViewModel.ts
|
||||||
src/Explorer/Tables/QueryBuilder/CustomTimestampHelper.ts
|
src/Explorer/Tables/QueryBuilder/CustomTimestampHelper.ts
|
||||||
src/Explorer/Tables/TableDataClient.ts
|
|
||||||
src/Explorer/Tables/TableEntityProcessor.ts
|
src/Explorer/Tables/TableEntityProcessor.ts
|
||||||
src/Explorer/Tables/Utilities.ts
|
src/Explorer/Tables/Utilities.ts
|
||||||
src/Explorer/Tabs/ConflictsTab.ts
|
src/Explorer/Tabs/ConflictsTab.ts
|
||||||
@@ -93,7 +92,11 @@ src/Explorer/Tabs/DocumentsTab.test.ts
|
|||||||
src/Explorer/Tabs/DocumentsTab.ts
|
src/Explorer/Tabs/DocumentsTab.ts
|
||||||
src/Explorer/Tabs/GraphTab.ts
|
src/Explorer/Tabs/GraphTab.ts
|
||||||
src/Explorer/Tabs/MongoDocumentsTab.ts
|
src/Explorer/Tabs/MongoDocumentsTab.ts
|
||||||
|
src/Explorer/Tabs/NotebookV2Tab.ts
|
||||||
|
src/Explorer/Tabs/ScriptTabBase.ts
|
||||||
|
src/Explorer/Tabs/TabComponents.ts
|
||||||
src/Explorer/Tabs/TabsBase.ts
|
src/Explorer/Tabs/TabsBase.ts
|
||||||
|
src/Explorer/Tabs/TriggerTab.ts
|
||||||
src/Explorer/Tabs/UserDefinedFunctionTab.ts
|
src/Explorer/Tabs/UserDefinedFunctionTab.ts
|
||||||
src/Explorer/Tree/AccessibleVerticalList.ts
|
src/Explorer/Tree/AccessibleVerticalList.ts
|
||||||
src/Explorer/Tree/Collection.ts
|
src/Explorer/Tree/Collection.ts
|
||||||
|
|||||||
@@ -307,18 +307,11 @@ function createOpenSynapseLinkDialogButton(container: Explorer): CommandButtonCo
|
|||||||
|
|
||||||
function createNewDatabase(container: Explorer): CommandButtonComponentProps {
|
function createNewDatabase(container: Explorer): CommandButtonComponentProps {
|
||||||
const label = "New " + getDatabaseName();
|
const label = "New " + getDatabaseName();
|
||||||
const newDatabaseButton = document.activeElement as HTMLElement;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
iconSrc: AddDatabaseIcon,
|
iconSrc: AddDatabaseIcon,
|
||||||
iconAlt: label,
|
iconAlt: label,
|
||||||
onCommandClick: () =>
|
onCommandClick: () =>
|
||||||
useSidePanel
|
useSidePanel.getState().openSidePanel("New " + getDatabaseName(), <AddDatabasePanel explorer={container} />),
|
||||||
.getState()
|
|
||||||
.openSidePanel(
|
|
||||||
"New " + getDatabaseName(),
|
|
||||||
<AddDatabasePanel explorer={container} buttonElement={newDatabaseButton} />
|
|
||||||
),
|
|
||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
hasPopup: true,
|
hasPopup: true,
|
||||||
|
|||||||
@@ -23,12 +23,10 @@ import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneFor
|
|||||||
|
|
||||||
export interface AddDatabasePaneProps {
|
export interface AddDatabasePaneProps {
|
||||||
explorer: Explorer;
|
explorer: Explorer;
|
||||||
buttonElement?: HTMLElement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
|
export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
|
||||||
explorer: container,
|
explorer: container,
|
||||||
buttonElement,
|
|
||||||
}: AddDatabasePaneProps) => {
|
}: AddDatabasePaneProps) => {
|
||||||
const closeSidePanel = useSidePanel((state) => state.closeSidePanel);
|
const closeSidePanel = useSidePanel((state) => state.closeSidePanel);
|
||||||
let throughput: number;
|
let throughput: number;
|
||||||
@@ -79,7 +77,6 @@ export const AddDatabasePanel: FunctionComponent<AddDatabasePaneProps> = ({
|
|||||||
dataExplorerArea: Constants.Areas.ContextualPane,
|
dataExplorerArea: Constants.Areas.ContextualPane,
|
||||||
};
|
};
|
||||||
TelemetryProcessor.trace(Action.CreateDatabase, ActionModifiers.Open, addDatabasePaneOpenMessage);
|
TelemetryProcessor.trace(Action.CreateDatabase, ActionModifiers.Open, addDatabasePaneOpenMessage);
|
||||||
buttonElement.focus();
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
|
|||||||
@@ -307,23 +307,16 @@ export class SplashScreen extends React.Component<SplashScreenProps> {
|
|||||||
iconSrc: AddDatabaseIcon,
|
iconSrc: AddDatabaseIcon,
|
||||||
title: "New " + getDatabaseName(),
|
title: "New " + getDatabaseName(),
|
||||||
description: undefined,
|
description: undefined,
|
||||||
onClick: () => this.openAddDatabasePanel(),
|
onClick: () =>
|
||||||
|
useSidePanel
|
||||||
|
.getState()
|
||||||
|
.openSidePanel("New " + getDatabaseName(), <AddDatabasePanel explorer={this.container} />),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
private openAddDatabasePanel() {
|
|
||||||
const newDatabaseButton = document.activeElement as HTMLElement;
|
|
||||||
useSidePanel
|
|
||||||
.getState()
|
|
||||||
.openSidePanel(
|
|
||||||
"New " + getDatabaseName(),
|
|
||||||
<AddDatabasePanel explorer={this.container} buttonElement={newDatabaseButton} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private decorateOpenCollectionActivity({ databaseId, collectionId }: MostRecentActivity.OpenCollectionItem) {
|
private decorateOpenCollectionActivity({ databaseId, collectionId }: MostRecentActivity.OpenCollectionItem) {
|
||||||
return {
|
return {
|
||||||
iconSrc: NotebookIcon,
|
iconSrc: NotebookIcon,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import { FeedOptions } from "@azure/cosmos";
|
import { FeedOptions } from "@azure/cosmos";
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import Q from "q";
|
import Q from "q";
|
||||||
@@ -31,8 +32,6 @@ export interface CassandraTableKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export abstract class TableDataClient {
|
export abstract class TableDataClient {
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
public abstract createDocument(
|
public abstract createDocument(
|
||||||
collection: ViewModels.Collection,
|
collection: ViewModels.Collection,
|
||||||
entity: Entities.ITableEntity
|
entity: Entities.ITableEntity
|
||||||
@@ -54,7 +53,7 @@ export abstract class TableDataClient {
|
|||||||
public abstract deleteDocuments(
|
public abstract deleteDocuments(
|
||||||
collection: ViewModels.Collection,
|
collection: ViewModels.Collection,
|
||||||
entitiesToDelete: Entities.ITableEntity[]
|
entitiesToDelete: Entities.ITableEntity[]
|
||||||
): Promise<any>;
|
): Promise<unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TablesAPIDataClient extends TableDataClient {
|
export class TablesAPIDataClient extends TableDataClient {
|
||||||
@@ -67,7 +66,7 @@ export class TablesAPIDataClient extends TableDataClient {
|
|||||||
collection,
|
collection,
|
||||||
TableEntityProcessor.convertEntityToNewDocument(<Entities.ITableEntityForTablesAPI>entity)
|
TableEntityProcessor.convertEntityToNewDocument(<Entities.ITableEntityForTablesAPI>entity)
|
||||||
).then(
|
).then(
|
||||||
(newDocument: any) => {
|
(newDocument: unknown) => {
|
||||||
const newEntity = TableEntityProcessor.convertDocumentsToEntities([newDocument])[0];
|
const newEntity = TableEntityProcessor.convertDocumentsToEntities([newDocument])[0];
|
||||||
deferred.resolve(newEntity);
|
deferred.resolve(newEntity);
|
||||||
},
|
},
|
||||||
@@ -146,7 +145,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
const clearInProgressMessage = logConsoleProgress(`Adding new row to table ${collection.id()}`);
|
const clearInProgressMessage = logConsoleProgress(`Adding new row to table ${collection.id()}`);
|
||||||
let properties = "(";
|
let properties = "(";
|
||||||
let values = "(";
|
let values = "(";
|
||||||
for (let property in entity) {
|
for (const property in entity) {
|
||||||
if (entity[property]._ === null) {
|
if (entity[property]._ === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -164,7 +163,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
const deferred = Q.defer<Entities.ITableEntity>();
|
const deferred = Q.defer<Entities.ITableEntity>();
|
||||||
this.queryDocuments(collection, query)
|
this.queryDocuments(collection, query)
|
||||||
.then(
|
.then(
|
||||||
(data: any) => {
|
() => {
|
||||||
entity[TableConstants.EntityKeyNames.RowKey] = entity[this.getCassandraPartitionKeyProperty(collection)];
|
entity[TableConstants.EntityKeyNames.RowKey] = entity[this.getCassandraPartitionKeyProperty(collection)];
|
||||||
entity[TableConstants.EntityKeyNames.RowKey]._ = entity[TableConstants.EntityKeyNames.RowKey]._.toString();
|
entity[TableConstants.EntityKeyNames.RowKey]._ = entity[TableConstants.EntityKeyNames.RowKey]._.toString();
|
||||||
logConsoleInfo(`Successfully added new row to table ${collection.id()}`);
|
logConsoleInfo(`Successfully added new row to table ${collection.id()}`);
|
||||||
@@ -188,10 +187,10 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
let whereSegment = " WHERE";
|
let whereSegment = " WHERE";
|
||||||
let keys: CassandraTableKey[] = collection.cassandraKeys.partitionKeys.concat(
|
const keys: CassandraTableKey[] = collection.cassandraKeys.partitionKeys.concat(
|
||||||
collection.cassandraKeys.clusteringKeys
|
collection.cassandraKeys.clusteringKeys
|
||||||
);
|
);
|
||||||
for (let keyIndex in keys) {
|
for (const keyIndex in keys) {
|
||||||
const key = keys[keyIndex].property;
|
const key = keys[keyIndex].property;
|
||||||
const keyType = keys[keyIndex].type;
|
const keyType = keys[keyIndex].type;
|
||||||
whereSegment += this.isStringType(keyType)
|
whereSegment += this.isStringType(keyType)
|
||||||
@@ -202,14 +201,21 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
|
|
||||||
let updateQuery = `UPDATE ${collection.databaseId}.${collection.id()}`;
|
let updateQuery = `UPDATE ${collection.databaseId}.${collection.id()}`;
|
||||||
let isPropertyUpdated = false;
|
let isPropertyUpdated = false;
|
||||||
for (let property in newEntity) {
|
let isFirstPropertyToUpdate = true;
|
||||||
|
for (const property in newEntity) {
|
||||||
if (
|
if (
|
||||||
!originalDocument[property] ||
|
!originalDocument[property] ||
|
||||||
newEntity[property]._.toString() !== originalDocument[property]._.toString()
|
newEntity[property]._.toString() !== originalDocument[property]._.toString()
|
||||||
) {
|
) {
|
||||||
updateQuery += this.isStringType(newEntity[property].$)
|
let propertyQuerySegment = this.isStringType(newEntity[property].$)
|
||||||
? ` SET ${property} = '${newEntity[property]._}',`
|
? `${property} = '${newEntity[property]._}',`
|
||||||
: ` SET ${property} = ${newEntity[property]._},`;
|
: `${property} = ${newEntity[property]._},`;
|
||||||
|
// Only add the "SET" keyword once
|
||||||
|
if (isFirstPropertyToUpdate) {
|
||||||
|
propertyQuerySegment = " SET " + propertyQuerySegment;
|
||||||
|
isFirstPropertyToUpdate = false;
|
||||||
|
}
|
||||||
|
updateQuery += propertyQuerySegment;
|
||||||
isPropertyUpdated = true;
|
isPropertyUpdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,7 +228,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
|
|
||||||
let deleteQuery = `DELETE `;
|
let deleteQuery = `DELETE `;
|
||||||
let isPropertyDeleted = false;
|
let isPropertyDeleted = false;
|
||||||
for (let property in originalDocument) {
|
for (const property in originalDocument) {
|
||||||
if (property !== TableConstants.EntityKeyNames.RowKey && !newEntity[property] && !!originalDocument[property]) {
|
if (property !== TableConstants.EntityKeyNames.RowKey && !newEntity[property] && !!originalDocument[property]) {
|
||||||
deleteQuery += ` ${property},`;
|
deleteQuery += ` ${property},`;
|
||||||
isPropertyDeleted = true;
|
isPropertyDeleted = true;
|
||||||
@@ -326,16 +332,16 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
resourceId: string,
|
resourceId: string,
|
||||||
explorer: Explorer,
|
explorer: Explorer,
|
||||||
createKeyspaceQuery: string
|
createKeyspaceQuery: string
|
||||||
): Q.Promise<any> {
|
): Q.Promise<unknown> {
|
||||||
if (!createKeyspaceQuery) {
|
if (!createKeyspaceQuery) {
|
||||||
return Q.reject("No query specified");
|
return Q.reject("No query specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
const deferred: Q.Deferred<any> = Q.defer();
|
const deferred: Q.Deferred<unknown> = Q.defer();
|
||||||
const clearInProgressMessage = logConsoleProgress(`Creating a new keyspace with query ${createKeyspaceQuery}`);
|
const clearInProgressMessage = logConsoleProgress(`Creating a new keyspace with query ${createKeyspaceQuery}`);
|
||||||
this.createOrDeleteQuery(cassandraEndpoint, resourceId, createKeyspaceQuery)
|
this.createOrDeleteQuery(cassandraEndpoint, resourceId, createKeyspaceQuery)
|
||||||
.then(
|
.then(
|
||||||
(data: any) => {
|
() => {
|
||||||
logConsoleInfo(`Successfully created a keyspace with query ${createKeyspaceQuery}`);
|
logConsoleInfo(`Successfully created a keyspace with query ${createKeyspaceQuery}`);
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
},
|
},
|
||||||
@@ -359,8 +365,8 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
explorer: Explorer,
|
explorer: Explorer,
|
||||||
createTableQuery: string,
|
createTableQuery: string,
|
||||||
createKeyspaceQuery?: string
|
createKeyspaceQuery?: string
|
||||||
): Q.Promise<any> {
|
): Q.Promise<unknown> {
|
||||||
let createKeyspacePromise: Q.Promise<any>;
|
let createKeyspacePromise: Q.Promise<unknown>;
|
||||||
if (createKeyspaceQuery) {
|
if (createKeyspaceQuery) {
|
||||||
createKeyspacePromise = this.createKeyspace(cassandraEndpoint, resourceId, explorer, createKeyspaceQuery);
|
createKeyspacePromise = this.createKeyspace(cassandraEndpoint, resourceId, explorer, createKeyspaceQuery);
|
||||||
} else {
|
} else {
|
||||||
@@ -373,7 +379,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
const clearInProgressMessage = logConsoleProgress(`Creating a new table with query ${createTableQuery}`);
|
const clearInProgressMessage = logConsoleProgress(`Creating a new table with query ${createTableQuery}`);
|
||||||
this.createOrDeleteQuery(cassandraEndpoint, resourceId, createTableQuery)
|
this.createOrDeleteQuery(cassandraEndpoint, resourceId, createTableQuery)
|
||||||
.then(
|
.then(
|
||||||
(data: any) => {
|
() => {
|
||||||
logConsoleInfo(`Successfully created a table with query ${createTableQuery}`);
|
logConsoleInfo(`Successfully created a table with query ${createTableQuery}`);
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
},
|
},
|
||||||
@@ -392,7 +398,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getTableKeys(collection: ViewModels.Collection): Q.Promise<CassandraTableKeys> {
|
public getTableKeys(collection: ViewModels.Collection): Q.Promise<CassandraTableKeys> {
|
||||||
if (!!collection.cassandraKeys) {
|
if (collection.cassandraKeys) {
|
||||||
return Q.resolve(collection.cassandraKeys);
|
return Q.resolve(collection.cassandraKeys);
|
||||||
}
|
}
|
||||||
const clearInProgressMessage = logConsoleProgress(`Fetching keys for table ${collection.id()}`);
|
const clearInProgressMessage = logConsoleProgress(`Fetching keys for table ${collection.id()}`);
|
||||||
@@ -401,7 +407,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
authType === AuthType.EncryptedToken
|
authType === AuthType.EncryptedToken
|
||||||
? Constants.CassandraBackend.guestKeysApi
|
? Constants.CassandraBackend.guestKeysApi
|
||||||
: Constants.CassandraBackend.keysApi;
|
: Constants.CassandraBackend.keysApi;
|
||||||
let endpoint = `${configContext.BACKEND_ENDPOINT}/${apiEndpoint}`;
|
const endpoint = `${configContext.BACKEND_ENDPOINT}/${apiEndpoint}`;
|
||||||
const deferred = Q.defer<CassandraTableKeys>();
|
const deferred = Q.defer<CassandraTableKeys>();
|
||||||
|
|
||||||
$.ajax(endpoint, {
|
$.ajax(endpoint, {
|
||||||
@@ -422,7 +428,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
logConsoleInfo(`Successfully fetched keys for table ${collection.id()}`);
|
logConsoleInfo(`Successfully fetched keys for table ${collection.id()}`);
|
||||||
deferred.resolve(data);
|
deferred.resolve(data);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: Error) => {
|
||||||
handleError(error, "FetchKeysCassandra", `Error fetching keys for table ${collection.id()}`);
|
handleError(error, "FetchKeysCassandra", `Error fetching keys for table ${collection.id()}`);
|
||||||
deferred.reject(error);
|
deferred.reject(error);
|
||||||
}
|
}
|
||||||
@@ -432,7 +438,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getTableSchema(collection: ViewModels.Collection): Q.Promise<CassandraTableKey[]> {
|
public getTableSchema(collection: ViewModels.Collection): Q.Promise<CassandraTableKey[]> {
|
||||||
if (!!collection.cassandraSchema) {
|
if (collection.cassandraSchema) {
|
||||||
return Q.resolve(collection.cassandraSchema);
|
return Q.resolve(collection.cassandraSchema);
|
||||||
}
|
}
|
||||||
const clearInProgressMessage = logConsoleProgress(`Fetching schema for table ${collection.id()}`);
|
const clearInProgressMessage = logConsoleProgress(`Fetching schema for table ${collection.id()}`);
|
||||||
@@ -441,7 +447,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
authType === AuthType.EncryptedToken
|
authType === AuthType.EncryptedToken
|
||||||
? Constants.CassandraBackend.guestSchemaApi
|
? Constants.CassandraBackend.guestSchemaApi
|
||||||
: Constants.CassandraBackend.schemaApi;
|
: Constants.CassandraBackend.schemaApi;
|
||||||
let endpoint = `${configContext.BACKEND_ENDPOINT}/${apiEndpoint}`;
|
const endpoint = `${configContext.BACKEND_ENDPOINT}/${apiEndpoint}`;
|
||||||
const deferred = Q.defer<CassandraTableKey[]>();
|
const deferred = Q.defer<CassandraTableKey[]>();
|
||||||
|
|
||||||
$.ajax(endpoint, {
|
$.ajax(endpoint, {
|
||||||
@@ -462,7 +468,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
logConsoleInfo(`Successfully fetched schema for table ${collection.id()}`);
|
logConsoleInfo(`Successfully fetched schema for table ${collection.id()}`);
|
||||||
deferred.resolve(data.columns);
|
deferred.resolve(data.columns);
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: Error) => {
|
||||||
handleError(error, "FetchSchemaCassandra", `Error fetching schema for table ${collection.id()}`);
|
handleError(error, "FetchSchemaCassandra", `Error fetching schema for table ${collection.id()}`);
|
||||||
deferred.reject(error);
|
deferred.reject(error);
|
||||||
}
|
}
|
||||||
@@ -489,7 +495,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
beforeSend: this.setAuthorizationHeader,
|
beforeSend: this.setAuthorizationHeader,
|
||||||
cache: false,
|
cache: false,
|
||||||
}).then(
|
}).then(
|
||||||
(data: any) => {
|
() => {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
},
|
},
|
||||||
(reason) => {
|
(reason) => {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default class NotebookTabV2 extends NotebookTabBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public onCloseTabButtonClick(): Q.Promise<void> {
|
public onCloseTabButtonClick(): Q.Promise<any> {
|
||||||
const cleanup = () => {
|
const cleanup = () => {
|
||||||
this.notebookComponentAdapter.notebookShutdown();
|
this.notebookComponentAdapter.notebookShutdown();
|
||||||
super.onCloseTabButtonClick();
|
super.onCloseTabButtonClick();
|
||||||
@@ -78,7 +78,7 @@ export default class NotebookTabV2 extends NotebookTabBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async reconfigureServiceEndpoints(): Promise<void> {
|
public async reconfigureServiceEndpoints() {
|
||||||
if (!this.notebookComponentAdapter) {
|
if (!this.notebookComponentAdapter) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ export default class NotebookTabV2 extends NotebookTabBase {
|
|||||||
ariaLabel: publishLabel,
|
ariaLabel: publishLabel,
|
||||||
});
|
});
|
||||||
|
|
||||||
const buttons: CommandButtonComponentProps[] = [
|
let buttons: CommandButtonComponentProps[] = [
|
||||||
{
|
{
|
||||||
iconSrc: SaveIcon,
|
iconSrc: SaveIcon,
|
||||||
iconAlt: saveLabel,
|
iconAlt: saveLabel,
|
||||||
@@ -160,7 +160,7 @@ export default class NotebookTabV2 extends NotebookTabBase {
|
|||||||
{
|
{
|
||||||
iconSrc: null,
|
iconSrc: null,
|
||||||
iconAlt: kernelLabel,
|
iconAlt: kernelLabel,
|
||||||
onCommandClick: () => undefined,
|
onCommandClick: () => {},
|
||||||
commandButtonLabel: null,
|
commandButtonLabel: null,
|
||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
disabled: availableKernels.length < 1,
|
disabled: availableKernels.length < 1,
|
||||||
@@ -271,7 +271,7 @@ export default class NotebookTabV2 extends NotebookTabBase {
|
|||||||
{
|
{
|
||||||
iconSrc: null,
|
iconSrc: null,
|
||||||
iconAlt: null,
|
iconAlt: null,
|
||||||
onCommandClick: () => undefined,
|
onCommandClick: () => {},
|
||||||
commandButtonLabel: null,
|
commandButtonLabel: null,
|
||||||
ariaLabel: cellTypeLabel,
|
ariaLabel: cellTypeLabel,
|
||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
@@ -361,7 +361,7 @@ export default class NotebookTabV2 extends NotebookTabBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private onKernelUpdate = async () => {
|
private onKernelUpdate = async () => {
|
||||||
await this.configureServiceEndpoints(this.notebookComponentAdapter.getCurrentKernelName()).catch(() => {
|
await this.configureServiceEndpoints(this.notebookComponentAdapter.getCurrentKernelName()).catch((reason) => {
|
||||||
/* Erroring is ok here */
|
/* Erroring is ok here */
|
||||||
});
|
});
|
||||||
this.updateNavbarWithTabsButtons();
|
this.updateNavbarWithTabsButtons();
|
||||||
|
|||||||
@@ -25,12 +25,11 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
|
|||||||
public errors: ko.ObservableArray<ViewModels.QueryError>;
|
public errors: ko.ObservableArray<ViewModels.QueryError>;
|
||||||
public statusMessge: ko.Observable<string>;
|
public statusMessge: ko.Observable<string>;
|
||||||
public statusIcon: ko.Observable<string>;
|
public statusIcon: ko.Observable<string>;
|
||||||
public formFields: ko.ObservableArray<ViewModels.Editable<unknown>>;
|
public formFields: ko.ObservableArray<ViewModels.Editable<any>>;
|
||||||
public formIsValid: ko.Computed<boolean>;
|
public formIsValid: ko.Computed<boolean>;
|
||||||
public formIsDirty: ko.Computed<boolean>;
|
public formIsDirty: ko.Computed<boolean>;
|
||||||
public isNew: ko.Observable<boolean>;
|
public isNew: ko.Observable<boolean>;
|
||||||
// TODO: Remove any. The SDK types for all the script.body are slightly incorrect which makes this REALLY hard to type correct.
|
// TODO: Remove any. The SDK types for all the script.body are slightly incorrect which makes this REALLY hard to type correct.
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
public resource: ko.Observable<any>;
|
public resource: ko.Observable<any>;
|
||||||
public isTemplateReady: ko.Observable<boolean>;
|
public isTemplateReady: ko.Observable<boolean>;
|
||||||
protected _partitionKey: DataModels.PartitionKey;
|
protected _partitionKey: DataModels.PartitionKey;
|
||||||
@@ -86,6 +85,7 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
|
|||||||
this.editorState(ViewModels.ScriptEditorState.exisitingDirtyInvalid);
|
this.editorState(ViewModels.ScriptEditorState.exisitingDirtyInvalid);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ViewModels.ScriptEditorState.exisitingDirtyValid:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
|
|||||||
this.editorContent.setBaseline(resource.body);
|
this.editorContent.setBaseline(resource.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setBaselines(): void {
|
public setBaselines() {
|
||||||
this._setBaselines();
|
this._setBaselines();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,9 +194,9 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract onSaveClick: () => void;
|
public abstract onSaveClick: () => void;
|
||||||
public abstract onUpdateClick: () => Promise<void>;
|
public abstract onUpdateClick: () => Promise<any>;
|
||||||
|
|
||||||
public onDiscard = (): Q.Promise<void> => {
|
public onDiscard = (): Q.Promise<any> => {
|
||||||
this.setBaselines();
|
this.setBaselines();
|
||||||
const original = this.editorContent.getEditableOriginalValue();
|
const original = this.editorContent.getEditableOriginalValue();
|
||||||
const editorModel = this.editor() && this.editor().getModel();
|
const editorModel = this.editor() && this.editor().getModel();
|
||||||
@@ -289,7 +289,7 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
|
|||||||
return !!value;
|
return !!value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async _createBodyEditor(): Promise<void> {
|
protected async _createBodyEditor() {
|
||||||
const id = this.editorId;
|
const id = this.editorId;
|
||||||
const container = document.getElementById(id);
|
const container = document.getElementById(id);
|
||||||
const options = {
|
const options = {
|
||||||
@@ -308,7 +308,7 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
|
|||||||
editorModel.onDidChangeContent(this._onBodyContentChange.bind(this));
|
editorModel.onDidChangeContent(this._onBodyContentChange.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _onBodyContentChange() {
|
private _onBodyContentChange(e: monaco.editor.IModelContentChangedEvent) {
|
||||||
const editorModel = this.editor().getModel();
|
const editorModel = this.editor().getModel();
|
||||||
this.editorContent(editorModel.getValue());
|
this.editorContent(editorModel.getValue());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user