Skip to content

Commit 20e5c23

Browse files
authored
Merge pull request #75 from topcoder-platform/dev
Group management and bower removal
2 parents 7d847e5 + 04c7511 commit 20e5c23

32 files changed

+1104
-111
lines changed

README.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ Internal application used to administer specific support tasks related to the To
1212

1313
## Installation
1414

15-
To install npm and bower dependencies run:
15+
To install npm dependencies run:
1616

1717
> npm install
1818
19-
Bower is set to run as a npm postinstall script.
20-
2119
## Configuration
2220

2321
The configuration is provided in `config.json` in the base directory.
@@ -64,13 +62,12 @@ Before executing the end-to-end (e2e) protractor tests, these environment variab
6462

6563
### Install global dependencies
6664

67-
```npm install -g gulp@3.8.10 bower```
65+
```npm install -g gulp@3.8.10```
6866

6967
### Install project dependencies
7068

7169
```
7270
npm install
73-
bower install
7471
```
7572

7673
### Start the Application

bower.json

-69
This file was deleted.

circle.yml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ dependencies:
1212
- curl -s https://raw.githubusercontent.com/chronogolf/circleci-google-chrome/master/use_chrome_stable_version.sh | bash
1313

1414
override:
15-
- rm -rf bower_components
1615
- npm install
1716

1817
post:

gulp/browserify.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
var gulp = require('gulp');
2+
3+
var paths = gulp.paths;
4+
5+
var browserify = require('browserify');
6+
var uglify = require('gulp-uglify');
7+
var buffer = require('vinyl-buffer');
8+
var source = require('vinyl-source-stream');
9+
var gutil = require('gulp-util');
10+
var fs = require('fs');
11+
12+
gulp.task('browserify', ['styles'], function () {
13+
14+
var cssFilePath = paths.tmp + '/serve/app/bundle.css';
15+
16+
//delete file if exist
17+
if (fs.existsSync(cssFilePath)) {
18+
fs.unlinkSync(cssFilePath);
19+
}
20+
21+
browserify('./src/index.js')
22+
.transform(require('browserify-css'), {
23+
rootDir: 'src',
24+
onFlush: function (options, done) {
25+
fs.appendFileSync(cssFilePath, options.data);
26+
27+
// Do not embed CSS into a JavaScript bundle
28+
done(null);
29+
}
30+
})
31+
.bundle()
32+
.on('error', function (e) {
33+
gutil.log("Browserify Error", gutil.colors.red(e.message))
34+
})
35+
//Pass desired output filename to vinyl-source-stream
36+
.pipe(source('bundle.js'))
37+
.pipe(buffer())
38+
.pipe(uglify())
39+
.pipe(gulp.dest(paths.tmp + '/serve/app'));
40+
});

gulp/build.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var gulp = require('gulp');
55
var paths = gulp.paths;
66

77
var $ = require('gulp-load-plugins')({
8-
pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del']
8+
pattern: ['gulp-*', 'uglify-save-license', 'del']
99
});
1010

1111
gulp.task('partials', function () {
@@ -46,7 +46,7 @@ gulp.task('html', ['inject', 'partials'], function () {
4646
.pipe($.uglify({preserveComments: $.uglifySaveLicense}))
4747
.pipe(jsFilter.restore())
4848
.pipe(cssFilter)
49-
.pipe($.replace('../bootstrap/fonts', 'fonts'))
49+
.pipe($.replace(/\.?\.?\/node_modules\/\w+-?\/?\w+\/fonts\/?/g, '../fonts/'))
5050
.pipe($.csso())
5151
.pipe(cssFilter.restore())
5252
.pipe(assets.restore())
@@ -69,15 +69,18 @@ gulp.task('images', function () {
6969
});
7070

7171
gulp.task('fonts', function () {
72-
return gulp.src($.mainBowerFiles())
72+
return gulp.src([
73+
"node_modules/bootstrap/dist/fonts/*.{eot,svg,ttf,woff}",
74+
"node_modules/footable/css/fonts/*.{eot,svg,ttf,woff}"
75+
])
7376
.pipe($.filter('**/*.{eot,svg,ttf,woff}'))
7477
.pipe($.flatten())
7578
.pipe(gulp.dest(paths.dist + '/fonts/'))
7679
.pipe(gulp.dest(paths.dist + '/styles/fonts/'));
7780
});
7881

7982
gulp.task('fontawesome', function () {
80-
return gulp.src('bower_components/font-awesome/fonts/*.{eot,svg,ttf,woff}')
83+
return gulp.src('node_modules/font-awesome/fonts/*.{eot,svg,ttf,woff}')
8184
.pipe(gulp.dest(paths.dist + '/fonts/'));
8285
});
8386

gulp/inject.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ var paths = gulp.paths;
66

77
var $ = require('gulp-load-plugins')();
88

9-
var wiredep = require('wiredep').stream;
109

11-
gulp.task('inject', ['styles'], function () {
10+
gulp.task('inject', ['browserify'], function () {
1211

1312
var injectStyles = gulp.src([
1413
paths.tmp + '/serve/{app,components}/**/*.css',
@@ -26,15 +25,9 @@ gulp.task('inject', ['styles'], function () {
2625
addRootSlash: false
2726
};
2827

29-
var wiredepOptions = {
30-
directory: 'bower_components',
31-
exclude: [/bootstrap\.js/, /bootstrap\.css/, /bootstrap\.css/, /foundation\.css/]
32-
};
33-
3428
return gulp.src(paths.src + '/*.html')
3529
.pipe($.inject(injectStyles, injectOptions))
3630
.pipe($.inject(injectScripts, injectOptions))
37-
.pipe(wiredep(wiredepOptions))
3831
.pipe(gulp.dest(paths.tmp + '/serve'));
3932

4033
});

gulp/server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function browserSyncInit(baseDir, files, browser) {
1616
var routes = null;
1717
if(baseDir === paths.src || (util.isArray(baseDir) && baseDir.indexOf(paths.src) !== -1)) {
1818
routes = {
19-
'/bower_components': 'bower_components'
19+
'/node_modules': 'node_modules'
2020
};
2121
}
2222

gulp/styles.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ gulp.task('styles', function () {
1010

1111
var lessOptions = {
1212
paths: [
13-
'bower_components',
13+
'node_modules',
1414
paths.src + '/app',
1515
paths.src + '/components'
1616
]

gulp/unit-tests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var paths = gulp.paths;
1010

1111
function runTests (singleRun, done) {
1212
var bowerDeps = wiredep({
13-
directory: 'bower_components',
13+
directory: 'node_modules',
1414
exclude: ['bootstrap-sass-official'],
1515
dependencies: true,
1616
devDependencies: true

gulp/watch.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ var paths = gulp.paths;
77
gulp.task('watch', ['inject'], function () {
88
gulp.watch([
99
paths.src + '/*.html',
10+
paths.src + '/*.css',
11+
paths.src + '/*.js',
1012
paths.src + '/{app,components}/**/*.less',
1113
paths.src + '/{app,components}/**/*.js',
12-
'bower.json'
14+
'package.json'
1315
], ['inject']);
1416
});

package.json

+40-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,46 @@
11
{
22
"name": "support-admin-app",
33
"version": "2.3.0",
4-
"dependencies": {},
4+
"dependencies": {
5+
"pace-js": "~1.0.2",
6+
"angular": "~1.4.4",
7+
"angular-animate": "~1.4.4",
8+
"angular-ui-bootstrap": "~2.5.0",
9+
"angular-clipboard": "~1.2.1",
10+
"angular-cookies": "~1.4.4",
11+
"angular-footable": "~0.0.3",
12+
"angular-jwt": "~0.0.9",
13+
"angular-moment": "~1.0.0-beta.3",
14+
"angular-resource": "~1.4.4",
15+
"angular-sanitize": "~1.4.4",
16+
"angular-storage": "~0.0.11",
17+
"angular-touch": "~1.4.4",
18+
"angular-bootstrap-multiselect": "git+https://github.com/bentorfs/angular-bootstrap-multiselect.git#master",
19+
"angular-ui-router": "~0.2.13",
20+
"auth0-angular": "~4.0.4",
21+
"auth0-js": "~6.4.2",
22+
"auth0-lock": "~7.6.2",
23+
"bootstrap": "~3.3.5",
24+
"bootstrap-ui-datetime-picker": "^2.4.0",
25+
"font-awesome": "~4.3.0",
26+
"footable": "~2.0.3",
27+
"icheck": "1.0.2",
28+
"jquery": "~2.1.1",
29+
"lodash": "~4.2.0",
30+
"metismenu": "~2.0.2",
31+
"moment": "~2.11.2",
32+
"moment-timezone": "~0.5.0",
33+
"ng-file-model": "~0.0.4"
34+
},
535
"devDependencies": {
6-
"bower": "~1.8.0",
36+
"brfs": "1.4.3",
737
"browser-sync": "~2.18.8",
38+
"browserify": "^9.0.3",
39+
"browserify-css": "0.10.1",
40+
"browserify-shim": "^3.8.10",
841
"chalk": "~0.5.1",
942
"del": "~2.2.2",
43+
"ejsify": "1.0.0",
1044
"gulp": "~3.8.10",
1145
"gulp-angular-filesort": "~1.0.4",
1246
"gulp-angular-templatecache": "~1.4.2",
@@ -35,17 +69,18 @@
3569
"jasmine-core": "^2.5.2",
3670
"jshint": "~2.9.4",
3771
"jshint-stylish": "~1.0.0",
38-
"main-bower-files": "~2.13.1",
3972
"protractor": "~5.1.1",
4073
"require-dir": "~0.1.0",
4174
"uglify-save-license": "~0.4.1",
42-
"wiredep": "~4.0.0"
75+
"vinyl-buffer": "1.0.0",
76+
"vinyl-source-stream": "1.1.0",
77+
"wiredep": "~4.0.0",
78+
"angular-mocks": "~1.4.4"
4379
},
4480
"engines": {
4581
"node": ">=0.10.0"
4682
},
4783
"scripts": {
48-
"postinstall": "bower install --config.interactive=false",
4984
"clean": "gulp clean",
5085
"build": "gulp build",
5186
"start": "gulp publish",

src/app/app.js

+34-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ angular.module('supportAdminApp', [
1515
'app.constants',
1616
'angular-clipboard',
1717
'ng-file-model',
18-
'ui.multiselect',
18+
'btorfs.multiselect',
1919
'ui.bootstrap.datetimepicker',
2020
'angularMoment',
2121
'angular-jwt'])
@@ -270,6 +270,39 @@ angular.module('supportAdminApp', [
270270
data: { pageTitle: 'Edit Client' },
271271
resolve: { auth: authenticate }
272272
})
273+
.state('index.groups', {
274+
abstract: true,
275+
url: '/groups',
276+
templateUrl: 'app/groups/groups.html',
277+
data: { pageTitle: 'Groups' },
278+
controller: 'permissionmanagement.GroupsController'
279+
})
280+
.state('index.groups.list', {
281+
url: '/list',
282+
templateUrl: 'app/groups/groups.list.html',
283+
controller: 'permissionmanagement.GroupsListController',
284+
resolve: { auth: authenticate }
285+
})
286+
.state('index.groupmembers', {
287+
abstract: true,
288+
url: '/groupmembers/:groupId',
289+
templateUrl: 'app/groupmembers/groupmembers.html',
290+
data: { pageTitle: 'Group Members' },
291+
controller: 'permissionmanagement.GroupMembersController'
292+
})
293+
.state('index.groupmembers.list', {
294+
url: '/list',
295+
templateUrl: 'app/groupmembers/groupmembers.list.html',
296+
controller: 'permissionmanagement.GroupMembersListController',
297+
resolve: { auth: authenticate }
298+
})
299+
.state('index.groupmembers.new', {
300+
url: '/new',
301+
templateUrl: 'app/groupmembers/groupmembers.new.html',
302+
controller: 'permissionmanagement.GroupMembersNewController',
303+
data: { pageTitle: 'Add Group Members' },
304+
resolve: { auth: authenticate }
305+
})
273306
.state('index.billingaccounts', {
274307
abstract: true,
275308
url: '/billingaccounts',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
var module = angular.module('supportAdminApp');
4+
5+
/**
6+
* The parent controller for the groupmembers states
7+
*/
8+
module.controller('permissionmanagement.GroupMembersController', ['$scope', 'AuthService', '$state',
9+
function ($scope, $authService, $state) {
10+
$scope.$state = $state;
11+
12+
/**
13+
* Validate the user authentication
14+
*/
15+
$scope.authorized = function() {
16+
return $authService.isLoggedIn();
17+
};
18+
}
19+
]);

0 commit comments

Comments
 (0)