From e694645a78ee769c6b089a85857d7a36e1ffbbc7 Mon Sep 17 00:00:00 2001 From: trivernis Date: Thu, 25 Nov 2021 20:56:49 +0100 Subject: [PATCH] Change indentation to 4 spaces (because why was it 2 anyway?) Signed-off-by: trivernis --- mediarepo-ui/.editorconfig | 4 +- mediarepo-ui/.eslintrc.json | 4 +- mediarepo-ui/src/app/app-routing.module.ts | 10 +- mediarepo-ui/src/app/app.component-theme.scss | 82 ++--- mediarepo-ui/src/app/app.component.scss | 4 +- mediarepo-ui/src/app/app.component.spec.ts | 62 ++-- mediarepo-ui/src/app/app.component.ts | 60 ++-- mediarepo-ui/src/app/app.module.ts | 28 +- .../app/components/core/core.component.html | 22 +- .../app/components/core/core.component.scss | 22 +- .../components/core/core.component.spec.ts | 38 +-- .../src/app/components/core/core.component.ts | 68 ++-- .../src/app/components/core/core.module.ts | 62 ++-- .../files-tab-sidebar.component.html | 74 ++-- .../files-tab-sidebar.component.scss | 70 ++-- .../files-tab-sidebar.component.spec.ts | 38 +-- .../files-tab-sidebar.component.ts | 157 ++++----- .../core/files-tab/files-tab.component.html | 20 +- .../core/files-tab/files-tab.component.scss | 54 +-- .../files-tab/files-tab.component.spec.ts | 37 +- .../core/files-tab/files-tab.component.ts | 40 +-- .../filesystem-import.component.html | 32 +- .../filesystem-import.component.scss | 20 +- .../filesystem-import.component.spec.ts | 38 +-- .../filesystem-import.component.ts | 105 +++--- .../import-tab-sidebar.component.html | 38 +-- .../import-tab-sidebar.component.scss | 34 +- .../import-tab-sidebar.component.spec.ts | 38 +-- .../import-tab-sidebar.component.ts | 16 +- .../core/import-tab/import-tab.component.html | 14 +- .../core/import-tab/import-tab.component.scss | 26 +- .../import-tab/import-tab.component.spec.ts | 38 +-- .../core/import-tab/import-tab.component.ts | 48 +-- .../add-repository-dialog.component.html | 92 ++--- .../add-repository-dialog.component.scss | 32 +- .../add-repository-dialog.component.spec.ts | 38 +-- .../add-repository-dialog.component.ts | 234 ++++++------- .../repositories-tab.component.html | 14 +- .../repositories-tab.component.scss | 28 +- .../repositories-tab.component.spec.ts | 38 +-- .../repositories-tab.component.ts | 48 +-- .../repository-card.component.html | 70 ++-- .../repository-card.component.scss | 36 +- .../repository-card.component.spec.ts | 38 +-- .../repository-card.component.ts | 164 ++++----- .../busy-indicator.component.html | 2 +- .../busy-indicator.component.scss | 38 +-- .../busy-indicator.component.spec.ts | 38 +-- .../busy-indicator.component.ts | 72 ++-- .../confirm-dialog.component.html | 8 +- .../confirm-dialog.component.scss | 10 +- .../confirm-dialog.component.spec.ts | 38 +-- .../confirm-dialog.component.ts | 50 +-- .../content-aware-image.component.html | 6 +- .../content-aware-image.component.scss | 20 +- .../content-aware-image.component.spec.ts | 38 +-- .../content-aware-image.component.ts | 58 ++-- .../context-menu/context-menu.component.html | 2 +- .../context-menu/context-menu.component.scss | 4 +- .../context-menu.component.spec.ts | 38 +-- .../context-menu/context-menu.component.ts | 32 +- .../file-context-menu.component.html | 6 +- .../file-context-menu.component.spec.ts | 38 +-- .../file-context-menu.component.ts | 48 +-- .../shared/file-edit/file-edit.component.html | 72 ++-- .../shared/file-edit/file-edit.component.scss | 86 ++--- .../file-edit/file-edit.component.spec.ts | 38 +-- .../shared/file-edit/file-edit.component.ts | 263 +++++++------- .../audio-viewer/audio-viewer.component.html | 4 +- .../audio-viewer/audio-viewer.component.scss | 12 +- .../audio-viewer.component.spec.ts | 38 +-- .../audio-viewer/audio-viewer.component.ts | 14 +- .../content-viewer.component.html | 4 +- .../content-viewer.component.scss | 28 +- .../content-viewer.component.spec.ts | 38 +-- .../content-viewer.component.ts | 160 ++++----- .../image-viewer/image-viewer.component.html | 24 +- .../image-viewer/image-viewer.component.scss | 38 +-- .../image-viewer.component.spec.ts | 38 +-- .../image-viewer/image-viewer.component.ts | 98 +++--- .../video-viewer/video-viewer.component.html | 2 +- .../video-viewer/video-viewer.component.scss | 4 +- .../video-viewer.component.spec.ts | 38 +-- .../video-viewer/video-viewer.component.ts | 10 +- .../file-gallery-entry.component-theme.scss | 26 +- .../file-gallery-entry.component.html | 4 +- .../file-gallery-entry.component.scss | 26 +- .../file-gallery-entry.component.spec.ts | 38 +-- .../file-gallery-entry.component.ts | 73 ++-- .../file-gallery/file-gallery.component.html | 38 ++- .../file-gallery/file-gallery.component.scss | 72 ++-- .../file-gallery.component.spec.ts | 38 +-- .../file-gallery/file-gallery.component.ts | 301 ++++++++-------- .../file-grid/file-grid-entry/GridEntry.ts | 4 +- .../file-grid-entry.component-theme.scss | 26 +- .../file-grid-entry.component.html | 6 +- .../file-grid-entry.component.scss | 16 +- .../file-grid-entry.component.spec.ts | 38 +-- .../file-grid-entry.component.ts | 79 +++-- .../file-grid/file-grid.component.html | 27 +- .../file-grid/file-grid.component.scss | 24 +- .../file-grid/file-grid.component.spec.ts | 38 +-- .../file-grid/file-grid.component.ts | 320 +++++++++--------- .../file-multiview.component.html | 6 +- .../file-multiview.component.scss | 4 +- .../file-multiview.component.spec.ts | 38 +-- .../file-multiview.component.ts | 62 ++-- .../file-search.component-theme.scss | 42 +-- .../file-search/file-search.component.html | 25 +- .../file-search/file-search.component.scss | 72 ++-- .../file-search/file-search.component.spec.ts | 38 +-- .../file-search/file-search.component.ts | 199 +++++------ .../filter-dialog.component.html | 39 +-- .../filter-dialog.component.scss | 42 +-- .../filter-dialog.component.spec.ts | 38 +-- .../filter-dialog/filter-dialog.component.ts | 279 +++++++-------- .../tag-filter-list-item.component.html | 34 +- .../tag-filter-list-item.component.scss | 46 +-- .../tag-filter-list-item.component.spec.ts | 38 +-- .../tag-filter-list-item.component.ts | 106 +++--- .../sort-dialog/sort-dialog.component.html | 87 ++--- .../sort-dialog/sort-dialog.component.scss | 58 ++-- .../sort-dialog/sort-dialog.component.spec.ts | 38 +-- .../sort-dialog/sort-dialog.component.ts | 53 +-- .../file-thumbnail.component.html | 12 +- .../file-thumbnail.component.scss | 38 +-- .../file-thumbnail.component.spec.ts | 38 +-- .../file-thumbnail.component.ts | 60 ++-- .../native-file-select.component.html | 26 +- .../native-file-select.component.scss | 24 +- .../native-file-select.component.spec.ts | 38 +-- .../native-file-select.component.ts | 120 +++---- .../inputs/tag-input/tag-input.component.html | 28 +- .../inputs/tag-input/tag-input.component.scss | 2 +- .../tag-input/tag-input.component.spec.ts | 38 +-- .../inputs/tag-input/tag-input.component.ts | 182 +++++----- .../app/components/shared/shared.module.ts | 148 ++++---- .../shared/tag-item/tag-item.component.html | 4 +- .../shared/tag-item/tag-item.component.scss | 14 +- .../tag-item/tag-item.component.spec.ts | 38 +-- .../shared/tag-item/tag-item.component.ts | 18 +- mediarepo-ui/src/app/models/AddFileOptions.ts | 8 +- mediarepo-ui/src/app/models/File.ts | 24 +- mediarepo-ui/src/app/models/FileOsMetadata.ts | 10 +- .../src/app/models/FilterExpression.ts | 141 ++++---- mediarepo-ui/src/app/models/Info.ts | 4 +- mediarepo-ui/src/app/models/Repository.ts | 14 +- mediarepo-ui/src/app/models/Selectable.ts | 16 +- mediarepo-ui/src/app/models/SortKey.ts | 50 +-- mediarepo-ui/src/app/models/Tag.ts | 24 +- mediarepo-ui/src/app/models/TagQuery.ts | 22 +- mediarepo-ui/src/app/models/Thumbnail.ts | 8 +- .../error-broker/error-broker.service.spec.ts | 22 +- .../error-broker/error-broker.service.ts | 62 ++-- .../src/app/services/file/file.helper.ts | 104 +++--- .../app/services/file/file.service.spec.ts | 22 +- .../src/app/services/file/file.service.ts | 154 ++++----- .../services/import/import.service.spec.ts | 22 +- .../src/app/services/import/import.service.ts | 46 +-- .../repository/repository.service.spec.ts | 22 +- .../services/repository/repository.service.ts | 226 +++++++------ .../src/app/services/tab/tab.service.spec.ts | 22 +- .../src/app/services/tab/tab.service.ts | 16 +- .../src/app/services/tag/tag.service.spec.ts | 22 +- .../src/app/services/tag/tag.service.ts | 52 +-- .../src/environments/environment.prod.ts | 2 +- mediarepo-ui/src/environments/environment.ts | 2 +- mediarepo-ui/src/main.ts | 12 +- mediarepo-ui/src/polyfills.ts | 2 +- mediarepo-ui/src/test.ts | 18 +- 170 files changed, 4173 insertions(+), 4132 deletions(-) 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 @@