Added Credentials page and backend
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { Routes } from '@angular/router';
|
||||
import { ToolComponent } from './components/partials/tool/tool.component';
|
||||
import { BackupListComponent } from './components/pages/backup-list/backup-list.component';
|
||||
import { ShiftUpdateComponent } from './components/pages/shift-update/shift-update.component';
|
||||
import { NoMansLandComponent } from './components/pages/no-mans-land/no-mans-land.component';
|
||||
import { ToolListComponent } from './components/pages/tool-list/tool-list.component';
|
||||
|
||||
export const routes: Routes = [
|
||||
{path: "", component: NoMansLandComponent},
|
||||
{path: "backup", component: BackupListComponent},
|
||||
{path: "update", component: ShiftUpdateComponent},
|
||||
{path: "**", component: NoMansLandComponent}
|
||||
{path: "creds", component: ToolListComponent },
|
||||
{path: "**", component: NoMansLandComponent},
|
||||
];
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
<div class="container">
|
||||
<app-title title="Tool List"></app-title>
|
||||
<tool *ngFor="let tool of tools" [name]="tool.name" [url]="tool.url" [userName]="tool.userName" [password]="tool.password"></tool>
|
||||
<div class="table-container">
|
||||
<div class="table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Service Name</th>
|
||||
<th>User Name</th>
|
||||
<th>Password</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let rowData of credList; let i = index">
|
||||
<td><a [href]="rowData.url">{{rowData.name}}</a></td>
|
||||
<td>{{rowData.userName}}</td>
|
||||
<td>{{rowData.password}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <tool *ngFor="let cred of credList" [name]="cred.name" [url]="cred.url" [userName]="cred.userName" [password]="cred.password"></tool> -->
|
||||
</div>
|
||||
@@ -1,7 +1,96 @@
|
||||
.container {
|
||||
@import './../../../shared/scss/colors.scss';
|
||||
|
||||
.table-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.table{
|
||||
padding: 0rem 2rem;
|
||||
}
|
||||
|
||||
table {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
table, tr, td {
|
||||
border-collapse: collapse;
|
||||
border: none;
|
||||
}
|
||||
|
||||
th{
|
||||
color: $txt-heading-color;
|
||||
font-size: 1.5rem;
|
||||
padding-bottom: 3rem;
|
||||
position:sticky;
|
||||
}
|
||||
|
||||
tbody tr {
|
||||
transition: all 0.3s
|
||||
}
|
||||
|
||||
tbody tr:hover {
|
||||
transform: scale(1.01);
|
||||
background-color: rgba($hover-color,0.5);
|
||||
border-collapse: collapse;
|
||||
border: none;
|
||||
}
|
||||
|
||||
td:first-child{
|
||||
border-radius: 1rem 0rem 0rem 1rem;
|
||||
padding-left: 2rem;
|
||||
}
|
||||
|
||||
td:nth-child(3){
|
||||
transition: color 0.09s ease-in-out;
|
||||
}
|
||||
td:last-child{
|
||||
border-radius: 0rem 1rem 1rem 0rem;
|
||||
padding-right: 2rem;
|
||||
}
|
||||
|
||||
td:nth-child(3):active {
|
||||
color: rgb(168, 168, 168);
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background-color: rgba(0,0,0,0.03);
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 0.7rem 1.5rem;
|
||||
-webkit-user-select: none; /* Safari */
|
||||
-ms-user-select: none; /* IE 10 and IE 11 */
|
||||
user-select: none; /* Standard syntax */
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.complete{
|
||||
background-color: $txt-heading-color;
|
||||
border: none;
|
||||
height: 2rem;
|
||||
width: 2.5rem;
|
||||
border-radius: 10px;
|
||||
&:hover {
|
||||
background-color: darken($txt-heading-color, 20);
|
||||
}
|
||||
}
|
||||
|
||||
.delete {
|
||||
background-color: $danger;
|
||||
border: none;
|
||||
height: 2rem;
|
||||
width: 2.5rem;
|
||||
border-radius: 10px;
|
||||
margin-top: 5px;
|
||||
&:hover {
|
||||
background-color: darken($danger, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ToolListService } from '../../../shared/module/tool-list.module';
|
||||
import { Tool } from '../../../shared/model/tool.model';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TitleComponent } from "../../partials/title/title.component";
|
||||
import { credService } from './tool-list.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-tool-list',
|
||||
@@ -13,12 +14,15 @@ import { TitleComponent } from "../../partials/title/title.component";
|
||||
styleUrl: './tool-list.component.scss'
|
||||
})
|
||||
export class ToolListComponent implements OnInit {
|
||||
tools!: Tool[];
|
||||
credList!: Tool[];
|
||||
|
||||
constructor(private toolListService: ToolListService) {}
|
||||
constructor(private toolListService: ToolListService, private credService: credService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.tools = this.toolListService.getAllTools()
|
||||
// this.tools = this.toolListService.getAllTools()
|
||||
this.credService.getAllCreds().subscribe((creds)=>{
|
||||
this.credList = creds;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
18
src/app/components/pages/tool-list/tool-list.service.ts
Normal file
18
src/app/components/pages/tool-list/tool-list.service.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import { Observable } from "rxjs";
|
||||
import { Tool } from "../../../shared/model/tool.model";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { SECRET_URL } from "../../../shared/constants/backend";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export class credService {
|
||||
|
||||
constructor(private httpClient: HttpClient){}
|
||||
|
||||
getAllCreds(): Observable<Tool[]> {
|
||||
return this.httpClient.get<Tool[]>(SECRET_URL)
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,5 @@ export const BACKUP_GET_URL = `${MAIN_URL}/backup`;
|
||||
export const UPDATE_GET_URL = `${MAIN_URL}/update`;
|
||||
export const UPDATE_ADD_URL = `${UPDATE_GET_URL}/add`;
|
||||
export const UPDATE_COMPLETE_URL = `${UPDATE_GET_URL}/complete`;
|
||||
export const UPDATE_DELETE_URL = `${UPDATE_GET_URL}/delete`;
|
||||
export const UPDATE_DELETE_URL = `${UPDATE_GET_URL}/delete`;
|
||||
export const SECRET_URL = `${MAIN_URL}/secrets`;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Tool } from "./shared/model/tool.model";
|
||||
|
||||
export const all_tools: Tool[] = [
|
||||
export const all_tools: any[] = [
|
||||
{
|
||||
name: 'Nagios',
|
||||
url: "http://nagios.brilliant.com.bd/nagios",
|
||||
|
||||
Reference in New Issue
Block a user