forked from awslabs/service-workbench-on-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update APU feature to support onboarding and updating AppStream
accounts (awslabs#606)
- Loading branch information
Tim Nguyen
committed
Jul 30, 2021
1 parent
41a9936
commit 47872f2
Showing
22 changed files
with
424 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/accounts/AccountUtils.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import _ from 'lodash'; | ||
|
||
function getAccountIdsOfActiveEnvironments(scEnvs, projects, indexes) { | ||
const nonActivateStates = ['FAILED', 'TERMINATED', 'UNKNOWN']; | ||
const activeEnvs = scEnvs.filter(env => { | ||
return !nonActivateStates.includes(env.status); | ||
}); | ||
const projectToActiveEnvs = _.groupBy(activeEnvs, 'projectId'); | ||
|
||
const indexIdToAwsAccountId = {}; | ||
indexes.forEach(index => { | ||
indexIdToAwsAccountId[index.id] = index.awsAccountId; | ||
}); | ||
|
||
const projectIdToAwsAccountId = {}; | ||
projects.forEach(project => { | ||
projectIdToAwsAccountId[project.id] = indexIdToAwsAccountId[project.indexId]; | ||
}); | ||
|
||
return Object.keys(projectToActiveEnvs).map(projectId => { | ||
return projectIdToAwsAccountId[projectId]; | ||
}); | ||
} | ||
|
||
module.exports = { | ||
getAccountIdsOfActiveEnvironments, | ||
}; |
Oops, something went wrong.