diff --git a/.gitignore b/.gitignore index f4eb2855..bf1d45ec 100644 --- a/.gitignore +++ b/.gitignore @@ -61,9 +61,11 @@ npm-debug.log .idea/ *.swp .vscode/ +target/ # NPM # npm-debug.log* +package-lock.json .history diff --git a/package.json b/package.json index 4f70d6a4..cd18abd0 100644 --- a/package.json +++ b/package.json @@ -110,9 +110,6 @@ "c3": "0.4.11", "ngx-base": "1.2.9", "ngx-bootstrap": "1.9.0", - "ngx-chips": "^1.5.3", - "ngx-fabric8-wit": "6.18.11", - "ngx-login-client": "0.6.32", "ngx-modal": "0.0.29", "rxjs": "5.2.0" }, @@ -181,7 +178,7 @@ "less": "2.7.3", "less-loader": "4.0.5", "less-plugin-autoprefix": "1.5.1", - "lodash": "4.17.4", + "lodash": "4.17.11", "mocha": "3.2.0", "ngc-webpack": "1.2.0", "npm-run-all": "4.0.2", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index edbe9689..6c11c31b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,20 +2,12 @@ import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { Broadcaster } from 'ngx-base'; -import { Contexts } from 'ngx-fabric8-wit'; -import { AuthenticationService, AUTH_API_URL, SSO_API_URL } from 'ngx-login-client'; import { AppComponent } from './app.component'; import { FormsModule } from '@angular/forms'; import {AppRoutingModule} from './app.routing'; -import { witApiUrlProvider } from './shared/wit-api.provider'; -import { ApiLocatorService } from './shared/api-locator.service'; -import { authApiUrlProvider } from './shared/auth-api.provider'; -import { ssoApiUrlProvider } from './shared/sso-api.provider'; -import { realmProvider } from './shared/realm-token.provider'; -import { MockAuthenticationService } from './shared/mock-auth.service'; // Imports stackdetailsmodule import { StackDetailsModule } from './stack/stack-details/stack-details.module'; @@ -29,16 +21,7 @@ import { StackDetailsModule } from './stack/stack-details/stack-details.module'; ], declarations: [ AppComponent ], providers: [ - Broadcaster, - ApiLocatorService, - witApiUrlProvider, - authApiUrlProvider, - ssoApiUrlProvider, - realmProvider, - { - provide: AuthenticationService, useClass: MockAuthenticationService - }, - Contexts + Broadcaster ], bootstrap: [ AppComponent ] }) diff --git a/src/app/shared/api-locator.service.ts b/src/app/shared/api-locator.service.ts deleted file mode 100644 index ac3bd114..00000000 --- a/src/app/shared/api-locator.service.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable() -export class ApiLocatorService { - - readonly DEFAULT_API_ENV_VAR_NAMES = new Map( - [ - ['wit', 'FABRIC8_WIT_API_URL'], - ['realm', 'FABRIC8_REALM'], - ['recommender', 'FABRIC8_RECOMMENDER_API_URL'] - ] - ); - - readonly DEFAULT_API_PREFIXES = new Map([ - ['wit', 'api'], - ['recommender', 'recommender'] - ]); - - readonly DEFAULT_API_PATHS = new Map([ - ['wit', 'api/'] - ]); - - private envVars = new Map(); - - constructor() { - this.DEFAULT_API_ENV_VAR_NAMES.forEach((value, key) => { - this.loadEnvVar(key); - }); - } - - get witApiUrl(): string { - return this.buildApiUrl('wit'); - } - - get realm(): string { - return this.envVars.get('realm'); - } - - get recommenderApiUrl(): string { - return this.buildApiUrl('recommender'); - } - - private loadEnvVar(key: string): void { - this.envVars.set(key, process.env[this.DEFAULT_API_ENV_VAR_NAMES.get(key)]); - } - - private buildApiUrl(key: string): string { - // Return any environment specified URLs for this API - if (this.envVars.get(key)) { - return this.envVars.get(key); - } - // Simple check to trim www - let domainname = window.location.hostname; - if (domainname.startsWith('www')) { - domainname = window.location.hostname.slice(4); - } - let url = domainname; - if (window.location.port) { - url += ':' + window.location.port; - } - if (this.DEFAULT_API_PREFIXES.has(key)) { - url = this.DEFAULT_API_PREFIXES.get(key) + '.' + url + '/'; - } - if (this.DEFAULT_API_PATHS.has(key)) { - url += this.DEFAULT_API_PATHS.get(key); - } - url = window.location.protocol + '//' + url; - return url; - } - - -} diff --git a/src/app/shared/auth-api.provider.ts b/src/app/shared/auth-api.provider.ts deleted file mode 100644 index f9f4d922..00000000 --- a/src/app/shared/auth-api.provider.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ApiLocatorService } from './api-locator.service'; -import { AUTH_API_URL } from 'ngx-login-client'; - -let authApiUrlFactory = (api: ApiLocatorService) => { - return api.witApiUrl; -}; - -export let authApiUrlProvider = { - provide: AUTH_API_URL, - useFactory: authApiUrlFactory, - deps: [ApiLocatorService] -}; diff --git a/src/app/shared/mock-auth.service.ts b/src/app/shared/mock-auth.service.ts deleted file mode 100644 index e881c563..00000000 --- a/src/app/shared/mock-auth.service.ts +++ /dev/null @@ -1,8 +0,0 @@ -import {Injectable} from '@angular/core'; -@Injectable() -export class MockAuthenticationService { - getToken(): string { - let token: string = process.env['STACK_API_TOKEN']; - return token; - } -} diff --git a/src/app/shared/realm-token.provider.ts b/src/app/shared/realm-token.provider.ts deleted file mode 100644 index 30e12b90..00000000 --- a/src/app/shared/realm-token.provider.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ApiLocatorService } from './api-locator.service'; -import { REALM } from 'ngx-login-client'; - -let realmFactory = (api: ApiLocatorService) => { - return api.realm; -}; - -export let realmProvider = { - provide: REALM, - useFactory: realmFactory, - deps: [ApiLocatorService] -}; diff --git a/src/app/shared/sso-api.provider.ts b/src/app/shared/sso-api.provider.ts deleted file mode 100644 index a7b0e518..00000000 --- a/src/app/shared/sso-api.provider.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ApiLocatorService } from './api-locator.service'; -import { SSO_API_URL } from 'ngx-login-client'; - -let ssoApiUrlFactory = (api: ApiLocatorService) => { - return api.witApiUrl; -}; - -export let ssoApiUrlProvider = { - provide: SSO_API_URL, - useFactory: ssoApiUrlFactory, - deps: [ApiLocatorService] -}; diff --git a/src/app/shared/wit-api.provider.ts b/src/app/shared/wit-api.provider.ts deleted file mode 100644 index fcbab0f6..00000000 --- a/src/app/shared/wit-api.provider.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ApiLocatorService } from './api-locator.service'; -import { WIT_API_URL } from 'ngx-fabric8-wit'; - -let witApiUrlFactory = (api: ApiLocatorService) => { - return api.witApiUrl; -}; - -export let witApiUrlProvider = { - provide: WIT_API_URL, - useFactory: witApiUrlFactory, - deps: [ApiLocatorService] -}; diff --git a/src/app/stack/card-details/component-information/component-information.component.spec.ts b/src/app/stack/card-details/component-information/component-information.component.spec.ts index 94007730..53c59d9a 100644 --- a/src/app/stack/card-details/component-information/component-information.component.spec.ts +++ b/src/app/stack/card-details/component-information/component-information.component.spec.ts @@ -2,7 +2,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { Http, ConnectionBackend, RequestOptions, BaseRequestOptions } from '@angular/http'; import { ComponentInformationComponent } from './component-information.component'; -import { AddWorkFlowService } from '../../stack-details/add-work-flow.service'; import { TooltipModule } from 'ngx-bootstrap'; import { ToastNotificationModule } from '../../toast-notification/toast-notification.module'; @@ -11,17 +10,6 @@ import { ComponentSnippetComponent } from './component-snippet/component-snippet import { ProgressMeterModule } from '../../utils/progress-meter/progress-meter.module'; import { ComponentFeedbackModule } from '../../utils/component-feedback/component-feedback.module'; -import { Broadcaster } from 'ngx-base'; -import { Contexts } from 'ngx-fabric8-wit'; -import { AuthenticationService, AUTH_API_URL, SSO_API_URL } from 'ngx-login-client'; - -import { witApiUrlProvider } from '../../../shared/wit-api.provider'; -import { ApiLocatorService } from '../../../shared/api-locator.service'; -import { authApiUrlProvider } from '../../../shared/auth-api.provider'; -import { ssoApiUrlProvider } from '../../../shared/sso-api.provider'; -import { realmProvider } from '../../../shared/realm-token.provider'; -import { MockAuthenticationService } from '../../../shared/mock-auth.service'; - import { MRecommendationInformation, MComponentInformation, @@ -92,18 +80,8 @@ describe ('ComponentInformationComponent', () => { ], providers: [ Http, - Contexts, - AddWorkFlowService, ConnectionBackend, - { provide: RequestOptions, useClass: BaseRequestOptions }, - witApiUrlProvider, - ApiLocatorService, - authApiUrlProvider, - ssoApiUrlProvider, - realmProvider, - { - provide: AuthenticationService, useClass: MockAuthenticationService - } + { provide: RequestOptions, useClass: BaseRequestOptions } ] }).compileComponents(); })); diff --git a/src/app/stack/card-details/component-information/component-information.component.ts b/src/app/stack/card-details/component-information/component-information.component.ts index 797fd9fa..386988cb 100644 --- a/src/app/stack/card-details/component-information/component-information.component.ts +++ b/src/app/stack/card-details/component-information/component-information.component.ts @@ -6,8 +6,6 @@ import { OnChanges, SimpleChanges } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; -import { Space, Contexts } from 'ngx-fabric8-wit'; /** Vendor imports Go HERE */ import { @@ -17,7 +15,6 @@ import { MGenericStackInformation } from '../../models/ui.model'; -import { AddWorkFlowService } from '../../stack-details/add-work-flow.service'; @Component({ selector: 'component-information', @@ -32,32 +29,9 @@ export class ComponentInformationComponent implements OnInit, OnChanges { @Input() type: string; @Input() repoInfo: any; public comp: MComponentInformation; - public workItemResponse: Array = []; - public messages: any; - private spaceName: string; - private userName: string; constructor( - private addWorkFlowService: AddWorkFlowService, - private context: Contexts - ) { - if (this.context && this.context.current) { - this.context.current.subscribe(val => { - if (val && val.name) { - this.spaceName = val.name.trim().replace(' ', '_'); - } - this.userName = val.user.attributes.username; - }); - } - this.messages = { - createWorkItemEerror: 'There was a error while creating work item.', - toastDisplay: { - text1: 'Workitem with ID ', - text2: ' has been added to the backlog.' - }, - viewWorkItem: 'View Work Item' - }; - } + ) {} ngOnInit() { this.paint(); @@ -85,161 +59,4 @@ export class ComponentInformationComponent implements OnInit, OnChanges { } } - public handleAction(event: MouseEvent, comp: MComponentInformation) { - event.preventDefault(); - let workItems = []; - let message: string = ''; - let codebase = { - 'repository': 'Test_Repo', - 'branch': 'task-1234', - 'filename': this.component['manifestFilePath'], - 'linenumber': 1 - }; - let key = ''; - - // TODO form data to be shared with recommender object - let titleHdr: string = ''; - if (comp && comp.recommendation) { - message = `Stack analysis has identified alternate component - for **${comp.name}**. - You have chosen to replace **${comp.name}** with **${comp.recommendation.componentInformation.name}** - and version: **${comp.recommendation.componentInformation.currentVersion}** in your application stack`; - titleHdr = `Alternate dependencies for ${comp.name}`; - key = comp.recommendation.componentInformation.name; - } else if (comp && !comp.hasSecurityIssue && !comp.recommendation) { - message = `Stack analysis has identified some additional dependencies for your - application stack. You have chosen to add **${comp.name}** - with **${comp.currentVersion}** to your application stack`; - titleHdr = `Add ${comp.name} to your application stack`; - key = comp.name; - } else if (comp && comp.hasSecurityIssue) { - message = `Stack analysis has identified some security issues for dependency **${comp.name}** - with **${comp.currentVersion}** in your application stack. CVE id for the highest security issue is **${comp.securityDetails.highestIssue.cve}**`; - titleHdr = `${comp.name} has some security issues`; - key = comp.name; - } - if (this.repoInfo && this.repoInfo.git) { - codebase['repository'] = this.repoInfo.git.uri || ''; - codebase['branch'] = this.repoInfo.git.ref || 'master'; - } - message += ' \n\n '; - message += '\n\n **Repository:** ' + codebase['repository']; - message += '\n\n **Branch:** ' + codebase['branch']; - message += '\n\n **Filename:** ' + codebase['filename']; - message += '\n\n **Line Number:**' + codebase['linenumber']; - let item: any = { - title: titleHdr, - description: message, - markup: 'Markdown', - codebase: codebase, - key: key - }; - - workItems.push(item); - - if (workItems.length > 0) { - this.addWorkItems(workItems[0], comp); - } else { - console.log('Work items are empty and cannot be added'); - } - } - - /* - * getWorkItemData - Takes nothing, returns Object - * It returns the predefined JSON structure to be sent as an input - * for work item creation request. - */ - private getWorkItemData(): any { - let workItemData = { - 'data': { - 'attributes': { - 'system.state': 'open', - 'system.title': '', - 'system.codebase': '' - }, - 'type': 'workitems', - 'relationships': { - 'baseType': { - 'data': { - 'id': '26787039-b68f-4e28-8814-c2f93be1ef4e', - 'type': 'workitemtypes' - } - } - } - } - }; - return workItemData; - } - - /* - * addWorkItems - takes workitems array, return nothing - * A generic function that recieves workitems in a predefined format - * Creates work items based on the data - * Handles single as well as multiple work items - */ - private addWorkItems(workItem: Array, comp: MComponentInformation): void { - let newItem: any; // , workItem: any; - newItem = this.getWorkItemData(); - // for (let i: number = 0; i < length; ++i) { - // if (workItems[i]) { - // workItem = workItems[i]; - // TODO: Handle the case of sending multiple work items concurrently - // once the API Payload is properly set at the receiving end. - if (newItem) { - newItem.data.attributes['system.title'] = workItem['title']; - newItem.data.attributes['system.description'] = workItem['description']; - newItem.data.attributes['system.codebase'] = workItem['codebase']; - newItem.data.attributes['system.description.markup'] = workItem['markup']; - newItem.key = workItem['key']; - } - // } - // } - - let workFlow: Observable = this.addWorkFlowService.addWorkFlow(newItem); - workFlow.subscribe((data) => { - if (data) { - let inputUrlArr: Array = []; - if (data.links && data.links.self && data.links.self.length && - data.data.attributes) { - comp.workItem.isWorkItemCreated = true; - inputUrlArr = data.links.self.split('/api/'); - let hostString = inputUrlArr[0] ? inputUrlArr[0].replace('api.', '') : ''; - let baseUrl: string = hostString + - `/${this.userName}/${this.spaceName}/plan/detail/` + - data.data.attributes['system.number']; - comp.workItem.url = baseUrl; - this.displayWorkItemResponse(baseUrl, data.data.attributes['system.number']); - newItem.url = baseUrl; - // TODO :: toggle Worke item link and toast notification - // this.toggleWorkItemButton(newItem); - } - } - }); - } - - /** - * displayWorkItemResponse - takes a message string and returns nothing - * Displays the response received from the creation of work items - */ - private displayWorkItemResponse(url: string, id: any): void { - let notification = { - iconClass: '', - alertClass: '', - text: null, - link: null, - linkText: this.messages.viewWorkItem - }; - if (id) { - notification.iconClass = 'pficon-ok'; - notification.alertClass = 'alert-success'; - notification.text = this.messages.toastDisplay.text1 + - id + this.messages.toastDisplay.text2; - notification.link = url; - } else { - notification.iconClass = 'pficon-error-circle-o'; - notification.alertClass = 'alert-danger'; - notification.text = this.messages.createWorkItemEerror; - } - this.workItemResponse.push(notification); - } } diff --git a/src/app/stack/card-details/report-information/report-information.component.spec.ts b/src/app/stack/card-details/report-information/report-information.component.spec.ts index 9b02c038..193a24a9 100644 --- a/src/app/stack/card-details/report-information/report-information.component.spec.ts +++ b/src/app/stack/card-details/report-information/report-information.component.spec.ts @@ -11,7 +11,6 @@ import { ComponentInformationComponent } from '../component-information/componen import { ComponentDetailsComponent } from '../component-details/component-details.component'; import { ReportInformationComponent } from './report-information.component'; -import { AddWorkFlowService } from '../../stack-details/add-work-flow.service'; import { NoDataComponent } from './no-data/no-data.component'; @@ -47,7 +46,6 @@ describe ('ReportInformationComponent', () => { ], providers: [ Http, - AddWorkFlowService, ConnectionBackend, { provide: RequestOptions, useClass: BaseRequestOptions } ] diff --git a/src/app/stack/card-details/report-information/report-information.module.ts b/src/app/stack/card-details/report-information/report-information.module.ts index 8e12e414..0c69187c 100644 --- a/src/app/stack/card-details/report-information/report-information.module.ts +++ b/src/app/stack/card-details/report-information/report-information.module.ts @@ -13,7 +13,6 @@ import { ComponentInformationComponent } from '../component-information/componen import { ComponentDetailsComponent } from '../component-details/component-details.component'; import { ReportInformationComponent } from './report-information.component'; -import { AddWorkFlowService } from '../../stack-details/add-work-flow.service'; import { NoDataComponent } from './no-data/no-data.component'; @@ -40,7 +39,7 @@ const imports = [ declarations: [ ...components ], - providers: [ AddWorkFlowService ], + providers: [ ], exports: [ ...components ] diff --git a/src/app/stack/feedback/feedback.service.ts b/src/app/stack/feedback/feedback.service.ts index a2b5ebc8..f8ab54f0 100644 --- a/src/app/stack/feedback/feedback.service.ts +++ b/src/app/stack/feedback/feedback.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core'; import { Http, Response, Headers, RequestOptions } from '@angular/http'; -import { AuthenticationService } from 'ngx-login-client'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/catch'; import 'rxjs/operator/map'; @@ -9,12 +8,7 @@ import 'rxjs/operator/map'; export class FeedbackService { private headers: Headers = new Headers({'Content-Type': 'application/json'}); constructor( - private http: Http, - private auth: AuthenticationService) { - if (this.auth.getToken() !== null) { - this.headers.set('Authorization', 'Bearer ' + this.auth.getToken()); - } - } + private http: Http) {} public submit(feedback: any): Observable { let url: string = 'https://recommender.api.openshift.io/api/v1/user-feedback'; diff --git a/src/app/stack/stack-details/add-work-flow.service.ts b/src/app/stack/stack-details/add-work-flow.service.ts deleted file mode 100644 index 84a716cd..00000000 --- a/src/app/stack/stack-details/add-work-flow.service.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Injectable, Inject } from '@angular/core'; -import { Http, Response, Headers, RequestOptions } from '@angular/http'; -import { AuthenticationService } from 'ngx-login-client'; -import { WIT_API_URL, Contexts } from 'ngx-fabric8-wit'; -import { Observable } from 'rxjs/Observable'; -import 'rxjs/add/operator/catch'; -import 'rxjs/operator/map'; - -@Injectable() -export class AddWorkFlowService { - - private stackWorkItemUrl; - - private headers: Headers = new Headers({'Content-Type': 'application/json'}); - private workItemsRoute: string = 'workitems'; - private spacesString: string = 'spaces'; - private spaceId: string; - - constructor( - private http: Http, - @Inject(WIT_API_URL) apiUrl: string, - private auth: AuthenticationService, - private context: Contexts - ) { - if (this.auth.getToken() !== null) { - this.headers.set('Authorization', 'Bearer ' + this.auth.getToken()); - } - - if (this.context && this.context.current) { - this.context.current.subscribe(currentContext => { - if (currentContext.space) { - this.spaceId = currentContext.space.id; - this.stackWorkItemUrl = apiUrl + this.spacesString + '/' + this.spaceId + '/' + this.workItemsRoute; - } - }); - } - } - - addWorkFlow(workItemData: any): Observable { - let options = new RequestOptions({ headers: this.headers }); - let body = JSON.stringify(workItemData); - return this.http.post(this.stackWorkItemUrl, body, options) - .map(this.extractData) - .catch(this.handleError); - } - - private extractData(res: Response) { - let body = res.json(); - return body || {}; - } - - private handleError(error: Response | any) { - // In a real world app, we might use a remote logging infrastructure - let errMsg: string; - if (error instanceof Response) { - const body = error.json() || ''; - const err = body.error || JSON.stringify(body); - errMsg = `${error.status} - ${error.statusText || ''} ${err}`; - } else { - errMsg = error.message ? error.message : error.toString(); - } - console.error(errMsg); - return Observable.throw(errMsg); - } -} diff --git a/src/app/stack/stack-details/stack-details-component.spec.ts b/src/app/stack/stack-details/stack-details-component.spec.ts index 6e24a1c1..77bb7ed3 100644 --- a/src/app/stack/stack-details/stack-details-component.spec.ts +++ b/src/app/stack/stack-details/stack-details-component.spec.ts @@ -16,15 +16,6 @@ import { GlobalConstants } from '../constants/constants.service'; import {FeedbackModule} from '../feedback/feedback.module'; import { Broadcaster } from 'ngx-base'; -import { Contexts } from 'ngx-fabric8-wit'; -import { AuthenticationService, AUTH_API_URL, SSO_API_URL } from 'ngx-login-client'; - -import { witApiUrlProvider } from '../../shared/wit-api.provider'; -import { ApiLocatorService } from '../../shared/api-locator.service'; -import { authApiUrlProvider } from '../../shared/auth-api.provider'; -import { ssoApiUrlProvider } from '../../shared/sso-api.provider'; -import { realmProvider } from '../../shared/realm-token.provider'; -import { MockAuthenticationService } from '../../shared/mock-auth.service'; /** Stack Report Revamp - Latest */ @@ -59,16 +50,7 @@ describe ('StackDetailsComponent', () => { StackDetailsComponent ], providers: [ - Broadcaster, - ApiLocatorService, - witApiUrlProvider, - authApiUrlProvider, - ssoApiUrlProvider, - realmProvider, - { - provide: AuthenticationService, useClass: MockAuthenticationService - }, - Contexts + Broadcaster ] }).compileComponents(); })); diff --git a/src/app/stack/utils/component-feedback/component-feedback.component.spec.ts b/src/app/stack/utils/component-feedback/component-feedback.component.spec.ts index 7e2a438d..1054796e 100644 --- a/src/app/stack/utils/component-feedback/component-feedback.component.spec.ts +++ b/src/app/stack/utils/component-feedback/component-feedback.component.spec.ts @@ -1,9 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { Http, ConnectionBackend, RequestOptions, BaseRequestOptions } from '@angular/http'; -import { AuthenticationService, AUTH_API_URL, SSO_API_URL } from 'ngx-login-client'; -import { MockAuthenticationService } from '../../../shared/mock-auth.service'; - import { ComponentFeedbackComponent } from './component-feedback.component'; import { ToastNotificationModule } from '../../toast-notification/toast-notification.module'; import { StackAnalysesService } from '../../stack-analyses.service'; @@ -24,9 +21,6 @@ describe ('ComponentFeedbackComponent', () => { Http, ConnectionBackend, { provide: RequestOptions, useClass: BaseRequestOptions }, - { - provide: AuthenticationService, useClass: MockAuthenticationService - }, StackAnalysesService ] }).compileComponents(); diff --git a/src/app/stack/utils/component-feedback/component-feedback.service.ts b/src/app/stack/utils/component-feedback/component-feedback.service.ts index 8fe6c3aa..f404ad77 100644 --- a/src/app/stack/utils/component-feedback/component-feedback.service.ts +++ b/src/app/stack/utils/component-feedback/component-feedback.service.ts @@ -1,6 +1,5 @@ import { Injectable, Inject } from '@angular/core'; import { Http, Response, Headers, RequestOptions } from '@angular/http'; -import { AuthenticationService } from 'ngx-login-client'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/catch'; import 'rxjs/operator/map'; @@ -17,13 +16,8 @@ export class ComponentFeedbackService { constructor( private http: Http, - private auth: AuthenticationService, private stackAnalysisService: StackAnalysesService - ) { - if (this.auth.getToken() !== null) { - this.headers.set('Authorization', 'Bearer ' + this.auth.getToken()); - } - } + ) {} postFeedback(feedback: MComponentFeedback, token?: string): Observable { let options = new RequestOptions({ headers: this.headers });