mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fix trusting opened notebooks (#9615)
* Fix trusting opened notebooks * Addressing comments
This commit is contained in:
@@ -74,9 +74,22 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
|||||||
let bookPathToTrust = bookTreeItem ? bookTreeItem.root : this.currentBook?.bookPath;
|
let bookPathToTrust = bookTreeItem ? bookTreeItem.root : this.currentBook?.bookPath;
|
||||||
|
|
||||||
if (bookPathToTrust) {
|
if (bookPathToTrust) {
|
||||||
|
|
||||||
let trustChanged = this._bookTrustManager.setBookAsTrusted(bookPathToTrust);
|
let trustChanged = this._bookTrustManager.setBookAsTrusted(bookPathToTrust);
|
||||||
|
|
||||||
if (trustChanged) {
|
if (trustChanged) {
|
||||||
|
|
||||||
|
let notebookDocuments = this._apiWrapper.getNotebookDocuments();
|
||||||
|
|
||||||
|
if (notebookDocuments) {
|
||||||
|
// update trust state of opened items
|
||||||
|
notebookDocuments.forEach(document => {
|
||||||
|
let notebook = this.currentBook.getNotebook(document.uri.fsPath);
|
||||||
|
if (notebook && this._bookTrustManager.isNotebookTrustedByDefault(document.uri.fsPath)) {
|
||||||
|
document.setTrusted(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
this._apiWrapper.showInfoMessage(loc.msgBookTrusted);
|
this._apiWrapper.showInfoMessage(loc.msgBookTrusted);
|
||||||
} else {
|
} else {
|
||||||
this._apiWrapper.showInfoMessage(loc.msgBookAlreadyTrusted);
|
this._apiWrapper.showInfoMessage(loc.msgBookAlreadyTrusted);
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ export class ApiWrapper {
|
|||||||
return vscode.commands.executeCommand(BuiltInCommands.SetContext, key, value);
|
return vscode.commands.executeCommand(BuiltInCommands.SetContext, key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getNotebookDocuments() {
|
||||||
|
return azdata.nb.notebookDocuments;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the configuration for a extensionName
|
* Get the configuration for a extensionName
|
||||||
* @param extensionName The string name of the extension to get the configuration for
|
* @param extensionName The string name of the extension to get the configuration for
|
||||||
|
|||||||
Reference in New Issue
Block a user