Skip to content

San 3912 dockerfile mirroing #1553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 100 commits into from
Apr 26, 2016
Merged
Show file tree
Hide file tree
Changes from 88 commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
706943c
Add fetchRepoDockerfiles service
thejsj Apr 6, 2016
5a6ca8e
Add dockerfile fetching and showing
thejsj Apr 6, 2016
eaf3d33
Remove unused params from serviceCreateNewBuild
thejsj Apr 6, 2016
6ef5b70
Add dockerfilepath when creating instance
thejsj Apr 6, 2016
6c1b38a
Add loading of Dockerfile in dockerfile mirror mode
thejsj Apr 7, 2016
171d139
Merge branch 'SAN-3925-refactor-container-creation-code-allow-new-mod…
thejsj Apr 7, 2016
80f5853
Dont updatedockerfile if mirroing dockerfile
thejsj Apr 7, 2016
43a1780
Merge branch 'edit-and-setup-modal-use-same-template' into SAN-3912-d…
thejsj Apr 8, 2016
215ba42
Fix stack selector for all views
thejsj Apr 9, 2016
4a5f7d4
Add initial implementation for creating mirrored instances
thejsj Apr 9, 2016
b051ab4
Refactor TAB_VISIBILITY
thejsj Apr 9, 2016
f010c0b
Fix instance creation in mirror dockerfile mode
thejsj Apr 9, 2016
2e85c37
Add changeFrormMirrorModeToAdvanced function
thejsj Apr 11, 2016
c1ed103
Fixing typos
thejsj Apr 11, 2016
cbb83b4
Change controller shortcut to allow view to be shared among multiple …
thejsj Apr 11, 2016
17cec4c
Add ability to switch between advanced and mirror mode
thejsj Apr 11, 2016
3972e05
Add advanced/mirror switching in SetupServerModalController
thejsj Apr 12, 2016
f5616d7
Make isMirroingDockerfile a part of advanced mode
thejsj Apr 12, 2016
3a4128a
Update template to refelect isMirroringDockerfile
thejsj Apr 12, 2016
7987d10
Fix advanced mode in setupServerModalController
thejsj Apr 12, 2016
f77ee14
Change method names
thejsj Apr 12, 2016
68d8ebe
Add switching in EditServerModalController
thejsj Apr 12, 2016
ea090ee
Fix editServerModalController test
thejsj Apr 13, 2016
7db6352
Fix serviceCreateNewBuildAndFetchBranch service tests
thejsj Apr 13, 2016
d1adcda
Fix tests in newContainerModalController
thejsj Apr 13, 2016
5a9bc06
Merge branch 'master' of github.com:CodeNow/runnable-angular into SAN…
thejsj Apr 14, 2016
470ef27
Fixing isTabVisible tests
thejsj Apr 14, 2016
2ace728
Create parent isTabVisible method. Add tests.
thejsj Apr 14, 2016
0c0a8cf
Fix repoFullName in controllers
thejsj Apr 14, 2016
0349ef9
Add tests for switchToMirrorMode
thejsj Apr 14, 2016
bbf04b0
Add tests for switchToAdvancedMode
thejsj Apr 14, 2016
49ac6fb
Add tests for switchBetweenAdvancedAndMirroring
thejsj Apr 14, 2016
a905df7
Add tests for openDockerfile
thejsj Apr 14, 2016
22a1f5e
Add tests for needsToBeDirtySaved
thejsj Apr 14, 2016
db7e48b
Add tests for isPrimaryButtonDisabled
thejsj Apr 14, 2016
f4714ae
Add tests for showAdvancedModeConfirm
thejsj Apr 14, 2016
f8cd1ae
Add tests for disableMirrorMode
thejsj Apr 14, 2016
83d4be5
Add tests for enableMirrorMode
thejsj Apr 15, 2016
4ce30f3
Add tests for minor functions
thejsj Apr 15, 2016
62e9b61
Add test for needsToBeDirtySaved
thejsj Apr 15, 2016
90b905a
Add test for showStackSelector
thejsj Apr 15, 2016
eb24244
Add tests for isPrimaryButtonDisabled
thejsj Apr 15, 2016
5fa4ff9
Move shared method to serverModalController
thejsj Apr 15, 2016
c0123b0
Add tests for getDisplayName
thejsj Apr 15, 2016
e587d47
Add tests for rebuild
thejsj Apr 15, 2016
9399ee6
Add tests for error handling in goToNextStep
thejsj Apr 15, 2016
fc51785
Add tests for init with Dockerfile
thejsj Apr 15, 2016
f06b962
Add initial test
thejsj Apr 18, 2016
93c437e
Move getElasticHostname and getDisplayName to serverModalController
thejsj Apr 18, 2016
826d9d0
Remove getElasticHostname and getDisplayName from setupMirrorServerCo…
thejsj Apr 18, 2016
c54c157
Remove insertHostname and isDirty from setupMirrorServerController
thejsj Apr 18, 2016
c897c03
Add tests for setupMirrorServerModalController
thejsj Apr 19, 2016
594f619
Delete unnecesary file. Update real file.
thejsj Apr 19, 2016
343f1a1
Add tests for createServer
thejsj Apr 19, 2016
442508a
Delete stupid file
thejsj Apr 19, 2016
1bac572
Delete stupid file
thejsj Apr 19, 2016
d49c453
Add tests for chooseDockerfileModeController
thejsj Apr 19, 2016
99f7740
Fixing SMC.needsToBeDirtySaved method name
thejsj Apr 19, 2016
f90b396
Change logic for showing next button
thejsj Apr 19, 2016
7339afa
Add hasDockerfileMirroring methods
thejsj Apr 19, 2016
ed8143a
Merge branch 'master' of github.com:CodeNow/runnable-angular into SAN…
thejsj Apr 19, 2016
78f0752
Clean up
thejsj Apr 19, 2016
956ce08
Add comments explaining isTabVisible
thejsj Apr 19, 2016
5467ea7
Add github url to Dockerfile
thejsj Apr 19, 2016
888e314
Fixing for isNonRepoContainer
thejsj Apr 19, 2016
abf424a
Adding loadingPromises to switching mirror/advanced
thejsj Apr 19, 2016
6d51745
Hide Change button behind featureFlag
thejsj Apr 20, 2016
2ca3d57
Fix isPrimaryButtonDisabled
thejsj Apr 20, 2016
681673c
Add verison for api-client
thejsj Apr 20, 2016
8b37753
Merge branch 'master' of github.com:CodeNow/runnable-angular into SAN…
thejsj Apr 20, 2016
cd16271
Fix loading state for repos
thejsj Apr 20, 2016
38b8769
Disable commit picker in fileTreeDir
thejsj Apr 20, 2016
56f006c
Merge branch 'master' of github.com:CodeNow/runnable-angular into SAN…
thejsj Apr 20, 2016
28767c4
Fixing Dockerfile opening. Removing unecessary tests
thejsj Apr 20, 2016
e77362f
Add cancel button to chooseDockerfileFileModalController view
thejsj Apr 20, 2016
d728d67
Temporarily removing last updated message from server card
thejsj Apr 20, 2016
14c5899
Add loading state in newContainerModalView
thejsj Apr 20, 2016
fa488af
Fix cross-browser issues for base64 decoding
thejsj Apr 20, 2016
a41a620
Show all repos in repo selection view
thejsj Apr 20, 2016
3fe3a72
Fix services tab
thejsj Apr 20, 2016
ef36dc9
Prevent modals from opening if previous modal was closed
thejsj Apr 20, 2016
515aab3
Clean up. Fix according to code review feedback. Fix branches in Mirr…
thejsj Apr 22, 2016
c2fc52f
Fix tests for Dockerfiles, branches
thejsj Apr 22, 2016
653502e
Add disabled class to button
thejsj Apr 22, 2016
7e9b537
Create service to fecth Dockerfile from contextVersion
thejsj Apr 22, 2016
16ddf55
Add fetchRepoDockerfile service
thejsj Apr 22, 2016
8255576
Add digest on keyup when filtering repos
thejsj Apr 22, 2016
f7da8e9
Switch isMirroringDockerfile to a string in advanced
thejsj Apr 25, 2016
904d02c
Fix tests for isMirroringDockerfile
thejsj Apr 25, 2016
a6f4651
Fixing tests
thejsj Apr 25, 2016
c007ed9
Removing unnecessary comment
thejsj Apr 25, 2016
ef9e083
Change tab visibility to services
thejsj Apr 25, 2016
bf1a346
Change parameters names
thejsj Apr 25, 2016
f17da88
Change regular expression for dockerfile path
thejsj Apr 25, 2016
31004e2
Add length check to regular expression
thejsj Apr 25, 2016
f51cbd6
Rebuild without cache if change from buildDockerfilePath
thejsj Apr 26, 2016
cb25669
fix active state on disabled list items
runnabro Apr 26, 2016
58d2c95
Merge branch 'SAN-3912-dockerfile-mirroing' of https://github.com/Cod…
runnabro Apr 26, 2016
bf59254
Revert "Rebuild without cache if change from buildDockerfilePath"
thejsj Apr 26, 2016
ee92e4c
Merge branch 'SAN-3912-dockerfile-mirroing' of github.com:CodeNow/run…
thejsj Apr 26, 2016
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
4 changes: 2 additions & 2 deletions client/directives/activePanel/directiveActivePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require('app')
*/
function activePanel(
$sce,
cleanStartCommand,
keypather
) {
return {
Expand All @@ -35,8 +36,7 @@ function activePanel(

$scope.startCommand = function () {
var cmd = keypather.get($scope, 'instance.containers.models[0].attrs.inspect.Config.Cmd[2]');
cmd = cmd || '';
return cmd.replace('until grep -q ethwe /proc/net/dev; do sleep 1; done;', '');
return cleanStartCommand(cmd);
};

$scope.showDebugCmd = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require('app')
* @ngInject
*/
function fileEditor(
$q,
$rootScope,
debounce,
errs,
Expand Down Expand Up @@ -57,6 +58,9 @@ function fileEditor(

function fetchFile() {
delete $scope.hasError;
if ($scope.readOnly && keypather.get($scope.file, 'attrs.body')) {
return $q.when(true);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think this could cause issues wherever we have to refetch a file. Off the top of my head, I think this can occur when an instance fails to be updated

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this to rely on a isRemoteCopy property on the file. Not sure if there's a better way to deal with this.

$scope.loading = true;
return promisify($scope.file, 'fetch')()
.then(resetFileBodyState)
Expand Down
5 changes: 3 additions & 2 deletions client/directives/components/explorer/fileTreeDirView.jade
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ li.folder(
li.file(
ng-class = "{\
active: acv.editing,\
disabled: !acv.id() || readOnly\
disabled: !acv.id() || readOnly || (acv.id() === fileModel.getMainAppCodeVersion().id()) \
}"
ng-repeat = "acv in fileModel.appCodeVersions.models | orderBy:'attrs.repo'"
pop-over
Expand All @@ -71,9 +71,10 @@ li.folder(
a(
ng-class = "{\
active: acv.editing,\
disabled: !acv.id()\
disabled: !acv.id() || acv.id() === fileModel.getMainAppCodeVersion().id()\
}"
ng-click = "popoverFileExplorerRepository.actions.editRepo(acv)"
ng-disabled = "acv.id() === fileModel.getMainAppCodeVersion().id()"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why both ng-disabled and disabled class?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The disabled class is what actually removes the styling form the button (not the disabled property). Without the class, button hover looks as follows (which is not what we want):

screen shot 2016-04-21 at 3 51 56 pm

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does ng-disabled do? The disabled attribute isn't used on anchor tags.

pop-over
pop-over-actions = "popoverFilesRepositoryCommitToggle.actions"
pop-over-active = "acv.editing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ function serverModalButtonsDirective(
},
link: function ($scope) {
$scope.showSaveAndBuild = function () {
return (!$scope.SMC.instance && $scope.SMC.state.step < 4) || ($scope.SMC.isDirty() === 'build' && !$rootScope.isLoading[$scope.SMC.name]);
return (
(!$scope.SMC.instance && ($scope.SMC.state.advanced || $scope.SMC.state.step < 4)) ||
($scope.SMC.isDirty() === 'build' && !$rootScope.isLoading[$scope.SMC.name])
);
};
$scope.createServerOrUpdate = function () {
if ($scope.isPrimaryButtonDisabled()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
button.btn.btn-md.gray.btn-cancel.float-left.js-animate(
ng-click = "SMC.actions.close()"
ng-if = "!SMC.instance && SMC.state.step < 4"
ng-if = "!SMC.instance"
type = "button"
) Cancel

Expand All @@ -9,14 +9,14 @@ button.btn.btn-md.btn-done.white.float-right(
'js-animate': SMC.state.step > 3\
}"
ng-click = "SMC.actions.close()"
ng-if = "SMC.instance || SMC.state.step > 3"
ng-if = "SMC.instance"
type = "button"
) Done

button.btn.btn-md.btn-primary.white.text-next.float-right(
ng-click = "SMC.goToNextStep()"
ng-disabled = "isPrimaryButtonDisabled()"
ng-if = "SMC.state.step < 3"
ng-if = "!SMC.instance && !SMC.isTabVisible('buildfiles')"
type = "button"
)
span.btn-text.float-left Next
Expand All @@ -39,8 +39,8 @@ button.btn.btn-md.white.btn-primary.float-right.js-animate(
'text-save-build': showSaveAndBuild()\
}"
ng-click = "thisForm.$invalid || createServerOrUpdate()"
ng-disabled = "(SMC.needToBeDirtyToSaved() && !SMC.isDirty()) || isPrimaryButtonDisabled()"
ng-if = "SMC.instance || SMC.state.step > 2"
ng-disabled = "(SMC.needsToBeDirtySaved() && !SMC.isDirty()) || isPrimaryButtonDisabled()"
ng-if = "SMC.instance || SMC.isTabVisible('buildfiles')"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not say the "next" button shouldn't be there if the buildfiles tab is not visible?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to this: ng-if = "!SMC.instance && !SMC.isTabVisible('buildfiles')" I think this makes the relationship more clear.

type = "submit"
)
span.btn-text.float-left Save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ ul.card-body.load(
li.btn.white(
ng-click = "openEditServerModal('repository')"
ng-class = "{'btn-hint': helpCards.cardIsActiveOnThisContainer(instance) && helpCards.getActiveCard().targets.repository}"
ng-if = "server.repo && (!server.advanced || $root.featureFlags.dockerfileMirroring)"
ng-if = "\
server.repo && \
(!server.advanced || $root.featureFlags.dockerfileMirroring) \
"
)
svg.iconnables
use(
Expand Down Expand Up @@ -120,7 +123,10 @@ ul.card-body.load(
li.btn.white(
ng-click = "openEditServerModal('translation')"
ng-class = "{'btn-hint': helpCards.cardIsActiveOnThisContainer(instance) && helpCards.getActiveCard().targets.findAndReplace}"
ng-if = "server.repo"
ng-if = "\
server.repo && \
!server.instance.hasDockerfileMirroring() \
"
)
svg.iconnables
use(
Expand All @@ -135,7 +141,11 @@ ul.card-body.load(
//- backup & restore
li.btn.white(
ng-click = "openEditServerModal('backup')"
ng-if = "!server.repo && $root.featureFlags.backup"
ng-if = "\
server.repo && \
!server.instance.hasDockerfileMirroring() && \
$root.featureFlags.backup \
"
)
svg.iconnables
use(
Expand All @@ -160,7 +170,7 @@ ul.card-body.load(
small.small.text-overflow(
ng-if = "server.advanced"
)
span.span.float-left {{$root.featureFlags.dockerfileMirroring ? 'Last updated 1m ago' : '—'}}
span.span.float-left
//- span.span.float-left Error: Dockerfile not found


Expand Down Expand Up @@ -189,7 +199,11 @@ ul.card-body.load(
//- only repo containers can sync
//- show this instead of the lock, when mirroring
svg.iconnables.icons-sync(
ng-if = "$root.featureFlags.dockerfileMirroring && server.advanced"
ng-if = "\
$root.featureFlags.dockerfileMirroring && \
server.advanced && \
server.instance.hasDockerfileMirroring() \
"
)
use(
xlink:href = "#icons-sync"
Expand All @@ -202,13 +216,16 @@ ul.card-body.load(
xlink:href = "#icons-alert-alt"
)
svg.iconnables.icons-lock(
ng-if = "!$root.featureFlags.dockerfileMirroring && !server.advanced"
ng-if = "!server.advanced"
)
use(
xlink:href = "#icons-lock"
)
svg.iconnables.icons-unlock(
ng-if = "!$root.featureFlags.dockerfileMirroring && server.advanced"
ng-if = "\
server.advanced && \
!($root.featureFlags.dockerfileMirroring || server.instance.hasDockerfileMirroring()) \
"
)
use(
xlink:href = "#icons-unlock"
Expand Down
2 changes: 1 addition & 1 deletion client/directives/environment/environmentController.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function EnvironmentController(
newContainer: function () {
return ModalService.showModal({
controller: 'NewContainerModalController',
controllerAs: 'NCMC',
controllerAs: 'MC', // Shared
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

templateUrl: 'newContainerModalView'
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
state = "SMC.state"
)
button.btn.btn-sm.white(
internal-modal-helper = "confirmSetupAdvancedModalView"
ng-click = "SMC.showAdvancedModeConfirm()"
ng-if = "$root.featureFlags.dockerfileMirroring"
)
svg.iconnables.icons-lock
Expand All @@ -58,22 +58,26 @@

//- add logic for repository containers only
.grid-block.shrink.align-center.well.gray.in.row-xxs(
ng-if = "$root.featureFlags.dockerfileMirroring && SMC.state.advanced"
ng-if = "$root.featureFlags.dockerfileMirroring && SMC.state.advanced && !SMC.state.isNonRepoContainer"
)
svg.grid-content.row-xxs.shrink.iconnables.icons-sync
use(
xlink:href = "#icons-sync"
)
.grid-content.row-xxs.text-overflow(
ng-class = "{'padding-right': state.syncing}"
ng-class = "{'padding-right': SMC.state.advanced === 'isMirroringDockerfile'}"
)
div Mirror Dockerfile
small.small(
ng-if = "state.syncing"
ng-if = "SMC.state.advanced === 'isMirroringDockerfile'"
)
span.span.text-overflow.float-left(
title = "reponame/path/to/dockerfile"
) Mirroring from GitHub: reponame/path/to/dockerfile
ng-title = "SMC.state.contextVersion.attrs.buildDockerfilePath"
) Mirroring from GitHub: {{ SMC.state.contextVersion.attrs.buildDockerfilePath }}
small.small(
ng-if = "SMC.state.advanced !== 'isMirroringDockerfile'"
)
span.span.text-overflow.float-left Mirror with a Dockerfile from this repo on GitHub.
//- when there's an error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have this case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you be more specific? Do you mean having no Dockerfile (Yes, we do have it) or having an error (We don't have it right now. Will be working on it).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The having an error :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's leave it for now. I'll have another PR that adds this functionality (you know, splitting PRs and stuff)

//- svg.iconnables.icons-alert-alt.float-left
//- use(
Expand All @@ -92,16 +96,15 @@
xlink:href = "#icons-help"
)
button.btn.btn-xxs.gray(
ng-if = "$root.featureFlags.dockerfileMirroringMultiple"
internal-modal-helper = "changeMirrorView"
) Change…
small.small(
ng-if = "!state.syncing"
) Mirror with a Dockerfile from this repo on GitHub.

//- this should open the 'viewModalSync' view when syncing has not been set up
label.toggle-wrapper
input.toggle-input(
ng-model = "state.syncing"
ng-model = "SMC.switchBetweenAdvancedAndMirroring"
ng-model-options = "{getterSetter: true}"
type = "checkbox"
)
.toggle-group.toggle-sm
Expand All @@ -114,7 +117,6 @@
'ace-runnable-dark': !$root.featureFlags.imAfraidOfTheDark,\
'ace-runnable-light': $root.featureFlags.imAfraidOfTheDark\
}"
ng-init = "state.syncing = null"
)

.sidebar(
Expand All @@ -123,7 +125,7 @@
explorer-title = "Build Files"
file-model = "SMC.state.contextVersion"
loading-promises-target = "editServerModal"
ng-if = "!state.syncing"
ng-if = "SMC.state.advanced !== 'isMirroringDockerfile'"
open-items = "SMC.openItems"
read-only = "!SMC.state.advanced"
root-dir = "SMC.state.contextVersion.rootDir"
Expand All @@ -135,11 +137,11 @@
file = "item"
file-editor
loading-promises-target = "editServerModal"
ng-class = "{'readonly': !SMC.state.advanced || state.syncing}"
ng-class = "{'readonly': !SMC.state.advanced || (SMC.state.advanced && SMC.state.advanced === 'isMirroringDockerfile') }"
ng-if = "item.state.type === 'File'"
ng-repeat = "item in SMC.openItems.models track by item.id()"
ng-show = "item === SMC.openItems.activeHistory.last()"
read-only = "!SMC.state.advanced || state.syncing"
read-only = "!SMC.state.advanced || SMC.state.advanced === 'isMirroringDockerfile'"
state = "SMC.state"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function stackSelectorForm(
scope: {
loadingPromisesTarget: '@?',
state: '=',
showStackSelector: '=',
isNewContainer: '=?'
},
link: function ($scope) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.label.clearfix(
ng-if = "showStackSelector"
ng-include = "'viewFormStackSelector'"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
ng-class = "{'in': active}"
)
.popover-header Choose Dockerfile
svg.iconnables.icons-close
svg.iconnables.icons-close(
ng-click = "MC.cancel()"
)
use(
xlink:href = "#icons-close"
)
Expand All @@ -14,12 +16,15 @@
onload = "fromTool = true"
)
footer.modal-footer.clearfix
button.btn.btn-md.white.float-left Cancel
button.btn.btn-md.white.float-left(
ng-click = "MC.cancel()"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MC Cancel is my homeboy

) Cancel
button.btn.btn-md.green.float-right.btn-spinner(
ng-disabled = "!dockerfile.selection"
ng-click = "MC.confirm(MC.state.dockerfile)"
ng-disabled = "!MC.state.dockerfile"
)
//- add the 'in' class to .btn-spinner when spinning!
//- .spinner-wrapper.spinner-white.spinner-sm.in(
//- ng-include = "'spinner'"
//- )
| Start Mirroring
| Start Mirroring
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use strict';

require('app')
.controller('ChooseDockerfileModalController', ChooseDockerfileModalController);

function ChooseDockerfileModalController(
$rootScope,
errs,
fetchRepoDockerfiles,
keypather,
loading,
close,
repo,
branchName
) {
var CDMC = this;
if (!repo) {
throw new Error('A repo is required for this controller');
}
angular.extend(CDMC, {
name: 'ChooseDockerfileModal',
state: {
repo: repo
}
});
loading.reset(CDMC.name);

loading(CDMC.name, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is CDMC.name set? Maybe just put 'ChooseDockerfileModal'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

var oauthName = keypather.get($rootScope, 'dataApp.data.activeAccount.oauthName()');
var name = keypather.get(repo, 'attrs.name');
var fullname = keypather.get(repo, 'attrs.full_name') || (oauthName + '/' + name);
var defaultBranch = keypather.get(repo, 'attrs.default_branch');
fetchRepoDockerfiles(fullname, branchName || defaultBranch)
.then(function (dockerfiles) {
CDMC.state.repo.dockerfiles = dockerfiles;
})
.catch(errs.handler)
.finally(function () {
loading(CDMC.name, false);
});

CDMC.cancel = close.bind(null, false);

CDMC.confirm = function (dockerfile) {
if (dockerfile) {
return close(dockerfile);
}
throw new Error('Dockerfile path needed');
};
}

Loading