style: format HTML and TypeScript code for consistency
This commit is contained in:
parent
ba520eea10
commit
739475ffcf
7 changed files with 40 additions and 18 deletions
|
@ -2,7 +2,12 @@
|
||||||
<app-navbar></app-navbar>
|
<app-navbar></app-navbar>
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row">
|
||||||
<button mat-flat-button color="secondary" class="my-3" (click)="createLink()">
|
<button
|
||||||
|
mat-flat-button
|
||||||
|
color="secondary"
|
||||||
|
class="my-3"
|
||||||
|
(click)="createLink()"
|
||||||
|
>
|
||||||
Create new Link
|
Create new Link
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -43,7 +48,11 @@
|
||||||
<ng-container matColumnDef="shortLink">
|
<ng-container matColumnDef="shortLink">
|
||||||
<th mat-header-cell *matHeaderCellDef>Short link</th>
|
<th mat-header-cell *matHeaderCellDef>Short link</th>
|
||||||
<td mat-cell *matCellDef="let element">
|
<td mat-cell *matCellDef="let element">
|
||||||
<button mat-flat-button class="my-3" (click)="copyLink(element.id)">
|
<button
|
||||||
|
mat-flat-button
|
||||||
|
class="my-3"
|
||||||
|
(click)="copyLink(element.id)"
|
||||||
|
>
|
||||||
Copy short link
|
Copy short link
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
@ -52,7 +61,11 @@
|
||||||
<ng-container matColumnDef="actions">
|
<ng-container matColumnDef="actions">
|
||||||
<th mat-header-cell *matHeaderCellDef>Actions</th>
|
<th mat-header-cell *matHeaderCellDef>Actions</th>
|
||||||
<td mat-cell *matCellDef="let element">
|
<td mat-cell *matCellDef="let element">
|
||||||
<button mat-flat-button color="warn" (click)="deleteLink(element)">
|
<button
|
||||||
|
mat-flat-button
|
||||||
|
color="warn"
|
||||||
|
(click)="deleteLink(element)"
|
||||||
|
>
|
||||||
Delete
|
Delete
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -15,7 +15,13 @@ import { LogoutService } from '../service/logout.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dashboard',
|
selector: 'app-dashboard',
|
||||||
imports: [NavbarComponent, MatTableModule, MatCardModule, MatButtonModule, OptionsMenuComponent],
|
imports: [
|
||||||
|
NavbarComponent,
|
||||||
|
MatTableModule,
|
||||||
|
MatCardModule,
|
||||||
|
MatButtonModule,
|
||||||
|
OptionsMenuComponent,
|
||||||
|
],
|
||||||
templateUrl: './dashboard.component.html',
|
templateUrl: './dashboard.component.html',
|
||||||
styleUrl: './dashboard.component.css',
|
styleUrl: './dashboard.component.css',
|
||||||
})
|
})
|
||||||
|
|
|
@ -38,7 +38,7 @@ export class LoginComponent {
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private snackBar: MatSnackBar,
|
private snackBar: MatSnackBar,
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
private validationErrorMessages: Record<string, string> = {
|
private validationErrorMessages: Record<string, string> = {
|
||||||
required: 'This field is required',
|
required: 'This field is required',
|
||||||
|
@ -80,7 +80,7 @@ export class LoginComponent {
|
||||||
loginWithAuthentik() {
|
loginWithAuthentik() {
|
||||||
this.pb
|
this.pb
|
||||||
.collection('users')
|
.collection('users')
|
||||||
.authWithOAuth2({ provider: 'oidc' })
|
.authWithOAuth2({ provider: 'oidc', scopes: ['openid', 'email', 'profile', 'avatar'] })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.router.navigate(['dashboard']);
|
this.router.navigate(['dashboard']);
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
<button mat-icon-button [matMenuTriggerFor]="menu" aria-label="Example icon-button with a menu">
|
<button
|
||||||
|
mat-icon-button
|
||||||
|
[matMenuTriggerFor]="menu"
|
||||||
|
aria-label="Example icon-button with a menu"
|
||||||
|
>
|
||||||
<mat-icon>more_vert</mat-icon>
|
<mat-icon>more_vert</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<mat-menu #menu="matMenu">
|
<mat-menu #menu="matMenu">
|
||||||
|
|
|
@ -8,9 +8,8 @@ describe('OptionsMenuComponent', () => {
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [OptionsMenuComponent]
|
imports: [OptionsMenuComponent],
|
||||||
})
|
}).compileComponents();
|
||||||
.compileComponents();
|
|
||||||
|
|
||||||
fixture = TestBed.createComponent(OptionsMenuComponent);
|
fixture = TestBed.createComponent(OptionsMenuComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import {MatIconModule} from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import {MatMenuModule} from '@angular/material/menu';
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
import {MatButtonModule} from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { LogoutService } from '../service/logout.service';
|
import { LogoutService } from '../service/logout.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-options-menu',
|
selector: 'app-options-menu',
|
||||||
imports: [MatIconModule, MatMenuModule, MatButtonModule],
|
imports: [MatIconModule, MatMenuModule, MatButtonModule],
|
||||||
templateUrl: './options-menu.component.html',
|
templateUrl: './options-menu.component.html',
|
||||||
styleUrl: './options-menu.component.css'
|
styleUrl: './options-menu.component.css',
|
||||||
})
|
})
|
||||||
export class OptionsMenuComponent {
|
export class OptionsMenuComponent {
|
||||||
constructor(private logoutService: LogoutService) {}
|
constructor(private logoutService: LogoutService) {}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from '@angular/core';
|
||||||
import PocketBase from 'pocketbase';
|
import PocketBase from 'pocketbase';
|
||||||
import { environment } from "../../environments/environment";
|
import { environment } from '../../environments/environment';
|
||||||
import { Router } from "@angular/router";
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
|
@ -9,7 +9,7 @@ import { Router } from "@angular/router";
|
||||||
export class LogoutService {
|
export class LogoutService {
|
||||||
private pb = new PocketBase(environment.POCKETBASE);
|
private pb = new PocketBase(environment.POCKETBASE);
|
||||||
|
|
||||||
constructor(private router: Router) { }
|
constructor(private router: Router) {}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
this.pb.authStore.clear();
|
this.pb.authStore.clear();
|
||||||
|
|
Loading…
Add table
Reference in a new issue