This commit is contained in:
Laurent Nguyen 2024-05-29 18:20:07 +02:00 committed by GitHub
parent f669a99228
commit cebf044803
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 77 additions and 77 deletions

View File

@ -324,9 +324,9 @@ export enum DocumentExplorerState {
noDocumentSelected, noDocumentSelected,
newDocumentValid, newDocumentValid,
newDocumentInvalid, newDocumentInvalid,
exisitingDocumentNoEdits, existingDocumentNoEdits,
exisitingDocumentDirtyValid, existingDocumentDirtyValid,
exisitingDocumentDirtyInvalid, existingDocumentDirtyInvalid,
} }
export enum IndexingPolicyEditorState { export enum IndexingPolicyEditorState {
@ -339,9 +339,9 @@ export enum IndexingPolicyEditorState {
export enum ScriptEditorState { export enum ScriptEditorState {
newInvalid, newInvalid,
newValid, newValid,
exisitingNoEdits, existingNoEdits,
exisitingDirtyValid, existingDirtyValid,
exisitingDirtyInvalid, existingDirtyInvalid,
} }
export enum CollectionTabKind { export enum CollectionTabKind {

View File

@ -6,16 +6,16 @@ import DiscardIcon from "../../../images/discard.svg";
import SaveIcon from "../../../images/save-cosmos.svg"; import SaveIcon from "../../../images/save-cosmos.svg";
import * as Constants from "../../Common/Constants"; import * as Constants from "../../Common/Constants";
import { DocumentsGridMetrics, KeyCodes } from "../../Common/Constants"; import { DocumentsGridMetrics, KeyCodes } from "../../Common/Constants";
import { createDocument } from "../../Common/dataAccess/createDocument";
import { deleteConflict } from "../../Common/dataAccess/deleteConflict";
import { deleteDocument } from "../../Common/dataAccess/deleteDocument";
import { queryConflicts } from "../../Common/dataAccess/queryConflicts";
import { updateDocument } from "../../Common/dataAccess/updateDocument";
import editable from "../../Common/EditableUtility"; import editable from "../../Common/EditableUtility";
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils"; import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
import * as HeadersUtility from "../../Common/HeadersUtility"; import * as HeadersUtility from "../../Common/HeadersUtility";
import { MinimalQueryIterator } from "../../Common/IteratorUtilities"; import { MinimalQueryIterator } from "../../Common/IteratorUtilities";
import { Splitter, SplitterBounds, SplitterDirection } from "../../Common/Splitter"; import { Splitter, SplitterBounds, SplitterDirection } from "../../Common/Splitter";
import { createDocument } from "../../Common/dataAccess/createDocument";
import { deleteConflict } from "../../Common/dataAccess/deleteConflict";
import { deleteDocument } from "../../Common/dataAccess/deleteDocument";
import { queryConflicts } from "../../Common/dataAccess/queryConflicts";
import { updateDocument } from "../../Common/dataAccess/updateDocument";
import * as DataModels from "../../Contracts/DataModels"; import * as DataModels from "../../Contracts/DataModels";
import * as ViewModels from "../../Contracts/ViewModels"; import * as ViewModels from "../../Contracts/ViewModels";
import { Action } from "../../Shared/Telemetry/TelemetryConstants"; import { Action } from "../../Shared/Telemetry/TelemetryConstants";
@ -117,15 +117,15 @@ export default class ConflictsTab extends TabsBase {
this.isEditorDirty = ko.computed<boolean>(() => { this.isEditorDirty = ko.computed<boolean>(() => {
switch (this.editorState()) { switch (this.editorState()) {
case ViewModels.DocumentExplorerState.noDocumentSelected: case ViewModels.DocumentExplorerState.noDocumentSelected:
case ViewModels.DocumentExplorerState.exisitingDocumentNoEdits: case ViewModels.DocumentExplorerState.existingDocumentNoEdits:
return false; return false;
case ViewModels.DocumentExplorerState.newDocumentValid: case ViewModels.DocumentExplorerState.newDocumentValid:
case ViewModels.DocumentExplorerState.newDocumentInvalid: case ViewModels.DocumentExplorerState.newDocumentInvalid:
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid: case ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid:
return true; return true;
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid: case ViewModels.DocumentExplorerState.existingDocumentDirtyValid:
return ( return (
this.selectedConflictCurrent.getEditableOriginalValue() !== this.selectedConflictCurrent.getEditableOriginalValue() !==
this.selectedConflictCurrent.getEditableCurrentValue() this.selectedConflictCurrent.getEditableCurrentValue()
@ -139,8 +139,8 @@ export default class ConflictsTab extends TabsBase {
this.acceptChangesButton = { this.acceptChangesButton = {
enabled: ko.computed<boolean>(() => { enabled: ko.computed<boolean>(() => {
switch (this.editorState()) { switch (this.editorState()) {
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid: case ViewModels.DocumentExplorerState.existingDocumentDirtyValid:
case ViewModels.DocumentExplorerState.exisitingDocumentNoEdits: case ViewModels.DocumentExplorerState.existingDocumentNoEdits:
return true; return true;
} }
@ -155,8 +155,8 @@ export default class ConflictsTab extends TabsBase {
this.discardButton = { this.discardButton = {
enabled: ko.computed<boolean>(() => { enabled: ko.computed<boolean>(() => {
switch (this.editorState()) { switch (this.editorState()) {
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid: case ViewModels.DocumentExplorerState.existingDocumentDirtyValid:
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid: case ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid:
return true; return true;
} }
@ -171,8 +171,8 @@ export default class ConflictsTab extends TabsBase {
this.deleteButton = { this.deleteButton = {
enabled: ko.computed<boolean>(() => { enabled: ko.computed<boolean>(() => {
switch (this.editorState()) { switch (this.editorState()) {
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid: case ViewModels.DocumentExplorerState.existingDocumentDirtyValid:
case ViewModels.DocumentExplorerState.exisitingDocumentNoEdits: case ViewModels.DocumentExplorerState.existingDocumentNoEdits:
return true; return true;
} }
@ -247,7 +247,7 @@ export default class ConflictsTab extends TabsBase {
return Q(); return Q();
} }
this.editorState(ViewModels.DocumentExplorerState.exisitingDocumentNoEdits); this.editorState(ViewModels.DocumentExplorerState.existingDocumentNoEdits);
return Q(); return Q();
} }
@ -407,22 +407,22 @@ export default class ConflictsTab extends TabsBase {
public onDiscardClick = (): Q.Promise<any> => { public onDiscardClick = (): Q.Promise<any> => {
this.selectedConflictContent(this.selectedConflictContent.getEditableOriginalValue()); this.selectedConflictContent(this.selectedConflictContent.getEditableOriginalValue());
this.editorState(ViewModels.DocumentExplorerState.exisitingDocumentNoEdits); this.editorState(ViewModels.DocumentExplorerState.existingDocumentNoEdits);
return Q(); return Q();
}; };
public onValidDocumentEdit(): Q.Promise<any> { public onValidDocumentEdit(): Q.Promise<any> {
this.editorState(ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid); this.editorState(ViewModels.DocumentExplorerState.existingDocumentDirtyValid);
return Q(); return Q();
} }
public onInvalidDocumentEdit(): Q.Promise<any> { public onInvalidDocumentEdit(): Q.Promise<any> {
if ( if (
this.editorState() === ViewModels.DocumentExplorerState.exisitingDocumentNoEdits || this.editorState() === ViewModels.DocumentExplorerState.existingDocumentNoEdits ||
this.editorState() === ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid this.editorState() === ViewModels.DocumentExplorerState.existingDocumentDirtyValid
) { ) {
this.editorState(ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid); this.editorState(ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid);
return Q(); return Q();
} }
@ -555,7 +555,7 @@ export default class ConflictsTab extends TabsBase {
let parsedConflictContent: any = JSON.parse(documentToInsert); let parsedConflictContent: any = JSON.parse(documentToInsert);
const renderedConflictContent: string = this.renderObjectForEditor(parsedConflictContent, null, 4); const renderedConflictContent: string = this.renderObjectForEditor(parsedConflictContent, null, 4);
this.selectedConflictContent.setBaseline(renderedConflictContent); this.selectedConflictContent.setBaseline(renderedConflictContent);
this.editorState(ViewModels.DocumentExplorerState.exisitingDocumentNoEdits); this.editorState(ViewModels.DocumentExplorerState.existingDocumentNoEdits);
} }
return Q(); return Q();
@ -576,7 +576,7 @@ export default class ConflictsTab extends TabsBase {
const renderedConflictContent: string = this.renderObjectForEditor(parsedConflictContent, null, 4); const renderedConflictContent: string = this.renderObjectForEditor(parsedConflictContent, null, 4);
this.selectedConflictContent.setBaseline(renderedConflictContent); this.selectedConflictContent.setBaseline(renderedConflictContent);
this.editorState(ViewModels.DocumentExplorerState.exisitingDocumentNoEdits); this.editorState(ViewModels.DocumentExplorerState.existingDocumentNoEdits);
} }
return Q(); return Q();
@ -588,7 +588,7 @@ export default class ConflictsTab extends TabsBase {
parsedDocumentToDelete = ConflictsTab.removeSystemProperties(parsedDocumentToDelete); parsedDocumentToDelete = ConflictsTab.removeSystemProperties(parsedDocumentToDelete);
const renderedDocumentToDelete: string = this.renderObjectForEditor(parsedDocumentToDelete, null, 4); const renderedDocumentToDelete: string = this.renderObjectForEditor(parsedDocumentToDelete, null, 4);
this.selectedConflictContent.setBaseline(renderedDocumentToDelete); this.selectedConflictContent.setBaseline(renderedDocumentToDelete);
this.editorState(ViewModels.DocumentExplorerState.exisitingDocumentNoEdits); this.editorState(ViewModels.DocumentExplorerState.existingDocumentNoEdits);
} }
return Q(); return Q();

View File

@ -179,17 +179,17 @@ describe("Documents tab (noSql API)", () => {
testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentValid, enabled: true, visible: true }); testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentValid, enabled: true, visible: true });
testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentInvalid, enabled: false, visible: true }); testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentInvalid, enabled: false, visible: true });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentNoEdits, state: ViewModels.DocumentExplorerState.existingDocumentNoEdits,
enabled: false, enabled: false,
visible: false, visible: false,
}); });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid, state: ViewModels.DocumentExplorerState.existingDocumentDirtyValid,
enabled: false, enabled: false,
visible: false, visible: false,
}); });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid, state: ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid,
enabled: false, enabled: false,
visible: false, visible: false,
}); });
@ -211,17 +211,17 @@ describe("Documents tab (noSql API)", () => {
testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentValid, enabled: true, visible: true }); testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentValid, enabled: true, visible: true });
testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentInvalid, enabled: true, visible: true }); testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentInvalid, enabled: true, visible: true });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentNoEdits, state: ViewModels.DocumentExplorerState.existingDocumentNoEdits,
enabled: false, enabled: false,
visible: false, visible: false,
}); });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid, state: ViewModels.DocumentExplorerState.existingDocumentDirtyValid,
enabled: false, enabled: false,
visible: false, visible: false,
}); });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid, state: ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid,
enabled: false, enabled: false,
visible: false, visible: false,
}); });
@ -243,17 +243,17 @@ describe("Documents tab (noSql API)", () => {
testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentValid, enabled: false, visible: false }); testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentValid, enabled: false, visible: false });
testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentInvalid, enabled: false, visible: false }); testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentInvalid, enabled: false, visible: false });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentNoEdits, state: ViewModels.DocumentExplorerState.existingDocumentNoEdits,
enabled: false, enabled: false,
visible: true, visible: true,
}); });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid, state: ViewModels.DocumentExplorerState.existingDocumentDirtyValid,
enabled: true, enabled: true,
visible: true, visible: true,
}); });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid, state: ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid,
enabled: false, enabled: false,
visible: true, visible: true,
}); });
@ -275,17 +275,17 @@ describe("Documents tab (noSql API)", () => {
testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentValid, enabled: false, visible: false }); testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentValid, enabled: false, visible: false });
testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentInvalid, enabled: false, visible: false }); testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentInvalid, enabled: false, visible: false });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentNoEdits, state: ViewModels.DocumentExplorerState.existingDocumentNoEdits,
enabled: false, enabled: false,
visible: true, visible: true,
}); });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid, state: ViewModels.DocumentExplorerState.existingDocumentDirtyValid,
enabled: true, enabled: true,
visible: true, visible: true,
}); });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid, state: ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid,
enabled: true, enabled: true,
visible: true, visible: true,
}); });
@ -306,14 +306,14 @@ describe("Documents tab (noSql API)", () => {
testCases.add({ state: ViewModels.DocumentExplorerState.noDocumentSelected, enabled: false, visible: false }); testCases.add({ state: ViewModels.DocumentExplorerState.noDocumentSelected, enabled: false, visible: false });
testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentValid, enabled: false, visible: false }); testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentValid, enabled: false, visible: false });
testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentInvalid, enabled: false, visible: false }); testCases.add({ state: ViewModels.DocumentExplorerState.newDocumentInvalid, enabled: false, visible: false });
testCases.add({ state: ViewModels.DocumentExplorerState.exisitingDocumentNoEdits, enabled: true, visible: true }); testCases.add({ state: ViewModels.DocumentExplorerState.existingDocumentNoEdits, enabled: true, visible: true });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid, state: ViewModels.DocumentExplorerState.existingDocumentDirtyValid,
enabled: true, enabled: true,
visible: true, visible: true,
}); });
testCases.add({ testCases.add({
state: ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid, state: ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid,
enabled: true, enabled: true,
visible: true, visible: true,
}); });

View File

@ -146,7 +146,7 @@ export const getDiscardNewDocumentChangesButtonState = (editorState: ViewModels.
export const getSaveExistingDocumentButtonState = (editorState: ViewModels.DocumentExplorerState) => ({ export const getSaveExistingDocumentButtonState = (editorState: ViewModels.DocumentExplorerState) => ({
enabled: (() => { enabled: (() => {
switch (editorState) { switch (editorState) {
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid: case ViewModels.DocumentExplorerState.existingDocumentDirtyValid:
return true; return true;
default: default:
return false; return false;
@ -155,9 +155,9 @@ export const getSaveExistingDocumentButtonState = (editorState: ViewModels.Docum
visible: (() => { visible: (() => {
switch (editorState) { switch (editorState) {
case ViewModels.DocumentExplorerState.exisitingDocumentNoEdits: case ViewModels.DocumentExplorerState.existingDocumentNoEdits:
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid: case ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid:
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid: case ViewModels.DocumentExplorerState.existingDocumentDirtyValid:
return true; return true;
default: default:
return false; return false;
@ -169,8 +169,8 @@ export const getSaveExistingDocumentButtonState = (editorState: ViewModels.Docum
export const getDiscardExistingDocumentChangesButtonState = (editorState: ViewModels.DocumentExplorerState) => ({ export const getDiscardExistingDocumentChangesButtonState = (editorState: ViewModels.DocumentExplorerState) => ({
enabled: (() => { enabled: (() => {
switch (editorState) { switch (editorState) {
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid: case ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid:
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid: case ViewModels.DocumentExplorerState.existingDocumentDirtyValid:
return true; return true;
default: default:
return false; return false;
@ -179,9 +179,9 @@ export const getDiscardExistingDocumentChangesButtonState = (editorState: ViewMo
visible: (() => { visible: (() => {
switch (editorState) { switch (editorState) {
case ViewModels.DocumentExplorerState.exisitingDocumentNoEdits: case ViewModels.DocumentExplorerState.existingDocumentNoEdits:
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid: case ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid:
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid: case ViewModels.DocumentExplorerState.existingDocumentDirtyValid:
return true; return true;
default: default:
return false; return false;
@ -368,7 +368,7 @@ const getNewDocumentButtonState = (editorState: ViewModels.DocumentExplorerState
enabled: (() => { enabled: (() => {
switch (editorState) { switch (editorState) {
case ViewModels.DocumentExplorerState.noDocumentSelected: case ViewModels.DocumentExplorerState.noDocumentSelected:
case ViewModels.DocumentExplorerState.exisitingDocumentNoEdits: case ViewModels.DocumentExplorerState.existingDocumentNoEdits:
return true; return true;
default: default:
return false; return false;
@ -588,15 +588,15 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
const isEditorDirty = useCallback((): boolean => { const isEditorDirty = useCallback((): boolean => {
switch (editorState) { switch (editorState) {
case ViewModels.DocumentExplorerState.noDocumentSelected: case ViewModels.DocumentExplorerState.noDocumentSelected:
case ViewModels.DocumentExplorerState.exisitingDocumentNoEdits: case ViewModels.DocumentExplorerState.existingDocumentNoEdits:
return false; return false;
case ViewModels.DocumentExplorerState.newDocumentValid: case ViewModels.DocumentExplorerState.newDocumentValid:
case ViewModels.DocumentExplorerState.newDocumentInvalid: case ViewModels.DocumentExplorerState.newDocumentInvalid:
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid: case ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid:
return true; return true;
case ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid: case ViewModels.DocumentExplorerState.existingDocumentDirtyValid:
return true; return true;
default: default:
@ -685,7 +685,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
ids.push(id); ids.push(id);
setDocumentIds(ids); setDocumentIds(ids);
setEditorState(ViewModels.DocumentExplorerState.exisitingDocumentNoEdits); setEditorState(ViewModels.DocumentExplorerState.existingDocumentNoEdits);
TelemetryProcessor.traceSuccess( TelemetryProcessor.traceSuccess(
Action.CreateDocument, Action.CreateDocument,
{ {
@ -759,7 +759,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
documentId.id(updatedDocument.id); documentId.id(updatedDocument.id);
} }
}); });
setEditorState(ViewModels.DocumentExplorerState.exisitingDocumentNoEdits); setEditorState(ViewModels.DocumentExplorerState.existingDocumentNoEdits);
TelemetryProcessor.traceSuccess( TelemetryProcessor.traceSuccess(
Action.UpdateDocument, Action.UpdateDocument,
{ {
@ -1179,7 +1179,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
setInitialDocumentContent(content); setInitialDocumentContent(content);
const newState = documentId const newState = documentId
? ViewModels.DocumentExplorerState.exisitingDocumentNoEdits ? ViewModels.DocumentExplorerState.existingDocumentNoEdits
: ViewModels.DocumentExplorerState.newDocumentValid; : ViewModels.DocumentExplorerState.newDocumentValid;
setEditorState(newState); setEditorState(newState);
} }
@ -1193,7 +1193,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
newContent === initialDocumentContent && newContent === initialDocumentContent &&
editorState !== ViewModels.DocumentExplorerState.newDocumentValid editorState !== ViewModels.DocumentExplorerState.newDocumentValid
) { ) {
setEditorState(ViewModels.DocumentExplorerState.exisitingDocumentNoEdits); setEditorState(ViewModels.DocumentExplorerState.existingDocumentNoEdits);
return; return;
} }
@ -1221,7 +1221,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
return; return;
} }
setEditorState(ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid); setEditorState(ViewModels.DocumentExplorerState.existingDocumentDirtyValid);
}; };
const onInvalidDocumentEdit = (): void => { const onInvalidDocumentEdit = (): void => {
@ -1234,10 +1234,10 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
} }
if ( if (
editorState === ViewModels.DocumentExplorerState.exisitingDocumentNoEdits || editorState === ViewModels.DocumentExplorerState.existingDocumentNoEdits ||
editorState === ViewModels.DocumentExplorerState.exisitingDocumentDirtyValid editorState === ViewModels.DocumentExplorerState.existingDocumentDirtyValid
) { ) {
setEditorState(ViewModels.DocumentExplorerState.exisitingDocumentDirtyInvalid); setEditorState(ViewModels.DocumentExplorerState.existingDocumentDirtyInvalid);
return; return;
} }
}; };
@ -1280,7 +1280,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
// If only one selection, we consider as a click // If only one selection, we consider as a click
if (selectedRows.size === 1) { if (selectedRows.size === 1) {
setEditorState(ViewModels.DocumentExplorerState.exisitingDocumentNoEdits); setEditorState(ViewModels.DocumentExplorerState.existingDocumentNoEdits);
} }
setSelectedRows(selectedRows); setSelectedRows(selectedRows);
@ -1443,7 +1443,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
setSelectedDocumentContentBaseline(value); setSelectedDocumentContentBaseline(value);
setDocumentIds(ids); setDocumentIds(ids);
setEditorState(ViewModels.DocumentExplorerState.exisitingDocumentNoEdits); setEditorState(ViewModels.DocumentExplorerState.existingDocumentNoEdits);
TelemetryProcessor.traceSuccess( TelemetryProcessor.traceSuccess(
Action.CreateDocument, Action.CreateDocument,
{ {
@ -1514,7 +1514,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
documentId.id(id.id()); documentId.id(id.id());
} }
}); });
setEditorState(ViewModels.DocumentExplorerState.exisitingDocumentNoEdits); setEditorState(ViewModels.DocumentExplorerState.existingDocumentNoEdits);
TelemetryProcessor.traceSuccess( TelemetryProcessor.traceSuccess(
Action.UpdateDocument, Action.UpdateDocument,
{ {

View File

@ -53,7 +53,7 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
if (this.isNew()) { if (this.isNew()) {
this.editorState = ko.observable(ViewModels.ScriptEditorState.newInvalid); this.editorState = ko.observable(ViewModels.ScriptEditorState.newInvalid);
} else { } else {
this.editorState = ko.observable(ViewModels.ScriptEditorState.exisitingNoEdits); this.editorState = ko.observable(ViewModels.ScriptEditorState.existingNoEdits);
} }
this.id = editable.observable<string>(); this.id = editable.observable<string>();
@ -77,15 +77,15 @@ export default abstract class ScriptTabBase extends TabsBase implements ViewMode
this.editorState(ViewModels.ScriptEditorState.newInvalid); this.editorState(ViewModels.ScriptEditorState.newInvalid);
} }
break; break;
case ViewModels.ScriptEditorState.exisitingDirtyInvalid: case ViewModels.ScriptEditorState.existingDirtyInvalid:
case ViewModels.ScriptEditorState.exisitingDirtyValid: case ViewModels.ScriptEditorState.existingDirtyValid:
if (isValid) { if (isValid) {
this.editorState(ViewModels.ScriptEditorState.exisitingDirtyValid); this.editorState(ViewModels.ScriptEditorState.existingDirtyValid);
} else { } else {
this.editorState(ViewModels.ScriptEditorState.exisitingDirtyInvalid); this.editorState(ViewModels.ScriptEditorState.existingDirtyInvalid);
} }
break; break;
case ViewModels.ScriptEditorState.exisitingDirtyValid: case ViewModels.ScriptEditorState.existingDirtyValid:
default: default:
break; break;
} }

View File

@ -404,7 +404,7 @@ export default class StoredProcedureTabComponent extends React.Component<
this.node = this.collection.createStoredProcedureNode(createdResource); this.node = this.collection.createStoredProcedureNode(createdResource);
this.props.scriptTabBaseInstance.node = this.node; this.props.scriptTabBaseInstance.node = this.node;
useTabs.getState().updateTab(this.props.scriptTabBaseInstance); useTabs.getState().updateTab(this.props.scriptTabBaseInstance);
this.props.scriptTabBaseInstance.editorState(ViewModels.ScriptEditorState.exisitingNoEdits); this.props.scriptTabBaseInstance.editorState(ViewModels.ScriptEditorState.existingNoEdits);
this.setState({ this.setState({
executeButton: { executeButton: {

View File

@ -114,7 +114,7 @@ export class TriggerTabContent extends Component<TriggerTab, ITriggerTabContentS
}, },
startKey, startKey,
); );
this.props.editorState(ViewModels.ScriptEditorState.exisitingNoEdits); this.props.editorState(ViewModels.ScriptEditorState.existingNoEdits);
this.props.isExecuting(false); this.props.isExecuting(false);
} }
} catch (createError) { } catch (createError) {

View File

@ -161,7 +161,7 @@ export default class UserDefinedFunctionTabContent extends Component<
}, },
startKey, startKey,
); );
this.props.editorState(ViewModels.ScriptEditorState.exisitingNoEdits); this.props.editorState(ViewModels.ScriptEditorState.existingNoEdits);
} }
} catch (createError) { } catch (createError) {
this.props.isExecutionError(true); this.props.isExecutionError(true);