Skip to content

Commit 02368bf

Browse files
committed
Hook state for branches to new branch selector
1 parent db70618 commit 02368bf

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

client/directives/components/mirrorDockerfile/addDockerfileDirective.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,21 @@ function addDockerfile(
4646
MDC.loadDefaultDockerfile($scope.fullRepo, $scope.branchName, path, $scope.fileType);
4747
}
4848

49-
fetchRepoDockerfile($scope.fullRepo, $scope.branchName, path)
50-
.then(doesDockerfileExist)
51-
.then(function (file) {
52-
if (file) {
53-
$scope.newDockerfile = $scope.fileName;
54-
}
55-
});
49+
50+
function populateNewDockerfile () {
51+
return fetchRepoDockerfile($scope.fullRepo, $scope.branchName, path)
52+
.then(doesDockerfileExist)
53+
.then(function (file) {
54+
if (file) {
55+
$scope.newDockerfile = $scope.fileName;
56+
} else {
57+
// Account for files not found
58+
$scope.newDockerfile = undefined;
59+
}
60+
});
61+
}
62+
$scope.$watch('branchName', populateNewDockerfile);
63+
populateNewDockerfile();
5664

5765
$scope.$on('dockerfileExistsValidator', function ($event, path, fileType, dockerfile) {
5866
if (fileType === 'Dockerfile') {
@@ -67,7 +75,7 @@ function addDockerfile(
6775
$scope.dockerfile = dockerfile;
6876
MDC.state.dockerfile = dockerfile;
6977
return;
70-
}
78+
}
7179
});
7280

7381
$scope.closeDockerFileInput = function () {

client/directives/components/newContainer/forms/configureNewServiceView.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ section.grid-block.vertical.modal-body(
7878

7979
//- form for dockerfile setup
8080
.grid-block.vertical.label.views-dockerfile-setup(
81-
branch-name = "NCC.state.repo.attrs.default_branch"
81+
branch-name = "NCC.state.branch.attrs.name"
8282
mirror-dockerfile
8383
name = "'newContainer'"
8484
ng-if = "NCC.state.dockerFileTab !== 'kubernetes'"

client/directives/components/newContainer/forms/defaultBranchView.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
auto-update = "true"
44
branch-selector
55
loading-promises-target = "editServerModal"
6-
state = "state"
6+
state = "NCC.state"
77
)
88
small.padding-xxs.small Select the first branch you want to add.

0 commit comments

Comments
 (0)