diff --git a/client/directives/components/mirrorDockerfile/addDockerfileDirective.js b/client/directives/components/mirrorDockerfile/addDockerfileDirective.js index 87325a323..669073f24 100644 --- a/client/directives/components/mirrorDockerfile/addDockerfileDirective.js +++ b/client/directives/components/mirrorDockerfile/addDockerfileDirective.js @@ -4,8 +4,6 @@ require('app') .directive('addDockerfile', addDockerfile); function addDockerfile( - $q, - $timeout, fetchRepoDockerfile, doesDockerfileExist ) { @@ -20,6 +18,8 @@ function addDockerfile( fileType: '@' }, link: function ($scope, elem, attrs, MDC) { + $scope.MDC = MDC; + var COMPOSE_DEFAULT = 'docker-compose.yml'; var COMPOSE_TEST_DEFAULT = 'docker-compose.test.yml'; var DOCKER_DEFAULT = 'Dockerfile'; diff --git a/client/directives/components/mirrorDockerfile/addDockerfileView.jade b/client/directives/components/mirrorDockerfile/addDockerfileView.jade index 652411de5..45323c9e0 100644 --- a/client/directives/components/mirrorDockerfile/addDockerfileView.jade +++ b/client/directives/components/mirrorDockerfile/addDockerfileView.jade @@ -15,7 +15,7 @@ form( dockerfile-exists-validator = "{{fileType}}" full-repo = "fullRepo" id = "add-dockerfile-input" - ng-disabled = "state.dockerFileAdded || $root.featureFlags.composeEditing" + ng-disabled = "state.dockerFileAdded || $root.featureFlags.composeEditing || MDC.isSaving()" ng-model = "newDockerfile" ng-model-options = "{ debounce: { 'default': 100, 'blur': 0 } }" placeholder = "{{ fileName }}" diff --git a/client/directives/components/mirrorDockerfile/composeFilePath.js b/client/directives/components/mirrorDockerfile/composeFilePath.js index 96cb970f5..e514f1d49 100644 --- a/client/directives/components/mirrorDockerfile/composeFilePath.js +++ b/client/directives/components/mirrorDockerfile/composeFilePath.js @@ -21,6 +21,8 @@ function composeFilePath( fullRepo: '=' }, link: function ($scope, elem, attr, MDC) { + $scope.MDC = MDC; + MDC.state.configurationMethod = 'dockerComposeFile'; $scope.dockerComposeState = MDC.state; $scope.dockerfile = {}; diff --git a/client/directives/components/mirrorDockerfile/mirrorDockerfileController.js b/client/directives/components/mirrorDockerfile/mirrorDockerfileController.js index 6772ccaa6..e3fad7b8b 100644 --- a/client/directives/components/mirrorDockerfile/mirrorDockerfileController.js +++ b/client/directives/components/mirrorDockerfile/mirrorDockerfileController.js @@ -6,7 +6,6 @@ require('app') function MirrorDockerfileController( $q, $rootScope, - $timeout, errs, doesDockerfileExist, fetchRepoDockerfile, @@ -74,5 +73,9 @@ function MirrorDockerfileController( } }); }; + + MDC.isSaving = function () { + return $rootScope.isLoading.newContainerSingleRepo || $rootScope.isLoading.creatingDockerCompose; + }; } diff --git a/client/directives/components/newContainer/forms/compose/composeFilePathView.jade b/client/directives/components/newContainer/forms/compose/composeFilePathView.jade index cd217c42a..11e16438a 100644 --- a/client/directives/components/newContainer/forms/compose/composeFilePathView.jade +++ b/client/directives/components/newContainer/forms/compose/composeFilePathView.jade @@ -6,6 +6,7 @@ ng-disabled = "$root.featureFlags.composeEditing" ng-model = "pathEnabled" type = "checkbox" + ng-disabled = "MDC.isSaving()" ) .toggle-group.toggle-sm @@ -41,7 +42,7 @@ - Copy: "Select a Container" fancy-select.btn-md.white( disabled - ng-disabled = "loadingFile || !dockerComposeTestServices.length" + ng-disabled = "loadingFile || !dockerComposeTestServices.length || MDC.isSaving()" ng-required = "true" spinner-flag = "loadingFile" value = "dockerComposeState.testReporter" diff --git a/client/directives/components/newContainer/forms/nameNewServiceView.jade b/client/directives/components/newContainer/forms/nameNewServiceView.jade index a79a99bb4..598270495 100644 --- a/client/directives/components/newContainer/forms/nameNewServiceView.jade +++ b/client/directives/components/newContainer/forms/nameNewServiceView.jade @@ -13,6 +13,7 @@ label required spellcheck = "false" unique-validator = "NCC.state.namesForAllInstances" + ng-disabled = "NCC.isSaving()" ) svg.iconnables.icons-check( ng-if = "NCC.nameForm.$valid" diff --git a/client/directives/components/newContainer/forms/setupMethodView.jade b/client/directives/components/newContainer/forms/setupMethodView.jade index f4c69c261..e63778103 100644 --- a/client/directives/components/newContainer/forms/setupMethodView.jade +++ b/client/directives/components/newContainer/forms/setupMethodView.jade @@ -17,7 +17,7 @@ label.grid-block.align-center.btn.btn-radio( label.grid-block.align-center.btn.btn-radio( data-event-name = "Selected Compose Setup" ng-class = "{'active': NCC.state.dockerFileTab === 'compose'}" - ng-click = "NCC.state.dockerFileTab = 'compose'; NCC.state.configurationMethod = 'dockerComposeFile'" + ng-click = "NCC.setToComposeTab()" ) svg.grid-block.shrink.btn.btn-xs.btn-icon.btn-add.iconnables.icons-check use( @@ -30,7 +30,7 @@ label.grid-block.align-center.btn.btn-radio( label.grid-block.align-center.btn.btn-radio( data-event-name = "Selected Dockerfile Setup" ng-class = "{'active': NCC.state.dockerFileTab === 'dockerfile'}" - ng-click = "NCC.state.dockerFileTab = 'dockerfile'; NCC.state.configurationMethod = 'dockerfile'" + ng-click = "NCC.setToDockerTab()" ng-if = "!$root.featureFlags.kubernetes" ) svg.grid-block.shrink.btn.btn-xs.btn-icon.btn-add.iconnables.icons-check diff --git a/client/directives/components/newContainer/newContainerController.js b/client/directives/components/newContainer/newContainerController.js index 09c01b12e..567915c45 100644 --- a/client/directives/components/newContainer/newContainerController.js +++ b/client/directives/components/newContainer/newContainerController.js @@ -396,6 +396,24 @@ function NewContainerController( (NCC.state.types.stage ? NCC.state.dockerComposeFile : NCC.state.types.test)))); }; + NCC.isSaving = function () { + return $rootScope.isLoading.newContainerSingleRepo || $rootScope.isLoading.creatingDockerCompose; + }; + + NCC.setToComposeTab = function () { + if (!NCC.isSaving()) { + NCC.state.dockerFileTab = 'compose'; + NCC.state.configurationMethod = 'dockerComposeFile'; + } + }; + + NCC.setToDockerTab = function () { + if (!NCC.isSaving()) { + NCC.state.dockerFileTab = 'dockerfile'; + NCC.state.configurationMethod = 'dockerfile'; + } + }; + NCC.populateComposeErrorMessage = function (errorMsg) { var err = /ValidationError(.*)/.exec(errorMsg); if (err) {