Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions client/controllers/instance/controllerInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,14 @@ function ControllerInstance(
// watch for deployed/started/stopped instance
// all watches necessary, updateDisplayedTabs expectst to be invoked
// after fetching instance, fetching container, and cointainer start
var containerWatch;
$scope.$watch('dataInstance.data.instance', handleInstance);
function handleInstance (instance) {
if (!instance) { return; } // instance still being fetched
containerWatch = $scope.$watch('dataInstance.data.instance.containers.models[0]', handleContainer);
}
var containerWatch =
$scope.$watch('dataInstance.data.instance.containers.models[0]', handleContainer);

function handleContainer (container) {
if (!container) {
buildLogsOnly();
}
else { // handles both container.error and container.dockerContainer states
containerWatch(); // once, got container
$scope.$watch('dataInstance.data.instance.containers.models[0].attrs.inspect.State.Running', displayTabsForContainerState); // once
}
}
Expand Down Expand Up @@ -140,6 +136,10 @@ function ControllerInstance(
displayTabsForContainerState(keypather.get(container, 'running()'));
}

$scope.$on('$destroy', function () {
containerWatch();
});

function buildLogsOnly () {
data.openItems.reset([]);
// Set to true if we see the instance in an undeployed state
Expand Down
10 changes: 7 additions & 3 deletions client/services/serviceHelperInstanceActionsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function HelperInstanceActionsModal(
$timeout,
async,
keypather,
errs,
updateEnvName,
$localStorage
) {
Expand Down Expand Up @@ -73,12 +74,15 @@ function HelperInstanceActionsModal(
$rootScope.dataApp.data.loading = true;
if (!opts.env) { return; }
$scope.instance.update(opts, function (err) {
$rootScope.safeApply();
if (err) { throw err; }
$rootScope.dataApp.data.loading = false;
$rootScope.safeApply();
// update instances collection to update
// viewInstanceList
$state.go('instance.instance', $stateParams);
$scope.instance.redeploy(function(err) {
$rootScope.dataApp.data.loading = false;
errs.handler(err);
$state.go('instance.instance', $stateParams, {reload: true});
});
});
if (cb) {
cb();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ngStorage": "git+https://github.com/cflynn07/ngStorage.git#v0.4.0",
"primus": "^2.3.0",
"regexp-quote": "0.0.0",
"runnable": "git+ssh://git@github.com:CodeNow/runnable-api-client#v0.38.4",
"runnable": "git+ssh://git@github.com:CodeNow/runnable-api-client#v0.38.6",
"term.js": "git://github.com/Runnable/term.js.git#6a1d4ec38aa26c61fb6a4f0a20ba5cb207e66f2d",
"uuid": "^2.0.1"
},
Expand Down