diff --git a/kahuna/public/js/components/gr-image-cost-message/gr-image-cost-message.js b/kahuna/public/js/components/gr-image-cost-message/gr-image-cost-message.js index f66f70343a..4ab2cd32f3 100644 --- a/kahuna/public/js/components/gr-image-cost-message/gr-image-cost-message.js +++ b/kahuna/public/js/components/gr-image-cost-message/gr-image-cost-message.js @@ -8,19 +8,30 @@ import './gr-image-cost-message.css'; export const module = angular.module('gr.imageCostMessage', [imageService.name]); module.controller('grImageCostMessage', [ - 'imageService', + '$rootScope', 'imageService', - function (imageService) { + function ($rootScope, imageService) { let ctrl = this; ctrl.$onInit = () => { - const states = imageService(ctrl.image).states; - ctrl.messageState = (states.hasRestrictions) ? "conditional" : states.costState; - ctrl.restrictionsText = () => { - return restrictionsText(this.image); + function updateState() { + ctrl.image.get().then(image => { + const states = imageService(image).states; + ctrl.messageState = (states.hasRestrictions) ? "conditional" : states.costState; + ctrl.restrictionsText = () => { + return restrictionsText(image); + }; + }); }; + $rootScope.$on('images-updated', () => { + updateState(); + }); + + updateState(); + }; + } ]); diff --git a/kahuna/public/js/components/gr-metadata-validity/gr-metadata-validity.js b/kahuna/public/js/components/gr-metadata-validity/gr-metadata-validity.js index cd93249b1f..3fde4ca1d9 100644 --- a/kahuna/public/js/components/gr-metadata-validity/gr-metadata-validity.js +++ b/kahuna/public/js/components/gr-metadata-validity/gr-metadata-validity.js @@ -35,6 +35,10 @@ module.controller('grMetadataValidityCtrl', [ '$rootScope', '$window', function updateState(); }); + $rootScope.$on('images-updated', () => { + updateState(); + }); + updateState(); }; }]);