[WIP] Updated packages #162-2
This commit is contained in:
@@ -17,7 +17,6 @@ import { SpinnerComponent } from './components/spinner/spinner.component';
|
||||
import { SharedModule } from './modules/shared/shared.module';
|
||||
import { ErrorHandlerService } from './services/error-handler/error-handler.service';
|
||||
import { SettingsService } from './services/settings/settings.service';
|
||||
import { GraphQLModule } from './graphql.module';
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +48,6 @@ import { GraphQLModule } from './graphql.module';
|
||||
deps: [HttpClient]
|
||||
}
|
||||
}),
|
||||
GraphQLModule,
|
||||
HttpClientModule
|
||||
],
|
||||
providers: [
|
||||
|
@@ -1,26 +0,0 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {ApolloModule, APOLLO_OPTIONS} from 'apollo-angular';
|
||||
import {ApolloClientOptions, InMemoryCache} from '@apollo/client/core';
|
||||
import {HttpLink} from 'apollo-angular/http';
|
||||
import { environment } from "../environments/environment";
|
||||
|
||||
const uri = `${environment.apiURL}/api/graphql/`; // <-- add the URL of the GraphQL server here
|
||||
|
||||
export function createApollo(httpLink: HttpLink): ApolloClientOptions<any> {
|
||||
return {
|
||||
link: httpLink.create({uri}),
|
||||
cache: new InMemoryCache(),
|
||||
};
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
exports: [ApolloModule],
|
||||
providers: [
|
||||
{
|
||||
provide: APOLLO_OPTIONS,
|
||||
useFactory: createApollo,
|
||||
deps: [HttpLink],
|
||||
},
|
||||
],
|
||||
})
|
||||
export class GraphQLModule {}
|
@@ -2,7 +2,6 @@ import { Component, OnInit } from "@angular/core";
|
||||
import { FormBuilder, FormControl, FormGroup } from "@angular/forms";
|
||||
import { Router } from "@angular/router";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
import { Apollo } from "apollo-angular";
|
||||
import { LazyLoadEvent } from "primeng/api";
|
||||
import { debounceTime } from "rxjs";
|
||||
import { ConfirmationDialogService } from "src/app/services/confirmation-dialog/confirmation-dialog.service";
|
||||
@@ -36,8 +35,7 @@ export class DashboardComponent implements OnInit {
|
||||
private fb: FormBuilder,
|
||||
private translate: TranslateService,
|
||||
private router: Router,
|
||||
private serverService: ServerService,
|
||||
private apollo: Apollo
|
||||
private serverService: ServerService
|
||||
) { }
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
|
@@ -217,7 +217,7 @@ export class AuthService {
|
||||
};
|
||||
}
|
||||
|
||||
getDecodedToken(): { [key: string]: any } {
|
||||
getDecodedToken(): { [key: string]: any } | null{
|
||||
return this.jwtHelper.decodeToken(this.getToken().token);
|
||||
}
|
||||
|
||||
@@ -288,10 +288,11 @@ export class AuthService {
|
||||
return false;
|
||||
}
|
||||
const token = this.getDecodedToken();
|
||||
if (!token) return false;
|
||||
return AuthRoles[token['role']] === AuthRoles[role];
|
||||
}
|
||||
|
||||
getEMailFromDecodedToken(token: { [key: string]: any }): string | null {
|
||||
getEMailFromDecodedToken(token: { [key: string]: any } | null): string | null {
|
||||
if (!token) {
|
||||
return null;
|
||||
}
|
||||
|
@@ -1,30 +1,28 @@
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { Injectable } from "@angular/core";
|
||||
import { SettingsService } from "../settings/settings.service";
|
||||
import { Apollo, gql } from "apollo-angular";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class DataService {
|
||||
|
||||
serverQuery = this.apollo.watchQuery({
|
||||
query: gql`
|
||||
{
|
||||
serverCount
|
||||
servers {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
`
|
||||
});
|
||||
// serverQuery = this.apollo.watchQuery({
|
||||
// query: gql`
|
||||
// {
|
||||
// serverCount
|
||||
// servers {
|
||||
// id
|
||||
// name
|
||||
// }
|
||||
// }
|
||||
// `
|
||||
// });
|
||||
|
||||
|
||||
constructor(
|
||||
private appsettings: SettingsService,
|
||||
private http: HttpClient,
|
||||
private apollo: Apollo
|
||||
private http: HttpClient
|
||||
) {}
|
||||
|
||||
}
|
||||
|
@@ -7,20 +7,8 @@ import {
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: {
|
||||
context(path: string, deep?: boolean, filter?: RegExp): {
|
||||
<T>(id: string): T;
|
||||
keys(): string[];
|
||||
};
|
||||
};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting(),
|
||||
);
|
||||
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().forEach(context);
|
||||
|
Reference in New Issue
Block a user