new structure
This commit is contained in:
parent
3a4d3fea18
commit
56cbf7b140
@ -3,7 +3,6 @@
|
|||||||
"",
|
"",
|
||||||
"\\src",
|
"\\src",
|
||||||
"\\src\\app",
|
"\\src\\app",
|
||||||
"\\src\\app\\about",
|
|
||||||
"\\src\\app\\boards"
|
"\\src\\app\\boards"
|
||||||
],
|
],
|
||||||
"PreviewInSolutionExplorer": false
|
"PreviewInSolutionExplorer": false
|
||||||
|
BIN
.vs/slnx.sqlite
BIN
.vs/slnx.sqlite
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
// двач лучший двач
|
// двач лучший двач
|
||||||
import { ApiChatService } from '../api-chat.service';
|
import { ApiChatService } from '../services/api-chat.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-about',
|
selector: 'app-about',
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
import { Injectable } from '@angular/core';
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class ApiChatService {
|
|
||||||
|
|
||||||
}
|
|
@ -8,9 +8,10 @@ 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 './boards/boards.component';
|
||||||
import { NotFoundComponent } from './not-found/not-found.component';
|
import { NotFoundComponent } from './not-found/not-found.component';
|
||||||
import { ApiChatService } from './api-chat.service';
|
import { ApiChatService } from './services/api-chat.service';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { SendPostComponent } from './boards/send-post/send-post.component';
|
import { SendPostComponent } from './boards/send-post/send-post.component';
|
||||||
|
import { PostComponent } from './boards/post/post.component'
|
||||||
|
|
||||||
const appRoutes: Routes = [
|
const appRoutes: Routes = [
|
||||||
{ path: '', component: HomeComponent },
|
{ path: '', component: HomeComponent },
|
||||||
@ -26,7 +27,8 @@ const appRoutes: Routes = [
|
|||||||
AboutComponent,
|
AboutComponent,
|
||||||
BoardsComponent,
|
BoardsComponent,
|
||||||
NotFoundComponent,
|
NotFoundComponent,
|
||||||
SendPostComponent
|
SendPostComponent,
|
||||||
|
PostComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
@ -1,23 +1,18 @@
|
|||||||
<div class="wrappe">
|
<div class="wrappe">
|
||||||
<img src="http://static.vdk2ch.ru:15555/test-public/16657431265390.png" alt="свiня" width="150">
|
<img src="http://static.vdk2ch.ru:15555/test-public/16657431265390.png" alt="свiня" width="150">
|
||||||
<app-send-post></app-send-post>,
|
<app-send-post></app-send-post>,
|
||||||
|
<button (click)="refreshPosts()">Обновить</button>
|
||||||
|
<post-single
|
||||||
|
*ngFor="let post of postsToShow" [post]="post"
|
||||||
|
></post-single>
|
||||||
|
<p></p>
|
||||||
|
<button (click)="refreshPosts()">Обновить</button>
|
||||||
|
|
||||||
<button (click)="listPosts()">Обновить</button>
|
|
||||||
<div *ngIf="response">
|
|
||||||
<div class="singlePost" *ngFor="let post of response">
|
|
||||||
<a href="#{{post.Id}}"></a>
|
|
||||||
<img src="http://static.vdk2ch.ru:15555/test-public/оладий.jpg" alt="anonpls" width="140">
|
|
||||||
<p> >>{{post.Id}} {{post.Date}}</p>
|
|
||||||
<p>{{post.Text}}</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<br>
|
<br>
|
||||||
<div class="hexagon">
|
<div class="hexagon">
|
||||||
<div class="hexagon-inside">
|
<div class="hexagon-inside">
|
||||||
<div class="hexagon-image">
|
<div class="hexagon-image">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -1,6 +1,8 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { ApiChatService } from '../api-chat.service';
|
import { ApiChatService } from '../services/api-chat.service';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { SinglePost } from '../models/post'
|
||||||
|
import { receivedPosts } from '../data/ResponseTemplate'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-boards',
|
selector: 'app-boards',
|
||||||
@ -10,24 +12,24 @@ import { HttpClient } from '@angular/common/http';
|
|||||||
export class BoardsComponent implements OnInit {
|
export class BoardsComponent implements OnInit {
|
||||||
command: string = "";
|
command: string = "";
|
||||||
response: any;
|
response: any;
|
||||||
|
postsToShow: SinglePost[] = [] //products: Iproduct[] = data
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
constructor(public apiChatService: ApiChatService) {
|
||||||
console.log("Boards opened");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listPosts() {
|
refreshPosts() {
|
||||||
console.log("Получаю данные...");
|
this.apiChatService.getPosts().subscribe(response => {
|
||||||
this.http.get('http://api.vdk2ch.ru:5000/List')
|
this.postsToShow = response
|
||||||
.subscribe((response)=> {
|
})
|
||||||
this.response = response;
|
|
||||||
console.log(this.response);
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.listPosts();
|
this.apiChatService.getPosts().subscribe(response => {
|
||||||
|
this.postsToShow = response
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
src/app/boards/post/post.component.css
Normal file
10
src/app/boards/post/post.component.css
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
.post {
|
||||||
|
border-width: 1;
|
||||||
|
border-color: rgb(190,190,190);
|
||||||
|
border-style: solid;
|
||||||
|
background-color: #F0D0B6;
|
||||||
|
border-radius: 5px;
|
||||||
|
width: 500px;
|
||||||
|
word-break: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
5
src/app/boards/post/post.component.html
Normal file
5
src/app/boards/post/post.component.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<div class="post">
|
||||||
|
<img src="http://static.vdk2ch.ru:15555/test-public/оладий.jpg" alt="anonpls" width="140"> # {{post.Id}}
|
||||||
|
<h3>{{post.Date}}</h3>
|
||||||
|
<h2>{{post.Text}}</h2>
|
||||||
|
</div>
|
19
src/app/boards/post/post.component.ts
Normal file
19
src/app/boards/post/post.component.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
|
import { SinglePost } from '../../models/post';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'post-single',
|
||||||
|
templateUrl: './post.component.html',
|
||||||
|
styleUrls: [`./post.component.css`]
|
||||||
|
})
|
||||||
|
export class PostComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
|
@Input() post: SinglePost
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { ApiChatService } from '../../services/api-chat.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-send-post',
|
selector: 'app-send-post',
|
||||||
@ -8,23 +9,12 @@ import { HttpClient } from '@angular/common/http';
|
|||||||
})
|
})
|
||||||
export class SendPostComponent implements OnInit {
|
export class SendPostComponent implements OnInit {
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
constructor(public apiChatService: ApiChatService) {
|
||||||
console.log("Открыто окно постинга");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sendPost(text: string) {
|
sendPost(text: string) {
|
||||||
console.log("Отправляю пост...");
|
console.log("Отправляю пост...");
|
||||||
var postToSend =
|
this.apiChatService.sendPostToApi(text).subscribe();
|
||||||
{
|
|
||||||
Date: Date,
|
|
||||||
Id: 0,
|
|
||||||
Text: text
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.http.post('http://api.vdk2ch.ru:5000/PostTo', postToSend).subscribe();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
189
src/app/data/ResponseTemplate.ts
Normal file
189
src/app/data/ResponseTemplate.ts
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
import { SinglePost } from '../models/post'
|
||||||
|
|
||||||
|
export const receivedPosts: SinglePost[] = [
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3742479+00:00",
|
||||||
|
"Id": 1,
|
||||||
|
"Text": "moi post"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3742571+00:00",
|
||||||
|
"Id": 2,
|
||||||
|
"Text": " post #2 "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3742581+00:00",
|
||||||
|
"Id": 3,
|
||||||
|
"Text": "dvach live2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3742589+00:00",
|
||||||
|
"Id": 4,
|
||||||
|
"Text": "again"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3742597+00:00",
|
||||||
|
"Id": 5,
|
||||||
|
"Text": "PRIVET DVACH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3742615+00:00",
|
||||||
|
"Id": 6,
|
||||||
|
"Text": "Привет двач"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3742628+00:00",
|
||||||
|
"Id": 7,
|
||||||
|
"Text": "Введено через консольку напрямую."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754268+00:00",
|
||||||
|
"Id": 8,
|
||||||
|
"Text": " А я люблю обмазываться не свежим говном и дрочить. Каждый день я хожу по земле с черным мешком для мусора и собераю в него все говно которое вижу. На два полных мешка целый день уходит. Зато, когда после тяжёлого дня я прихожу домой, иду в ванну, включаю горячую воду...ммм и сваливаю в нее свое сокровище. И дрочу, представляя, что меня поглотил единый организм говно. Мне вообще кажется, что какашки, умеют думать, у них есть свои семьи, города, чувства, не смывайте их в унитаз, лучше приютите у себя, говорите с ними, ласкайте их.... А вчера в ванной, мне преснился чудный сон, как будто я нырнул в море, и оно прератилось в говно, рыбы, водоросли, медузы, все из говна, даже небо, даже Аллах.\n\nприслал: вован кротов "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754479+00:00",
|
||||||
|
"Id": 13,
|
||||||
|
"Text": "ДЕФОЛТНОЕ ЗНАЧЕНИЕ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754511+00:00",
|
||||||
|
"Id": 14,
|
||||||
|
"Text": "ЩИТПОСТИНГ ТАЙМ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754524+00:00",
|
||||||
|
"Id": 15,
|
||||||
|
"Text": "САП БЭ Я ТЯН"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754536+00:00",
|
||||||
|
"Id": 16,
|
||||||
|
"Text": "ПРУФОВ НЕ БУДЕТ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754548+00:00",
|
||||||
|
"Id": 17,
|
||||||
|
"Text": "ЭКЗЕШНИК ЗАПИЛИЛ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754559+00:00",
|
||||||
|
"Id": 18,
|
||||||
|
"Text": "Пробую выводить значения в другом порядке, немного допилил консольный интерфейс."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754578+00:00",
|
||||||
|
"Id": 19,
|
||||||
|
"Text": "Subquery added and worked!"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.375459+00:00",
|
||||||
|
"Id": 20,
|
||||||
|
"Text": "А теперь в браузере!"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754607+00:00",
|
||||||
|
"Id": 21,
|
||||||
|
"Text": "Проверяю"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754622+00:00",
|
||||||
|
"Id": 22,
|
||||||
|
"Text": "test from linus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754636+00:00",
|
||||||
|
"Id": 23,
|
||||||
|
"Text": "Postman"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754648+00:00",
|
||||||
|
"Id": 25,
|
||||||
|
"Text": "Checked to server"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.375466+00:00",
|
||||||
|
"Id": 29,
|
||||||
|
"Text": "Чекаю борду"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754675+00:00",
|
||||||
|
"Id": 30,
|
||||||
|
"Text": "Опять прон налили"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.375469+00:00",
|
||||||
|
"Id": 31,
|
||||||
|
"Text": "Проверка связи"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754704+00:00",
|
||||||
|
"Id": 32,
|
||||||
|
"Text": "Алё, это телефон АТС?"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.375472+00:00",
|
||||||
|
"Id": 33,
|
||||||
|
"Text": "Ах ты сука спидовый!"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754736+00:00",
|
||||||
|
"Id": 38,
|
||||||
|
"Text": "Печатать сюда"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.375475+00:00",
|
||||||
|
"Id": 39,
|
||||||
|
"Text": "Или не печатать сюда."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754765+00:00",
|
||||||
|
"Id": 40,
|
||||||
|
"Text": "это мой первый пост через интернет"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3754785+00:00",
|
||||||
|
"Id": 41,
|
||||||
|
"Text": "Ну ка бля"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.37548+00:00",
|
||||||
|
"Id": 42,
|
||||||
|
"Text": "Ого"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3757265+00:00",
|
||||||
|
"Id": 43,
|
||||||
|
"Text": "Ого"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3757291+00:00",
|
||||||
|
"Id": 44,
|
||||||
|
"Text": "Чё то тиха бля"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3757303+00:00",
|
||||||
|
"Id": 45,
|
||||||
|
"Text": "Печатать сюда"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.375732+00:00",
|
||||||
|
"Id": 46,
|
||||||
|
"Text": "ВСЕМ ПРИВЕТ, Я ФОКУСНИК!"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3757334+00:00",
|
||||||
|
"Id": 47,
|
||||||
|
"Text": "Как пропатчить инпуты под KDE?"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3757353+00:00",
|
||||||
|
"Id": 48,
|
||||||
|
"Text": "Печатать. Я не должен это руками стирать "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Date": "2022-10-22T02:53:17.3757373+00:00",
|
||||||
|
"Id": 51,
|
||||||
|
"Text": "пишу с телефона "
|
||||||
|
}
|
||||||
|
]
|
@ -1,5 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ApiChatService } from '../api-chat.service';
|
import { ApiChatService } from '../services/api-chat.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-home',
|
selector: 'app-home',
|
||||||
|
6
src/app/models/post.ts
Normal file
6
src/app/models/post.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export interface SinglePost {
|
||||||
|
Date: string
|
||||||
|
Id: number
|
||||||
|
Text: string
|
||||||
|
|
||||||
|
}
|
@ -1 +1 @@
|
|||||||
<p>not-found works!</p>
|
<p>Страничка не найдена. Попробуйте внимательнее.</p>
|
||||||
|
@ -2,7 +2,8 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-not-found',
|
selector: 'app-not-found',
|
||||||
template: `<h3>Страница не найдена.<h3>`
|
templateUrl: './not-found.component.html',
|
||||||
|
styleUrls: ['./not-found.component.css']
|
||||||
})
|
})
|
||||||
export class NotFoundComponent implements OnInit {
|
export class NotFoundComponent implements OnInit {
|
||||||
|
|
||||||
|
28
src/app/services/api-chat.service.ts
Normal file
28
src/app/services/api-chat.service.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { SinglePost } from '../models/post';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class ApiChatService {
|
||||||
|
constructor(private http: HttpClient) {
|
||||||
|
}
|
||||||
|
|
||||||
|
getPosts(): Observable<SinglePost[]> {
|
||||||
|
console.log("Получаю данные из сервиса");
|
||||||
|
return this.http.get<SinglePost[]>('http://localhost:7141/List');
|
||||||
|
}
|
||||||
|
|
||||||
|
sendPostToApi(text: string) {
|
||||||
|
console.log("Отправляю пост...");
|
||||||
|
var postToSend =
|
||||||
|
{
|
||||||
|
Date: Date,
|
||||||
|
Id: 0,
|
||||||
|
Text: text
|
||||||
|
}
|
||||||
|
return this.http.post('http://localhost:7141/PostTo', postToSend)
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,7 @@
|
|||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitOverride": true,
|
"noImplicitOverride": true,
|
||||||
"noPropertyAccessFromIndexSignature": true,
|
"noPropertyAccessFromIndexSignature": false,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
@ -21,7 +21,8 @@
|
|||||||
"lib": [
|
"lib": [
|
||||||
"es2020",
|
"es2020",
|
||||||
"dom"
|
"dom"
|
||||||
]
|
],
|
||||||
|
"strictPropertyInitialization" : false
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"enableI18nLegacyMessageIdFormat": false,
|
"enableI18nLegacyMessageIdFormat": false,
|
||||||
|
Reference in New Issue
Block a user