diff --git a/mediarepo-ui/.editorconfig b/mediarepo-ui/.editorconfig index 59d9a3a..783e38e 100644 --- a/mediarepo-ui/.editorconfig +++ b/mediarepo-ui/.editorconfig @@ -4,12 +4,12 @@ root = true [*] charset = utf-8 indent_style = space -indent_size = 2 +indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true [*.ts] -quote_type = single +quote_type = double [*.md] max_line_length = off diff --git a/mediarepo-ui/.eslintrc.json b/mediarepo-ui/.eslintrc.json index 47c17dd..5c694cf 100644 --- a/mediarepo-ui/.eslintrc.json +++ b/mediarepo-ui/.eslintrc.json @@ -34,7 +34,9 @@ "prefix": "app", "style": "kebab-case" } - ] + ], + "quotes": ["warn", "double", {"avoidEscape": true}], + "indent": ["error", 4, {"SwitchCase": 1}] } }, { diff --git a/mediarepo-ui/src/app/app-routing.module.ts b/mediarepo-ui/src/app/app-routing.module.ts index f223ae1..84df263 100644 --- a/mediarepo-ui/src/app/app-routing.module.ts +++ b/mediarepo-ui/src/app/app-routing.module.ts @@ -1,13 +1,13 @@ -import {NgModule} from '@angular/core'; -import {RouterModule, Routes} from '@angular/router'; +import {NgModule} from "@angular/core"; +import {RouterModule, Routes} from "@angular/router"; import {CoreComponent} from "./components/core/core.component"; const routes: Routes = [ - {path: "", component: CoreComponent}]; + {path: "", component: CoreComponent}]; @NgModule({ - imports: [RouterModule.forRoot(routes)], - exports: [RouterModule] + imports: [RouterModule.forRoot(routes)], + exports: [RouterModule] }) export class AppRoutingModule { } diff --git a/mediarepo-ui/src/app/app.component-theme.scss b/mediarepo-ui/src/app/app.component-theme.scss index d525a4e..1e79cbd 100644 --- a/mediarepo-ui/src/app/app.component-theme.scss +++ b/mediarepo-ui/src/app/app.component-theme.scss @@ -2,53 +2,53 @@ @use '~@angular/material' as mat; @mixin color($theme) { - $color-config: mat.get-color-config($theme); - $primary-palette: map.get($color-config, 'primary'); - $warn-palette: map.get($color-config, 'warn'); - - body { - background-color: darken(#303030, 5); - color: white - } - ::ng-deep ::-webkit-scrollbar { - width: 15px; - height: 15px; - background: #272727; - } - - ::ng-deep ::-webkit-scrollbar-thumb { - background: mat.get-color-from-palette($primary-palette, 'darker'); - border-radius: 1px; - } - - ::ng-deep ::-webkit-scrollbar-thumb:hover { - background: mat.get-color-from-palette($primary-palette); - } - - .warn { - background-color: mat.get-color-from-palette($warn-palette); - color: white - } + $color-config: mat.get-color-config($theme); + $primary-palette: map.get($color-config, 'primary'); + $warn-palette: map.get($color-config, 'warn'); + + body { + background-color: darken(#303030, 5); + color: white + } + ::ng-deep ::-webkit-scrollbar { + width: 15px; + height: 15px; + background: #272727; + } + + ::ng-deep ::-webkit-scrollbar-thumb { + background: mat.get-color-from-palette($primary-palette, 'darker'); + border-radius: 1px; + } + + ::ng-deep ::-webkit-scrollbar-thumb:hover { + background: mat.get-color-from-palette($primary-palette); + } + + .warn { + background-color: mat.get-color-from-palette($warn-palette); + color: white + } } @mixin typography($theme) { - // Get the typography config from the theme. - $typography-config: mat.get-typography-config($theme); + // Get the typography config from the theme. + $typography-config: mat.get-typography-config($theme); - body { - font-family: mat.font-family($typography-config); - } + body { + font-family: mat.font-family($typography-config); + } } @mixin theme($theme) { - $color-config: mat.get-color-config($theme); - @if $color-config != null { - @include color($theme); - } - - $typography-config: mat.get-typography-config($theme); - @if $typography-config != null { - @include typography($theme); - } + $color-config: mat.get-color-config($theme); + @if $color-config != null { + @include color($theme); + } + + $typography-config: mat.get-typography-config($theme); + @if $typography-config != null { + @include typography($theme); + } } diff --git a/mediarepo-ui/src/app/app.component.scss b/mediarepo-ui/src/app/app.component.scss index 92c9c07..8b79f48 100644 --- a/mediarepo-ui/src/app/app.component.scss +++ b/mediarepo-ui/src/app/app.component.scss @@ -1,7 +1,7 @@ ::ng-deep .mat-button-wrapper > ng-icon { - font-size: 26px; + font-size: 26px; } ::ng-deep ng-icon { - font-size: 24px; + font-size: 24px; } diff --git a/mediarepo-ui/src/app/app.component.spec.ts b/mediarepo-ui/src/app/app.component.spec.ts index c9bd039..17910bf 100644 --- a/mediarepo-ui/src/app/app.component.spec.ts +++ b/mediarepo-ui/src/app/app.component.spec.ts @@ -1,36 +1,36 @@ -import {TestBed} from '@angular/core/testing'; -import {RouterTestingModule} from '@angular/router/testing'; -import {AppComponent} from './app.component'; +import {TestBed} from "@angular/core/testing"; +import {RouterTestingModule} from "@angular/router/testing"; +import {AppComponent} from "./app.component"; -describe('AppComponent', () => { - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [ - RouterTestingModule - ], - declarations: [ - AppComponent - ], - }).compileComponents(); - }); +describe("AppComponent", () => { + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ + RouterTestingModule + ], + declarations: [ + AppComponent + ], + }).compileComponents(); + }); - it('should create the app', () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.componentInstance; - expect(app).toBeTruthy(); - }); + it("should create the app", () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app).toBeTruthy(); + }); - it(`should have as title 'mediarepo-ui'`, () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.componentInstance; - expect(app.title).toEqual('mediarepo-ui'); - }); + it("should have as title 'mediarepo-ui'", () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app.title).toEqual("mediarepo-ui"); + }); - it('should render title', () => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.nativeElement as HTMLElement; - expect(compiled.querySelector('.content span')?.textContent) - .toContain('mediarepo-ui app is running!'); - }); + it("should render title", () => { + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + const compiled = fixture.nativeElement as HTMLElement; + expect(compiled.querySelector(".content span")?.textContent) + .toContain("mediarepo-ui app is running!"); + }); }); diff --git a/mediarepo-ui/src/app/app.component.ts b/mediarepo-ui/src/app/app.component.ts index dee33bc..ab1fbed 100644 --- a/mediarepo-ui/src/app/app.component.ts +++ b/mediarepo-ui/src/app/app.component.ts @@ -1,43 +1,43 @@ -import {Component, OnInit} from '@angular/core'; +import {Component, OnInit} from "@angular/core"; import {Router} from "@angular/router"; import {RepositoryService} from "./services/repository/repository.service"; import {MatSnackBar} from "@angular/material/snack-bar"; import {ErrorBrokerService} from "./services/error-broker/error-broker.service"; @Component({ - selector: 'app-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + selector: "app-root", + templateUrl: "./app.component.html", + styleUrls: ["./app.component.scss"] }) export class AppComponent implements OnInit { - title = 'mediarepo-ui'; + title = "mediarepo-ui"; - constructor( - private router: Router, - private snackBar: MatSnackBar, - private errorBroker: ErrorBrokerService, - private repoService: RepositoryService, - ) { - } + constructor( + private router: Router, + private snackBar: MatSnackBar, + private errorBroker: ErrorBrokerService, + private repoService: RepositoryService, + ) { + } - async ngOnInit() { - this.errorBroker.errorCb = (err: { message: string }) => this.showError( - err); - this.errorBroker.infoCb = (info: string) => this.showInfo(info); - await this.repoService.loadRepositories(); - } + async ngOnInit() { + this.errorBroker.errorCb = (err: { message: string }) => this.showError( + err); + this.errorBroker.infoCb = (info: string) => this.showInfo(info); + await this.repoService.loadRepositories(); + } - private showError(err: { message: string }) { - this.snackBar.open(err.message, undefined, { - panelClass: "warn", - duration: 2000, - }); - } + private showError(err: { message: string }) { + this.snackBar.open(err.message, undefined, { + panelClass: "warn", + duration: 2000, + }); + } - private showInfo(info: string) { - this.snackBar.open(info, undefined, { - panelClass: "primary", - duration: 2000, - }); - } + private showInfo(info: string) { + this.snackBar.open(info, undefined, { + panelClass: "primary", + duration: 2000, + }); + } } diff --git a/mediarepo-ui/src/app/app.module.ts b/mediarepo-ui/src/app/app.module.ts index b12edea..f5897a1 100644 --- a/mediarepo-ui/src/app/app.module.ts +++ b/mediarepo-ui/src/app/app.module.ts @@ -1,20 +1,20 @@ -import {NgModule} from '@angular/core'; -import {BrowserModule} from '@angular/platform-browser'; -import {AppComponent} from './app.component'; -import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; +import {NgModule} from "@angular/core"; +import {BrowserModule} from "@angular/platform-browser"; +import {AppComponent} from "./app.component"; +import {BrowserAnimationsModule} from "@angular/platform-browser/animations"; import {CoreModule} from "./components/core/core.module"; @NgModule({ - declarations: [ - AppComponent, - ], - imports: [ - BrowserModule, - BrowserAnimationsModule, - CoreModule, - ], - providers: [], - bootstrap: [AppComponent] + declarations: [ + AppComponent, + ], + imports: [ + BrowserModule, + BrowserAnimationsModule, + CoreModule, + ], + providers: [], + bootstrap: [AppComponent] }) export class AppModule { } diff --git a/mediarepo-ui/src/app/components/core/core.component.html b/mediarepo-ui/src/app/components/core/core.component.html index c8dc551..2312064 100644 --- a/mediarepo-ui/src/app/components/core/core.component.html +++ b/mediarepo-ui/src/app/components/core/core.component.html @@ -1,13 +1,13 @@
- - - - - - - - - - - + + + + + + + + + + +
diff --git a/mediarepo-ui/src/app/components/core/core.component.scss b/mediarepo-ui/src/app/components/core/core.component.scss index d107163..8512ac5 100644 --- a/mediarepo-ui/src/app/components/core/core.component.scss +++ b/mediarepo-ui/src/app/components/core/core.component.scss @@ -1,19 +1,19 @@ #content { - height: 100vh; - width: 100vw; - position: absolute; - left: 0; - top: 0; - margin: 0; - overflow: hidden + height: 100vh; + width: 100vw; + position: absolute; + left: 0; + top: 0; + margin: 0; + overflow: hidden } mat-tab-group { - height: 100%; - width: 100%; + height: 100%; + width: 100%; } ::ng-deep .mat-tab-body-wrapper { - height: 100%; - width: 100%; + height: 100%; + width: 100%; } diff --git a/mediarepo-ui/src/app/components/core/core.component.spec.ts b/mediarepo-ui/src/app/components/core/core.component.spec.ts index 14c2ab0..b6348c5 100644 --- a/mediarepo-ui/src/app/components/core/core.component.spec.ts +++ b/mediarepo-ui/src/app/components/core/core.component.spec.ts @@ -1,25 +1,25 @@ -import {ComponentFixture, TestBed} from '@angular/core/testing'; +import {ComponentFixture, TestBed} from "@angular/core/testing"; -import {CoreComponent} from './core.component'; +import {CoreComponent} from "./core.component"; -describe('HomeComponent', () => { - let component: CoreComponent; - let fixture: ComponentFixture; +describe("HomeComponent", () => { + let component: CoreComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [CoreComponent] - }) - .compileComponents(); - }); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [CoreComponent] + }) + .compileComponents(); + }); - beforeEach(() => { - fixture = TestBed.createComponent(CoreComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(CoreComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it("should create", () => { + expect(component).toBeTruthy(); + }); }); diff --git a/mediarepo-ui/src/app/components/core/core.component.ts b/mediarepo-ui/src/app/components/core/core.component.ts index 949fdea..cd5d284 100644 --- a/mediarepo-ui/src/app/components/core/core.component.ts +++ b/mediarepo-ui/src/app/components/core/core.component.ts @@ -1,4 +1,4 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; +import {Component, OnInit, ViewChild} from "@angular/core"; import {Repository} from "../../models/Repository"; import {RepositoryService} from "../../services/repository/repository.service"; import {MatTabChangeEvent, MatTabGroup} from "@angular/material/tabs"; @@ -6,48 +6,48 @@ import {TagService} from "../../services/tag/tag.service"; import {TabService} from "../../services/tab/tab.service"; @Component({ - selector: 'app-core', - templateUrl: './core.component.html', - styleUrls: ['./core.component.scss'] + selector: "app-core", + templateUrl: "./core.component.html", + styleUrls: ["./core.component.scss"] }) export class CoreComponent implements OnInit { - public selectedRepository: Repository | undefined; + public selectedRepository: Repository | undefined; - @ViewChild("tabGroup") tabGroup!: MatTabGroup; + @ViewChild("tabGroup") tabGroup!: MatTabGroup; - constructor( - private tabService: TabService, - private repoService: RepositoryService, - private tagService: TagService) { - } - - public async ngOnInit(): Promise { - this.selectedRepository = this.repoService.selectedRepository.getValue(); - this.repoService.selectedRepository.subscribe(async (selected) => { - this.selectedRepository = selected; - this.updateSelectedTab(); - await this.loadRepoData(); - }); - } + constructor( + private tabService: TabService, + private repoService: RepositoryService, + private tagService: TagService) { + } - public updateSelectedTab() { - if (!this.tabGroup) { - return; + public async ngOnInit(): Promise { + this.selectedRepository = this.repoService.selectedRepository.getValue(); + this.repoService.selectedRepository.subscribe(async (selected) => { + this.selectedRepository = selected; + this.updateSelectedTab(); + await this.loadRepoData(); + }); } - if (!this.selectedRepository) { - this.tabGroup.selectedIndex = 0; - } else if (this.tabGroup.selectedIndex === 0) { - this.tabGroup.selectedIndex = 1; + + public updateSelectedTab() { + if (!this.tabGroup) { + return; + } + if (!this.selectedRepository) { + this.tabGroup.selectedIndex = 0; + } else if (this.tabGroup.selectedIndex === 0) { + this.tabGroup.selectedIndex = 1; + } } - } - async loadRepoData() { - await this.tagService.loadTags(); - } + async loadRepoData() { + await this.tagService.loadTags(); + } - public onTabSelectionChange(event: MatTabChangeEvent): void { - this.tabService.setSelectedTab(event.index); - } + public onTabSelectionChange(event: MatTabChangeEvent): void { + this.tabService.setSelectedTab(event.index); + } } diff --git a/mediarepo-ui/src/app/components/core/core.module.ts b/mediarepo-ui/src/app/components/core/core.module.ts index daecd0a..0ddbfb3 100644 --- a/mediarepo-ui/src/app/components/core/core.module.ts +++ b/mediarepo-ui/src/app/components/core/core.module.ts @@ -1,5 +1,5 @@ -import {NgModule} from '@angular/core'; -import {CommonModule} from '@angular/common'; +import {NgModule} from "@angular/core"; +import {CommonModule} from "@angular/common"; import {CoreComponent} from "./core.component"; import {RepositoriesTabComponent} from "./repositories-tab/repositories-tab.component"; import {FilesTabComponent} from "./files-tab/files-tab.component"; @@ -24,35 +24,35 @@ import {MatMenuModule} from "@angular/material/menu"; @NgModule({ - declarations: [ - RepositoriesTabComponent, - CoreComponent, - FilesTabComponent, - FilesTabSidebarComponent, - ImportTabComponent, - ImportTabSidebarComponent, - FilesystemImportComponent, - ], - exports: [ - CoreComponent - ], - imports: [ - CommonModule, - SharedModule, - MatTabsModule, - MatSidenavModule, - MatOptionModule, - MatSelectModule, - MatDividerModule, - MatProgressBarModule, - MatCheckboxModule, - ScrollingModule, - NgIconsModule.withIcons({...materialIcons}), - FlexModule, - MatButtonModule, - MatMenuModule, - MatRippleModule, - ] + declarations: [ + RepositoriesTabComponent, + CoreComponent, + FilesTabComponent, + FilesTabSidebarComponent, + ImportTabComponent, + ImportTabSidebarComponent, + FilesystemImportComponent, + ], + exports: [ + CoreComponent + ], + imports: [ + CommonModule, + SharedModule, + MatTabsModule, + MatSidenavModule, + MatOptionModule, + MatSelectModule, + MatDividerModule, + MatProgressBarModule, + MatCheckboxModule, + ScrollingModule, + NgIconsModule.withIcons({...materialIcons}), + FlexModule, + MatButtonModule, + MatMenuModule, + MatRippleModule, + ] }) export class CoreModule { } diff --git a/mediarepo-ui/src/app/components/core/files-tab/files-tab-sidebar/files-tab-sidebar.component.html b/mediarepo-ui/src/app/components/core/files-tab/files-tab-sidebar/files-tab-sidebar.component.html index 437a6f2..2d02289 100644 --- a/mediarepo-ui/src/app/components/core/files-tab/files-tab-sidebar/files-tab-sidebar.component.html +++ b/mediarepo-ui/src/app/components/core/files-tab/files-tab-sidebar/files-tab-sidebar.component.html @@ -1,41 +1,43 @@