Skip to content

Commit

Permalink
Merge pull request #1825 from CodeNow/SAN-5180-new-window
Browse files Browse the repository at this point in the history
SAN-5180 New Window
  • Loading branch information
Myztiq authored Oct 5, 2016
2 parents 5b4ae8c + aae1094 commit 45d9aca
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ function ChooseOrganizationModalController(
$scope,
$state,
ahaGuide,
configEnvironment,
createNewSandboxForUserService,
customWindowService,
errs,
eventTracking,
featureFlags,
Expand Down Expand Up @@ -46,6 +48,11 @@ function ChooseOrganizationModalController(
};

COMC.grantAccess = function () {
var connectionUrl = 'https://github.com/settings/connections/applications/d42d6634d4070c9d9bf9';
if (configEnvironment === 'development') {
connectionUrl = 'https://github.com/settings/applications';
}
customWindowService(connectionUrl);
loading.reset('grantAccess');
loading('grantAccess', true);
COMC.cancelPollingForWhitelisted();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
//- hide after clicked
a.grid-block.align-center.justify-center.shrink.btn.btn-md.green.margin-top-md(
data-event-name = "Clicked Grant Access"
href = "https://github.com/settings/connections/applications/d42d6634d4070c9d9bf9"
ng-click = "COMC.grantAccess()"
ng-if = "!$root.isLoading.grantAccess"
target = "_blank"
)
svg.iconnables.margin-right-xxs(
ng-if = "!$root.isLoading.grantAccess"
Expand All @@ -45,9 +43,7 @@
ng-if = "$root.isLoading.grantAccess"
) We’ll update this page once you grant access to an org 
a.link(
href = "https://github.com/settings/connections/applications/d42d6634d4070c9d9bf9"
ng-click = "COMC.grantAccess()"
target = "_blank"
) on GitHub
| .
button.grid-block.align-center.shrink.btn.btn-md.btn-cancel.gray.margin-top-sm(
Expand Down
17 changes: 17 additions & 0 deletions client/services/customWindowService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

require('app')
.factory('customWindowService', customWindowService);

function customWindowService() {
return function (targetUrl) {
var topBar = window.outerHeight - window.innerHeight;
var padding = 60;
var width = window.innerWidth - padding - padding;
var height = window.innerHeight - padding - padding - 50;
var top = window.screenTop + padding + topBar;
var left = window.screenLeft + padding;
return window.open(targetUrl, 'page', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',titlebar=yes');
};
}

15 changes: 5 additions & 10 deletions client/services/launchDebugContainerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@
require('app')
.factory('launchDebugContainer', launchDebugContainer);

function launchDebugContainer (
function launchDebugContainer(
errs,
createDebugContainer
createDebugContainer,
customWindowService
) {
return function (instance, contextVersionId, imageId, rawCommand) {
var topBar = window.outerHeight - window.innerHeight;
var padding = 60;
var width = window.innerWidth - padding - padding;
var height = window.innerHeight - padding - padding - 50;
var top = window.screenTop + padding + topBar;
var left = window.screenLeft + padding;
var newWindow = window.open('/loading', 'page', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+width+',height='+height+',left='+left+',top='+top+',titlebar=yes');
var newWindow = customWindowService('/loading');
return createDebugContainer(instance, contextVersionId, imageId, rawCommand)
.then(function (debugContainer) {
if (newWindow) {
newWindow.location = '/debug/'+debugContainer.id();
newWindow.location = '/debug/' + debugContainer.id();
}
})
.catch(function (err) {
Expand Down

0 comments on commit 45d9aca

Please sign in to comment.