This commit is contained in:
RakVhalate 2022-12-29 00:18:09 +05:00
parent c32dc357cf
commit 35173d9905
21 changed files with 58 additions and 81 deletions

View File

@ -1 +0,0 @@
<p>consul works!</p>

View File

@ -1,10 +0,0 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-consul',
templateUrl: './consul.component.html',
styleUrls: ['./consul.component.scss']
})
export class ConsulComponent {
}

View File

@ -1,3 +0,0 @@
import { IConsulObject } from "./JsonObject"
export var SampleResponse = '{"consul-server":{"ID":"Wfrning!","Service":"Dummy-Response ","Tags":["infra","vdk2ch","consul-server","ssl"],"Meta":{},"Port":8500,"Address":"consul.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"drone-server":{"ID":"drone-server","Service":"drone-server","Tags":["infra","vdk2ch","drone-server","ssl"],"Meta":{},"Port":38080,"Address":"drone.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"dvach-back-api":{"ID":"dvach-back-api","Service":"dvach-back-api","Tags":["board","vdk2ch","back-api","api","ssl"],"Meta":{},"Port":5000,"Address":"api.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"dvach-front-angular":{"ID":"dvach-front-angular","Service":"dvach-front-angular","Tags":["board","vdk2ch","angular","front","ssl"],"Meta":{},"Port":4200,"Address":"board.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"gitea":{"ID":"gitea","Service":"gitea","Tags":["infra","vdk2ch","git","ssl"],"Meta":{},"Port":3000,"Address":"git.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"graylog":{"ID":"graylog","Service":"graylog","Tags":["infra","vdk2ch","graylog","ssl"],"Meta":{},"Port":9000,"Address":"graylog.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"minio-api":{"ID":"minio-api","Service":"minio-api","Tags":["infra","vdk2ch","minio-api","static","ssl"],"Meta":{},"Port":15555,"Address":"static.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"minio-consule":{"ID":"minio-consule","Service":"minio-console","Tags":["infra","vdk2ch","minio-consol","ssl"],"Meta":{},"Port":15556,"Address":"minio.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"}}'

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MainPageComponent } from './main-page.component';
describe('MainPageComponent', () => {
let component: MainPageComponent;
let fixture: ComponentFixture<MainPageComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ MainPageComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(MainPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SingleObjcetComponent } from './single-objcet.component';
describe('SingleObjcetComponent', () => {
let component: SingleObjcetComponent;
let fixture: ComponentFixture<SingleObjcetComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ SingleObjcetComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(SingleObjcetComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,9 +1,11 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { MainPageComponent } from './Pages/main-page/main-page.component';
import { AboutComponent } from './pages/about/about.component';
import { MainPageComponent } from './pages/main-page/main-page.component';
const routes: Routes = [
{ path: 'benis', component: MainPageComponent },
{ path: 'about', component: AboutComponent}
];
@NgModule({

View File

@ -1,6 +1,7 @@
<nav>
<ul>
<li><a routerLink="/benis" routerLinkActive="active" ariaCurrentWhenActive="page">Отобразить жсон</a></li>
<li><a routerLink="/about" routerLinkActive="active" ariaCurrentWhenActive="page">О нас</a></li>
</ul>
</nav>
<router-outlet></router-outlet>

View File

@ -4,14 +4,16 @@ import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { MainPageComponent } from './Pages/main-page/main-page.component';
import { SingleObjcetComponent } from './Pages/single-object/single-objcet.component';
import { MainPageComponent } from './pages/main-page/main-page.component';
import { SingleObjcetComponent } from './pages/main-page/single-object/single-objcet.component';
import { AboutComponent } from './pages/about/about.component';
@NgModule({
declarations: [
AppComponent,
MainPageComponent,
SingleObjcetComponent
SingleObjcetComponent,
AboutComponent
],
imports: [
BrowserModule,

View File

@ -0,0 +1,3 @@
import { IConsulObject } from "./JsonObject"
export const SampleResponse = '{"consul-server":{"ID":"Wfrning!","Service":"Dummy-Response ","Tags":["infra","vdk2ch","consul-server","ssl"],"Meta":{},"Port":8500,"Address":"consul.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"drone-server":{"ID":"drone-server","Service":"drone-server","Tags":["infra","vdk2ch","drone-server","ssl"],"Meta":{},"Port":38080,"Address":"drone.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"dvach-back-api":{"ID":"dvach-back-api","Service":"dvach-back-api","Tags":["board","vdk2ch","back-api","api","ssl"],"Meta":{},"Port":5000,"Address":"api.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"dvach-front-angular":{"ID":"dvach-front-angular","Service":"dvach-front-angular","Tags":["board","vdk2ch","angular","front","ssl"],"Meta":{},"Port":4200,"Address":"board.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"gitea":{"ID":"gitea","Service":"gitea","Tags":["infra","vdk2ch","git","ssl"],"Meta":{},"Port":3000,"Address":"git.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"graylog":{"ID":"graylog","Service":"graylog","Tags":["infra","vdk2ch","graylog","ssl"],"Meta":{},"Port":9000,"Address":"graylog.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"minio-api":{"ID":"minio-api","Service":"minio-api","Tags":["infra","vdk2ch","minio-api","static","ssl"],"Meta":{},"Port":15555,"Address":"static.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"},"minio-consule":{"ID":"minio-consule","Service":"minio-console","Tags":["infra","vdk2ch","minio-consol","ssl"],"Meta":{},"Port":15556,"Address":"minio.vdk2ch.ru","Weights":{"Passing":1,"Warning":1},"EnableTagOverride":false,"Datacenter":"vdk2ch"}}'

View File

@ -0,0 +1,2 @@
<p>Написано на больную, температурящую голову, отшкребая сопли от клавиатуры и задаваясь вопросом "когда же выздоровление?"</p>
<p>Рак, 29 декабря 2022</p>

View File

@ -1,18 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ConsulComponent } from './consul.component';
import { AboutComponent } from './about.component';
describe('ConsulComponent', () => {
let component: ConsulComponent;
let fixture: ComponentFixture<ConsulComponent>;
describe('AboutComponent', () => {
let component: AboutComponent;
let fixture: ComponentFixture<AboutComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ConsulComponent ]
declarations: [ AboutComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(ConsulComponent);
fixture = TestBed.createComponent(AboutComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-about',
templateUrl: './about.component.html',
styleUrls: ['./about.component.scss']
})
export class AboutComponent {
}

View File

@ -1,7 +1,7 @@
import { Component } from '@angular/core';
import { IConsulObject } from 'src/app/Models/JsonObject';
import { HttpClient } from '@angular/common/http'
import * as DummyResponse from '../../Models/DummyResponse';
import { IConsulObject } from 'src/app/models/JsonObject';
import * as DummyResponse from '../../models/DummyResponse';
import { JsonService } from 'src/app/services/json.service';
@Component({
selector: 'app-main-page',
@ -9,7 +9,10 @@ import * as DummyResponse from '../../Models/DummyResponse';
styleUrls: ['./main-page.component.scss']
})
export class MainPageComponent {
constructor(private http: HttpClient) {}
constructor(public jsonService: JsonService) {
}
response: any = JSON.parse(DummyResponse.SampleResponse);
@ -18,7 +21,7 @@ responseArray: IConsulObject[] = [];
list(){
this.responseArray = []
this.getList().subscribe(response => {
this.jsonService.getList().subscribe(response => {
this.response = response
this.keys= Object.keys(this.response);
this.keys.forEach(element => {
@ -30,11 +33,7 @@ this.getList().subscribe(response => {
getList(){
var response = this.http.get<any>("https://consul.vdk2ch.ru/v1/agent/services")
console.log(response)
return response;
}
ngOnInit(): void {

View File

@ -1,5 +1,5 @@
import { Component, Input, OnInit } from '@angular/core';
import { IConsulObject } from 'src/app/Models/JsonObject';
import { IConsulObject } from 'src/app/models/JsonObject';
@Component({
selector: 'app-single-objcet',

View File

@ -0,0 +1,18 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class JsonService {
constructor(private http: HttpClient) {
}
getList(): Observable<any> {
var response = this.http.get<any>("https://consul.vdk2ch.ru/v1/agent/services")
return response;
}
}