Added threads listing.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
592509f337
commit
28e0cfb239
12
src/app/BoardThreads/op/op.component.css
Normal file
12
src/app/BoardThreads/op/op.component.css
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
.op {
|
||||||
|
border-width: 1px;
|
||||||
|
border-color: rgb(190,190,190);
|
||||||
|
border-style: solid;
|
||||||
|
background-color: #F0D0B6;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding:20px;
|
||||||
|
width: 500px;
|
||||||
|
word-break: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
10
src/app/BoardThreads/op/op.component.html
Normal file
10
src/app/BoardThreads/op/op.component.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<div class="op">
|
||||||
|
<h4>Тред номер {{op.Thread_Id}}</h4>
|
||||||
|
<p> # {{op.Id}} {{op.Timestamp}}</p>
|
||||||
|
<div>
|
||||||
|
<a *ngFor="let i of op.ImgURL" [href]="i" target="_blank">
|
||||||
|
<img [src]="i" style="height:140px">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<p>{{op.Text}}</p>
|
||||||
|
</div>
|
23
src/app/BoardThreads/op/op.component.spec.ts
Normal file
23
src/app/BoardThreads/op/op.component.spec.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { OPComponent } from './op.component';
|
||||||
|
|
||||||
|
describe('OPComponent', () => {
|
||||||
|
let component: OPComponent;
|
||||||
|
let fixture: ComponentFixture<OPComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ OPComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(OPComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
18
src/app/BoardThreads/op/op.component.ts
Normal file
18
src/app/BoardThreads/op/op.component.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
|
import { SinglePost } from '../../models/post';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'op-single',
|
||||||
|
templateUrl: './op.component.html',
|
||||||
|
styleUrls: ['./op.component.css']
|
||||||
|
})
|
||||||
|
export class OPComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
@Input() op: SinglePost
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
0
src/app/BoardThreads/threads.component.css
Normal file
0
src/app/BoardThreads/threads.component.css
Normal file
12
src/app/BoardThreads/threads.component.html
Normal file
12
src/app/BoardThreads/threads.component.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<h2>Вы находитесь на доске {{boardName}} </h2>
|
||||||
|
<a (click)="showGuide = !showGuide" style=" font-size: small; color: chocolate; width: 500px;"> Что это и как это работает?</a>
|
||||||
|
<br>
|
||||||
|
<div *ngIf="showGuide">
|
||||||
|
Добро пожаловать в список доступных тредов. Выберите подходящий для вас тред, затем введите его номер во вкладке "Тред" выше и нажмите "обновить" чтобы перейти в этот тред.
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<button (click)="refreshOPs(boardName)">Обновить</button>
|
||||||
|
<op-single
|
||||||
|
*ngFor="let ops of opsToShow" [op]="ops"
|
||||||
|
></op-single>
|
||||||
|
<button (click)="refreshOPs(boardName)">Обновить</button>
|
23
src/app/BoardThreads/threads.component.spec.ts
Normal file
23
src/app/BoardThreads/threads.component.spec.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ThreadsComponent } from './threads.component';
|
||||||
|
|
||||||
|
describe('ThreadsComponent', () => {
|
||||||
|
let component: ThreadsComponent;
|
||||||
|
let fixture: ComponentFixture<ThreadsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ ThreadsComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ThreadsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
35
src/app/BoardThreads/threads.component.ts
Normal file
35
src/app/BoardThreads/threads.component.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import * as vars from "../var/api";
|
||||||
|
import {SinglePost} from "../models/post";
|
||||||
|
import {ApiChatService} from "../services/api-chat.service";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-BoardThreads',
|
||||||
|
templateUrl: './threads.component.html',
|
||||||
|
styleUrls: ['./threads.component.css']
|
||||||
|
})
|
||||||
|
export class ThreadsComponent implements OnInit {
|
||||||
|
|
||||||
|
boardName:string = 'b'
|
||||||
|
command: string = "";
|
||||||
|
response: any;
|
||||||
|
opsToShow: SinglePost[] = []
|
||||||
|
displayed_thread_number = vars.displayed_thread;
|
||||||
|
showGuide: boolean = false;
|
||||||
|
|
||||||
|
constructor(public apiChatService: ApiChatService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshOPs(boardName: string) {
|
||||||
|
this.apiChatService.getThreads(boardName).subscribe(response => {
|
||||||
|
this.opsToShow = response
|
||||||
|
vars.setDisplayedThread(this.displayed_thread_number);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.apiChatService.getThreads(this.boardName).subscribe(response => {
|
||||||
|
this.opsToShow = response
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@ import { SinglePost } from '../models/post'
|
|||||||
import * as vars from '../var/api'
|
import * as vars from '../var/api'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-boards',
|
selector: 'app-SingleThread',
|
||||||
templateUrl: `./boards.component.html`,
|
templateUrl: `./boards.component.html`,
|
||||||
styleUrls: [`./boards.component.css`]
|
styleUrls: [`./boards.component.css`]
|
||||||
})
|
})
|
@ -5,9 +5,10 @@ import { Component } from '@angular/core';
|
|||||||
template: `<div>
|
template: `<div>
|
||||||
<h1>Welcome, traveler.</h1>
|
<h1>Welcome, traveler.</h1>
|
||||||
<nav>
|
<nav>
|
||||||
<a routerLink = "">Главная </a>
|
<a routerLink = "">Главная </a>
|
||||||
<a routerLink = "about">О нас </a>
|
<a routerLink = "about">О нас </a>
|
||||||
<a routerLink = "boards">Борда </a>
|
<a routerLink = "board">Тред </a>
|
||||||
|
<a routerLink = "threads">Борда </a>
|
||||||
</nav>
|
</nav>
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
</div>`
|
</div>`
|
||||||
|
@ -7,19 +7,21 @@ import { HttpClientModule } from '@angular/common/http';
|
|||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { HomeComponent } from './home/home.component';
|
import { HomeComponent } from './home/home.component';
|
||||||
import { AboutComponent } from './about/about.component';
|
import { AboutComponent } from './about/about.component';
|
||||||
import { BoardsComponent } from './boards/boards.component';
|
import { BoardsComponent } from './SingleThread/boards.component';
|
||||||
import { NotFoundComponent } from './not-found/not-found.component';
|
import { NotFoundComponent } from './not-found/not-found.component';
|
||||||
import { ApiChatService } from './services/api-chat.service';
|
import { ApiChatService } from './services/api-chat.service';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { SendPostComponent } from './send-post/send-post.component';
|
import { SendPostComponent } from './send-post/send-post.component';
|
||||||
import { PostComponent } from './boards/post/post.component'
|
import { PostComponent } from './SingleThread/post/post.component'
|
||||||
import { MinIoService } from "./services/min-io.service.";
|
import { ThreadsComponent } from './BoardThreads/threads.component';
|
||||||
|
import { OPComponent } from './BoardThreads/op/op.component';
|
||||||
|
|
||||||
const appRoutes: Routes = [
|
const appRoutes: Routes = [
|
||||||
{ path: '', component: HomeComponent },
|
{ path: '', component: HomeComponent },
|
||||||
{ path: 'boards', component: BoardsComponent },
|
{ path: 'threads', component: ThreadsComponent},
|
||||||
|
{ path: 'board', component: BoardsComponent },
|
||||||
{ path: 'about', component: AboutComponent },
|
{ path: 'about', component: AboutComponent },
|
||||||
{ path: '**', component: NotFoundComponent },
|
{ path: '**', component: NotFoundComponent }
|
||||||
]
|
]
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@ -30,7 +32,9 @@ const appRoutes: Routes = [
|
|||||||
BoardsComponent,
|
BoardsComponent,
|
||||||
NotFoundComponent,
|
NotFoundComponent,
|
||||||
PostComponent,
|
PostComponent,
|
||||||
SendPostComponent
|
SendPostComponent,
|
||||||
|
ThreadsComponent,
|
||||||
|
OPComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
@ -39,8 +43,7 @@ const appRoutes: Routes = [
|
|||||||
FormsModule
|
FormsModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
ApiChatService,
|
ApiChatService
|
||||||
MinIoService
|
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||||
import { ApiChatService } from '../services/api-chat.service';
|
import { ApiChatService } from '../services/api-chat.service';
|
||||||
import { MinIoService } from '../services/min-io.service.'
|
|
||||||
import {IPicresponse} from "../models/picResponse";
|
|
||||||
import * as vars from "../var/api";
|
import * as vars from "../var/api";
|
||||||
|
|
||||||
|
|
||||||
@ -17,8 +15,7 @@ export class SendPostComponent implements OnInit {
|
|||||||
filename: string[] = [];
|
filename: string[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public apiChatService: ApiChatService,
|
public apiChatService: ApiChatService
|
||||||
public minIoService: MinIoService,
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,5 +36,10 @@ export class ApiChatService {
|
|||||||
return this.http.post(globals.api_endpoint +'UploadPic', PostPicture)
|
return this.http.post(globals.api_endpoint +'UploadPic', PostPicture)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getThreads(boardName:string): Observable<SinglePost[]> {
|
||||||
|
//console.log("Получаю посты и картинки");
|
||||||
|
return this.http.get<SinglePost[]>(globals.api_endpoint +'Threads/', {params:{board: boardName}}) ;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { HttpClient } from "@angular/common/http";
|
|
||||||
import * as Minio from 'minio';
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class MinIoService {
|
|
||||||
picToSend = null;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//SendPicture(event: any): void {
|
|
||||||
//console.log(event.target.files[0].name);
|
|
||||||
//console.log('Отправляю картинку сервисом...');
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
import { TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { MinIoService } from './min-io.service.';
|
|
||||||
|
|
||||||
describe('MinIoServiceService', () => {
|
|
||||||
let service: MinIoService;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({});
|
|
||||||
service = TestBed.inject(MinIoService);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(service).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
Reference in New Issue
Block a user