Skip to content

Commit f789af3

Browse files
committed
1) Injected angularjs dependencies
2) Implemented Pub/Sub Model 3) Implemented event list view in react Signed-off-by: Neha Gupta <gnehapk@gmail.com>
1 parent 079eef8 commit f789af3

11 files changed

Lines changed: 373 additions & 274 deletions

File tree

gulpfile.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ gulp.task("jsLibraries", function() {
9898
"node_modules/jquery/dist/jquery.min.js",
9999
"node_modules/bootstrap/dist/js/bootstrap.min.js", // For dropdown : temporary
100100
"node_modules/bootstrap-datepicker/dist/js/bootstrap-datepicker.js",
101+
"node_modules/angular/angular.js",
101102
"node_modules/react/umd/react.production.min.js",
102103
"node_modules/react-dom/umd/react-dom.production.min.js",
103-
"node_modules/angular/angular.js",
104+
"node_modules/ngreact/ngReact.min.js",
104105
"node_modules/angular-ui-bootstrap/dist/ui-bootstrap.min.js",
105106
"node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js",
106107
"node_modules/angular-sanitize/angular-sanitize.min.js",
@@ -115,7 +116,10 @@ gulp.task("jsLibraries", function() {
115116
"node_modules/angular-bootstrap-switch/dist/angular-bootstrap-switch.min.js",
116117
"node_modules/angular-patternfly/node_modules/angular-drag-and-drop-lists/angular-drag-and-drop-lists.js",
117118
"node_modules/datatables/media/js/jquery.dataTables.js",
118-
"node_modules/angular-patternfly/node_modules/angularjs-datatables/dist/angular-datatables.js"
119+
"node_modules/angular-patternfly/node_modules/angularjs-datatables/dist/angular-datatables.js",
120+
"node_modules/q/q.js",
121+
"node_modules/moment/min/moment.min.js",
122+
"node_modules/react-datepicker/dist/react-datepicker.min.js"
119123
])
120124
.pipe(uglify())
121125
.pipe(concat("libraries.js"))
@@ -128,7 +132,8 @@ gulp.task("cssLibraries", function() {
128132
"node_modules/patternfly/dist/css/patternfly.css",
129133
"node_modules/patternfly/dist/css/patternfly-additions.css",
130134
"node_modules/angular-patternfly/styles/angular-patternfly.css",
131-
"node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css"
135+
"node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css",
136+
"node_modules/react-datepicker/dist/react-datepicker.min.css"
132137
])
133138
.pipe(postCss([autoprefixer({ browsers: browsers })]))
134139
.pipe(buildMode === "dev" ? noop() : minifyCSS())
@@ -215,8 +220,8 @@ gulp.task("resource", function(done) {
215220
gulp.task("jsbundle", ["eslint"], function() {
216221

217222
return gulp.src(paths.jsFiles, { cwd: paths.src })
218-
.pipe(babel({ presets: ["es2015"] }))
219223
.pipe(concat("plugin-bundle.js"))
224+
.pipe(babel({ presets: ["es2015", "react"] }))
220225
.pipe(gulp.dest(paths.dest));
221226
});
222227

@@ -256,7 +261,7 @@ gulp.task("watcher", ["browser-sync", "common"], function(done) {
256261

257262
gulp.watch(filters.js, { cwd: paths.src }, function(event) {
258263
log("Modified:", colors.yellow(event.path));
259-
runSequence("preload", "jsbundle");
264+
runSequence("preload", "jsbundle", "transform");
260265
});
261266

262267
gulp.watch([filters.css, filters.scss], { cwd: paths.src }, function(event) {

package.json

Lines changed: 113 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,116 @@
11
{
2-
"name": "Tendrl",
3-
"description": "Dashboard",
4-
"version": "1.6.3",
5-
"dependencies": {
6-
"@uirouter/angularjs": "^1.0.7",
7-
"angular": "~1.5.8",
8-
"angular-animate": "~1.5.8",
9-
"angular-bootstrap-switch": "~0.5.2",
10-
"angular-cookies": "~1.5.8",
11-
"angular-growl-v2": "~0.7.5",
12-
"angular-motion": "~0.4.4",
13-
"angular-patternfly": "^4.0.0",
14-
"angular-resource": "~1.5.8",
15-
"angular-route": "~1.5.8",
16-
"angular-sanitize": "~1.5.8",
17-
"angular-strap": "~2.3.10",
18-
"angular-ui-bootstrap": "~2.2.0",
19-
"bootstrap": "^3.3.7",
20-
"bootstrap-datepicker": "~1.6.4",
21-
"bootstrap-tooltip": "~3.1.1",
22-
"c3": "~0.4.11",
23-
"c3-angular": "git://github.com/jettro/c3-angular-directive#1.3.1",
24-
"d3": "~3.5.17",
25-
"es6-shim": "~0.35.1",
26-
"font-awesome": "^4.7.0",
27-
"idb-wrapper": "~1.7.1",
28-
"jquery": "~3.1.1",
29-
"ngreact": "^0.5.1",
30-
"numeral": "~1.5.3",
31-
"patternfly": "~3.29.13",
32-
"patternfly-react": "^2.3.0",
33-
"react": "^16.3.2",
34-
"react-dom": "^16.3.2",
35-
"redux": "^4.0.0"
2+
"name": "Tendrl",
3+
"description": "Dashboard",
4+
"version": "1.6.3",
5+
"dependencies": {
6+
"@uirouter/angularjs": "^1.0.7",
7+
"angular": "~1.5.8",
8+
"angular-animate": "~1.5.8",
9+
"angular-bootstrap-switch": "~0.5.2",
10+
"angular-cookies": "~1.5.8",
11+
"angular-growl-v2": "~0.7.5",
12+
"angular-motion": "~0.4.4",
13+
"angular-patternfly": "^4.0.0",
14+
"angular-resource": "~1.5.8",
15+
"angular-route": "~1.5.8",
16+
"angular-sanitize": "~1.5.8",
17+
"angular-strap": "~2.3.10",
18+
"angular-ui-bootstrap": "~2.2.0",
19+
"bootstrap": "^3.3.7",
20+
"bootstrap-datepicker": "~1.6.4",
21+
"bootstrap-tooltip": "~3.1.1",
22+
"c3": "~0.4.11",
23+
"c3-angular": "git://github.com/jettro/c3-angular-directive#1.3.1",
24+
"d3": "~3.5.17",
25+
"es6-shim": "~0.35.1",
26+
"font-awesome": "^4.7.0",
27+
"idb-wrapper": "~1.7.1",
28+
"jquery": "~3.1.1",
29+
"moment": "^2.22.1",
30+
"ngreact": "^0.5.1",
31+
"numeral": "~1.5.3",
32+
"patternfly": "~3.29.13",
33+
"patternfly-react": "^2.3.0",
34+
"react": "^16.3.2",
35+
"react-datepicker": "^1.5.0",
36+
"react-dom": "^16.3.2",
37+
"redux": "^4.0.0"
38+
},
39+
"devDependencies": {
40+
"angular-mocks": "~1.5.8",
41+
"ansi-colors": "^1.1.0",
42+
"autoprefixer": "^7.1.3",
43+
"babel-cli": "^6.26.0",
44+
"babel-core": "^6.26.3",
45+
"babel-preset-es2015": "^6.24.1",
46+
"babel-preset-react": "^6.24.1",
47+
"babelify": "^8.0.0",
48+
"browser-sync": "^2.18.13",
49+
"browserify": "^16.2.0",
50+
"chai": "^3.5.0",
51+
"datatables": "^1.10.13",
52+
"del": "*",
53+
"fancy-log": "^1.3.2",
54+
"glob": "~7.1.1",
55+
"gulp": "^3.9.1",
56+
"gulp-babel": "^7.0.1",
57+
"gulp-browserify": "^0.5.1",
58+
"gulp-clean-css": "^3.9.3",
59+
"gulp-concat": "^2.6.0",
60+
"gulp-cssimport": "^4.0.1",
61+
"gulp-debug": "*",
62+
"gulp-eslint": "^2.0.1",
63+
"gulp-if": "^2.0.2",
64+
"gulp-ignore": "^2.0.2",
65+
"gulp-inject": "^4.1.0",
66+
"gulp-load-plugins": "*",
67+
"gulp-ng-annotate": "^2.0.0",
68+
"gulp-noop": "^1.0.0",
69+
"gulp-postcss": "^6.0.10",
70+
"gulp-react": "^3.1.0",
71+
"gulp-rename": "^1.2.2",
72+
"gulp-sass": "^2.3.2",
73+
"gulp-sourcemaps": "^2.6.4",
74+
"gulp-uglify": "^2.0.0",
75+
"http-proxy": "^1.16.2",
76+
"karma": "~1.3.0",
77+
"karma-chai": "~0.1.0",
78+
"karma-coverage": "~1.1.1",
79+
"karma-mocha": "~1.2.0",
80+
"karma-mocha-reporter": "~2.2.0",
81+
"karma-ng-html2js-preprocessor": "^1.0.0",
82+
"karma-phantomjs-launcher": "^1.0.2",
83+
"karma-sinon": "^1.0.5",
84+
"merge-stream": "^1.0.0",
85+
"minimist": "^1.2.0",
86+
"mkdirp": "^0.5.1",
87+
"mocha": "^3.1.2",
88+
"request": "^2.78.0",
89+
"run-sequence": "^1.2.2",
90+
"sinon": "^1.17.6",
91+
"vinyl-source-stream": "^2.0.0"
92+
},
93+
"TendrlProps": {
94+
"preloads": [],
95+
"resources": {
96+
"../node_modules/patternfly/dist/fonts/*.*": "fonts/",
97+
"../node_modules/font-awesome/fonts/*.*": "fonts/",
98+
"../node_modules/patternfly/node_modules/font-awesome/fonts/*.*": "dist/components/font-awesome/fonts"
3699
},
37-
"devDependencies": {
38-
"angular-mocks": "~1.5.8",
39-
"ansi-colors": "^1.1.0",
40-
"autoprefixer": "^7.1.3",
41-
"babel-core": "^6.26.3",
42-
"babel-preset-es2015": "^6.24.1",
43-
"babelify": "^8.0.0",
44-
"browser-sync": "^2.18.13",
45-
"browserify": "^16.2.0",
46-
"chai": "^3.5.0",
47-
"datatables": "^1.10.13",
48-
"del": "*",
49-
"fancy-log": "^1.3.2",
50-
"glob": "~7.1.1",
51-
"gulp": "^3.9.1",
52-
"gulp-babel": "^7.0.1",
53-
"gulp-browserify": "^0.5.1",
54-
"gulp-clean-css": "^3.9.3",
55-
"gulp-concat": "^2.6.0",
56-
"gulp-cssimport": "^4.0.1",
57-
"gulp-debug": "*",
58-
"gulp-eslint": "^2.0.1",
59-
"gulp-if": "^2.0.2",
60-
"gulp-ignore": "^2.0.2",
61-
"gulp-inject": "^4.1.0",
62-
"gulp-load-plugins": "*",
63-
"gulp-ng-annotate": "^2.0.0",
64-
"gulp-noop": "^1.0.0",
65-
"gulp-postcss": "^6.0.10",
66-
"gulp-react": "^3.1.0",
67-
"gulp-rename": "^1.2.2",
68-
"gulp-sass": "^2.3.2",
69-
"gulp-sourcemaps": "^2.6.4",
70-
"gulp-uglify": "^2.0.0",
71-
"http-proxy": "^1.16.2",
72-
"karma": "~1.3.0",
73-
"karma-chai": "~0.1.0",
74-
"karma-coverage": "~1.1.1",
75-
"karma-mocha": "~1.2.0",
76-
"karma-mocha-reporter": "~2.2.0",
77-
"karma-ng-html2js-preprocessor": "^1.0.0",
78-
"karma-phantomjs-launcher": "^1.0.2",
79-
"karma-sinon": "^1.0.5",
80-
"merge-stream": "^1.0.0",
81-
"minimist": "^1.2.0",
82-
"mkdirp": "^0.5.1",
83-
"mocha": "^3.1.2",
84-
"request": "^2.78.0",
85-
"run-sequence": "^1.2.2",
86-
"sinon": "^1.17.6",
87-
"vinyl-source-stream": "^2.0.0"
88-
},
89-
"TendrlProps": {
90-
"preloads": [],
91-
"resources": {
92-
"../node_modules/patternfly/dist/fonts/*.*": "fonts/",
93-
"../node_modules/font-awesome/fonts/*.*": "fonts/",
94-
"../node_modules/patternfly/node_modules/font-awesome/fonts/*.*": "dist/components/font-awesome/fonts"
95-
},
96-
"targetBrowsers": [
97-
"last 2 version"
98-
],
99-
"cssMain": "commons/scss/main.scss",
100-
"jsFiles": [
101-
"commons/js/index.js",
102-
"commons/**/*.js",
103-
"modules/**/*.js"
104-
],
105-
"htmlFiles": [
106-
"index.html"
107-
],
108-
"config": "config.json",
109-
"buildDestination": "./dist/",
110-
"archiveExtension": ".tar.gz"
111-
}
100+
"targetBrowsers": [
101+
"last 2 version"
102+
],
103+
"cssMain": "commons/scss/main.scss",
104+
"jsFiles": [
105+
"commons/js/index.js",
106+
"commons/**/*.js",
107+
"modules/**/*.js"
108+
],
109+
"htmlFiles": [
110+
"index.html"
111+
],
112+
"config": "config.json",
113+
"buildDestination": "./dist/",
114+
"archiveExtension": ".tar.gz"
115+
}
112116
}

src/commons/js/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"patternfly.form",
1212
"patternfly.notification",
1313
"patternfly.table",
14-
"patternfly.filters"
14+
"patternfly.filters",
15+
"react"
1516
]);
1617

1718
/* Setting up provider for getting config data */

src/commons/js/ng-react-ng-deps.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ export const ngDeps = {};
44

55
export function injectNgDeps(deps) {
66
Object.assign(ngDeps, deps);
7+
window.ngDeps = ngDeps;
78
};
89

910
export default ngDeps;
1011

1112
var storageModule = angular.module("TendrlModule");
1213

1314
storageModule.run([
14-
"$rootScope",
15-
"$state",
16-
"$q",
17-
($rootScope, $state, $q) => {
18-
injectNgDeps({ $rootScope, $state, $q });
15+
"$stateParams",
16+
"utils",
17+
"config",
18+
($stateParams, utils, config) => {
19+
injectNgDeps({ $stateParams, utils, config });
1920
},
2021
]);

src/commons/services/pub-sub.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const PubSubService = {
2+
topics: {},
3+
subscribe: function(topic, listener) {
4+
var that = this;
5+
6+
// Create the topic's object if not yet created
7+
if (!that.topics.hasOwnProperty.call(that.topics, topic)) {
8+
that.topics[topic] = [];
9+
}
10+
11+
// Add the listener to queue
12+
var index = that.topics[topic].push(listener) - 1;
13+
14+
// Provide handle back for removal of topic
15+
return {
16+
remove: function() {
17+
delete that.topics[topic][index];
18+
}
19+
};
20+
},
21+
publish: function(topic, info) {
22+
var that = this;
23+
24+
// If the topic doesn't exist, or there's no listeners in queue, just leave
25+
if (!that.topics.hasOwnProperty.call(that.topics, topic)) return;
26+
27+
// Cycle through topics queue, fire!
28+
that.topics[topic].forEach(function(item) {
29+
item(info != undefined ? info : {});
30+
});
31+
}
32+
};
33+
34+
35+
angular
36+
.module("TendrlModule")
37+
.service("pubSubService", pubSubService);
38+
39+
/*@ngInject*/
40+
function pubSubService() {
41+
return PubSubService;
42+
}

src/commons/services/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@
235235
getEventListRequest,
236236
request;
237237

238-
//url = "/api/events.json";
239-
url = config.baseUrl + "clusters/" + clusterId + "/notifications";
238+
url = "/api/events.json";
239+
//url = config.baseUrl + "clusters/" + clusterId + "/notifications";
240240

241241
getEventListRequest = {
242242
method: "GET",

src/commons/services/vendor.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import React, { Component } from "react";
2+
import moment from "moment";
3+
import DatePicker from 'react-datepicker';
4+
require("ngreact");

0 commit comments

Comments
 (0)