Notebooks: Save cell connection name in cell metadata (#13208)

* save connection info in notebook metadata

* update attachTo dropdown based on saved alias

* add setting for saving connection (default=false)

* save/read cell connection name to/from metadata

* get started on toggling multi connection mode

* add activeConnection property to cell model

* add changeContext method for cell

* add comments

* add unit test for reading connection name

* save connection mode in metadata

* clean up code

* address PR comments
This commit is contained in:
Lucy Zhang
2020-11-12 10:44:34 -08:00
committed by GitHub
parent 468119caa4
commit 32a6385fef
5 changed files with 38 additions and 6 deletions

View File

@@ -1024,4 +1024,20 @@ suite('Cell Model', function (): void {
assert(!isEditMode);
});
test('Should read connection name from notebook metadata', async function () {
const connectionName = 'connectionName';
let notebookModel = new NotebookModelStub({
name: '',
version: '',
mimetype: ''
});
let contents: nb.ICellContents = {
cell_type: CellTypes.Code,
source: '',
metadata: { connection_name: connectionName }
};
let model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
assert.equal(model.savedConnectionName, connectionName);
});
});