mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-07-13 15:34:36 +01:00
Use feature flag instead of ko observable
This commit is contained in:
parent
bc951b4e13
commit
b1a434c011
@ -56,7 +56,6 @@ export default class DocumentsTab extends TabsBase {
|
|||||||
public discardNewDocumentChangesButton: ViewModels.Button;
|
public discardNewDocumentChangesButton: ViewModels.Button;
|
||||||
public discardExisitingDocumentChangesButton: ViewModels.Button;
|
public discardExisitingDocumentChangesButton: ViewModels.Button;
|
||||||
public deleteExisitingDocumentButton: ViewModels.Button;
|
public deleteExisitingDocumentButton: ViewModels.Button;
|
||||||
public copliotEntityButton: ViewModels.Button;
|
|
||||||
public displayedError: ko.Observable<string>;
|
public displayedError: ko.Observable<string>;
|
||||||
public accessibleDocumentList: AccessibleVerticalList;
|
public accessibleDocumentList: AccessibleVerticalList;
|
||||||
public dataContentsGridScrollHeight: ko.Observable<string>;
|
public dataContentsGridScrollHeight: ko.Observable<string>;
|
||||||
@ -308,13 +307,13 @@ export default class DocumentsTab extends TabsBase {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.copliotEntityButton = {
|
this.copilotEntityButton = {
|
||||||
enabled: ko.computed<boolean>(() => {
|
enabled: ko.computed<boolean>(() => {
|
||||||
return userContext.features.enableCopilot;
|
return userContext.features.enableCopilot;
|
||||||
}),
|
}),
|
||||||
visible: ko.computed<boolean>(() => {
|
visible: ko.computed<boolean>(() => {
|
||||||
return userContext.features.enableCopilot;
|
return userContext.features.enableCopilot;
|
||||||
})
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.buildCommandBarOptions();
|
this.buildCommandBarOptions();
|
||||||
@ -782,8 +781,8 @@ export default class DocumentsTab extends TabsBase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public onCopilotEntityClick = (): void => {
|
public onCopilotEntityClick = (): void => {
|
||||||
useTabs.getState().openAndActivateReactTab(ReactTabKind.QueryCopilot)
|
useTabs.getState().openAndActivateReactTab(ReactTabKind.QueryCopilot);
|
||||||
}
|
};
|
||||||
|
|
||||||
protected _loadNextPageInternal(): Q.Promise<DataModels.DocumentId[]> {
|
protected _loadNextPageInternal(): Q.Promise<DataModels.DocumentId[]> {
|
||||||
return Q(this._documentsIterator.fetchNext().then((response) => response.resources));
|
return Q(this._documentsIterator.fetchNext().then((response) => response.resources));
|
||||||
@ -901,7 +900,7 @@ export default class DocumentsTab extends TabsBase {
|
|||||||
buttons.push(DocumentsTab._createUploadButton(this.collection.container));
|
buttons.push(DocumentsTab._createUploadButton(this.collection.container));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.copliotEntityButton.visible()) {
|
if (userContext.features.enableCopilot) {
|
||||||
const label = "Query Copliot";
|
const label = "Query Copliot";
|
||||||
buttons.push({
|
buttons.push({
|
||||||
iconSrc: CopilotQueryTablesTab,
|
iconSrc: CopilotQueryTablesTab,
|
||||||
@ -910,7 +909,7 @@ export default class DocumentsTab extends TabsBase {
|
|||||||
commandButtonLabel: label,
|
commandButtonLabel: label,
|
||||||
ariaLabel: label,
|
ariaLabel: label,
|
||||||
hasPopup: true,
|
hasPopup: true,
|
||||||
disabled: !this.copliotEntityButton.enabled(),
|
disabled: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user