@ -0,0 +1,57 @@ |
|||||
|
import { Component, OnInit } from '@angular/core'; |
||||
|
import {Router} from "@angular/router"; |
||||
|
import {AuthService} from "../../services/auth.service"; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-admin-main-page', |
||||
|
styleUrls: ['./admin-main-page.component.scss'], |
||||
|
template: ` |
||||
|
<!--тут меню кнопочки всякая хуйня--> |
||||
|
<div |
||||
|
class="content-in-center-header"> |
||||
|
<div class="main-content-in-header"> |
||||
|
<!--кнопочки страниц--> |
||||
|
<!--<mat-toolbar style="background: unset !important; margin-bottom: 2%"> |
||||
|
<button *ngFor="let b of go2urls" mat-icon-button style="color: #fbf1d7; margin: 0 1%;" class="spacer" (click)="go2url(b.url)"> |
||||
|
<mat-icon>{{b.ico}}</mat-icon> |
||||
|
<br> |
||||
|
<p style="margin: 0 0; line-height: 10px">{{b.name}}</p> |
||||
|
</button> |
||||
|
</mat-toolbar>--> |
||||
|
<div style="display: flex; justify-content: space-between;background: unset !important; margin-bottom: 3%; margin-top: 1%" > |
||||
|
<button *ngFor="let b of go2urls" mat-icon-button style="color: #fbf1d7; display: flex;justify-content: center;align-items: center;flex-wrap: wrap;" (click)="go2url(b.url)"> |
||||
|
<mat-icon>{{b.ico}}</mat-icon> |
||||
|
<br> |
||||
|
<p style="margin: 0 0; line-height: 10px">{{b.name}}</p> |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="content-in-center"> |
||||
|
<div class="content-in-border"> |
||||
|
<h1 style="color: black">ПРИВЕТ ПЕЛЬМЕНЬ, ЕСЛИ ТЫ ЭТО ЧИТАЕШЬ ЛУЧШЕ ВЫЙДИ С ЭТОЙ СТРАНИЦЫ ТУТ МНОГО НЕПОНЯТНЫХ ДЛЯ ТЕБЯ КНОПОЧЕК</h1> |
||||
|
</div> |
||||
|
</div> |
||||
|
` |
||||
|
}) |
||||
|
export class AdminMainPageComponent implements OnInit { |
||||
|
|
||||
|
go2urls: {ico: string, name: string, url: string}[] = [ |
||||
|
{ico: 'business', name: 'Файлы', url: 'admin/files'} |
||||
|
] |
||||
|
|
||||
|
constructor(private router: Router, |
||||
|
public authService: AuthService) { } |
||||
|
|
||||
|
ngOnInit(): void { |
||||
|
if (!this.authService.isAdmin()) { |
||||
|
this.router.navigate(['putisRun']) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
go2url(url:string) { |
||||
|
this.router.navigate([url]) |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
import {Component} from "@angular/core"; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-files-search-table', |
||||
|
template: ` |
||||
|
` |
||||
|
}) |
||||
|
export class FilesSearchTable { |
||||
|
|
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
import {Component} from "@angular/core"; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-files-uploader', |
||||
|
template: ` |
||||
|
` |
||||
|
}) |
||||
|
export class FilesUploader { |
||||
|
|
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
import { Component, OnInit } from '@angular/core'; |
||||
|
import {Router} from "@angular/router"; |
||||
|
import {AuthService} from "../../services/auth.service"; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-files-page', |
||||
|
styleUrls: ['./files-page.component.scss'], |
||||
|
template: ` |
||||
|
<div class="content-in-center-header" style="flex-direction: column;"> |
||||
|
<h1>Прикольные файлы которые можно получить через API</h1> |
||||
|
<h3>Лучше этим говном даже не пользоваться, опасно шо пиздец, ты понял меня пельмень??</h3> |
||||
|
</div> |
||||
|
|
||||
|
<div class="content-in-center"> |
||||
|
<div class="content-in-border"> |
||||
|
<app-files-uploader></app-files-uploader> |
||||
|
</div> |
||||
|
<div class="content-in-border"> |
||||
|
<app-files-search-table></app-files-search-table> |
||||
|
</div> |
||||
|
</div> |
||||
|
` |
||||
|
}) |
||||
|
export class FilesPageComponent implements OnInit { |
||||
|
|
||||
|
constructor(private router: Router, |
||||
|
public authService: AuthService) { } |
||||
|
|
||||
|
ngOnInit(): void { |
||||
|
if (!this.authService.isAdmin()) { |
||||
|
this.router.navigate(['putisRun']) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
export class DbFile { |
||||
|
id!:string; |
||||
|
uploader!:string; |
||||
|
filename!:string; |
||||
|
filesize!:number; |
||||
|
extraInfo!:string; |
||||
|
timestamp!:Date; |
||||
|
deleted!:boolean; |
||||
|
tags!:string; |
||||
|
|
||||
|
static fromData(data:any): DbFile { |
||||
|
let f = new DbFile(); |
||||
|
Object.assign(f, data); |
||||
|
return f; |
||||
|
} |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
import { Injectable } from '@angular/core'; |
||||
|
import {HttpClient} from "@angular/common/http"; |
||||
|
import {SearchFilter} from "../entities/search/SearchFilter"; |
||||
|
import {MatPaginator} from "@angular/material/paginator"; |
||||
|
import {map, Observable} from "rxjs"; |
||||
|
import {PagingAndSortingPaginator} from "../entities/PagingAndSortingPaginator"; |
||||
|
import {DbFile} from "../entities/DbFile"; |
||||
|
|
||||
|
@Injectable({ |
||||
|
providedIn: 'root' |
||||
|
}) |
||||
|
export class FileService { |
||||
|
|
||||
|
constructor(private http: HttpClient) { } |
||||
|
|
||||
|
getFiles(filters: SearchFilter, paginator: MatPaginator | undefined) { |
||||
|
return this.http.post(`api/file/search`, filters, |
||||
|
{params: {size: paginator?paginator.pageSize:20, page: paginator?paginator.pageIndex:0}}).pipe( |
||||
|
map((res) => PagingAndSortingPaginator<DbFile>.newObj().fromData(res).updatePaginator(paginator)) |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
getFile(uuid: string): Observable<DbFile> { |
||||
|
return this.http.get(`api/file/edit/${uuid}`).pipe( |
||||
|
map((res) => DbFile.fromData(res)) |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
editFile(file: DbFile) { |
||||
|
return this.http.post(`api/file/edit`, file); |
||||
|
} |
||||
|
|
||||
|
uploadFile(file: File): Observable<string> { |
||||
|
const formData = new FormData(); |
||||
|
formData.append('file', file, file.name); |
||||
|
return this.http.post(`api/file`, formData).pipe( |
||||
|
map((res) => `${res}`) |
||||
|
) |
||||
|
} |
||||
|
} |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 8.5 KiB |
@ -0,0 +1,16 @@ |
|||||
|
If you want to change the color dynamically: |
||||
|
|
||||
|
Open the SVG in a code editor |
||||
|
|
||||
|
Add or rewrite the attribute of fill of every path to fill="currentColor" |
||||
|
|
||||
|
Now, that svg will take the color of your font color, so you can do something like: |
||||
|
|
||||
|
svg { |
||||
|
color : "red"; |
||||
|
} |
||||
|
Note: this will only work if the SVG is inlined in HTML. |
||||
|
|
||||
|
BLU #5885a2 |
||||
|
RED #b8383b |
||||
|
UNK #b0b0b0 |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 25 KiB |