mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Cleanup from last develop release (#614)
* Added extra information for Swagger Gen * Ensure that the last scanned time gets updated after a scan finishes. Remove title case from Library name UI display. Show time on last scanned * Don't force title case for library names. Show them as the user created them.
This commit is contained in:
parent
839e35b15e
commit
6d86008607
@ -52,8 +52,41 @@ namespace API
|
|||||||
services.AddSwaggerGen(c =>
|
services.AddSwaggerGen(c =>
|
||||||
{
|
{
|
||||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Kavita API", Version = "v1" });
|
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Kavita API", Version = "v1" });
|
||||||
|
|
||||||
|
c.SwaggerDoc("Kavita API", new OpenApiInfo()
|
||||||
|
{
|
||||||
|
Description = "Kavita provides a set of APIs that are authenticated by JWT. JWT token can be copied from local storage.",
|
||||||
|
Title = "Kavita API",
|
||||||
|
Version = "v1",
|
||||||
|
});
|
||||||
|
|
||||||
var filePath = Path.Combine(AppContext.BaseDirectory, "API.xml");
|
var filePath = Path.Combine(AppContext.BaseDirectory, "API.xml");
|
||||||
c.IncludeXmlComments(filePath);
|
c.IncludeXmlComments(filePath);
|
||||||
|
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme {
|
||||||
|
In = ParameterLocation.Header,
|
||||||
|
Description = "Please insert JWT with Bearer into field",
|
||||||
|
Name = "Authorization",
|
||||||
|
Type = SecuritySchemeType.ApiKey
|
||||||
|
});
|
||||||
|
c.AddSecurityRequirement(new OpenApiSecurityRequirement {
|
||||||
|
{
|
||||||
|
new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Reference = new OpenApiReference
|
||||||
|
{
|
||||||
|
Type = ReferenceType.SecurityScheme,
|
||||||
|
Id = "Bearer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new string[] { }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
c.AddServer(new OpenApiServer()
|
||||||
|
{
|
||||||
|
Description = "Local Server",
|
||||||
|
Url = "http://localhost:5000/",
|
||||||
|
});
|
||||||
});
|
});
|
||||||
services.AddResponseCompression(options =>
|
services.AddResponseCompression(options =>
|
||||||
{
|
{
|
||||||
@ -95,7 +128,10 @@ namespace API
|
|||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "API v1"));
|
app.UseSwaggerUI(c =>
|
||||||
|
{
|
||||||
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Kavita API " + BuildInfo.Version);
|
||||||
|
});
|
||||||
app.UseHangfireDashboard();
|
app.UseHangfireDashboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<li *ngFor="let library of libraries; let idx = index;" class="list-group-item">
|
<li *ngFor="let library of libraries; let idx = index;" class="list-group-item">
|
||||||
<div>
|
<div>
|
||||||
<h4>
|
<h4>
|
||||||
<span id="library-name--{{idx}}">{{library.name | titlecase}}</span>
|
<span id="library-name--{{idx}}">{{library.name}}</span>
|
||||||
<div class="spinner-border text-primary" style="width: 1.5rem; height: 1.5rem;" role="status" *ngIf="scanInProgress.hasOwnProperty(library.id) && scanInProgress[library.id]" title="Scan in progress">
|
<div class="spinner-border text-primary" style="width: 1.5rem; height: 1.5rem;" role="status" *ngIf="scanInProgress.hasOwnProperty(library.id) && scanInProgress[library.id]" title="Scan in progress">
|
||||||
<span class="sr-only">Scan for {{library.name}} in progress</span>
|
<span class="sr-only">Scan for {{library.name}} in progress</span>
|
||||||
</div>
|
</div>
|
||||||
@ -24,7 +24,7 @@
|
|||||||
Last Scanned:
|
Last Scanned:
|
||||||
<span *ngIf="library.lastScanned == '0001-01-01T00:00:00'; else activeDate">Never</span>
|
<span *ngIf="library.lastScanned == '0001-01-01T00:00:00'; else activeDate">Never</span>
|
||||||
<ng-template #activeDate>
|
<ng-template #activeDate>
|
||||||
{{library.lastScanned | date: 'MM/dd/yyyy'}}
|
{{library.lastScanned | date: 'short'}}
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@ -39,6 +39,15 @@ export class ManageLibraryComponent implements OnInit, OnDestroy {
|
|||||||
this.hubService.messages$.pipe(takeWhile(event => event.event === EVENTS.ScanLibraryProgress)).subscribe((event) => {
|
this.hubService.messages$.pipe(takeWhile(event => event.event === EVENTS.ScanLibraryProgress)).subscribe((event) => {
|
||||||
const scanEvent = event.payload as ScanLibraryProgressEvent;
|
const scanEvent = event.payload as ScanLibraryProgressEvent;
|
||||||
this.scanInProgress[scanEvent.libraryId] = scanEvent.progress !== 100;
|
this.scanInProgress[scanEvent.libraryId] = scanEvent.progress !== 100;
|
||||||
|
if (this.scanInProgress[scanEvent.libraryId] === false && scanEvent.progress === 100) {
|
||||||
|
this.libraryService.getLibraries().pipe(take(1)).subscribe(libraries => {
|
||||||
|
const newLibrary = libraries.find(lib => lib.id === scanEvent.libraryId);
|
||||||
|
const existingLibrary = this.libraries.find(lib => lib.id === scanEvent.libraryId);
|
||||||
|
if (existingLibrary !== undefined) {
|
||||||
|
existingLibrary.lastScanned = newLibrary?.lastScanned || existingLibrary.lastScanned;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,6 @@
|
|||||||
<app-card-actionables (actionHandler)="performAction($event)" [actions]="actions" [labelBy]="title"></app-card-actionables>
|
<app-card-actionables (actionHandler)="performAction($event)" [actions]="actions" [labelBy]="title"></app-card-actionables>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<a class="card-title library" [routerLink]="['/library', libraryId]" routerLinkActive="router-link-active" *ngIf="!supressLibraryLink && libraryName">{{libraryName | titlecase}}</a>
|
<a class="card-title library" [routerLink]="['/library', libraryId]" routerLinkActive="router-link-active" *ngIf="!supressLibraryLink && libraryName">{{libraryName}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
Loading…
x
Reference in New Issue
Block a user