Make sure to initialize trigger setup when *both* values change
Hopefully fixes https://www.pivotaltracker.com/story/show/141245817
This commit is contained in:
parent
b45dc07dce
commit
f2750ba645
1 changed files with 16 additions and 8 deletions
|
@ -62,14 +62,8 @@ export class ManageTriggerGithostComponent implements ng.IComponentController {
|
||||||
|
|
||||||
public $onInit(): void {
|
public $onInit(): void {
|
||||||
// TODO: Replace $scope.$watch with @Output methods for child component mutations or $onChanges for parent mutations
|
// TODO: Replace $scope.$watch with @Output methods for child component mutations or $onChanges for parent mutations
|
||||||
this.$scope.$watch(() => this.trigger, (trigger) => {
|
this.$scope.$watch(() => this.trigger, this.initialSetup.bind(this));
|
||||||
if (trigger && this.repository) {
|
this.$scope.$watch(() => this.repository, this.initialSetup.bind(this));
|
||||||
this.config = trigger['config'] || {};
|
|
||||||
this.namespaceTitle = 'organization';
|
|
||||||
this.local.selectedNamespace = null;
|
|
||||||
this.loadNamespaces();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.$scope.$watch(() => this.local.selectedNamespace, (namespace) => {
|
this.$scope.$watch(() => this.local.selectedNamespace, (namespace) => {
|
||||||
if (namespace) {
|
if (namespace) {
|
||||||
|
@ -102,6 +96,20 @@ export class ManageTriggerGithostComponent implements ng.IComponentController {
|
||||||
this.$scope.$watch(() => this.local.robotOptions.filter, this.buildOrderedRobotAccounts);
|
this.$scope.$watch(() => this.local.robotOptions.filter, this.buildOrderedRobotAccounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private initialSetup(): void {
|
||||||
|
if (!this.repository || !this.trigger) { return; }
|
||||||
|
|
||||||
|
if (this.namespaceTitle) {
|
||||||
|
// Already setup.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config = this.trigger['config'] || {};
|
||||||
|
this.namespaceTitle = 'organization';
|
||||||
|
this.local.selectedNamespace = null;
|
||||||
|
this.loadNamespaces();
|
||||||
|
}
|
||||||
|
|
||||||
public getTriggerIcon(): any {
|
public getTriggerIcon(): any {
|
||||||
return this.TriggerService.getIcon(this.trigger.service);
|
return this.TriggerService.getIcon(this.trigger.service);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue