Improve repository details display

Signed-off-by: Trivernis <trivernis@protonmail.com>
pull/4/head
Trivernis 3 years ago
parent 86412b7039
commit ef445e14b3

@ -1,6 +1,7 @@
<div id="content"> <div id="content">
<mat-tab-group #tabGroup (selectedTabChange)="this.onTabSelectionChange($event)" class="main-tab-group" animationDuration="0"> <mat-tab-group #tabGroup (selectedTabChange)="this.onTabSelectionChange($event)" class="main-tab-group"
<mat-tab label="Repositories"> animationDuration="0">
<mat-tab [label]="this.selectedRepository? 'Repository' : 'Repositories'">
<app-repositories-tab></app-repositories-tab> <app-repositories-tab></app-repositories-tab>
</mat-tab> </mat-tab>
<mat-tab *ngFor="let tab of tabs"> <mat-tab *ngFor="let tab of tabs">

@ -57,3 +57,7 @@ mat-tab-group {
.tab-label-div { .tab-label-div {
display: flex; display: flex;
} }
app-repositories-tab {
height: 100%;
}

@ -27,3 +27,7 @@
app-repository-card { app-repository-card {
position: relative; position: relative;
} }
app-repository-details-view, .repo-details {
height: 100%;
}

@ -8,7 +8,6 @@
<app-metadata-entry *ngIf="repository.path" attributeName="Path" [value]="repository.path"></app-metadata-entry> <app-metadata-entry *ngIf="repository.path" attributeName="Path" [value]="repository.path"></app-metadata-entry>
<app-metadata-entry *ngIf="repository.address" attributeName="Address" [value]="repository.address"></app-metadata-entry> <app-metadata-entry *ngIf="repository.address" attributeName="Address" [value]="repository.address"></app-metadata-entry>
<ng-container *ngIf="metadata"> <ng-container *ngIf="metadata">
<app-metadata-entry attributeName="Daemon Version" [value]="metadata.version"></app-metadata-entry>
<app-metadata-entry attributeName="File Count" [value]="metadata.file_count.toString()"></app-metadata-entry> <app-metadata-entry attributeName="File Count" [value]="metadata.file_count.toString()"></app-metadata-entry>
<app-metadata-entry attributeName="Tag Count" [value]="metadata.tag_count.toString()"></app-metadata-entry> <app-metadata-entry attributeName="Tag Count" [value]="metadata.tag_count.toString()"></app-metadata-entry>
<app-metadata-entry attributeName="Namespace Count" [value]="metadata.namespace_count.toString()"></app-metadata-entry> <app-metadata-entry attributeName="Namespace Count" [value]="metadata.namespace_count.toString()"></app-metadata-entry>

@ -7,3 +7,19 @@
.button-close-repository { .button-close-repository {
float: right float: right
} }
.repository-metadata {
padding: 1em 1em 1em 3em;
overflow-y: auto;
user-select: none;
app-metadata-entry {
margin-bottom: 0.5em;
display: block;
}
}
.details-content {
height: calc(100% - 64px);
overflow: hidden;
}

@ -1,7 +1,7 @@
import { import {
Component, Component,
Input, Input,
OnChanges, OnChanges, OnDestroy,
OnInit, OnInit,
SimpleChanges SimpleChanges
} from "@angular/core"; } from "@angular/core";
@ -16,24 +16,30 @@ import {RepositoryMetadata} from "../../../../models/RepositoryMetadata";
templateUrl: "./repository-details-view.component.html", templateUrl: "./repository-details-view.component.html",
styleUrls: ["./repository-details-view.component.scss"] styleUrls: ["./repository-details-view.component.scss"]
}) })
export class RepositoryDetailsViewComponent implements OnInit, OnChanges { export class RepositoryDetailsViewComponent implements OnInit, OnChanges, OnDestroy {
@Input() repository!: Repository; @Input() repository!: Repository;
public metadata?: RepositoryMetadata; public metadata?: RepositoryMetadata;
private refreshMetadataInterval?: number;
constructor(private repoService: RepositoryService) { constructor(private repoService: RepositoryService) {
} }
public async ngOnInit() { public async ngOnInit() {
this.metadata = await this.repoService.getRepositoryMetadata(); await this.loadMetadata();
this.refreshMetadataInterval = setInterval(async () => this.loadMetadata(), 30000);
} }
public async ngOnChanges(changes: SimpleChanges) { public async ngOnChanges(changes: SimpleChanges) {
if (changes["repository"]) { if (changes["repository"]) {
this.metadata = await this.repoService.getRepositoryMetadata(); await this.loadMetadata();
} }
} }
public ngOnDestroy(): void {
clearInterval(this.refreshMetadataInterval);
}
public async closeRepository() { public async closeRepository() {
if (this.repository?.local) { if (this.repository?.local) {
await this.repoService.closeSelectedRepository(); await this.repoService.closeSelectedRepository();
@ -60,4 +66,8 @@ export class RepositoryDetailsViewComponent implements OnInit, OnChanges {
return size + " B" return size + " B"
} }
} }
public async loadMetadata() {
this.metadata = await this.repoService.getRepositoryMetadata();
}
} }

Loading…
Cancel
Save