Compare commits
10 Commits
482a78207e
...
bf2356e10a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf2356e10a | ||
|
|
95d2832ef8 | ||
|
|
7f04bb16d3 | ||
|
|
b35026f186 | ||
|
|
cf619fb982 | ||
|
|
0405c9722b | ||
|
|
b880a3245d | ||
|
|
f502a47090 | ||
|
|
f329340c7f | ||
|
|
a509583210 |
@@ -32,7 +32,8 @@
|
|||||||
"styles": [
|
"styles": [
|
||||||
"node_modules/bootstrap/dist/css/bootstrap.min.css",
|
"node_modules/bootstrap/dist/css/bootstrap.min.css",
|
||||||
"@angular/material/prebuilt-themes/indigo-pink.css",
|
"@angular/material/prebuilt-themes/indigo-pink.css",
|
||||||
"src/styles.scss"
|
"src/styles.scss",
|
||||||
|
"src/dd-mat-theme.scss"
|
||||||
],
|
],
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
|
"node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
|
||||||
@@ -106,7 +107,8 @@
|
|||||||
"styles": [
|
"styles": [
|
||||||
"@angular/material/prebuilt-themes/indigo-pink.css",
|
"@angular/material/prebuilt-themes/indigo-pink.css",
|
||||||
"src/styles.scss",
|
"src/styles.scss",
|
||||||
"node_modules/bootstrap/dist/css/bootstrap.min.css"
|
"node_modules/bootstrap/dist/css/bootstrap.min.css",
|
||||||
|
"src/dd-mat-theme.scss"
|
||||||
],
|
],
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
|
"node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ApplicationConfig } from '@angular/core';
|
import { APP_INITIALIZER, ApplicationConfig } from '@angular/core';
|
||||||
import { provideRouter } from '@angular/router';
|
import { provideRouter } from '@angular/router';
|
||||||
import { routes } from './app.routes';
|
import { routes } from './app.routes';
|
||||||
import { provideClientHydration } from '@angular/platform-browser';
|
import { provideClientHydration } from '@angular/platform-browser';
|
||||||
@@ -6,6 +6,7 @@ import { provideAnimationsAsync } from '@angular/platform-browser/animations/asy
|
|||||||
import { provideHttpClient, withFetch } from '@angular/common/http';
|
import { provideHttpClient, withFetch } from '@angular/common/http';
|
||||||
import { APP_BASE_HREF } from '@angular/common';
|
import { APP_BASE_HREF } from '@angular/common';
|
||||||
import { UrlService } from './services/url.service';
|
import { UrlService } from './services/url.service';
|
||||||
|
import { API_URL } from './tokens';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
@@ -17,6 +18,16 @@ export const appConfig: ApplicationConfig = {
|
|||||||
provide: APP_BASE_HREF,
|
provide: APP_BASE_HREF,
|
||||||
useFactory: (urlService: UrlService) => urlService.getBaseHref(),
|
useFactory: (urlService: UrlService) => urlService.getBaseHref(),
|
||||||
deps: [UrlService]
|
deps: [UrlService]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: API_URL,
|
||||||
|
useFactory: (urlService: UrlService) => urlService.getApiUrl(),
|
||||||
|
deps: [UrlService]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: API_URL,
|
||||||
|
useFactory: (urlService: UrlService) => urlService.getApiUrl(),
|
||||||
|
deps: [UrlService]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@@ -23,12 +23,11 @@ export class AuthGuard implements CanActivate {
|
|||||||
const isAuthenticated = await this.authService.isAuthenticated();
|
const isAuthenticated = await this.authService.isAuthenticated();
|
||||||
|
|
||||||
if (!isAuthenticated) {
|
if (!isAuthenticated) {
|
||||||
this.openLogin();
|
this.router.navigate(['/']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return isAuthenticated;
|
return isAuthenticated;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Hata durumunda false döndür
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { GroupTableComponent } from '../tables/group-table/group-table.component
|
|||||||
import { UserRepService } from '../../services/user-representation.service';
|
import { UserRepService } from '../../services/user-representation.service';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
import { MatTabsModule, MatTabGroup } from '@angular/material/tabs';
|
import { MatTabsModule, MatTabGroup } from '@angular/material/tabs';
|
||||||
|
import { env } from '../../../environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@@ -28,9 +29,9 @@ export class UserRepresentationComponent {
|
|||||||
|
|
||||||
initWithoutData = () => { }
|
initWithoutData = () => { }
|
||||||
|
|
||||||
constructor(userRepService: UserRepService, @Inject('GROUP_REP_TABLE_COLUMNS') groupRepCols: Array<GuiColumn>, @Inject('GROUP_RIGHT_TABLE_COLUMNS') groupRightColumns: Array<GuiColumn>) {
|
constructor(userRepService: UserRepService) {
|
||||||
this.groupRepCols = groupRepCols;
|
this.groupRepCols = env.columnNames.group.representative;
|
||||||
this.groupRightColumns = groupRightColumns;
|
this.groupRightColumns = env.columnNames.group.right;
|
||||||
this.userRepService = userRepService;
|
this.userRepService = userRepService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,4 +92,17 @@ html {
|
|||||||
|
|
||||||
.bd-mode-toggle .dropdown-menu .active .bi {
|
.bd-mode-toggle .dropdown-menu .active .bi {
|
||||||
display: block !important;
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-icon:hover {
|
||||||
|
animation: rotate 1s ease forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rotate {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -30,6 +30,9 @@
|
|||||||
<!-- Right menu -->
|
<!-- Right menu -->
|
||||||
<div class="navbar-collapse justify-content-end me-5">
|
<div class="navbar-collapse justify-content-end me-5">
|
||||||
<a class="navbar-brand" [routerLink]="['/']">User Manager Portal</a>
|
<a class="navbar-brand" [routerLink]="['/']">User Manager Portal</a>
|
||||||
|
<button class="btn" (click)="refreshService.executeAll()">
|
||||||
|
<mat-icon>sync</mat-icon>
|
||||||
|
</button>
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse"
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse"
|
||||||
aria-label="Toggle navigation" [attr.aria-expanded]="isExpanded" (click)="toggle()">
|
aria-label="Toggle navigation" [attr.aria-expanded]="isExpanded" (click)="toggle()">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ import { LoginComponent } from '../login/login.component';
|
|||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { ColorModeBttnComponent } from '../components/common/color-mode-bttn/color-mode-bttn.component';
|
import { ColorModeBttnComponent } from '../components/common/color-mode-bttn/color-mode-bttn.component';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { RefreshService } from '../services/refresh.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [RouterModule, CommonModule, ColorModeBttnComponent],
|
imports: [RouterModule, CommonModule, ColorModeBttnComponent, MatIconModule],
|
||||||
selector: 'app-nav-menu',
|
selector: 'app-nav-menu',
|
||||||
templateUrl: './nav-menu.component.html',
|
templateUrl: './nav-menu.component.html',
|
||||||
styleUrls: ['./nav-menu.component.css']
|
styleUrls: ['./nav-menu.component.css']
|
||||||
@@ -21,7 +23,7 @@ export class NavMenuComponent {
|
|||||||
}
|
}
|
||||||
isExpanded = false;
|
isExpanded = false;
|
||||||
|
|
||||||
constructor(public dialog: MatDialog, private authService: AuthenticationService) {
|
constructor(public dialog: MatDialog, private authService: AuthenticationService, public refreshService: RefreshService) {
|
||||||
this.authService.isAuthenticated().then().catch()
|
this.authService.isAuthenticated().then().catch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ConfigService } from './config.service';
|
||||||
|
|
||||||
|
describe('ConfigService', () => {
|
||||||
|
let service: ConfigService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(ConfigService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { firstValueFrom } from 'rxjs/internal/firstValueFrom';
|
||||||
|
import { env } from '../../environments/environment';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class ConfigService {
|
||||||
|
constructor(private http: HttpClient) { }
|
||||||
|
|
||||||
|
async getConfig(): Promise<any> {
|
||||||
|
return await firstValueFrom(this.http.get(env.config_url));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { RefreshService } from './refresh.service';
|
||||||
|
|
||||||
|
describe('RefreshService', () => {
|
||||||
|
let service: RefreshService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(RefreshService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class RefreshService {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
private actions: Array<() => void> = [];
|
||||||
|
|
||||||
|
add(action: () => void): void {
|
||||||
|
this.actions.push(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeAll(): void {
|
||||||
|
this.actions = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
executeAll(): void {
|
||||||
|
this.actions.forEach(action => action());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,21 +7,30 @@ import { env } from '../../environments/environment';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UrlService {
|
export class UrlService {
|
||||||
document: Document;
|
|
||||||
meta: Meta;
|
|
||||||
|
|
||||||
constructor() {
|
private loaded:boolean = false;
|
||||||
this.document = inject(DOCUMENT)
|
private base_href: any;
|
||||||
this.meta = inject(Meta)
|
private api_url: any;
|
||||||
}
|
|
||||||
|
constructor(@Inject(DOCUMENT) private document: Document, @Inject(Meta) private meta: Meta) {}
|
||||||
|
|
||||||
|
private lazyLoad(){
|
||||||
|
if(this.loaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.base_href = this.document!.querySelector('base')?.getAttribute('href') || '/';
|
||||||
|
this.api_url = (this.meta!.getTag('name="api-url"')?.content ?? env.default_api_url);
|
||||||
|
this.loaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
getBaseHref(): string {
|
getBaseHref(): string {
|
||||||
const baseElement = this.document.querySelector('base');
|
this.lazyLoad()
|
||||||
return baseElement?.getAttribute('href') || '/';
|
return this.base_href;
|
||||||
}
|
}
|
||||||
|
|
||||||
getApiUrl(route: string = ""): string {
|
getApiUrl(route: string = ""): string {
|
||||||
return env.api_url + route;
|
this.lazyLoad()
|
||||||
|
return this.api_url + route;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly apiRoute = {
|
readonly apiRoute = {
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
import { InjectionToken } from '@angular/core';
|
import { InjectionToken } from '@angular/core';
|
||||||
|
|
||||||
|
export const API_URL = new InjectionToken<string>('API_URL');
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"apiUrl": "/api"
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
@use '@angular/material' as mat;
|
||||||
|
|
||||||
|
@include mat.core();
|
||||||
|
|
||||||
|
$palette: (
|
||||||
|
50: #e8eaf6,
|
||||||
|
100: #c5cae9,
|
||||||
|
200: #9fa8da,
|
||||||
|
300: #7986cb,
|
||||||
|
400: #5c6bc0,
|
||||||
|
500: #3f51b5,
|
||||||
|
600: #3949ab,
|
||||||
|
700: #303f9f,
|
||||||
|
800: #283593,
|
||||||
|
900: #1a237e,
|
||||||
|
A100: #8c9eff,
|
||||||
|
A200: #3143a3,
|
||||||
|
A400: #213083,
|
||||||
|
A700: #10173f,
|
||||||
|
contrast: (
|
||||||
|
50: rgba(black, 0.87),
|
||||||
|
100: rgba(black, 0.87),
|
||||||
|
200: rgba(black, 0.87),
|
||||||
|
300: white,
|
||||||
|
400: white,
|
||||||
|
500: white,
|
||||||
|
600: white,
|
||||||
|
700: white,
|
||||||
|
800: white,
|
||||||
|
900: white,
|
||||||
|
A100: black,
|
||||||
|
A200: black,
|
||||||
|
A400: black,
|
||||||
|
A700: black,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$dark-palette: mat.$amber-palette;
|
||||||
|
$light-palette: mat.$blue-grey-palette;
|
||||||
|
|
||||||
|
$typography: mat.define-typography-config(
|
||||||
|
$font-family: 'Roboto, sans-serif',
|
||||||
|
$headline-1: mat.define-typography-level(32px, 48px, 700),
|
||||||
|
$body-1: mat.define-typography-level(16px, 24px, 400)
|
||||||
|
);
|
||||||
|
|
||||||
|
$dark-primary: mat.define-palette($dark-palette);
|
||||||
|
$dark-accent: mat.define-palette($dark-palette);
|
||||||
|
$dark-warn: mat.define-palette($dark-palette);
|
||||||
|
|
||||||
|
$dark-theme: mat.define-dark-theme((
|
||||||
|
color: (
|
||||||
|
primary: $dark-primary,
|
||||||
|
accent: $dark-accent,
|
||||||
|
warn: $dark-warn,
|
||||||
|
),
|
||||||
|
typography: $typography,
|
||||||
|
density: 0,
|
||||||
|
));
|
||||||
|
|
||||||
|
// Define a light theme
|
||||||
|
$light-primary: mat.define-palette($light-palette);
|
||||||
|
$light-accent: mat.define-palette($light-palette);
|
||||||
|
$light-warn: mat.define-palette($light-palette);
|
||||||
|
|
||||||
|
$light-theme: mat.define-dark-theme((
|
||||||
|
color: (
|
||||||
|
primary: $light-primary,
|
||||||
|
accent: $light-accent,
|
||||||
|
warn: $light-warn,
|
||||||
|
),
|
||||||
|
typography: $typography,
|
||||||
|
density: 0,
|
||||||
|
));
|
||||||
|
|
||||||
|
.mat-color-scheme-light{
|
||||||
|
@include mat.all-component-themes($light-theme);
|
||||||
|
}
|
||||||
|
.mat-color-scheme-dark{
|
||||||
|
@include mat.all-component-themes($dark-theme);
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
export const env = {
|
export const env = {
|
||||||
production: false,
|
production: false,
|
||||||
api_url: "/api",
|
default_api_url: "/api",
|
||||||
routes: {
|
routes: {
|
||||||
user: "/user",
|
user: "/user",
|
||||||
group: "/group",
|
group: "/group",
|
||||||
@@ -115,5 +115,6 @@ export const env = {
|
|||||||
field: (ur: any) => ur.repUser?.username
|
field: (ur: any) => ur.repUser?.username
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
config_url: "/assets/config.json"
|
||||||
};
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
export const env = {
|
export const env = {
|
||||||
production: false,
|
production: false,
|
||||||
api_url: "/api",
|
default_api_url: "/api",
|
||||||
routes: {
|
routes: {
|
||||||
user: "/user",
|
user: "/user",
|
||||||
group: "/group",
|
group: "/group",
|
||||||
@@ -115,5 +115,6 @@ export const env = {
|
|||||||
field: (ur: any) => ur.repUser?.username
|
field: (ur: any) => ur.repUser?.username
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
config_url: "/assets/config.json"
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user