Removes obsolete service "Language" from backend and frontend.

This commit is contained in:
gkolokythas 2019-09-06 13:00:01 +03:00
parent 1f79c9d3e5
commit 0db79b9498
12 changed files with 7 additions and 91 deletions

View File

@ -22,22 +22,13 @@ import java.util.List;
@RequestMapping(value = {"/api/common"})
public class CommonController {
private DynamicGrantConfiguration dynamicGrantConfiguration;
private ConfigLoader configLoader;
@Autowired
public CommonController(DynamicGrantConfiguration dynamicGrantConfiguration, ConfigLoader configLoader) {
this.dynamicGrantConfiguration = dynamicGrantConfiguration;
public CommonController(ConfigLoader configLoader) {
this.configLoader = configLoader;
}
@RequestMapping(method = RequestMethod.GET, value = {"/language"}, produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<List<Language>>> getPaged() {
List<Language> language = this.dynamicGrantConfiguration.getConfiguration().getMainExternalField().getLanguage();
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Language>>().status(ApiMessageCode.NO_MESSAGE).payload(language));
}
@RequestMapping(method = RequestMethod.GET, value = {"/externalSourcesConfiguration"}, produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<ExternalSourcesConfiguration>> getExternalSourcesConfiguration() {

View File

@ -1,7 +1,5 @@
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
import { CookieService } from 'ngx-cookie-service';
import { LanguageResolverService } from '../services/language-resolver/language-resolver.service';
import { LanguageService } from '../services/language/language.service';
import { AuthGuard } from './auth-guard.service';
import { AuthService } from './services/auth/auth.service';
import { CultureService } from './services/culture/culture-service';
@ -60,7 +58,6 @@ export class CoreServiceModule {
CookieService,
BaseHttpService,
AuthGuard,
LanguageService,
CultureService,
TimezoneService,
TypeUtils,
@ -70,7 +67,6 @@ export class CoreServiceModule {
LoggingService,
SearchBarService,
DashboardService,
LanguageResolverService,
GrantService,
ProjectService,
FunderService,

View File

@ -1,27 +0,0 @@
import { Injectable } from '@angular/core';
import { takeUntil } from 'rxjs/operators';
import { BaseService } from '../../core/common/base/base.service';
import { LanguageService } from '../language/language.service';
@Injectable()
export class LanguageResolverService extends BaseService {
private languageData = {};
constructor(private language: LanguageService) {
super();
if (Object.keys(this.languageData).length === 0) {
this.language.getLang()
.pipe(takeUntil(this._destroyed))
.subscribe(result => {
result.forEach(item => {
this.languageData[item.key] = item.languageKey;
});
});
}
}
public getBy(key: string): string {
return this.languageData[key];
}
}

View File

@ -1,25 +0,0 @@
import { HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from '../../../environments/environment';
import { BaseHttpService } from '../../core/services/http/base-http.service';
import { Language } from '../../models/language/Language';
@Injectable()
export class LanguageService {
private actionUrl: string;
private headers: HttpHeaders;
constructor(private http: BaseHttpService) {
this.actionUrl = environment.Server + 'common/';
this.headers = new HttpHeaders();
this.headers = this.headers.set('Content-Type', 'application/json');
this.headers = this.headers.set('Accept', 'application/json');
}
public getLang(): Observable<Language[]> {
return this.http.get<any>(this.actionUrl + 'language', { headers: this.headers });
}
}

View File

@ -25,7 +25,6 @@ import { ExternalSourcesService } from '../../../core/services/external-sources/
import { SnackBarNotificationLevel, UiNotificationService } from '../../../core/services/notification/ui-notification-service';
import { GrantService } from '../../../core/services/grant/grant.service';
import { ConfirmationDialogComponent } from '../../../library/confirmation-dialog/confirmation-dialog.component';
import { LanguageResolverService } from '../../../services/language-resolver/language-resolver.service';
import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item';
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
import { DmpEditorModel } from './dmp-editor.model';
@ -66,7 +65,6 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
private dmpProfileService: DmpProfileService,
private dmpService: DmpService,
private grantService: GrantService,
// private projectService: ProjectService,
private externalSourcesService: ExternalSourcesService,
private route: ActivatedRoute,
private snackBar: MatSnackBar,
@ -75,7 +73,6 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
private _service: DmpService,
private dialog: MatDialog,
private _viewContainerRef: ViewContainerRef,
public languageResolverService: LanguageResolverService,
private uiNotificationService: UiNotificationService,
private authService: AuthService,
) {

View File

@ -16,10 +16,8 @@ import { DmpService } from '../../../../core/services/dmp/dmp.service';
import { ExternalSourcesService } from '../../../../core/services/external-sources/external-sources.service';
import { MultipleAutoCompleteConfiguration } from '../../../../library/auto-complete/multiple/multiple-auto-complete-configuration';
import { SingleAutoCompleteConfiguration } from '../../../../library/auto-complete/single/single-auto-complete-configuration';
import { LanguageResolverService } from '../../../../services/language-resolver/language-resolver.service';
import { AddResearcherComponent } from '../add-researcher/add-researcher.component';
import { AvailableProfilesComponent } from '../available-profiles/available-profiles.component';
import { startWith } from 'rxjs/internal/operators';
@Component({
selector: 'app-general-tab',
@ -49,8 +47,7 @@ export class GeneralTabComponent extends BaseComponent implements OnInit {
private dmpProfileService: DmpProfileService,
private externalSourcesService: ExternalSourcesService,
private _service: DmpService,
private dialog: MatDialog,
public languageResolverService: LanguageResolverService,
private dialog: MatDialog
) {
super();
}

View File

@ -4,7 +4,6 @@ import { SingleAutoCompleteConfiguration } from '../../../../library/auto-comple
import { RequestItem } from '../../../../core/query/request-item';
import { GrantCriteria } from '../../../../core/query/grant/grant-criteria';
import { GrantService } from '../../../../core/services/grant/grant.service';
import { LanguageResolverService } from '../../../../services/language-resolver/language-resolver.service';
import { GrantTabModel } from './grant-tab-model';
import { ProjectService } from '../../../../core/services/project/project.service';
import { FunderService } from '../../../../core/services/funder/funder.service';
@ -38,8 +37,7 @@ export class GrantTabComponent implements OnInit {
private grantService: GrantService,
private projectService: ProjectService,
private funderService: FunderService,
private language: TranslateService,
public languageResolverService: LanguageResolverService
private language: TranslateService
) { }
ngOnInit() {

View File

@ -18,7 +18,6 @@ import { ExternalSourcesService } from '../../../../core/services/external-sourc
import { GrantService } from '../../../../core/services/grant/grant.service';
import { MultipleAutoCompleteConfiguration } from '../../../../library/auto-complete/multiple/multiple-auto-complete-configuration';
import { SingleAutoCompleteConfiguration } from '../../../../library/auto-complete/single/single-auto-complete-configuration';
import { LanguageResolverService } from '../../../../services/language-resolver/language-resolver.service';
import { SnackBarNotificationLevel, UiNotificationService } from '../../../../core/services/notification/ui-notification-service';
@Component({
@ -55,7 +54,6 @@ export class DmpWizardEditorComponent extends BaseComponent implements OnInit {
public router: Router,
public language: TranslateService,
private _service: DmpService,
public languageResolverService: LanguageResolverService,
private uiNotificationService: UiNotificationService
) {
super();

View File

@ -4,7 +4,6 @@ import { TranslateService } from '@ngx-translate/core';
import { ValidationErrorModel } from '../../../../common/forms/validation/error-model/validation-error-model';
import { GrantStateType } from '../../../../core/common/enum/grant-state-type';
import { GrantCriteria } from '../../../../core/query/grant/grant-criteria';
import { LanguageResolverService } from '../../../../services/language-resolver/language-resolver.service';
import { BaseCriteriaComponent } from '../../../misc/criteria/base-criteria.component';
import { ErrorStateMatcher } from '@angular/material';
@ -20,8 +19,7 @@ export class GrantCriteriaComponent extends BaseCriteriaComponent implements OnI
constructor(
public language: TranslateService,
public formBuilder: FormBuilder,
public languageResolver: LanguageResolverService
public formBuilder: FormBuilder
) {
super(new ValidationErrorModel());
}

View File

@ -4,7 +4,6 @@ import { Router, ActivatedRoute, Params } from '@angular/router';
import { Observable } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { BaseComponent } from '../../../core/common/base/base.component';
import { GrantStateType } from '../../../core/common/enum/grant-state-type';
import { DataTableRequest } from '../../../core/model/data-table/data-table-request';
import { GrantListingModel } from '../../../core/model/grant/grant-listing';
import { GrantCriteria } from '../../../core/query/grant/grant-criteria';
@ -12,7 +11,6 @@ import { GrantService } from '../../../core/services/grant/grant.service';
import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item';
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
import { GrantCriteriaComponent } from './criteria/grant-criteria.component';
import { LanguageResolverService } from '../../../services/language-resolver/language-resolver.service';
import { TranslateService } from '@ngx-translate/core';
@Component({
@ -34,8 +32,7 @@ export class GrantListingComponent extends BaseComponent implements OnInit, IBre
private grantService: GrantService,
private router: Router,
private route: ActivatedRoute,
public language: TranslateService,
public languageResolverService: LanguageResolverService
public language: TranslateService
) {
super();
}

View File

@ -14,7 +14,6 @@ import { ProgressIndicationService } from '../../../core/services/progress-indic
import { GrantService } from '../../../core/services/grant/grant.service';
import { SearchBarService } from '../../../core/services/search-bar/search-bar.service';
import { SingleAutoCompleteConfiguration } from '../../../library/auto-complete/single/single-auto-complete-configuration';
import { LanguageResolverService } from '../../../services/language-resolver/language-resolver.service';
import { UserDialogComponent } from './user-dialog/user-dialog.component';
export enum SearchBarType {
@ -43,8 +42,7 @@ export class NavigationComponent extends BaseComponent implements OnInit {
private grantService: GrantService,
private searchBarService: SearchBarService,
private router: Router,
private progressIndicationService: ProgressIndicationService,
public languageResolver: LanguageResolverService
private progressIndicationService: ProgressIndicationService
) {
super();
}

View File

@ -11,7 +11,6 @@ import { RequestItem } from '../../../core/query/request-item';
import { SnackBarNotificationLevel, UiNotificationService } from '../../../core/services/notification/ui-notification-service';
import { GrantService } from '../../../core/services/grant/grant.service';
import { SingleAutoCompleteConfiguration } from '../../../library/auto-complete/single/single-auto-complete-configuration';
import { LanguageResolverService } from '../../../services/language-resolver/language-resolver.service';
import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item';
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
import { GrantEditorWizardModel } from './grant-editor-wizard-model';
@ -37,8 +36,7 @@ export class GrantEditorWizardComponent extends BaseComponent implements OnInit,
private route: ActivatedRoute,
public router: Router,
public language: TranslateService,
private grantService: GrantService,
public languageResolverService: LanguageResolverService,
private grantService: GrantService
) {
super();
}