Skip to content

Commit 6674883

Browse files
committed
Merge branch 'dev' into feature/v5-challenge-management
# Conflicts: # README.md # config.json
2 parents 79d5dc7 + c722304 commit 6674883

9 files changed

+61
-90
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ The following configuration parameters are available:
4343
| TERMS_V5_API_URL | URL of the v5 Terms API |
4444
| CHALLENGES_V5_API_URL | URL of the v5 Challenges API |
4545
| RESOURCE_V5_API_URL | URL of the v5 Resources API |
46-
| AGREEABILITY_TYPES | List of Agreeable types and its UUID from Database |
4746
| AGREE_FOR_DOCUSIGN_TEMPLATE | UUID from Database of the `"DocuSign Template"` Agreeable type |
4847
| AGREE_ELECTRONICALLY | UUID from Database of the `Electronically` Agreeable Type |
4948
| DEFAULT_TERMS_TYPE_ID | The default terms type id |

config.json

+6-78
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,6 @@
1717
"TERMS_V5_API_URL": "http://localhost:3000/v5",
1818
"CHALLENGES_V5_API_URL": "https://api.topcoder-dev.com/v5",
1919
"RESOURCE_V5_API_URL": "https://api.topcoder-dev.com/v5",
20-
"AGREEABILITY_TYPES": [
21-
{
22-
"id": "f3cb81fa-d1ed-4231-b6c6-770f4f1ce8a4",
23-
"name": "Non-agreeable"
24-
},
25-
{
26-
"id": "208779bf-72ce-4e97-a398-13fa62c0414a",
27-
"name": "Non-electronically-agreeable"
28-
},
29-
{
30-
"id": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
31-
"name": "Electronically-agreeable"
32-
},
33-
{
34-
"id": "999a26ad-b334-453c-8425-165d4cf496d7",
35-
"name": "Docusign-template"
36-
}
37-
],
3820
"AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7",
3921
"AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
4022
"DEFAULT_TERMS_TYPE_ID": 5
@@ -44,8 +26,8 @@
4426
"ADMIN_TOOL_URL": "https://api.topcoder-dev.com/v2",
4527
"API_VERSION_PATH": "v3",
4628
"COOKIES_SECURE": false,
47-
"AUTH_URL": "https://accounts.topcoder-dev.com/member",
48-
"ACCOUNTS_CONNECTOR_URL": "https://accounts.topcoder-dev.com/connector.html",
29+
"AUTH_URL": "https://accounts-auth0.topcoder-dev.com",
30+
"ACCOUNTS_CONNECTOR_URL": "https://accounts-auth0.topcoder-dev.com",
4931
"JWT_V3_NAME": "v3jwt",
5032
"JWT_V2_NAME": "tcjwt",
5133
"OAUTH2_TOKEN_NAME": "oa2spigit",
@@ -57,24 +39,6 @@
5739
"TERMS_V5_API_URL": "https://api.topcoder-dev.com/v5",
5840
"CHALLENGES_V5_API_URL": "https://api.topcoder-dev.com/v5",
5941
"RESOURCE_V5_API_URL": "https://api.topcoder-dev.com/v5",
60-
"AGREEABILITY_TYPES": [
61-
{
62-
"id": "f3cb81fa-d1ed-4231-b6c6-770f4f1ce8a4",
63-
"name": "Non-agreeable"
64-
},
65-
{
66-
"id": "208779bf-72ce-4e97-a398-13fa62c0414a",
67-
"name": "Non-electronically-agreeable"
68-
},
69-
{
70-
"id": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
71-
"name": "Electronically-agreeable"
72-
},
73-
{
74-
"id": "999a26ad-b334-453c-8425-165d4cf496d7",
75-
"name": "Docusign-template"
76-
}
77-
],
7842
"AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7",
7943
"AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
8044
"DEFAULT_TERMS_TYPE_ID": 5
@@ -97,24 +61,6 @@
9761
"TERMS_V5_API_URL": "http://localhost:3000/v5",
9862
"CHALLENGES_V5_API_URL": "https://api.topcoder-dev.com/v5",
9963
"RESOURCE_V5_API_URL": "https://api.topcoder-dev.com/v5",
100-
"AGREEABILITY_TYPES": [
101-
{
102-
"id": "f3cb81fa-d1ed-4231-b6c6-770f4f1ce8a4",
103-
"name": "Non-agreeable"
104-
},
105-
{
106-
"id": "208779bf-72ce-4e97-a398-13fa62c0414a",
107-
"name": "Non-electronically-agreeable"
108-
},
109-
{
110-
"id": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
111-
"name": "Electronically-agreeable"
112-
},
113-
{
114-
"id": "999a26ad-b334-453c-8425-165d4cf496d7",
115-
"name": "Docusign-template"
116-
}
117-
],
11864
"AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7",
11965
"AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
12066
"DEFAULT_TERMS_TYPE_ID": 5
@@ -124,8 +70,8 @@
12470
"ADMIN_TOOL_URL": "https://api.topcoder.com/v2",
12571
"API_VERSION_PATH": "v3",
12672
"COOKIES_SECURE": false,
127-
"AUTH_URL": "https://accounts.topcoder.com/member",
128-
"ACCOUNTS_CONNECTOR_URL": "https://accounts.topcoder.com/connector.html",
73+
"AUTH_URL": "https://accounts-auth0.topcoder.com",
74+
"ACCOUNTS_CONNECTOR_URL": "https://accounts-auth0.topcoder.com",
12975
"JWT_V3_NAME": "v3jwt",
13076
"JWT_V2_NAME": "tcjwt",
13177
"OAUTH2_TOKEN_NAME": "oa2spigit",
@@ -136,27 +82,9 @@
13682
"LOOKUP_V5_API_URL": "https://api.topcoder.com/v5",
13783
"TERMS_V5_API_URL": "https://api.topcoder.com/v5",
13884
"CHALLENGES_V5_API_URL": "https://api.topcoder-dev.com/v5",
139-
"RESOURCE_V5_API_URL": "https://api.topcoder-dev.com/v5",
140-
"AGREEABILITY_TYPES": [
141-
{
142-
"id": "f3cb81fa-d1ed-4231-b6c6-770f4f1ce8a4",
143-
"name": "Non-agreeable"
144-
},
145-
{
146-
"id": "208779bf-72ce-4e97-a398-13fa62c0414a",
147-
"name": "Non-electronically-agreeable"
148-
},
149-
{
150-
"id": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
151-
"name": "Electronically-agreeable"
152-
},
153-
{
154-
"id": "999a26ad-b334-453c-8425-165d4cf496d7",
155-
"name": "Docusign-template"
156-
}
157-
],
85+
"RESOURCE_V5_API_URL": "https://api.topcoder-dev.com/v5",
15886
"AGREE_FOR_DOCUSIGN_TEMPLATE": "999a26ad-b334-453c-8425-165d4cf496d7",
15987
"AGREE_ELECTRONICALLY": "5b2798b2-ae82-4210-9b4d-5d6428125ccb",
16088
"DEFAULT_TERMS_TYPE_ID": 5
16189
}
162-
}
90+
}

src/app/auth/auth.service.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ angular.module('supportAdminApp')
148148
*
149149
* @return {Promise} promise which is resolved when user is logged out on the server
150150
*/
151-
AuthService.logout = function() {
151+
/* AuthService.logout = function() {
152152
// send request to the server that we want to log out
153153
// save logginOut promise to be accessed any time
154154
AuthService.logginOut = proxyCall(LOGOUT_REQUEST, LOGOUT_SUCCESS, LOGOUT_FAILURE).then(function() {
@@ -159,6 +159,10 @@ angular.module('supportAdminApp')
159159
$cookies.remove(JWT_V3_NAME);
160160
161161
return AuthService.logginOut;
162+
} */
163+
164+
AuthService.logout = function () {
165+
$window.location.href = AUTH_URL + '?logout=true&retUrl=' + encodeURIComponent($window.location.href);
162166
}
163167

164168
AuthService.login = function() {
@@ -229,7 +233,7 @@ angular.module('supportAdminApp')
229233
* @return {Boolean} true if token V3 is expired
230234
*/
231235
AuthService.isTokenV3Expired = function() {
232-
return !AuthService.getTokenV3() || jwtHelper.isTokenExpired(AuthService.getTokenV3(), 300);
236+
return !AuthService.getTokenV3() || jwtHelper.isTokenExpired(AuthService.getTokenV3(), 10);
233237
}
234238

235239
/**

src/app/terms/terms.edit.controller.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,25 @@ var module = angular.module('supportAdminApp');
55
/**
66
* Controller for edit terms of use view
77
*/
8-
module.controller('terms.EditTermsController', ['$scope', '$rootScope', 'AGREEABILITY_TYPES', 'AGREE_FOR_DOCUSIGN_TEMPLATE', '$log',
8+
module.controller('terms.EditTermsController', ['$scope', '$rootScope', 'AGREE_FOR_DOCUSIGN_TEMPLATE', '$log',
99
'TermsService', 'Alert', '$state', '$stateParams', 'AGREE_ELECTRONICALLY',
10-
function ($scope, $rootScope, agreeabilityTypeList, docusignTypeId, $log, TermsService, $alert, $state, $stateParams, electronicallyAgreeableId) {
10+
function ($scope, $rootScope, docusignTypeId, $log, TermsService, $alert, $state, $stateParams, electronicallyAgreeableId) {
1111
// init variables
1212
$scope.processing = false;
1313
$scope.editTerms = { };
14-
$scope.agreeabilityTypes = agreeabilityTypeList;
14+
$scope.agreeabilityTypes = [];
1515
$scope.isDocuSignFieldEnabled = false;
1616
$scope.isUrlEnabled = false;
1717
$scope.termTypes = [];
1818
$scope.signedUsers = { total: 0, deleteDisabled: true };
1919

20+
// gets the agreeability types
21+
TermsService.getAgreeabilityTypes().then(function (data) {
22+
$scope.agreeabilityTypes = data;
23+
}).catch(function (error) {
24+
$alert.error(error.error, $rootScope);
25+
});
26+
2027
/**
2128
* handles the agreebility type change.
2229
* @param {string} agreeabilityTypeId the agreebility type id.

src/app/terms/terms.list.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
</td>
6161
<td>{{terms.type}}</td>
6262
<td>{{terms.agreeabilityType}}</td>
63-
<td>{{terms.agreeabilityTypeId===electronicallyAgreeableId?terms.url:terms.agreeabilityTypeId===agreeForDocuSignTemplateId?terms.agreeabilityTypeId:''}}</td>
63+
<td>{{terms.agreeabilityTypeId===electronicallyAgreeableId?terms.url:terms.agreeabilityTypeId===agreeForDocuSignTemplateId?terms.docusignTemplateId:''}}</td>
6464
<td class="btn-toolbar">
6565
<a ui-sref="index.terms.users({termsId: terms.id,title:terms.title})" class="btn btn-sm btn-info">View Users</a>
6666
</td>

src/app/terms/terms.new.controller.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,26 @@
33
var module = angular.module('supportAdminApp');
44

55
module.controller('terms.NewTermsController', ['$rootScope', '$scope', 'TermsService', 'Alert',
6-
'AGREEABILITY_TYPES', 'AGREE_FOR_DOCUSIGN_TEMPLATE', 'AGREE_ELECTRONICALLY', '$state', 'DEFAULT_TERMS_TYPE_ID',
7-
function ($rootScope, $scope, TermsService, $alert, agreeabilityTypeList, docusignTypeId, electronicallyAgreeableId, $state, defaultTermTypeId) {
6+
'AGREE_FOR_DOCUSIGN_TEMPLATE', 'AGREE_ELECTRONICALLY', '$state', 'DEFAULT_TERMS_TYPE_ID',
7+
function ($rootScope, $scope, TermsService, $alert, docusignTypeId, electronicallyAgreeableId, $state, defaultTermTypeId) {
88
// init variables
99
$scope.newTerms = {};
1010
$scope.processing = false;
11-
$scope.agreeabilityTypes = agreeabilityTypeList;
11+
$scope.agreeabilityTypes = [];
1212
$scope.isDocuSignFieldEnabled = false;
1313
$scope.isUrlEnabled = false;
1414
$scope.termTypes = [];
1515

1616
// clear the alert
1717
$alert.clear();
1818

19+
// gets the agreeability types
20+
TermsService.getAgreeabilityTypes().then(function (data) {
21+
$scope.agreeabilityTypes = data;
22+
}).catch(function (error) {
23+
$alert.error(error.error, $rootScope);
24+
});
25+
1926
// get term types
2027
TermsService.getTypes().then(function (response) {
2128
$scope.termTypes = response;

src/app/terms/terms.service.js

+19-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ angular.module('supportAdminApp')
128128
TermsService.getTypes = function () {
129129
var deferred = $q.defer();
130130
$http({
131-
url: TermsService.getBasePath() + '/terms/type',
131+
url: TermsService.getBasePath() + '/terms/types',
132132
}).then(function (response) {
133133
deferred.resolve(response.data);
134134
}).catch(function (error) {
@@ -279,5 +279,23 @@ angular.module('supportAdminApp')
279279
return deferred.promise;
280280
};
281281

282+
/**
283+
* gets all agreeability types.
284+
* @returns {Promise} the agreeability types.
285+
*/
286+
TermsService.getAgreeabilityTypes = function () {
287+
var deferred = $q.defer();
288+
var request = $http({
289+
method: 'GET',
290+
url: TermsService.getBasePath() + '/terms/agreeability-types'
291+
});
292+
request.then(function (response) {
293+
deferred.resolve(response.data);
294+
}).catch(function (error) {
295+
TermsService.handleError(error, deferred);
296+
})
297+
return deferred.promise;
298+
};
299+
282300
return TermsService;
283301
}]);

src/app/terms/terms.users.list.controller.js

+4
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@ module.controller('terms.ListTermsUsersController', ['$scope', '$stateParams', '
2929
$scope.calender.signTermsFromOpen = false;
3030
$scope.calender.signTermsToOpen = false;
3131
$scope.title = '';
32+
$scope.id = '';
33+
$scope.legacyId = '';
3234

3335
// list data
3436
$scope.data = [];
3537
var loadUser = IdResolverService.getUserResolverFunction($scope.users);
3638

3739
TermsService.findTermsById($stateParams.termsId).then(function (data) {
3840
$scope.title = data.title;
41+
$scope.id = data.id;
42+
$scope.legacyId = data.legacyId;
3943
}).catch(function (error) {
4044
$alert.error(error.error, $scope);
4145
});

src/app/terms/terms.users.list.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
<div class="wrapper wrapper-content animated fadeInRight" ng-show="authorized()">
66
<div class="row">
77
<div class="col col-md-12 col-lg-12">
8-
<h2><span>{{title}}</span></h2>
8+
<h2><span>{{title}}</span></h2>
9+
<div class="small">
10+
UUID: {{id}}<br />
11+
LegacyID: {{legacyId}}
12+
</div>
913
</div>
1014
</div>
1115
<div class="row">

0 commit comments

Comments
 (0)