Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions app/hydrator/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,37 +201,12 @@ angular
window.CaskCommon.StatusFactory.startPollingForBackendStatus();
})

.run(function (MYSOCKET_EVENT, myAlert, EventPipe) {

EventPipe.on(MYSOCKET_EVENT.message, function (data) {
if (data.statusCode > 399 && !data.resource.suppressErrors) {
myAlert({
title: data.statusCode.toString(),
content: data.response || 'Server had an issue, please try refreshing the page',
type: 'danger'
});
}

// The user doesn't need to know that the backend node
// is unable to connect to CDAP. Error messages add no
// more value than the pop showing that the FE is waiting
// for system to come back up. Most of the issues are with
// connect, other than that pass everything else to user.
if (data.warning && data.error.syscall !== 'connect') {
myAlert({
content: data.warning,
type: 'warning'
});
}
});
})

/**
* BodyCtrl
* attached to the <body> tag, mostly responsible for
* setting the className based events from $state and caskTheme
*/
.controller('BodyCtrl', function ($scope, $cookies, $cookieStore, caskTheme, CASK_THEME_EVENT, $rootScope, $state, $log, MYSOCKET_EVENT, MyCDAPDataSource, MY_CONFIG, MYAUTH_EVENT, EventPipe, myAuth, $window, myAlertOnValium, myLoadingService, myHelpers, $http) {
.controller('BodyCtrl', function ($scope, $cookies, $cookieStore, caskTheme, CASK_THEME_EVENT, $rootScope, $state, $log, MY_CONFIG, MYAUTH_EVENT, EventPipe, myAuth, $window, myAlertOnValium, myLoadingService, myHelpers, $http) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Removing MYSOCKET_EVENT and MyCDAPDataSource from the controller dependencies is correct, but there are two remaining references in this file that will now cause runtime errors:

  1. MyDataSourceProvider Configuration (Lines 91-93):
.config(function (MyDataSourceProvider) {
  MyDataSourceProvider.defaultInterval = 5;
})

Since MyDataSource has been completely removed (from datasource.js), configuring MyDataSourceProvider here will throw an AngularJS injector error on startup. This block should be removed.

  1. MYSOCKET_EVENT Event Listener (Lines 301-304):
EventPipe.on(MYSOCKET_EVENT.reconnected, function () {
  $log.log('[DataSource] reconnected.');
  myLoadingService.hideLoadingIcon();
});

Since MYSOCKET_EVENT is no longer injected or defined, referencing it here will throw a ReferenceError at runtime. This event listener should be removed.

window.CaskCommon.CDAPHelpers.setupExperiments();
var activeThemeClass = caskTheme.getClassName();
getVersion();
Expand Down
7 changes: 4 additions & 3 deletions app/hydrator/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,11 @@ angular.module(PKG.name + '.feature.hydrator')
});
return defer.promise;
},
rVersion: function($state, MyCDAPDataSource) {
var dataSource = new MyCDAPDataSource();
return dataSource.request({
rVersion: function($state, $http, myCdapUrl) {
return $http.get(myCdapUrl.constructUrl({
_cdapPath: '/version'
})).then(function(res) {
return res.data;
});
}
},
Expand Down
Loading
Loading