-
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.
Merge pull request #3938 from hashicorp/f-ui-polling-everywhere
UI: Polling Step 2 - Polling on all views
- Loading branch information
Showing
22 changed files
with
188 additions
and
65 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,3 @@ | ||
import Watchable from './watchable'; | ||
|
||
export default Watchable.extend(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Mixin from '@ember/object/mixin'; | ||
import { computed } from '@ember/object'; | ||
import { assert } from '@ember/debug'; | ||
|
||
export default Mixin.create({ | ||
watchers: computed(() => []), | ||
|
||
actions: { | ||
willTransition() { | ||
this.get('watchers').forEach(watcher => { | ||
assert('Watchers must be Ember Concurrency Tasks.', !!watcher.cancelAll); | ||
watcher.cancelAll(); | ||
}); | ||
}, | ||
}, | ||
}); |
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 |
---|---|---|
@@ -1,4 +1,16 @@ | ||
import Route from '@ember/routing/route'; | ||
import WithModelErrorHandling from 'nomad-ui/mixins/with-model-error-handling'; | ||
import { collect } from '@ember/object/computed'; | ||
import { watchRecord } from 'nomad-ui/utils/properties/watch'; | ||
import WithWatchers from 'nomad-ui/mixins/with-watchers'; | ||
|
||
export default Route.extend(WithModelErrorHandling); | ||
export default Route.extend(WithModelErrorHandling, WithWatchers, { | ||
setupController(controller, model) { | ||
controller.set('watcher', this.get('watch').perform(model)); | ||
return this._super(...arguments); | ||
}, | ||
|
||
watch: watchRecord('allocation'), | ||
|
||
watchers: collect('watch'), | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Route from '@ember/routing/route'; | ||
import { collect } from '@ember/object/computed'; | ||
import { watchAll } from 'nomad-ui/utils/properties/watch'; | ||
import WithWatchers from 'nomad-ui/mixins/with-watchers'; | ||
|
||
export default Route.extend(WithWatchers, { | ||
setupController(controller) { | ||
controller.set('watcher', this.get('watch').perform()); | ||
return this._super(...arguments); | ||
}, | ||
|
||
watch: watchAll('node'), | ||
watchers: collect('watch'), | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
import Route from '@ember/routing/route'; | ||
import RSVP from 'rsvp'; | ||
import { collect } from '@ember/object/computed'; | ||
import { watchRelationship } from 'nomad-ui/utils/properties/watch'; | ||
import WithWatchers from 'nomad-ui/mixins/with-watchers'; | ||
|
||
export default Route.extend({ | ||
export default Route.extend(WithWatchers, { | ||
model() { | ||
const job = this.modelFor('jobs.job'); | ||
return RSVP.all([job.get('deployments'), job.get('versions')]).then(() => job); | ||
}, | ||
|
||
setupController(controller, model) { | ||
controller.set('watchDeployments', this.get('watchDeployments').perform(model)); | ||
controller.set('watchVersions', this.get('watchVersions').perform(model)); | ||
return this._super(...arguments); | ||
}, | ||
|
||
watchDeployments: watchRelationship('deployments'), | ||
watchVersions: watchRelationship('versions'), | ||
|
||
watchers: collect('watchDeployments', 'watchVersions'), | ||
}); |
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,24 @@ | ||
import Route from '@ember/routing/route'; | ||
import { collect } from '@ember/object/computed'; | ||
import { watchRecord, watchRelationship } from 'nomad-ui/utils/properties/watch'; | ||
import WithWatchers from 'nomad-ui/mixins/with-watchers'; | ||
|
||
export default Route.extend(WithWatchers, { | ||
setupController(controller, model) { | ||
controller.set('watchers', { | ||
model: this.get('watch').perform(model), | ||
summary: this.get('watchSummary').perform(model), | ||
evaluations: this.get('watchEvaluations').perform(model), | ||
deployments: this.get('watchDeployments').perform(model), | ||
}); | ||
|
||
return this._super(...arguments); | ||
}, | ||
|
||
watch: watchRecord('job'), | ||
watchSummary: watchRelationship('summary'), | ||
watchEvaluations: watchRelationship('evaluations'), | ||
watchDeployments: watchRelationship('deployments'), | ||
|
||
watchers: collect('watch', 'watchSummary', 'watchEvaluations', 'watchDeployments'), | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
import Route from '@ember/routing/route'; | ||
import { collect } from '@ember/object/computed'; | ||
import { watchRelationship } from 'nomad-ui/utils/properties/watch'; | ||
import WithWatchers from 'nomad-ui/mixins/with-watchers'; | ||
|
||
export default Route.extend({ | ||
export default Route.extend(WithWatchers, { | ||
model() { | ||
const job = this.modelFor('jobs.job'); | ||
return job.get('versions').then(() => job); | ||
}, | ||
|
||
setupController(controller, model) { | ||
controller.set('watcher', this.get('watchVersions').perform(model)); | ||
return this._super(...arguments); | ||
}, | ||
|
||
watchVersions: watchRelationship('versions'), | ||
watchers: collect('watchVersions'), | ||
}); |
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
Oops, something went wrong.