Skip to content

Commit 61db5b7

Browse files
author
vikasrohit
committed
Merge branch 'dev'
* dev: (31 commits) Centre aligned the Preparing and Finishing texts. AS#99253782379764, Admin Tool - add progress bar and disable upload button when submission is processing Added support for bulk load users removing commented out code removing debugging statements -- Fixed undefined userHandle being used while uploading -- Fixed error in submission processor because of empty file. more fixes Changed an error message Checking profile after handle is updated [COR-534] COR-207 COR-207 COR-207 COR-207 COR-207 COR-207 Changed the label of user status in the Update status dialog. "Active" -> "Verified" Changed the albel for users' active status. Active -> Verified [COR-523] Admin Tool does not make user's email active - Changed labels (Email, Active) - Added "Email Status" in detailed items - Fixed a bug that contents in the table is not refreshed after activation/deactivation Show deactivation comment in Admin tool [COR-502] - A dialog to confirm change status history. Copy activation link feature in Admin tool [COR-503] - fixed an agly source ...
2 parents 5c82ce1 + 290ddd3 commit 61db5b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2939
-235
lines changed

bower.json

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,28 @@
2525
"angular-footable": "~1.0.3",
2626
"appirio-tech-ng-auth": "3.x.x",
2727
"appirio-tech-ng-login-reg": "0.x.x",
28-
"appirio-tech-ng-api-services": "0.x.x"
28+
"appirio-tech-ng-api-services": "0.x.x",
29+
"angular-clipboard": "~1.2.1",
30+
"appirio-tech-ng-login-reg": "0.x.x",
31+
"lodash": "~4.2.0",
32+
"angular-moment": "~1.0.0-beta.3",
33+
"moment": "~2.11.2",
34+
"moment-timezone": "~0.5.0",
35+
"ng-file-model": "*"
2936
},
3037
"overrides": {
38+
"bootstrap": {
39+
"main": [
40+
"less/bootstrap.less",
41+
"dist/css/bootstrap.css",
42+
"dist/js/bootstrap.js",
43+
"dist/fonts/glyphicons-halflings-regular.eot",
44+
"dist/fonts/glyphicons-halflings-regular.svg",
45+
"dist/fonts/glyphicons-halflings-regular.ttf",
46+
"dist/fonts/glyphicons-halflings-regular.woff",
47+
"dist/fonts/glyphicons-halflings-regular.woff2"
48+
]
49+
},
3150
"footable": {
3251
"main": [
3352
"dist/footable.all.min.js",
@@ -45,6 +64,7 @@
4564
"resolutions": {
4665
"jquery": "~2.1.1",
4766
"angular": "1.4.x",
48-
"angular-resource": "1.4.x"
67+
"angular-resource": "1.4.x",
68+
"moment": "^2.10.x"
4969
}
5070
}

config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
{
22
"local": {
33
"API_URL" : "http://localhost:8080",
4+
"API_VERSION_PATH" : "v3",
45
"AUTH0_CLIENT_ID" : "JFDo7HMkf0q2CkVFHojy3zHWafziprhT",
56
"AUTH0_DOMAIN" : "topcoder-dev.auth0.com",
67
"AUTH0_TOKEN_NAME" : "userJWTToken",
78
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
89
},
910
"dev": {
1011
"API_URL" : "https://api.topcoder-dev.com",
12+
"API_VERSION_PATH" : "v3",
1113
"AUTH0_CLIENT_ID" : "JFDo7HMkf0q2CkVFHojy3zHWafziprhT",
1214
"AUTH0_DOMAIN" : "topcoder-dev.auth0.com",
1315
"AUTH0_TOKEN_NAME" : "userJWTToken",
1416
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
1517
},
1618
"qa": {
1719
"API_URL" : "https://api.topcoder-qa.com",
20+
"API_VERSION_PATH" : "v3",
1821
"AUTH0_CLIENT_ID" : "EVOgWZlCtIFlbehkq02treuRRoJk12UR",
1922
"AUTH0_DOMAIN" : "topcoder-qa.auth0.com",
2023
"AUTH0_TOKEN_NAME" : "userJWTToken",
2124
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
2225
},
2326
"prod": {
2427
"API_URL" : "https://api.topcoder.com",
28+
"API_VERSION_PATH" : "v3",
2529
"AUTH0_CLIENT_ID" : "6ZwZEUo2ZK4c50aLPpgupeg5v2Ffxp9P",
2630
"AUTH0_DOMAIN" : "topcoder.auth0.com",
2731
"AUTH0_TOKEN_NAME" : "userJWTToken",

gulp/build.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ gulp.task('fonts', function () {
7272
return gulp.src($.mainBowerFiles())
7373
.pipe($.filter('**/*.{eot,svg,ttf,woff}'))
7474
.pipe($.flatten())
75-
.pipe(gulp.dest(paths.dist + '/fonts/'));
75+
.pipe(gulp.dest(paths.dist + '/fonts/'))
76+
.pipe(gulp.dest(paths.dist + '/styles/fonts/'));
7677
});
7778

7879
gulp.task('fontawesome', function () {

gulp/ng-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ gulp.task('ng-config', function () {
88
gulp.src('config.json')
99
.pipe(
1010
gulpNgConfig('app.constants', {
11-
environment: process.env.BUILD_ENV || 'dev'
11+
environment: process.env.BUILD_ENV || 'dev',
1212
}))
1313
.pipe(gulp.dest('src/app'))
1414
});

src/app/addmembers/add.controller.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
'use strict';
2+
3+
var module = angular.module('supportAdminApp');
4+
5+
module.controller('addmembers.AddMemberController', ['$log', '$scope', '$parse', 'AuthService', 'MemberService', function ($log, $scope, $parse, $authService, $memberService) {
6+
7+
$scope.errors = [];
8+
$scope.response = [];
9+
$scope.save = function() {
10+
$log.debug($scope.jsonInput);
11+
};
12+
13+
$scope.add = function() {
14+
$log.debug($scope.jsonInput);
15+
16+
if($scope.activate) {
17+
$scope.activate = true;
18+
} else {
19+
$scope.activate = false;
20+
}
21+
22+
for ( var i=0, len = $scope.jsonInput.length; i<len; i++) {
23+
$memberService.addMember($scope.jsonInput[i], $scope.activate, $scope.showFullResponse).then(
24+
function(response) {
25+
$scope.response.push(response);
26+
},
27+
function(error) {
28+
$scope.errors.push(error);
29+
}
30+
);
31+
}
32+
};
33+
}]);

src/app/addmembers/add.html

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
<div class="row wrapper border-bottom white-bg page-heading">
3+
<div class="col-lg-10">
4+
<h2>Add Members</h2>
5+
</div>
6+
<div class="col-lg-2">
7+
</div>
8+
</div>
9+
10+
<div class="wrapper wrapper-content animated fadeInRight">
11+
<div class="row" ng-controller="addmembers.AddMemberController">
12+
<div class="col-lg-12">
13+
<div class="ibox float-e-margins">
14+
<div class="ibox-title">
15+
<div class="row">
16+
<form role="form">
17+
<form action="" method="post" enctype="multipart/form-data">
18+
<div class="form-group" ng-hide="jsonInput">
19+
<label class="control-label">Upload CSV file</label>
20+
<input type="file" csv-reader results="jsonInput" />
21+
</div>
22+
23+
<div class="block right" ng-if="jsonInput.length">
24+
<h2>JSON</h2>
25+
<div class="content">{{ jsonInput }}</div>
26+
<div class="form-group">
27+
<button class="btn btn-primary" ng-click="add()" type="button">Add</button>
28+
</div>
29+
</div>
30+
31+
<div class="checkbox">
32+
<label>
33+
<input type="checkbox" ng-model="activate">Activate
34+
</label>
35+
</div>
36+
37+
<div class="checkbox">
38+
<label>
39+
<input type="checkbox" ng-model="showFullResponse">Show Full Response
40+
</label>
41+
</div>
42+
43+
<div ng-if="response.length">
44+
<h2>SUCCESS</h2>
45+
<div class="row" style="color:green; line-height:2;"><p style="margin-bottom:5px; border:1px solid black;" ng-repeat="res in response">{{ res }}</p></div>
46+
</div>
47+
48+
<div ng-if="errors.length">
49+
<h2>ERRORS</h2>
50+
<div class="row" style="color:red; line-height:2;"><p style="margin-bottom:5px; border:1px solid black;" ng-repeat="error in errors">{{ error }}</p></div>
51+
</div>
52+
</form>
53+
</form>
54+
</div>
55+
</div>
56+
</div>
57+
</div>
58+
</div>
59+
</div>

src/app/addmembers/add.service.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
'use strict';
2+
3+
angular.module('supportAdminApp')
4+
.factory('MemberService', ['$log', '$q','$http', 'API_URL',
5+
function ($log, $q, $http, API_URL) {
6+
// local dev
7+
// var API_URL = 'http://local.topcoder-dev.com:8080';
8+
return ({
9+
/* add member */
10+
addMember: function(jsonInput, activate, showFullResponse) {
11+
12+
$log.debug("in addMember");
13+
$log.debug(jsonInput);
14+
var payload = "{\"param\": {" +
15+
"\"handle\": \""+jsonInput.handle+"\","+
16+
"\"firstName\": \""+jsonInput.firstName+"\","+
17+
"\"lastName\": \""+jsonInput.lastName+"\","+
18+
"\"email\": \""+jsonInput.email+"\","+
19+
"\"active\": "+activate+","+
20+
"\"country\": {"+
21+
"\"name\": \""+jsonInput.country+"\"},"+
22+
"\"credential\": {"+
23+
"\"password\": \""+jsonInput.password+"\"}}}";
24+
$log.debug("payload is "+payload);
25+
var request = $http({
26+
method: 'POST',
27+
url: API_URL + '/v3/users',
28+
headers: {
29+
"Content-Type":"application/json"
30+
},
31+
data: payload
32+
});
33+
var errors;
34+
var response;
35+
return request.then(
36+
function(response) {
37+
$log.debug(response);
38+
if (!showFullResponse) {
39+
response = "HANDLE: "+jsonInput.handle+" STATUS: "+response.status;
40+
}
41+
return response;
42+
},
43+
function(error) {
44+
$log.error(error);
45+
var err;
46+
if(error && error.data && error.data.result) {
47+
err = {
48+
status: error.status,
49+
error : error.data.result.content
50+
};
51+
$log.error("Status: "+error.status);
52+
$log.error("Error Reason: "+error.data.result.content);
53+
if (!showFullResponse) {
54+
errors = "HANDLE: "+jsonInput.handle+" STATUS: "+error.status+" REASON: "+error.data.result.content;
55+
}else {
56+
errors = error;
57+
}
58+
}
59+
if(!err) {
60+
err = {
61+
status: error.status,
62+
error : error.statusText
63+
};
64+
}
65+
return $q.reject(errors);
66+
}
67+
);
68+
69+
}, // addMember()
70+
});
71+
}]);

src/app/addmembers/csv.import.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
'use strict';
2+
3+
var csvImport = angular.module('csvReader', []);
4+
5+
csvImport.directive('csvReader', [function () {
6+
7+
// Function to convert to JSON
8+
var convertToJSON = function (content) {
9+
10+
// Declare our variables
11+
var lines = content.csv.split('\n'),
12+
headers = lines[0].split(content.separator),
13+
columnCount = lines[0].split(content.separator).length,
14+
results = [];
15+
16+
// For each row
17+
for (var i = 1; i < lines.length; i++) {
18+
19+
// Declare an object
20+
var obj = {};
21+
22+
// Get our current line
23+
var line = lines[i].split(new RegExp(content.separator + '(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)'));
24+
25+
// For each header
26+
for (var j = 0; j < headers.length; j++) {
27+
28+
// Populate our object
29+
obj[headers[j]] = line[j];
30+
}
31+
32+
// Push our object to our result array
33+
results.push(obj);
34+
}
35+
36+
// Return our array
37+
return results;
38+
};
39+
40+
return {
41+
restrict: 'A',
42+
scope: {
43+
results: '=',
44+
separator: '=',
45+
callback: '&saveResultsCallback'
46+
},
47+
link: function (scope, element, attrs) {
48+
49+
// Create our data model
50+
var data = {
51+
csv: null,
52+
separator: scope.separator || ','
53+
};
54+
55+
// When the file input changes
56+
element.on('change', function (e) {
57+
58+
// Get our files
59+
var files = e.target.files;
60+
61+
// If we have some files
62+
if (files && files.length) {
63+
64+
// Create our fileReader and get our file
65+
var reader = new FileReader();
66+
var file = (e.srcElement || e.target).files[0];
67+
68+
// Once the fileReader has loaded
69+
reader.onload = function (e) {
70+
71+
// Get the contents of the reader
72+
var contents = e.target.result;
73+
74+
// Set our contents to our data model
75+
data.csv = contents;
76+
77+
// Apply to the scope
78+
scope.$apply(function () {
79+
80+
// Our data after it has been converted to JSON
81+
scope.results = convertToJSON(data);
82+
83+
// Call our callback function
84+
scope.callback(scope.result);
85+
});
86+
};
87+
88+
// Read our file contents
89+
reader.readAsText(file);
90+
}
91+
});
92+
}
93+
};
94+
}])

src/app/addmembers/testData.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
handle,firstName,lastName,email,country,password
2+
rpemm_testbk1,ram,p,[email protected],United States,appirio123

0 commit comments

Comments
 (0)