Skip to content

Commit 0d645ec

Browse files
committed
Revert "Merge pull request #2051 from CodeNow/SAN-5804-implement-remove-forking"
This reverts commit 2cda5b8, reversing changes made to fd522b1.
1 parent f13f60e commit 0d645ec

File tree

15 files changed

+84
-545
lines changed

15 files changed

+84
-545
lines changed

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

client/controllers/controllerInstances.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ function ControllerInstances(
1818
demoRepos,
1919
errs,
2020
eventTracking,
21-
fetchGitHubRepoBranches,
2221
fetchInstances,
2322
fetchInstancesByPod,
2423
fetchRepoBranches,
@@ -269,7 +268,7 @@ function ControllerInstances(
269268
var branchName;
270269
var searchQuery = CIS.branchQuery.toLowerCase();
271270
return CIS.instanceBranches.filter(function (branch) {
272-
branchName = branch.name.toLowerCase();
271+
branchName = branch.attrs.name.toLowerCase();
273272
return branchName.includes(searchQuery);
274273
});
275274
};
@@ -301,8 +300,8 @@ function ControllerInstances(
301300
}, {});
302301
var instanceBranchName = instance.getBranchName();
303302
childInstances[instanceBranchName] = instanceBranchName;
304-
var unbuiltBranches = branches.filter(function (branch) {
305-
branchName = keypather.get(branch, 'name');
303+
var unbuiltBranches = branches.models.filter(function (branch) {
304+
branchName = keypather.get(branch, 'attrs.name');
306305
return !childInstances[branchName];
307306
});
308307
return unbuiltBranches;
@@ -312,13 +311,9 @@ function ControllerInstances(
312311
CIS.instanceBranches = null;
313312
CIS.poppedInstance = instance;
314313
loading('fetchingBranches', true);
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)
314+
return CIS.getAllBranches(instance)
320315
.then(function (branches) {
321-
CIS.totalInstanceBranches = branches.length;
316+
CIS.totalInstanceBranches = branches.models.length;
322317
CIS.instanceBranches = CIS.getUnbuiltBranches(instance, branches);
323318
loading('fetchingBranches', false);
324319
});
@@ -332,8 +327,8 @@ function ControllerInstances(
332327
};
333328

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

client/directives/components/buildLogs/buildLogsDirective.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ require('app').directive('buildLogs', buildLogs);
44
function buildLogs(
55
$timeout,
66
debounce,
7-
featureFlags,
87
moment,
98
$interval,
109
keypather
@@ -188,8 +187,7 @@ function buildLogs(
188187
$scope.timerExpired &&
189188
$scope.BLC.buildLogs.length === 0 &&
190189
!$scope.BLC.buildLogsRunning &&
191-
$scope.BLC.buildStatus === 'failed' &&
192-
featureFlags.flags.internalDebugging !== true
190+
$scope.BLC.buildStatus === 'failed'
193191
);
194192
};
195193

client/directives/components/newContainer/newContainerController.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ function NewContainerController(
8484
// Fetch all non-repo containres
8585
return fetchInstances({ githubUsername: 'HelloRunnable' })
8686
.then(function (servers) {
87+
console.log('Fetched template servers', servers);
8788
NCC.templateServers = servers;
8889
loading('newContainerTemplates', false);
8990
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.name],\
136-
'active': $root.isLoading['buildingForkedBranch'] && $root.isLoading[branch.name]\
135+
'disabled': $root.isLoading['buildingForkedBranch'] && !$root.isLoading[branch.attrs.name],\
136+
'active': $root.isLoading['buildingForkedBranch'] && $root.isLoading[branch.attrs.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.name }}"
147-
) {{ branch.name }}
146+
title = "{{ branch.attrs.name }}"
147+
) {{ branch.attrs.name }}
148148
button.grid-content.shrink.btn.btn-xs.btn-icon.btn-add(
149-
ng-if = "!$root.isLoading[branch.name]"
149+
ng-if = "!$root.isLoading[branch.attrs.name]"
150150
) Add
151151
.grid-content.shrink.spinner-wrapper.spinner-sm.spinner-green(
152-
ng-if = "$root.isLoading[branch.name]"
152+
ng-if = "$root.isLoading[branch.attrs.name]"
153153
ng-include = "'spinner'"
154154
)
155155

client/directives/instances/instanceList/DemoAddBranchController.js

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

24-
function getBranchForPR (instance) {
25-
var githubId = keypather.get(instance, 'attrs.contextVersion.owner.github') || currentOrg.github;
26-
return promisify(githubId, 'fetchRepo')(instance.getRepoName())
24+
function getBranchForPR () {
25+
return promisify(currentOrg.github, 'fetchRepo')(DBC.instance.getRepoName())
2726
.then(function (repo) {
2827
return promisify(repo, 'fetchBranch')('dark-theme');
2928
})
3029
.then(function (branch) {
3130
var sha = branch.attrs.commit.sha;
3231
var branchName = branch.attrs.name;
33-
return promisify(instance, 'fork')(branchName, sha);
32+
return promisify(DBC.instance, 'fork')(branchName, sha);
3433
});
3534
}
3635

client/services/demoFlowService.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ function demoFlowService(
1212
defaultContainerUrl,
1313
errs,
1414
featureFlags,
15-
fetchGitHubRepoBranch,
1615
github,
1716
keypather,
1817
patchOrgMetadata,
@@ -134,15 +133,14 @@ function demoFlowService(
134133
}
135134

136135
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];
141136
addBranchListener();
142-
return fetchGitHubRepoBranch(orgName, repoName, 'dark-theme')
137+
return promisify(currentOrg.github, 'fetchRepo')(instance.getRepoName())
138+
.then(function (repo) {
139+
return promisify(repo, 'fetchBranch')('dark-theme');
140+
})
143141
.then(function (branch) {
144-
var sha = branch.commit.sha;
145-
var branchName = branch.name;
142+
var sha = branch.attrs.commit.sha;
143+
var branchName = branch.attrs.name;
146144
return promisify(instance, 'fork')(branchName, sha);
147145
});
148146
}

0 commit comments

Comments
 (0)