fix issue where sometimes ownerUri was null (#7094)

This commit is contained in:
Aditya Bist
2019-09-05 15:36:51 -07:00
committed by GitHub
parent 3281d28de7
commit 485cb43a34
2 changed files with 7 additions and 8 deletions

View File

@@ -43,13 +43,12 @@ export class CmsResourceTreeNode extends CmsResourceTreeNodeBase {
this.connection.options.password = await this.appContext.cmsUtils.getPassword(this.connection.options.user);
}
}
return this.appContext.cmsUtils.createCmsServer(this.connection, this.name, this.description).then((result) => {
// cache new connection is different from old one
if (this.appContext.cmsUtils.didConnectionChange(this._connection, result.connection)) {
this._connection = result.connection;
this._ownerUri = result.ownerUri;
this.appContext.cmsUtils.cacheRegisteredCmsServer(this.name, this.description, this.ownerUri, this.connection);
}
return this.appContext.cmsUtils.createCmsServer(this.connection, this.name, this.description).then(async (result) => {
// update the owner uri and the connection
this._ownerUri = result.ownerUri;
this._connection = result.connection;
await this.appContext.cmsUtils.cacheRegisteredCmsServer(this.name, this.description, this.ownerUri, this.connection);
if (result.listRegisteredServersResult.registeredServersList) {
result.listRegisteredServersResult.registeredServersList.forEach((registeredServer) => {
nodes.push(new RegisteredServerTreeNode(

View File

@@ -46,7 +46,7 @@ export class CmsResourceTreeProvider implements TreeDataProvider<TreeNode>, ICms
server.ownerUri,
server.connection,
this._appContext, this, null));
this.appContext.cmsUtils.cacheRegisteredCmsServer(server.name, server.description,
await this.appContext.cmsUtils.cacheRegisteredCmsServer(server.name, server.description,
server.ownerUri, server.connection);
});
return servers;