Skip to content

Commit ae51f88

Browse files
committed
Merge branch 'master' of https://github.com/CodeNow/runnable-angular into add-events-to-new-auth
2 parents 86a6c21 + 310bb46 commit ae51f88

File tree

16 files changed

+548
-86
lines changed

16 files changed

+548
-86
lines changed

client/controllers/controllerInstances.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ function ControllerInstances(
1818
demoRepos,
1919
errs,
2020
eventTracking,
21+
fetchGitHubRepoBranches,
2122
fetchInstances,
2223
fetchInstancesByPod,
2324
fetchRepoBranches,
@@ -268,7 +269,7 @@ function ControllerInstances(
268269
var branchName;
269270
var searchQuery = CIS.branchQuery.toLowerCase();
270271
return CIS.instanceBranches.filter(function (branch) {
271-
branchName = branch.attrs.name.toLowerCase();
272+
branchName = branch.name.toLowerCase();
272273
return branchName.includes(searchQuery);
273274
});
274275
};
@@ -300,8 +301,8 @@ function ControllerInstances(
300301
}, {});
301302
var instanceBranchName = instance.getBranchName();
302303
childInstances[instanceBranchName] = instanceBranchName;
303-
var unbuiltBranches = branches.models.filter(function (branch) {
304-
branchName = keypather.get(branch, 'attrs.name');
304+
var unbuiltBranches = branches.filter(function (branch) {
305+
branchName = keypather.get(branch, 'name');
305306
return !childInstances[branchName];
306307
});
307308
return unbuiltBranches;
@@ -311,9 +312,13 @@ function ControllerInstances(
311312
CIS.instanceBranches = null;
312313
CIS.poppedInstance = instance;
313314
loading('fetchingBranches', true);
314-
return CIS.getAllBranches(instance)
315+
var acv = instance.contextVersion.getMainAppCodeVersion();
316+
var fullReponame = acv.attrs.repo.split('/');
317+
var orgName = fullReponame[0];
318+
var repoName = fullReponame[1];
319+
return fetchGitHubRepoBranches(orgName, repoName)
315320
.then(function (branches) {
316-
CIS.totalInstanceBranches = branches.models.length;
321+
CIS.totalInstanceBranches = branches.length;
317322
CIS.instanceBranches = CIS.getUnbuiltBranches(instance, branches);
318323
loading('fetchingBranches', false);
319324
});
@@ -327,8 +332,8 @@ function ControllerInstances(
327332
};
328333

329334
this.forkBranchFromInstance = function (branch, closePopover) {
330-
var sha = branch.attrs.commit.sha;
331-
var branchName = branch.attrs.name;
335+
var sha = branch.commit.sha;
336+
var branchName = branch.name;
332337
loading(branchName, true);
333338
loading('buildingForkedBranch', true);
334339
promisify(CIS.poppedInstance, 'fork')(branchName, sha)

client/directives/components/buildLogs/buildLogsDirective.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ require('app').directive('buildLogs', buildLogs);
44
function buildLogs(
55
$timeout,
66
debounce,
7+
featureFlags,
78
moment,
89
$interval,
910
keypather
@@ -187,7 +188,8 @@ function buildLogs(
187188
$scope.timerExpired &&
188189
$scope.BLC.buildLogs.length === 0 &&
189190
!$scope.BLC.buildLogsRunning &&
190-
$scope.BLC.buildStatus === 'failed'
191+
$scope.BLC.buildStatus === 'failed' &&
192+
featureFlags.flags.internalDebugging !== true
191193
);
192194
};
193195

client/directives/components/newContainer/newContainerController.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ function NewContainerController(
8484
// Fetch all non-repo containres
8585
return fetchInstances({ githubUsername: 'HelloRunnable' })
8686
.then(function (servers) {
87-
console.log('Fetched template servers', servers);
8887
NCC.templateServers = servers;
8988
loading('newContainerTemplates', false);
9089
return servers;

client/directives/instances/instance/branchMenuPopover/branchMenuPopoverView.jade

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@
132132
)
133133
li.grid-block.align-center.list-item.popover-list-item(
134134
ng-class = "{\
135-
'disabled': $root.isLoading['buildingForkedBranch'] && !$root.isLoading[branch.attrs.name],\
136-
'active': $root.isLoading['buildingForkedBranch'] && $root.isLoading[branch.attrs.name]\
135+
'disabled': $root.isLoading['buildingForkedBranch'] && !$root.isLoading[branch.name],\
136+
'active': $root.isLoading['buildingForkedBranch'] && $root.isLoading[branch.name]\
137137
}"
138138
ng-repeat = "branch in CIS.getFilteredBranches()"
139139
ng-click = "CIS.forkBranchFromInstance(branch, POC.closePopover);"
@@ -143,13 +143,13 @@
143143
xlink:href = "#icons-branch-alt"
144144
)
145145
.grid-content.text-overflow(
146-
title = "{{ branch.attrs.name }}"
147-
) {{ branch.attrs.name }}
146+
title = "{{ branch.name }}"
147+
) {{ branch.name }}
148148
button.grid-content.shrink.btn.btn-xs.btn-icon.btn-add(
149-
ng-if = "!$root.isLoading[branch.attrs.name]"
149+
ng-if = "!$root.isLoading[branch.name]"
150150
) Add
151151
.grid-content.shrink.spinner-wrapper.spinner-sm.spinner-green(
152-
ng-if = "$root.isLoading[branch.attrs.name]"
152+
ng-if = "$root.isLoading[branch.name]"
153153
ng-include = "'spinner'"
154154
)
155155

client/directives/instances/instanceList/DemoAddBranchController.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ function DemoAddBranchController(
2121
) {
2222
var DBC = this;
2323

24-
function getBranchForPR () {
25-
return promisify(currentOrg.github, 'fetchRepo')(DBC.instance.getRepoName())
24+
function getBranchForPR (instance) {
25+
var githubId = keypather.get(instance, 'attrs.contextVersion.owner.github') || currentOrg.github;
26+
return promisify(githubId, 'fetchRepo')(instance.getRepoName())
2627
.then(function (repo) {
2728
return promisify(repo, 'fetchBranch')('dark-theme');
2829
})
2930
.then(function (branch) {
3031
var sha = branch.attrs.commit.sha;
3132
var branchName = branch.attrs.name;
32-
return promisify(DBC.instance, 'fork')(branchName, sha);
33+
return promisify(instance, 'fork')(branchName, sha);
3334
});
3435
}
3536

client/services/demoFlowService.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function demoFlowService(
1212
defaultContainerUrl,
1313
errs,
1414
featureFlags,
15+
fetchGitHubRepoBranch,
1516
github,
1617
keypather,
1718
patchOrgMetadata,
@@ -133,14 +134,15 @@ function demoFlowService(
133134
}
134135

135136
function forkNewInstance (instance) {
137+
var acv = instance.contextVersion.getMainAppCodeVersion();
138+
var fullReponame = acv.attrs.repo.split('/');
139+
var orgName = fullReponame[0];
140+
var repoName = fullReponame[1];
136141
addBranchListener();
137-
return promisify(currentOrg.github, 'fetchRepo')(instance.getRepoName())
138-
.then(function (repo) {
139-
return promisify(repo, 'fetchBranch')('dark-theme');
140-
})
142+
return fetchGitHubRepoBranch(orgName, repoName, 'dark-theme')
141143
.then(function (branch) {
142-
var sha = branch.attrs.commit.sha;
143-
var branchName = branch.attrs.name;
144+
var sha = branch.commit.sha;
145+
var branchName = branch.name;
144146
return promisify(instance, 'fork')(branchName, sha);
145147
});
146148
}

0 commit comments

Comments
 (0)