Introduce connection API (#598)

Including getCurrentConnection, getActiveConnections, and getCredentials
This commit is contained in:
Matt Irvine
2018-02-06 15:56:49 -08:00
committed by GitHub
parent f5aa49ebb9
commit 3df522536f
15 changed files with 264 additions and 3 deletions

View File

@@ -209,4 +209,13 @@ export class ConnectionStatusManager {
}
return providerId;
}
/**
* Get a list of the active connection profiles managed by the status manager
*/
public getActiveConnectionProfiles(): ConnectionProfile[] {
let profiles = Object.values(this._connections).map((connectionInfo: ConnectionManagementInfo) => connectionInfo.connectionProfile);
// Remove duplicate profiles that may be listed multiple times under different URIs by filtering for profiles that don't have the same ID as an earlier profile in the list
return profiles.filter((profile, index) => profiles.findIndex(otherProfile => otherProfile.id === profile.id) === index);
}
}