Skip to content

Commit

Permalink
[ML] Adding missed applyAsync calls (#28814)
Browse files Browse the repository at this point in the history
* [ML] Adding missed applyAsync calls

* fixing data recognizer results panel

* adding extra applySync calls to job saving in advanced job page

* fix for forcast results display issue
  • Loading branch information
jgowdyelastic committed Jan 24, 2019
1 parent 735cc82 commit ad48848
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export class DataRecognizer extends Component {
));
if (typeof this.results === 'object') {
this.results.count = results.length;
if (typeof this.results.onChange === 'function') {
this.results.onChange();
}
}

this.setState({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ module
$scope.metricFieldFilter = '';
$scope.fieldFilterIcon = 0;
$scope.fieldFilter = '';
$scope.recognizerResults = { count: 0 };
$scope.recognizerResults = {
count: 0,
onChange() {
$scope.$applyAsync();
}
};

$scope.showSidebar = isFullLicense();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ module.controller('MlNewJob',
);
// update status
$scope.ui.saveStatus.job = 2;
$scope.$applyAsync();

// save successful, attempt to open the job
mlJobService.openJob($scope.job.job_id)
Expand Down Expand Up @@ -631,10 +632,14 @@ module.controller('MlNewJob',
resp
);
$scope.saveLock = false;
})
.then(() => {
$scope.$applyAsync();
});
} else {
// no datafeed, so save is complete
$scope.saveLock = false;
$scope.$applyAsync();
}
}

Expand All @@ -650,6 +655,7 @@ module.controller('MlNewJob',
values: { message: result.resp.message }
})
);
$scope.$applyAsync();
}
}).catch((result) => {
$scope.ui.saveStatus.job = -1;
Expand All @@ -660,6 +666,7 @@ module.controller('MlNewJob',
values: { message: result.resp.message }
})
);
$scope.$applyAsync();
});
}
})
Expand All @@ -670,11 +677,13 @@ module.controller('MlNewJob',
})
);
console.log('save(): job validation failed. Jobs list could not be loaded.');
$scope.$applyAsync();
});
}
else {
msgs.error(jobValid.message);
console.log('save(): job validation failed');
$scope.$applyAsync();
}
};

Expand All @@ -689,6 +698,7 @@ module.controller('MlNewJob',
})
.then(() => {
msgs.clear();
$scope.$applyAsync();
$location.path('jobs');
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ module
msgs.error(i18n('xpack.ml.newJob.simple.singleMetric.saveDatafeedFailedErrorMessage', {
defaultMessage: 'Save datafeed failed: '
}), resp);
$scope.$applyAsync();
});
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { I18nProvider } from '@kbn/i18n/react';
import chrome from 'ui/chrome';
const mlAnnotationsEnabled = chrome.getInjected('mlAnnotationsEnabled', false);

module.directive('mlTimeseriesChart', function () {
module.directive('mlTimeseriesChart', function ($timeout) {

function link(scope, element) {
// Key dimensions for the viz and constituent charts.
Expand Down Expand Up @@ -85,7 +85,9 @@ module.directive('mlTimeseriesChart', function () {
renderReactComponent();

scope.$on('render', () => {
renderReactComponent();
$timeout(() => {
renderReactComponent();
});
});

function renderFocusChart() {
Expand Down

0 comments on commit ad48848

Please sign in to comment.