-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actions aggregated at job model level (#18733)
- Loading branch information
1 parent
d6c350a
commit 3a931d1
Showing
4 changed files
with
144 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: BUSL-1.1 | ||
*/ | ||
|
||
import { attr } from '@ember-data/model'; | ||
import { fragmentOwner } from 'ember-data-model-fragments/attributes'; | ||
import Fragment from 'ember-data-model-fragments/fragment'; | ||
|
||
export default class ActionModel extends Fragment { | ||
@attr('string') name; | ||
@attr('string') command; | ||
@attr() args; | ||
@fragmentOwner() task; | ||
} |
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 |
---|---|---|
|
@@ -155,6 +155,18 @@ export default class Job extends Model { | |
|
||
@hasMany('recommendation-summary') recommendationSummaries; | ||
|
||
get actions() { | ||
return this.taskGroups.reduce((acc, taskGroup) => { | ||
return acc.concat( | ||
taskGroup.tasks | ||
.map((task) => { | ||
return task.get('actions').toArray(); | ||
}) | ||
.reduce((taskAcc, taskActions) => taskAcc.concat(taskActions), []) | ||
); | ||
}, []); | ||
} | ||
|
||
@computed('[email protected]') | ||
get drivers() { | ||
return this.taskGroups | ||
|
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