Skip to content

Commit

Permalink
1) Injected angularjs dependencies
Browse files Browse the repository at this point in the history
2) Implemented Pub/Sub Model
3) Implemented event list view in react

Signed-off-by: Neha Gupta <[email protected]>
  • Loading branch information
gnehapk committed Jun 4, 2018
1 parent 079eef8 commit f789af3
Show file tree
Hide file tree
Showing 11 changed files with 373 additions and 274 deletions.
15 changes: 10 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ gulp.task("jsLibraries", function() {
"node_modules/jquery/dist/jquery.min.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js", // For dropdown : temporary
"node_modules/bootstrap-datepicker/dist/js/bootstrap-datepicker.js",
"node_modules/angular/angular.js",
"node_modules/react/umd/react.production.min.js",
"node_modules/react-dom/umd/react-dom.production.min.js",
"node_modules/angular/angular.js",
"node_modules/ngreact/ngReact.min.js",
"node_modules/angular-ui-bootstrap/dist/ui-bootstrap.min.js",
"node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js",
"node_modules/angular-sanitize/angular-sanitize.min.js",
Expand All @@ -115,7 +116,10 @@ gulp.task("jsLibraries", function() {
"node_modules/angular-bootstrap-switch/dist/angular-bootstrap-switch.min.js",
"node_modules/angular-patternfly/node_modules/angular-drag-and-drop-lists/angular-drag-and-drop-lists.js",
"node_modules/datatables/media/js/jquery.dataTables.js",
"node_modules/angular-patternfly/node_modules/angularjs-datatables/dist/angular-datatables.js"
"node_modules/angular-patternfly/node_modules/angularjs-datatables/dist/angular-datatables.js",
"node_modules/q/q.js",
"node_modules/moment/min/moment.min.js",
"node_modules/react-datepicker/dist/react-datepicker.min.js"
])
.pipe(uglify())
.pipe(concat("libraries.js"))
Expand All @@ -128,7 +132,8 @@ gulp.task("cssLibraries", function() {
"node_modules/patternfly/dist/css/patternfly.css",
"node_modules/patternfly/dist/css/patternfly-additions.css",
"node_modules/angular-patternfly/styles/angular-patternfly.css",
"node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css"
"node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css",
"node_modules/react-datepicker/dist/react-datepicker.min.css"
])
.pipe(postCss([autoprefixer({ browsers: browsers })]))
.pipe(buildMode === "dev" ? noop() : minifyCSS())
Expand Down Expand Up @@ -215,8 +220,8 @@ gulp.task("resource", function(done) {
gulp.task("jsbundle", ["eslint"], function() {

return gulp.src(paths.jsFiles, { cwd: paths.src })
.pipe(babel({ presets: ["es2015"] }))
.pipe(concat("plugin-bundle.js"))
.pipe(babel({ presets: ["es2015", "react"] }))
.pipe(gulp.dest(paths.dest));
});

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

gulp.watch(filters.js, { cwd: paths.src }, function(event) {
log("Modified:", colors.yellow(event.path));
runSequence("preload", "jsbundle");
runSequence("preload", "jsbundle", "transform");
});

gulp.watch([filters.css, filters.scss], { cwd: paths.src }, function(event) {
Expand Down
222 changes: 113 additions & 109 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,112 +1,116 @@
{
"name": "Tendrl",
"description": "Dashboard",
"version": "1.6.3",
"dependencies": {
"@uirouter/angularjs": "^1.0.7",
"angular": "~1.5.8",
"angular-animate": "~1.5.8",
"angular-bootstrap-switch": "~0.5.2",
"angular-cookies": "~1.5.8",
"angular-growl-v2": "~0.7.5",
"angular-motion": "~0.4.4",
"angular-patternfly": "^4.0.0",
"angular-resource": "~1.5.8",
"angular-route": "~1.5.8",
"angular-sanitize": "~1.5.8",
"angular-strap": "~2.3.10",
"angular-ui-bootstrap": "~2.2.0",
"bootstrap": "^3.3.7",
"bootstrap-datepicker": "~1.6.4",
"bootstrap-tooltip": "~3.1.1",
"c3": "~0.4.11",
"c3-angular": "git://github.com/jettro/c3-angular-directive#1.3.1",
"d3": "~3.5.17",
"es6-shim": "~0.35.1",
"font-awesome": "^4.7.0",
"idb-wrapper": "~1.7.1",
"jquery": "~3.1.1",
"ngreact": "^0.5.1",
"numeral": "~1.5.3",
"patternfly": "~3.29.13",
"patternfly-react": "^2.3.0",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"redux": "^4.0.0"
"name": "Tendrl",
"description": "Dashboard",
"version": "1.6.3",
"dependencies": {
"@uirouter/angularjs": "^1.0.7",
"angular": "~1.5.8",
"angular-animate": "~1.5.8",
"angular-bootstrap-switch": "~0.5.2",
"angular-cookies": "~1.5.8",
"angular-growl-v2": "~0.7.5",
"angular-motion": "~0.4.4",
"angular-patternfly": "^4.0.0",
"angular-resource": "~1.5.8",
"angular-route": "~1.5.8",
"angular-sanitize": "~1.5.8",
"angular-strap": "~2.3.10",
"angular-ui-bootstrap": "~2.2.0",
"bootstrap": "^3.3.7",
"bootstrap-datepicker": "~1.6.4",
"bootstrap-tooltip": "~3.1.1",
"c3": "~0.4.11",
"c3-angular": "git://github.com/jettro/c3-angular-directive#1.3.1",
"d3": "~3.5.17",
"es6-shim": "~0.35.1",
"font-awesome": "^4.7.0",
"idb-wrapper": "~1.7.1",
"jquery": "~3.1.1",
"moment": "^2.22.1",
"ngreact": "^0.5.1",
"numeral": "~1.5.3",
"patternfly": "~3.29.13",
"patternfly-react": "^2.3.0",
"react": "^16.3.2",
"react-datepicker": "^1.5.0",
"react-dom": "^16.3.2",
"redux": "^4.0.0"
},
"devDependencies": {
"angular-mocks": "~1.5.8",
"ansi-colors": "^1.1.0",
"autoprefixer": "^7.1.3",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babelify": "^8.0.0",
"browser-sync": "^2.18.13",
"browserify": "^16.2.0",
"chai": "^3.5.0",
"datatables": "^1.10.13",
"del": "*",
"fancy-log": "^1.3.2",
"glob": "~7.1.1",
"gulp": "^3.9.1",
"gulp-babel": "^7.0.1",
"gulp-browserify": "^0.5.1",
"gulp-clean-css": "^3.9.3",
"gulp-concat": "^2.6.0",
"gulp-cssimport": "^4.0.1",
"gulp-debug": "*",
"gulp-eslint": "^2.0.1",
"gulp-if": "^2.0.2",
"gulp-ignore": "^2.0.2",
"gulp-inject": "^4.1.0",
"gulp-load-plugins": "*",
"gulp-ng-annotate": "^2.0.0",
"gulp-noop": "^1.0.0",
"gulp-postcss": "^6.0.10",
"gulp-react": "^3.1.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-sourcemaps": "^2.6.4",
"gulp-uglify": "^2.0.0",
"http-proxy": "^1.16.2",
"karma": "~1.3.0",
"karma-chai": "~0.1.0",
"karma-coverage": "~1.1.1",
"karma-mocha": "~1.2.0",
"karma-mocha-reporter": "~2.2.0",
"karma-ng-html2js-preprocessor": "^1.0.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-sinon": "^1.0.5",
"merge-stream": "^1.0.0",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"mocha": "^3.1.2",
"request": "^2.78.0",
"run-sequence": "^1.2.2",
"sinon": "^1.17.6",
"vinyl-source-stream": "^2.0.0"
},
"TendrlProps": {
"preloads": [],
"resources": {
"../node_modules/patternfly/dist/fonts/*.*": "fonts/",
"../node_modules/font-awesome/fonts/*.*": "fonts/",
"../node_modules/patternfly/node_modules/font-awesome/fonts/*.*": "dist/components/font-awesome/fonts"
},
"devDependencies": {
"angular-mocks": "~1.5.8",
"ansi-colors": "^1.1.0",
"autoprefixer": "^7.1.3",
"babel-core": "^6.26.3",
"babel-preset-es2015": "^6.24.1",
"babelify": "^8.0.0",
"browser-sync": "^2.18.13",
"browserify": "^16.2.0",
"chai": "^3.5.0",
"datatables": "^1.10.13",
"del": "*",
"fancy-log": "^1.3.2",
"glob": "~7.1.1",
"gulp": "^3.9.1",
"gulp-babel": "^7.0.1",
"gulp-browserify": "^0.5.1",
"gulp-clean-css": "^3.9.3",
"gulp-concat": "^2.6.0",
"gulp-cssimport": "^4.0.1",
"gulp-debug": "*",
"gulp-eslint": "^2.0.1",
"gulp-if": "^2.0.2",
"gulp-ignore": "^2.0.2",
"gulp-inject": "^4.1.0",
"gulp-load-plugins": "*",
"gulp-ng-annotate": "^2.0.0",
"gulp-noop": "^1.0.0",
"gulp-postcss": "^6.0.10",
"gulp-react": "^3.1.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-sourcemaps": "^2.6.4",
"gulp-uglify": "^2.0.0",
"http-proxy": "^1.16.2",
"karma": "~1.3.0",
"karma-chai": "~0.1.0",
"karma-coverage": "~1.1.1",
"karma-mocha": "~1.2.0",
"karma-mocha-reporter": "~2.2.0",
"karma-ng-html2js-preprocessor": "^1.0.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-sinon": "^1.0.5",
"merge-stream": "^1.0.0",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"mocha": "^3.1.2",
"request": "^2.78.0",
"run-sequence": "^1.2.2",
"sinon": "^1.17.6",
"vinyl-source-stream": "^2.0.0"
},
"TendrlProps": {
"preloads": [],
"resources": {
"../node_modules/patternfly/dist/fonts/*.*": "fonts/",
"../node_modules/font-awesome/fonts/*.*": "fonts/",
"../node_modules/patternfly/node_modules/font-awesome/fonts/*.*": "dist/components/font-awesome/fonts"
},
"targetBrowsers": [
"last 2 version"
],
"cssMain": "commons/scss/main.scss",
"jsFiles": [
"commons/js/index.js",
"commons/**/*.js",
"modules/**/*.js"
],
"htmlFiles": [
"index.html"
],
"config": "config.json",
"buildDestination": "./dist/",
"archiveExtension": ".tar.gz"
}
"targetBrowsers": [
"last 2 version"
],
"cssMain": "commons/scss/main.scss",
"jsFiles": [
"commons/js/index.js",
"commons/**/*.js",
"modules/**/*.js"
],
"htmlFiles": [
"index.html"
],
"config": "config.json",
"buildDestination": "./dist/",
"archiveExtension": ".tar.gz"
}
}
3 changes: 2 additions & 1 deletion src/commons/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"patternfly.form",
"patternfly.notification",
"patternfly.table",
"patternfly.filters"
"patternfly.filters",
"react"
]);

/* Setting up provider for getting config data */
Expand Down
11 changes: 6 additions & 5 deletions src/commons/js/ng-react-ng-deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ export const ngDeps = {};

export function injectNgDeps(deps) {
Object.assign(ngDeps, deps);
window.ngDeps = ngDeps;
};

export default ngDeps;

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

storageModule.run([
"$rootScope",
"$state",
"$q",
($rootScope, $state, $q) => {
injectNgDeps({ $rootScope, $state, $q });
"$stateParams",
"utils",
"config",
($stateParams, utils, config) => {
injectNgDeps({ $stateParams, utils, config });
},
]);
42 changes: 42 additions & 0 deletions src/commons/services/pub-sub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const PubSubService = {
topics: {},
subscribe: function(topic, listener) {
var that = this;

// Create the topic's object if not yet created
if (!that.topics.hasOwnProperty.call(that.topics, topic)) {
that.topics[topic] = [];
}

// Add the listener to queue
var index = that.topics[topic].push(listener) - 1;

// Provide handle back for removal of topic
return {
remove: function() {
delete that.topics[topic][index];
}
};
},
publish: function(topic, info) {
var that = this;

// If the topic doesn't exist, or there's no listeners in queue, just leave
if (!that.topics.hasOwnProperty.call(that.topics, topic)) return;

// Cycle through topics queue, fire!
that.topics[topic].forEach(function(item) {
item(info != undefined ? info : {});
});
}
};


angular
.module("TendrlModule")
.service("pubSubService", pubSubService);

/*@ngInject*/
function pubSubService() {
return PubSubService;
}
4 changes: 2 additions & 2 deletions src/commons/services/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@
getEventListRequest,
request;

//url = "/api/events.json";
url = config.baseUrl + "clusters/" + clusterId + "/notifications";
url = "/api/events.json";
//url = config.baseUrl + "clusters/" + clusterId + "/notifications";

getEventListRequest = {
method: "GET",
Expand Down
4 changes: 4 additions & 0 deletions src/commons/services/vendor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import React, { Component } from "react";
import moment from "moment";
import DatePicker from 'react-datepicker';
require("ngreact");
Loading

0 comments on commit f789af3

Please sign in to comment.