Skip to content

Commit 3b49289

Browse files
committed
injected angularjs dependencies
1 parent 079eef8 commit 3b49289

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

gulpfile.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ gulp.task("resource", function(done) {
215215
gulp.task("jsbundle", ["eslint"], function() {
216216

217217
return gulp.src(paths.jsFiles, { cwd: paths.src })
218-
.pipe(babel({ presets: ["es2015"] }))
219218
.pipe(concat("plugin-bundle.js"))
219+
.pipe(babel({ presets: ["es2015"] }))
220220
.pipe(gulp.dest(paths.dest));
221221
});
222222

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

257257
gulp.watch(filters.js, { cwd: paths.src }, function(event) {
258258
log("Modified:", colors.yellow(event.path));
259-
runSequence("preload", "jsbundle");
259+
runSequence("preload", "jsbundle", "transform");
260260
});
261261

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

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

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
export const ngDeps = {};
44

55
export function injectNgDeps(deps) {
6+
console.log(deps, "deps");
67
Object.assign(ngDeps, deps);
8+
window.ngDeps = ngDeps;
79
};
810

911
export default ngDeps;
@@ -14,7 +16,10 @@ storageModule.run([
1416
"$rootScope",
1517
"$state",
1618
"$q",
17-
($rootScope, $state, $q) => {
18-
injectNgDeps({ $rootScope, $state, $q });
19+
"$http",
20+
"utils",
21+
($rootScope, $state, $q, $http, utils) => {
22+
console.log("inside run");
23+
injectNgDeps({ $rootScope, $state, $q, $http, utils });
1924
},
2025
]);

src/commons/services/utils.js

+2-2
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/stores/events-store.js

+19-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
import React, { Component } from "react";
2-
import ngDeps from "../js/ng-react-ng-deps.js";
2+
3+
console.log(ngDeps, "ngDeps");
4+
5+
const { $rootScope, $state, $q, $http } = ngDeps;
36

47
const EventStore = {
58
getAlertList: function() {
69
var list,
7-
deferred;
10+
deferred,
11+
utils = window.ngDeps.utils,
12+
$rootScope = window.ngDeps.$rootScope,
13+
$q = window.ngDeps.$q;
814

15+
console.log(window.ngDeps, "window");
916
deferred = $q.defer();
17+
1018
utils.getAlertList()
1119
.then(function(data) {
20+
1221
$rootScope.showAlertIndication = false;
1322
list = data ? _formatAlertData(data) : [];
1423
deferred.resolve(list);
@@ -28,8 +37,8 @@ const EventStore = {
2837
i;
2938

3039
for (i = 0; i < len; i++) {
31-
temp = {},
32-
temp.alertId = data[i].alert_id;
40+
temp = {};
41+
temp.alertId = data[i].alert_id;
3342
temp.timeStamp = new Date(data[i].time_stamp);
3443
temp.severity = severity[data[i].severity];
3544
temp.nodeId = data[i].node_id;
@@ -49,7 +58,10 @@ const EventStore = {
4958
},
5059
getEventList: function(clusterId) {
5160
var list,
52-
deferred;
61+
deferred,
62+
utils = window.ngDeps.utils,
63+
$rootScope = window.ngDeps.$rootScope,
64+
$q = window.ngDeps.$q;
5365

5466
deferred = $q.defer();
5567
utils.getEventList(clusterId)
@@ -69,8 +81,8 @@ const EventStore = {
6981
i;
7082

7183
for (i = 0; i < len; i++) {
72-
temp = {},
73-
temp.timeStamp = new Date(data[i].timestamp);
84+
temp = {};
85+
temp.timeStamp = new Date(data[i].timestamp);
7486
temp.priority = data[i].priority;
7587
temp.message = data[i].message;
7688
temp.message_id = data[i].message_id;
@@ -81,8 +93,6 @@ const EventStore = {
8193
}
8294
};
8395

84-
export default EventStore;
85-
8696
angular
8797
.module("TendrlModule")
8898
.service("eventStore", eventStore);

0 commit comments

Comments
 (0)