Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit f09e519

Browse files
committed
Octoboer release challenge
#201 #200 #199 #198 #197 #190 #127 #84 #72
1 parent d93d533 commit f09e519

19 files changed

+356
-154
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"icheck": "1.0.2",
6464
"joi": "^10.6.0",
6565
"jquery": "^3.4.1",
66+
"jquery-ui-dist": "^1.12.1",
6667
"jsonwebtoken": "^7.4.3",
6768
"jwt-decode": "^2.2.0",
6869
"lodash": "^4.17.4",

src/controllers/ProjectController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const ProjectService = require('../services/ProjectService');
1818
* @returns {Object} the result
1919
*/
2020
async function create(req) {
21-
return await ProjectService.create(req.body, req.currentUser.handle);
21+
return await ProjectService.create(req.body, req.currentUser);
2222
}
2323

2424
/**

src/front/src/app/less/base.less

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -120,55 +120,56 @@ video {
120120
}
121121

122122
/* MODAL */
123-
.modal-content {
124-
background-clip: padding-box;
125-
background-color: #FFFFFF;
126-
border: 1px solid rgba(0, 0, 0, 0);
127-
border-radius: 4px;
128-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
129-
outline: 0 none;
130-
position: relative;
123+
button.btn-settings {
124+
margin: 25px;
125+
padding: 20px 30px;
126+
font-size: 1.2em;
127+
background-color: #337ab7;
128+
color: white;
129+
}
130+
button.btn-settings:active {
131+
color: white;
132+
}
133+
.modal {
134+
overflow: hidden;
135+
position: absolute;
136+
left: 35%;
137+
top: 25%;
138+
// pointer-events: none;
131139
}
132-
133140
.modal-dialog {
134-
z-index: 2200;
141+
margin-right: 0;
142+
margin-left: 0;
135143
}
136-
137-
.modal-body {
138-
padding: 20px 30px 30px 30px;
144+
.modal-header {
145+
height:30px;
146+
padding: 20px;
147+
background-color:#18456b;
148+
color:white;
139149
}
140-
141-
142-
.inmodal .modal-body {
143-
background: #f8fafb;
150+
.modal-title {
151+
margin-top:-10px;
152+
font-size:16px;
144153
}
145-
146-
.inmodal .modal-header {
147-
padding: 30px 15px;
148-
text-align: center;
154+
.modal-header .close {
155+
margin-top:-10px;
156+
color:#fff;
149157
}
150-
151-
.animated.modal.fade .modal-dialog {
152-
-webkit-transform: none;
153-
-ms-transform: none;
154-
-o-transform: none;
155-
transform: none;
158+
.modal-body {
159+
color:#888;
160+
padding: 5px 35px 20px;
156161
}
157-
158-
.inmodal .modal-title {
159-
font-size: 26px;
162+
.modal-body h3 {
163+
text-align: center;
160164
}
161-
162-
.inmodal .modal-icon {
163-
font-size: 84px;
164-
color: #e2e3e3;
165+
.modal-body p {
166+
padding-top:10px;
167+
font-size: 1.1em;
165168
}
166-
167-
.modal-footer {
168-
margin-top: 0;
169+
.modal-backdrop {
170+
display: none;
169171
}
170172

171-
172173
/* WRAPPERS */
173174

174175
#wrapper {

src/front/src/app/less/buttons.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,8 @@ button.dim:active:before {
341341
top: 7px;
342342
font-size: 50px;
343343
}
344+
345+
.btn-top {
346+
width: 140px !important;
347+
margin-right: 20px;
348+
}

src/front/src/app/less/pages.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ a.compose-mail {
611611
}
612612

613613
.word-wrap {
614-
word-break: break-all;
614+
word-break: normal;
615615
}
616616

617617
.mail-box-header {

src/front/src/app/main/main.controller.js

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
'use strict';
22

33
angular.module('topcoderX')
4-
.controller('MainController', ['$scope', '$rootScope', 'Alert', '$state', 'AuthService', 'IssueService', 'SettingService', '$log',
5-
function ($scope, $rootScope, Alert, $state, AuthService, IssueService, SettingService, $log) {
4+
.controller('MainController', ['$scope', '$rootScope', 'Alert', '$state', 'AuthService', 'IssueService',
5+
'SettingService', 'Tutorial', 'ProjectService', '$log', '$location',
6+
function ($scope, $rootScope, Alert, $state, AuthService, IssueService, SettingService, Tutorial,
7+
ProjectService, $log, $location) {
68
$scope.isLoaded = false;
79
$scope.tableConfig = {
810
readyForReview: {
@@ -140,8 +142,6 @@ angular.module('topcoderX')
140142
};
141143

142144
SettingService.userSetting($rootScope.currentUser.handle).then(function (response) {
143-
$log.log('logku');
144-
$log.log(response);
145145
if (response.data.expired.github) {
146146
Alert.error('Your Github token has expired. Please go to settings to renew your token', $scope);
147147
}
@@ -150,4 +150,39 @@ angular.module('topcoderX')
150150
}
151151
});
152152

153+
//private function to get projects.
154+
$scope.getProjects = function (status) {
155+
ProjectService.getProjects(status, false).then(function (response) {
156+
$scope.projects = response.data;
157+
if (!$scope.projects || $scope.projects.length === 0) {
158+
$scope.showTutorial();
159+
}
160+
}).catch(function () {
161+
$scope.showTutorial();
162+
});
163+
};
164+
$scope.getProjects('active');
165+
$scope.showTutorial = function () {
166+
$rootScope.dialog = {
167+
proceed: false
168+
};
169+
var tutorialMessage = 'Welcome to Topcoder-X! You can find full documentation here: <a href="https://github.com/topcoder-platform/topcoder-x-ui/wiki" target="_blank">https://github.com/topcoder-platform/topcoder-x-ui/wiki</a>\n' +
170+
'<br>' +
171+
'<br>' +
172+
'Next steps include:\n' +
173+
'<br>' +
174+
'Authorize GitHub / GitLab <Should be a link to the Settings>\n' +
175+
'<br>' +
176+
'Add a Project <Should be a link to the Projects>\n' +
177+
'<br>' +
178+
'Add Labels and Webhooks to your project';
179+
var dialog = {
180+
message: tutorialMessage,
181+
action: 'close'
182+
};
183+
if ($location.path() === '/app/main') {
184+
Tutorial.show(dialog, $scope);
185+
}
186+
}
187+
153188
}]);

src/front/src/app/main/main.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,4 +302,5 @@ <h2>Dashboard</h2>
302302
</div>
303303
</div>
304304
</div>
305-
</div>
305+
</div>
306+
<div ng-include src="'components/tutorial/tutorial.html'"></div>

src/front/src/app/settings/settings.controller.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
angular.module('topcoderX').controller('SettingController', ['currentUser', '$scope', 'OWNER_LOGIN_GITHUB_URL',
44
'OWNER_LOGIN_GITLAB_URL', 'SettingService', '$rootScope', 'Dialog', 'Alert', 'Helper', '$window',
5+
'Tutorial',
56
function (currentUser, $scope, OWNER_LOGIN_GITHUB_URL,
6-
OWNER_LOGIN_GITLAB_URL, SettingService, $rootScope, Dialog, Alert, Helper, $window) {
7+
OWNER_LOGIN_GITLAB_URL, SettingService, $rootScope, Dialog, Alert, Helper, $window, Tutorial) {
78
$scope.settings = {};
89
$scope.isLoaded = false;
910

@@ -56,4 +57,16 @@ angular.module('topcoderX').controller('SettingController', ['currentUser', '$sc
5657
});
5758
}
5859

60+
var tutorial = $window.localStorage.getItem('tutorial');
61+
if (tutorial) {
62+
setTimeout(function() {
63+
var dialog = {
64+
message: 'Connect your Gitlab or Github account into Topcoder-X by pressing "Setup" button',
65+
action: 'app.project'
66+
};
67+
$rootScope.tutorial = dialog;
68+
Tutorial.show(dialog, $scope);
69+
}, 2500);
70+
}
71+
5972
}]);

src/front/src/app/settings/settings.html

Lines changed: 53 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,63 @@ <h2>Settings</h2>
1111
<div class="row">
1212
<div class="col-lg-12">
1313
<div class="ibox">
14-
<div class="ibox-content lh-40">
15-
<div class="row">
16-
<div class="col-xs-6 col-md-2">Github</div>
17-
<div class="col-xs-6 col-md-2" ng-if='isLoaded'>
18-
<div ng-if='settings.github'>
19-
<i ng-if='!settings.expired.github' class="btn fa fa-check green-check-icon"></i>
20-
<i ng-if='settings.expired.github' class="btn fa fa-warning orange-warning-icon" ng-click="renew('github')" title="Renew the token"></i>&#09;
21-
<i class="btn btn-sm btn-danger fa fa-remove white-remove-icon" ng-click="revoke('github')" title="Revoke"></i>
14+
<table style="width:30%">
15+
<col width="70%">
16+
<col width="15%">
17+
<col width="15%">
18+
<tr height="60px">
19+
<td><h4>Github</h4></td>
20+
<td>
21+
<div ng-if='isLoaded'>
22+
<div ng-if='settings.github'>
23+
<i ng-if='!settings.expired.github' class="btn fa fa-check green-check-icon"></i>
24+
<i ng-if='settings.expired.github' class="btn fa fa-warning orange-warning-icon" ng-click="renew('github')" title="Renew the token"></i>&#09;
25+
</div>
26+
<div ng-if='!settings.github'>
27+
<a class="btn btn-sm btn-info" ng-href="{{loginUrl.github}}">
28+
Setup
29+
</a>
30+
</div>
2231
</div>
23-
<div ng-if='!settings.github'>
24-
<a class="btn btn-sm btn-info" ng-href="{{loginUrl.github}}">
25-
Setup
26-
</a>
32+
</td>
33+
<td>
34+
<div ng-if='isLoaded'>
35+
<div ng-if='settings.github'>
36+
<a class="btn btn-sm btn-danger" ng-click="revoke('github')">
37+
Revoke
38+
</a>
39+
</div>
2740
</div>
28-
</div>
29-
</div>
30-
<div class="row">
31-
<div class="col-xs-6 col-md-2">Gitlab</div>
32-
<div class="col-xs-6 col-md-2" ng-if='isLoaded'>
33-
<div ng-if='settings.gitlab'>
34-
<i ng-if='!settings.expired.gitlab' class="btn fa fa-check green-check-icon"></i>
35-
<i ng-if='settings.expired.gitlab' class="btn fa fa-warning orange-warning-icon" ng-click="renew('gitlab')" title="Renew the token"></i>&#09;
36-
<i class="btn btn-sm btn-danger fa fa-remove white-remove-icon" ng-click="revoke('gitlab')" title="Revoke"></i>
41+
</td>
42+
</tr>
43+
<tr height="60px">
44+
<td><h4>Gitlab</h4></td>
45+
<td>
46+
<div ng-if='isLoaded'>
47+
<div ng-if='settings.gitlab'>
48+
<i ng-if='!settings.expired.gitlab' class="btn fa fa-check green-check-icon"></i>
49+
<i ng-if='settings.expired.gitlab' class="btn fa fa-warning orange-warning-icon" ng-click="renew('gitlab')" title="Renew the token"></i>&#09;
50+
</div>
51+
<div ng-if='!settings.gitlab'>
52+
<a class="btn btn-sm btn-info" ng-href="{{loginUrl.gitlab}}">
53+
Setup
54+
</a>
55+
</div>
3756
</div>
38-
<div ng-if='!settings.gitlab'>
39-
<a class="btn btn-sm btn-info" ng-href="{{loginUrl.gitlab}}" target="_self">
40-
Setup
41-
</a>
57+
</td>
58+
<td>
59+
<div ng-if='isLoaded'>
60+
<div ng-if='settings.gitlab'>
61+
<a class="btn btn-sm btn-danger" ng-click="revoke('gitlab')">
62+
Revoke
63+
</a>
64+
</div>
4265
</div>
43-
</div>
44-
</div>
45-
</div>
66+
</td>
67+
</tr>
68+
</table>
4669
</div>
4770
</div>
4871
</div>
49-
</div>
72+
</div>
73+
<div ng-include src="'components/tutorial/tutorial.html'"></div>

src/front/src/app/upsertproject/recreate-dialog.controller.js

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
angular.module('topcoderX')
55
.controller('RecreateDialogController', [
6-
'$scope', '$rootScope', '$state', '$uibModalInstance', 'IssueService', 'Alert', 'appConfig', 'project', '$log',
7-
function ($scope, $rootScope, $state, $uibModalInstance, IssueService, Alert, appConfig, project, $log) {
6+
'$scope', '$rootScope', '$state', '$uibModalInstance', 'IssueService', 'Alert', 'appConfig', 'project',
7+
function ($scope, $rootScope, $state, $uibModalInstance, IssueService, Alert, appConfig, project) {
88
// The user list
99
$scope.project = project;
1010
$scope.appConfig = appConfig;
@@ -18,17 +18,11 @@ angular.module('topcoderX')
1818
return;
1919
}
2020
var issueNumber;
21-
$log.log($scope.url);
2221
var ticketURL = new URL($scope.url);
23-
$log.log(ticketURL);
2422
if (ticketURL.pathname) {
25-
$log.log('asda');
2623
var paths = ticketURL.pathname.split('/');
27-
$log.log(paths);
2824
if (paths && paths.length > 0) {
29-
$log.log('fafa');
3025
issueNumber = parseInt(paths[paths.length - 1], 10);
31-
$log.log(issueNumber);
3226
}
3327
}
3428
if (!issueNumber) {
@@ -38,7 +32,8 @@ angular.module('topcoderX')
3832
var issue = {
3933
projectId: $scope.project.id,
4034
url: $scope.url,
41-
number: issueNumber
35+
number: issueNumber,
36+
recreate: $scope.isRecreate === 1
4237
};
4338
IssueService.recreate(issue).then(function () {
4439
Alert.info('<a href="' + $scope.url+ '" target="_blank"><b><u>Issue #' + issue.number + '</u></b></a> has been recreated', $scope);
@@ -48,15 +43,6 @@ angular.module('topcoderX')
4843
Alert.error(error.data.message, $scope);
4944
});
5045

51-
// ProjectService.transferOwnership($scope.project.id, $scope.owner).then(function () {
52-
// Alert.info('Project ownership is transferred Successfully', $rootScope);
53-
// $rootScope.project = project;
54-
// $rootScope.project.owner = $scope.owner;
55-
// $state.go('app.project');
56-
// $uibModalInstance.close();
57-
// }).catch(function (error) {
58-
// Alert.error(error.data.message, $scope);
59-
// });
6046
};
6147

6248
/**

src/front/src/app/upsertproject/recreate-dialog.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ <h4 class="modal-title" id="reg-dialog-label">Recreate an Issue</h4>
1111
<input class="form-control" type="text" ng-model="url" required />
1212
<br />
1313
</div>
14+
<div class="row">
15+
<label>
16+
<input type="checkbox" ng-model="isRecreate" ng-true-value="1" ng-false-value="0"> Recreate
17+
</label>
18+
<br />
19+
</div>
1420
<div class="row">
1521
<div class="col-md-10 col-md-offset-1" ng-include src="'components/alert/alert.html'"></div>
1622
</div>

0 commit comments

Comments
 (0)