You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by to...@apache.org on 2018/08/14 08:52:45 UTC

[ambari] branch trunk updated: [AMBARI-24445] [Log Search UI] exclude mock data from production build (#2008)

This is an automated email from the ASF dual-hosted git repository.

tobiasistvan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 2ccf01b  [AMBARI-24445] [Log Search UI] exclude mock data from production build (#2008)
2ccf01b is described below

commit 2ccf01b25e9a9418a1c1243840fc433f76104b09
Author: Istvan Tobias <to...@gmail.com>
AuthorDate: Tue Aug 14 10:52:43 2018 +0200

    [AMBARI-24445] [Log Search UI] exclude mock data from production build (#2008)
---
 ambari-logsearch/ambari-logsearch-web/README.md    |  9 +++++----
 .../ambari-logsearch-web/src/app/app.module.ts     | 23 ----------------------
 2 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/ambari-logsearch/ambari-logsearch-web/README.md b/ambari-logsearch/ambari-logsearch-web/README.md
index 50e1e29..10ad300 100644
--- a/ambari-logsearch/ambari-logsearch-web/README.md
+++ b/ambari-logsearch/ambari-logsearch-web/README.md
@@ -7,7 +7,7 @@ This project was generated with [Angular CLI](https://github.com/angular/angular
 Run `npm start` or `yarn start` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
 
 ## Webpack Development Config
-In order to use Webpack Devserver proxy without changing the main config file and commit accidentally we can use a `webpack.config.dev.js` file for that. So you can set a service URL in order to test the UI against real data.
+In order to use the UI without changing the main webpack config file (and commit accidentally) we can use a `webpack.config.dev.js` file for that. So you can set a service URL proxy.
 
 The content of the `webpack.config.dev.js` can be:
 ```
@@ -18,13 +18,14 @@ module.exports = merge(baseConfig, {
   devServer: {
     historyApiFallback: true,
     proxy: {
-      '/': 'http://c7401.ambari.apache.org:61888'
+      '/api': 'http://c7401.ambari.apache.org:61888/', // proxying the api requests
+      '/login': 'http://c7401.ambari.apache.org:61888/', // proxying the login action
+      '/logout': 'http://c7401.ambari.apache.org:61888/' // proxying the the logout action
     }
   }
 });
 ```
-And you can start it that way: `NODE_ENV=production yarn start --config webpack.config.dev.js`
-You have to set the `NODE_ENV` to production in order to skip the mock data usage
+And you can start it that way: `yarn start --config webpack.config.dev.js`
 
 ## Code scaffolding
 
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts b/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
index b1121d5..b72980e 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
@@ -38,7 +38,6 @@ import {ShipperModule} from '@modules/shipper/shipper.module';
 
 import {ServiceInjector} from '@app/classes/service-injector';
 
-import {MockApiDataService} from '@app/services/mock-api-data.service';
 import {HttpClientService} from '@app/services/http-client.service';
 import {UtilsService} from '@app/services/utils.service';
 import {LogsContainerService} from '@app/services/logs-container.service';
@@ -116,23 +115,6 @@ import {LogsFilteringUtilsService} from '@app/services/logs-filtering-utils.serv
 import {LogsStateService} from '@app/services/storage/logs-state.service';
 import {LoginScreenGuardService} from '@app/services/login-screen-guard.service';
 
-export function getXHRBackend(
-  injector: Injector, browser: BrowserXhr, xsrf: XSRFStrategy, options: ResponseOptions
-): XHRBackend | InMemoryBackendService {
-  if (environment.production) {
-    return new XHRBackend(browser, options, xsrf);
-  } else {
-    return new InMemoryBackendService(
-      injector,
-      new MockApiDataService(),
-      {
-        passThruUnknownUrl: true,
-        rootPath: ''
-      }
-    );
-  }
-}
-
 @NgModule({
   declarations: [
     AppComponent,
@@ -230,11 +212,6 @@ export function getXHRBackend(
     TabsService,
     TabGuard,
     LogsBreadcrumbsResolverService,
-    {
-      provide: XHRBackend,
-      useFactory: getXHRBackend,
-      deps: [Injector, BrowserXhr, XSRFStrategy, ResponseOptions]
-    },
     AuthService,
     AuthGuardService,
     HistoryManagerService,