Skip to content

Commit 53882a9

Browse files
committed
Add initial implementation for creating mirrored instances
1 parent fad415a commit 53882a9

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

client/directives/modals/modalNewContainer/newContainerModalController.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ function NewContainerModalController(
153153
loading(NCMC.name + 'SingleRepo', true);
154154
return createNewBuildAndFetchBranch($rootScope.dataApp.data.activeAccount, repo, dockerfilePath)
155155
.then(function (repoBuildAndBranch) {
156-
NCMC.newRepositoryContainer(repoBuildAndBranch);
156+
if (dockerfilePath) {
157+
NCMC.newMirrorRepositoryContainer(repoBuildAndBranch);
158+
} else {
159+
NCMC.newRepositoryContainer(repoBuildAndBranch);
160+
}
157161
})
158162
.finally(function () {
159163
loading(NCMC.name + 'SingleRepo', false);
@@ -173,6 +177,20 @@ function NewContainerModalController(
173177
}, inputs)
174178
});
175179
};
180+
181+
NCMC.newMirrorRepositoryContainer = function (inputs) {
182+
close();
183+
ModalService.showModal({
184+
controller: 'SetupMirrorServerModalController',
185+
controllerAs: 'SMC',
186+
templateUrl: 'setupMirrorServerModalView',
187+
inputs: angular.extend({
188+
repo: null,
189+
build: null,
190+
masterBranch: null
191+
}, inputs)
192+
});
193+
};
176194
// TODO: Remove code when removing `dockerFileMirroing` code
177195
NCMC.newTemplateContainer = function () {
178196
close();

client/services/serviceCreateNewBuild.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ function createNewBuild(
6161
}
6262

6363
function createNewBuildAndFetchBranch(
64+
createDockerfileFromSource,
6465
createNewBuild,
6566
errs,
6667
fetchStackData,
@@ -78,6 +79,9 @@ function createNewBuildAndFetchBranch(
7879
})
7980
.then(function (buildWithVersion) {
8081
inputs.build = buildWithVersion;
82+
if (!inputs.build.contextVersion.source) {
83+
return createDockerfileFromSource(inputs.build.contextVersion, 'nodejs');
84+
}
8185
return buildWithVersion.contextVersion;
8286
})
8387
.then(function () {

0 commit comments

Comments
 (0)