Skip to content

Commit 8af41f2

Browse files
author
James Cori
committed
Merge branch 'dev'
2 parents a4258c3 + 3222b50 commit 8af41f2

22 files changed

+390
-43
lines changed

.circleci/config.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ install_deploysuite: &install_deploysuite
2020
build_steps: &build_steps
2121
- checkout
2222
- run: curl -s https://raw.githubusercontent.com/chronogolf/circleci-google-chrome/master/use_chrome_stable_version.sh | bash
23-
- restore_cache:
24-
key: node-modules-{{ checksum "package-lock.json" }}
23+
# - restore_cache:
24+
# key: node-modules-{{ checksum "package-lock.json" }}
2525
- run: npm install
26-
- save_cache:
27-
key: node-modules-{{ checksum "package-lock.json" }}
28-
paths:
29-
- node_modules
26+
# - save_cache:
27+
# key: node-modules-{{ checksum "package-lock.json" }}
28+
# paths:
29+
# - node_modules
3030
- run: ./node_modules/gulp/bin/gulp.js clean
3131
- run: ./node_modules/gulp/bin/gulp.js build
3232
# - run: ./node_modules/gulp/bin/gulp.js publish

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.17.1

README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Internal application used to administer specific support tasks related to the To
66

77
## Software Requirements
88

9-
- node.js v6+
10-
- npm v3+
9+
- node.js v6 (not later)
10+
- npm v3
1111
- Google Chrome browser version >= 55.0.2883.0
1212

1313
## Installation
@@ -46,6 +46,10 @@ The following configuration parameters are available:
4646
| AGREE_FOR_DOCUSIGN_TEMPLATE | UUID from Database of the `"DocuSign Template"` Agreeable type |
4747
| AGREE_ELECTRONICALLY | UUID from Database of the `Electronically` Agreeable Type |
4848
| DEFAULT_TERMS_TYPE_ID | The default terms type id |
49+
| CONNECT_URL | URL of Topcoder Connect |
50+
| DIRECT_URL | URL of Topcoder Direct |
51+
| WORK_MANAGER_URL | URL of Topcoder Work Manager |
52+
| ONLINE_REVIEW_URL | URL of Topcoder Online Review |
4953

5054

5155
## Start the Application

config.json

+20-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
"RESOURCE_V5_API_URL": "https://api.topcoder-dev.com/v5",
2020
"AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7",
2121
"AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
22-
"DEFAULT_TERMS_TYPE_ID": 5
22+
"DEFAULT_TERMS_TYPE_ID": 5,
23+
"CONNECT_URL": "https://connect.topcoder-dev.com",
24+
"DIRECT_URL": "https://www.topcoder-dev.com/direct",
25+
"WORK_MANAGER_URL": "https://challenges.topcoder-dev.com",
26+
"ONLINE_REVIEW_URL": "https://software.topcoder-dev.com/review"
2327
},
2428
"dev": {
2529
"API_URL": "https://api.topcoder-dev.com",
@@ -41,7 +45,11 @@
4145
"RESOURCE_V5_API_URL": "https://api.topcoder-dev.com/v5",
4246
"AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7",
4347
"AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
44-
"DEFAULT_TERMS_TYPE_ID": 5
48+
"DEFAULT_TERMS_TYPE_ID": 5,
49+
"CONNECT_URL": "https://connect.topcoder-dev.com",
50+
"DIRECT_URL": "https://www.topcoder-dev.com/direct",
51+
"WORK_MANAGER_URL": "https://challenges.topcoder-dev.com",
52+
"ONLINE_REVIEW_URL": "https://software.topcoder-dev.com/review"
4553
},
4654
"qa": {
4755
"API_URL": "https://api.topcoder-qa.com",
@@ -63,7 +71,11 @@
6371
"RESOURCE_V5_API_URL": "https://api.topcoder-dev.com/v5",
6472
"AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7",
6573
"AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
66-
"DEFAULT_TERMS_TYPE_ID": 5
74+
"DEFAULT_TERMS_TYPE_ID": 5,
75+
"CONNECT_URL": "https://connect.topcoder-dev.com",
76+
"DIRECT_URL": "https://www.topcoder-dev.com/direct",
77+
"WORK_MANAGER_URL": "https://challenges.topcoder-dev.com",
78+
"ONLINE_REVIEW_URL": "https://software.topcoder-dev.com/review"
6779
},
6880
"prod": {
6981
"API_URL": "https://api.topcoder.com",
@@ -85,6 +97,10 @@
8597
"RESOURCE_V5_API_URL": "https://api.topcoder.com/v5",
8698
"AGREE_FOR_DOCUSIGN_TEMPLATE": "1363a7ab-fd3e-4d7c-abbb-2f7440b8b355",
8799
"AGREE_ELECTRONICALLY": "2db6c920-4089-4755-9cd1-99b0df0af961",
88-
"DEFAULT_TERMS_TYPE_ID": 5
100+
"DEFAULT_TERMS_TYPE_ID": 5,
101+
"CONNECT_URL": "https://connect.topcoder.com",
102+
"DIRECT_URL": "https://www.topcoder.com/direct",
103+
"WORK_MANAGER_URL": "https://challenges.topcoder.com",
104+
"ONLINE_REVIEW_URL": "https://software.topcoder.com/review"
89105
}
90106
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"wiredep": "~4.0.0"
8383
},
8484
"engines": {
85-
"node": ">=0.10.0"
85+
"node": "6"
8686
},
8787
"scripts": {
8888
"clean": "gulp clean",

src/app/challenges/challenges.service.js

+26
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ angular.module('supportAdminApp')
1414
getChallengeTypes: getChallengeTypes,
1515
getChallengeTracks: getChallengeTracks,
1616
getChallengeById: getChallengeById,
17+
getChallengeByLegacyId: getChallengeByLegacyId,
1718
getChallengeResources: getChallengeResources,
1819
getResourceRoles: getResourceRoles,
1920
deleteChallengeResource: deleteChallengeResource,
@@ -305,6 +306,31 @@ angular.module('supportAdminApp')
305306
return deferred.promise;
306307
};
307308

309+
/**
310+
* gets the challenge details by legacyId.
311+
* Throws an error message if no challenge is found, as of now the api returns 200 and an empty array
312+
* @param {string} legacyId the challenge legacyId.
313+
* @returns {Promise} the promise base api result.
314+
*/
315+
function getChallengeByLegacyId(id) {
316+
var deferred = $q.defer();
317+
318+
$http({
319+
method: 'GET',
320+
url: V5_API_URL + '/challenges?legacyId=' + id,
321+
headers: {
322+
"Content-Type": "application/json"
323+
}
324+
}).then(function (response) {
325+
if (Array.isArray(response.data) && response.data.length > 0)
326+
deferred.resolve(response.data[0]);
327+
else throw({"message":" Invalid \"legacyId\""});
328+
}).catch(function (error) {
329+
handleError(error, deferred);
330+
});
331+
return deferred.promise;
332+
};
333+
308334
/**
309335
* get the challenge resources
310336
* @param {string} challengeId the challenge id.

src/app/directives.js

+46
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,50 @@ angular.module('supportAdminApp')
7373
});
7474
}
7575
};
76+
})
77+
.directive('backButton', function($window) {
78+
return {
79+
restrict: 'AE',
80+
link: function(scope, element, attrs) {
81+
element.on('click', function() {
82+
$window.history.back();
83+
});
84+
}
85+
}
86+
87+
})
88+
// gets current phase according to a predefined logic, based on the phases array of a challenge
89+
.directive('currentPhase', function(moment) {
90+
return {
91+
restrict: 'AE',
92+
replace: true,
93+
template: '<span>{{phaseMessage}}</span>',
94+
scope: {
95+
challenge: '='
96+
},
97+
link: function(scope, element, attrs) {
98+
var statusPhase = null;
99+
100+
if (scope.challenge.phases) {
101+
statusPhase = scope.challenge.phases
102+
.filter(function(p) {
103+
return p.name !== 'Registration' && p.isOpen
104+
})
105+
.sort(function(a, b) {
106+
return moment(a.scheduledEndDate).diff(b.scheduledEndDate);
107+
})[0];
108+
}
109+
110+
if (!statusPhase && scope.challenge.type === 'First2Finish' && scope.challenge.phases.length) {
111+
statusPhase = _.clone(scope.challenge.phases[0]);
112+
statusPhase.name = 'Submission';
113+
}
114+
115+
scope.phaseMessage = "Stalled";
116+
if (statusPhase)
117+
scope.phaseMessage = statusPhase.name;
118+
else if (scope.challenge.status === 'Draft')
119+
scope.phaseMessage = "In Draft";
120+
}
121+
}
76122
});

src/app/less/base.less

+22-1
Original file line numberDiff line numberDiff line change
@@ -1372,4 +1372,25 @@ input[readonly] {
13721372

13731373
.mce-container > iframe {
13741374
height: 200px !important;
1375-
}
1375+
}
1376+
1377+
.dropdown-go-to {
1378+
left: auto;
1379+
right: 0;
1380+
}
1381+
1382+
.table-challenge-list {
1383+
th:first-child {
1384+
width:46px;
1385+
}
1386+
}
1387+
1388+
.table-challenge-overflow {
1389+
overflow-x: auto;
1390+
}
1391+
1392+
.dropdown-menu > li > a.link-disabled {
1393+
cursor: default;
1394+
pointer-events: none;
1395+
color: #bbbbbb;
1396+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.challenge-users-stats {
2+
min-width: 100px;
3+
4+
.challenge-users-stats-type:not(:first-child) {
5+
margin: 0 0 0 10px;
6+
}
7+
}

src/app/less/style.less

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
@import "spinners.less";
2828
@import "progress-bar.directive.less";
2929

30+
// Components
31+
@import "challenge-users-stats.directive.less";
32+
@import "track-icon.directive.less";
33+
3034
// Landing page styles
3135
@import "landing.less";
3236

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
@base-unit: 5px;
2+
@corner-radius: 2px;
3+
@track-code-pad: (@base-unit * 2) - 2;
4+
@tco-line-height: @base-unit * 2 + 2;
5+
@track-space-15: @base-unit * 3;
6+
@tc-light-blue-110: #0076a5;
7+
@tc-light-blue-10: #e9f6fc;
8+
@tc-green-110: #328732;
9+
@tc-green-10: #effae4;
10+
@tc-purple-120: #8231a9;
11+
@tc-purple-20: #e6cff1;
12+
@tc-orange-110: #ba4c00;
13+
@tc-orange-10: #fff0eb;
14+
@tc-white: #ffffff;
15+
16+
.trackIcon {
17+
display: inline-block;
18+
width: @base-unit * 6;
19+
height: @base-unit * 6;
20+
flex-direction: column;
21+
22+
.main-icon {
23+
24+
text-align: center;
25+
line-height: @track-space-15;
26+
color: @tc-white;
27+
padding: @track-code-pad - 1 0 @track-code-pad;
28+
border-radius: @corner-radius;
29+
width: 100%;
30+
height: 100%;
31+
32+
&.design,
33+
&.generic {
34+
background: @tc-light-blue-110;
35+
}
36+
37+
&.develop,
38+
&.development {
39+
background: @tc-green-110;
40+
}
41+
42+
&.qa,
43+
&.quality-assurance {
44+
background: @tc-purple-120;
45+
}
46+
47+
&.data_science,
48+
&.data-science,
49+
&.data {
50+
background: @tc-orange-110;
51+
}
52+
}
53+
}

src/app/v5_challenges/challenge.detail.controller.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.controller('v5challenge.DetailController', ['$scope', '$rootScope', 'Auth
99
$scope.challenge = {};
1010
$scope.id = $stateParams.id;
1111
$scope.challengeData = '';
12+
$scope.error = false;
1213

1314
/**
1415
* Check if user is logged in.
@@ -52,12 +53,18 @@ module.controller('v5challenge.DetailController', ['$scope', '$rootScope', 'Auth
5253
);
5354
};
5455

55-
// fetch challenge detail
56-
$challengeService.v5.getChallengeById($stateParams.id).then(function (data) {
56+
// fetch challenge detail, either by id(string) or legacyId(number)
57+
var getChallengeDetail;
58+
if (isNaN($stateParams.id))
59+
getChallengeDetail = $challengeService.v5.getChallengeById($stateParams.id);
60+
else
61+
getChallengeDetail = $challengeService.v5.getChallengeByLegacyId($stateParams.id);
62+
getChallengeDetail.then(function (data) {
5763
$scope.challenge = data;
5864
$scope.challengeData = prettifyJson(data, true);
5965
}).catch(function (error) {
6066
$alert.error(error.error, $rootScope);
67+
$scope.error = true;
6168
}).finally(function () {
6269
$scope.isLoading = false;
6370
});

src/app/v5_challenges/challenge.detail.html

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ <h2>{{pageTitle}}</h2>
66
<!-- add member button row -->
77
<div class="row">
88
<div class="col col-md-12 col-lg-12">
9-
<a class="btn btn-primary pull-right m-b" ui-sref="index.v5challenges" style="margin-left: 20px">
9+
<a class="btn btn-primary pull-right m-b" style="margin-left: 20px" back-button>
1010
<strong>Back</strong>
1111
</a>
1212
<a class="btn btn-info pull-right m-b" ui-sref="index.v5ChallengeManageUser({id: id})">
@@ -17,18 +17,22 @@ <h2>{{pageTitle}}</h2>
1717
<!-- list members row -->
1818
<div class="row">
1919
<div class="col-lg-12">
20+
<div class="col-md-10 col-md-offset-1" ng-include src="'components/alert/alert.html'"></div>
2021
<div class="ibox float-e-margins">
2122
<div class="ibox-content">
2223
<div class="text-center" ng-show="isLoading">
2324
<img src="assets/images/loading.gif" />
2425
</div>
25-
<dl class="dl-horizontal" ng-show="!isLoading">
26+
<dl class="dl-horizontal" ng-show="!isLoading && !error">
2627
<div class="m-b">
2728
<label style="margin-right: 1%;">Title:</label>
2829
<span>{{challenge.name}}</span>
2930
</div>
3031
<pre ng-bind-html="challengeData"></pre>
3132
</dl>
33+
<dl class="dl-horizontal" ng-show="!isLoading && error">
34+
Challenge not found
35+
</dl>
3236
</div>
3337
</div>
3438
</div>

0 commit comments

Comments
 (0)