Skip to content

Commit 626cd8e

Browse files
author
javaage
committed
client ui
1 parent 75315ea commit 626cd8e

19 files changed

Lines changed: 648 additions & 67 deletions
Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1-
2018-01-12 17:17:42,880,==> Preparing: select usr_id, usr_name, usr_budget, usr_balance, usr_bu, usr_title, usr_grade, usr_rl_name, usr_active from public.la_user where usr_id = ?
2-
2018-01-12 17:17:43,177,==> Parameters: test1@test1.com(String)
3-
2018-01-12 17:17:43,342,<== Total: 0
4-
2018-01-12 17:19:19,791,==> Preparing: select usr_id, usr_name, usr_budget, usr_balance, usr_bu, usr_title, usr_grade, usr_rl_name, usr_active from public.la_user where usr_id = ?
5-
2018-01-12 17:19:19,792,==> Parameters: test1@test.com(String)
6-
2018-01-12 17:19:19,801,<== Total: 1
1+
2018-01-15 16:43:04,444,==> Preparing: select usr_id, usr_name, usr_budget, usr_balance, usr_bu, usr_title, usr_grade, usr_rl_name, usr_active from public.la_user
2+
2018-01-15 16:43:04,446,==> Preparing: select usr_id, usr_name, usr_budget, usr_balance, usr_bu, usr_title, usr_grade, usr_rl_name, usr_active from public.la_user
3+
2018-01-15 16:43:04,466,==> Parameters:
4+
2018-01-15 16:43:04,468,==> Parameters:
5+
2018-01-15 16:43:04,547,<== Total: 2
6+
2018-01-15 16:43:04,547,<== Total: 2
7+
2018-01-15 16:43:07,846,==> Preparing: select usr_id, usr_name, usr_budget, usr_balance, usr_bu, usr_title, usr_grade, usr_rl_name, usr_active from public.la_user
8+
2018-01-15 16:43:07,847,==> Parameters:
9+
2018-01-15 16:43:07,848,<== Total: 2
10+
2018-01-15 16:43:07,855,==> Preparing: select usr_id, usr_name, usr_budget, usr_balance, usr_bu, usr_title, usr_grade, usr_rl_name, usr_active from public.la_user
11+
2018-01-15 16:43:07,856,==> Parameters:
12+
2018-01-15 16:43:07,858,<== Total: 2
13+
2018-01-15 16:46:28,849,==> Preparing: select usr_id, usr_name, usr_budget, usr_balance, usr_bu, usr_title, usr_grade, usr_rl_name, usr_active from public.la_user
14+
2018-01-15 16:46:28,872,==> Parameters:
15+
2018-01-15 16:46:28,890,<== Total: 2
16+
2018-01-15 16:46:28,931,==> Preparing: select usr_id, usr_name, usr_budget, usr_balance, usr_bu, usr_title, usr_grade, usr_rl_name, usr_active from public.la_user
17+
2018-01-15 16:46:28,932,==> Parameters:
18+
2018-01-15 16:46:28,934,<== Total: 2
19+
2018-01-15 16:47:26,146,==> Preparing: select usr_id, usr_name, usr_budget, usr_balance, usr_bu, usr_title, usr_grade, usr_rl_name, usr_active from public.la_user
20+
2018-01-15 16:47:26,147,==> Parameters:
21+
2018-01-15 16:47:26,150,<== Total: 2
22+
2018-01-15 16:48:20,616,==> Preparing: select usr_id, usr_name, usr_budget, usr_balance, usr_bu, usr_title, usr_grade, usr_rl_name, usr_active from public.la_user
23+
2018-01-15 16:48:20,620,==> Parameters:
24+
2018-01-15 16:48:20,637,<== Total: 2
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2018-01-12 17:17:42,880,==> Preparing: select usr_id, usr_name, usr_budget, usr_balance, usr_bu, usr_title, usr_grade, usr_rl_name, usr_active from public.la_user where usr_id = ?
2+
2018-01-12 17:17:43,177,==> Parameters: test1@test1.com(String)
3+
2018-01-12 17:17:43,342,<== Total: 0
4+
2018-01-12 17:19:19,791,==> Preparing: select usr_id, usr_name, usr_budget, usr_balance, usr_bu, usr_title, usr_grade, usr_rl_name, usr_active from public.la_user where usr_id = ?
5+
2018-01-12 17:19:19,792,==> Parameters: test1@test.com(String)
6+
2018-01-12 17:19:19,801,<== Total: 1

helloworld-springboot/src/main/UI/gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ gulp.task('custom-images', function() {
5656

5757
gulp.task('custom-js', function() {
5858
return gulp.src(paths.scripts)
59-
.pipe(minifyJs())
59+
//.pipe(minifyJs())
6060
.pipe(concat('dashboard.min.js'))
6161
.pipe(gulp.dest('../webapp/js'));
6262
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Loading Directive
3+
* @see http://tobiasahlin.com/spinkit/
4+
*/
5+
6+
angular
7+
.module('RDash')
8+
.constant('app.constants',{
9+
environments: {
10+
PRO: 'PRO',
11+
UAT: 'UAT',
12+
SIT: 'SIT',
13+
MOCK: 'MOCK'
14+
}
15+
});
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
angular
2+
.module('RDash')
3+
.provider('app.environments', ['app.constants', function (constants) {
4+
function getMock() {
5+
return {
6+
environment: 'MOCK',
7+
services: {
8+
customService: {
9+
serviceName: 'customService',
10+
identifier: 'http://192.168.120.128:8080'
11+
}
12+
}
13+
};
14+
}
15+
function getPRO() {
16+
return {
17+
environment: 'PRO',
18+
services: {
19+
customService: {
20+
serviceName: 'customService',
21+
identifier: '/'
22+
}
23+
}
24+
};
25+
}
26+
// config object
27+
var config = {
28+
environment: '',
29+
services: {}
30+
};
31+
var _basicUrls = {
32+
getUser: '/api/user/{0}',
33+
getUserList: '/api/user/list',
34+
deleteUser: '/api/user/{0}',
35+
addUser: '/api/user',
36+
updateUser: '/api/user/{0}'
37+
};
38+
function _joinUrl(domain, path) {
39+
return domain.replace(/(^http.*?)\/{0,}$/, '$1/') + path.replace(/^\/{0,}(.*)/, '$1');
40+
}
41+
function _generateURLs(identifier, urls) {
42+
var newUrls = angular.extend({}, urls);
43+
44+
angular.forEach(newUrls, function (v, k) {
45+
if (typeof v == 'string') {
46+
if (!(v.match(/^http/))) {
47+
newUrls[k] = _joinUrl(identifier, v);
48+
}
49+
}
50+
else {
51+
newUrls[k] = _generateURLs(identifier, v);
52+
}
53+
});
54+
return newUrls;
55+
}
56+
this.setEnvironment = function (environment) {
57+
if (environment === constants.environments.MOCK) {
58+
config = getMock();
59+
}
60+
else if (environment === constants.environments.PRO) {
61+
config = getPRO();
62+
}
63+
if (!config.services.customService.url) {
64+
config.services.customService.url = _generateURLs(config.services.customService.identifier, _basicUrls);
65+
}
66+
if (!config.services.customService.urlParams) {
67+
if (environment === constants.environments.MOCK) {
68+
config.services.customService.urlParams = config.services.customService.url;
69+
} else {
70+
config.services.customService.urlParams = _basicUrls;
71+
}
72+
}
73+
this.config = config;
74+
};
75+
this.$get = function () {
76+
this.setEnvironment(constants.environments.MOCK);
77+
return config;
78+
};
79+
80+
}]);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
angular
2+
.module('RDash')
3+
.service('app.services', ['$http','$q','app.environments',function ($http,$q,environments) {
4+
var url = environments.services.customService.url;
5+
var deferred = $q.defer();
6+
this.getUserList = function(){
7+
$http.get(url.getUserList,{})
8+
.success(function(data){
9+
console.log(data);
10+
if (data.code == 1) {
11+
deferred.resolve(data);
12+
} else {
13+
deferred.reject(data);
14+
}
15+
})
16+
.error(function(error){
17+
deferred.reject(error);
18+
});
19+
20+
return deferred.promise;
21+
};
22+
}]);
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
/**
2-
* Alerts Controller
3-
*/
4-
51
angular
62
.module('RDash')
7-
.controller('EmployeeCtrl', ['$scope', EmployeeCtrl]);
3+
.controller('EmployeeCtrl', ['$scope','app.environments','app.services', EmployeeCtrl]);
4+
5+
function EmployeeCtrl($scope,environments,services) {
6+
7+
services.getUserList().then(function(result) {
8+
9+
if (result.code == 1) {
10+
$scope.users = result.data;
11+
}
12+
}, function (error) {
13+
console.log(error);
14+
});
15+
16+
$scope.submitUser = function(){
817

9-
function EmployeeCtrl($scope) {
10-
$scope.message = "welcome";
18+
};
1119
}

helloworld-springboot/src/main/UI/src/js/routes.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,23 @@ angular.module('RDash').config(['$stateProvider', '$urlRouterProvider',
1313
$stateProvider
1414
.state('employee', {
1515
url: '/employee',
16-
templateUrl: 'templates/employee.html'
16+
templateUrl: 'templates/employee.html',
17+
controller: 'EmployeeCtrl'
1718
})
1819
.state('role', {
1920
url: '/role',
20-
templateUrl: 'templates/role.html'
21+
templateUrl: 'templates/role.html',
22+
controller: 'RoleCtrl'
2123
})
2224
.state('course', {
2325
url: '/course',
24-
templateUrl: 'templates/course.html'
26+
templateUrl: 'templates/course.html',
27+
controller: 'CourseCtrl'
2528
})
2629
.state('sample', {
2730
url: '/sample',
28-
templateUrl: 'templates/sample.html'
31+
templateUrl: 'templates/sample.html',
32+
controller: 'SampleCtrl'
2933
})
3034
// .state('index', {
3135
// url: '/',

helloworld-springboot/src/main/UI/src/templates/employee.html

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,53 @@
99
<table class="table">
1010
<thead>
1111
<tr>
12-
<th class="text-center">ID</th>
13-
<th>Username</th>
14-
<th>Role</th>
15-
<th>Account</th>
12+
<th class="text-center">Spark Account</th>
13+
<th class="text-center">Name</th>
14+
<th class="text-center">Budget</th>
15+
<th class="text-center">Balance</th>
16+
<th class="text-center">BU</th>
17+
<th class="text-center">Role</th>
18+
<th class="text-center">Title</th>
19+
<th class="text-center">Grade</th>
1620
</tr>
1721
</thead>
1822
<tbody>
19-
<tr><td class="text-center">1</td><td>Joe Bloggs</td><td>Super Admin</td><td>AZ23045</td></tr>
20-
<tr><td class="text-center">2</td><td>Timothy Hernandez</td><td>Admin</td><td>AU24783</td></tr>
21-
<tr><td class="text-center">3</td><td>Joe Bickham</td><td>User</td><td>AM23781</td></tr>
23+
<tr ng-repeat="item in users" >
24+
<td class="text-center">{{item.id}}</td>
25+
<td class="text-center">{{item.name}}</td>
26+
<td class="text-center">{{item.budget}}</td>
27+
<td class="text-center">{{item.balance}}</td>
28+
<td class="text-center">{{item.bu}}</td>
29+
<td class="text-center">{{item.roleName}}</td>
30+
<td class="text-center">{{item.title}}</td>
31+
<td class="text-center">{{item.grade}}</td>
32+
</tr>
2233
</tbody>
2334
</table>
2435
</div>
2536
</rd-widget-body>
2637
<rd-widget>
2738
</div>
39+
40+
<div class="modal fade" id="id_user_info" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
41+
<div class="modal-dialog">
42+
<div class="modal-content" style="background-color: #43596e;">
43+
<div class="modal-header tableHeader">
44+
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
45+
<h4 class="modal-title" id="myModalLabel">Title</h4>
46+
</div>
47+
<div class="modal-body" style="padding: 5px 20px;">
48+
49+
</div>
50+
<div class="modal-footer">
51+
<button type="button" class="btn btn-primary" ng-click="submitUser()">Submit</button>
52+
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
53+
</div>
54+
</div>
55+
</div>
56+
</div>
57+
58+
2859
<div class="col-lg-12">
2960
<form class="form-horizontal">
3061
<div class="form-group">
Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package com.cisco.la;
22

3+
import org.springframework.context.annotation.Bean;
34
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.web.cors.CorsConfiguration;
6+
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
7+
import org.springframework.web.filter.CorsFilter;
48

59
@Configuration
610
public class AppConfiguration {
@@ -10,18 +14,18 @@ public class AppConfiguration {
1014
// return new DataSourceTransactionManager(dataSource);
1115
// }
1216
//
13-
// private CorsConfiguration buildConfig() {
14-
// CorsConfiguration corsConfiguration = new CorsConfiguration();
15-
// corsConfiguration.addAllowedOrigin("*"); // 1
16-
// corsConfiguration.addAllowedHeader("*"); // 2
17-
// corsConfiguration.addAllowedMethod("*"); // 3
18-
// return corsConfiguration;
19-
// }
20-
//
21-
// @Bean
22-
// public CorsFilter corsFilter() {
23-
// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
24-
// source.registerCorsConfiguration("/**", buildConfig()); // 4
25-
// return new CorsFilter(source);
26-
// }
17+
private CorsConfiguration buildConfig() {
18+
CorsConfiguration corsConfiguration = new CorsConfiguration();
19+
corsConfiguration.addAllowedOrigin("*"); // 1
20+
corsConfiguration.addAllowedHeader("*"); // 2
21+
corsConfiguration.addAllowedMethod("*"); // 3
22+
return corsConfiguration;
23+
}
24+
25+
@Bean
26+
public CorsFilter corsFilter() {
27+
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
28+
source.registerCorsConfiguration("/**", buildConfig()); // 4
29+
return new CorsFilter(source);
30+
}
2731
}

0 commit comments

Comments
 (0)