Ran formatter, removed unused array and updated APIModel.ts
This commit is contained in:
parent
f52060482a
commit
5eec98d127
8 changed files with 44 additions and 45 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import { MediaTypeModel } from '../models/MediaTypeModel';
|
import { MediaTypeModel } from '../models/MediaTypeModel';
|
||||||
import { MediaType } from '../utils/MediaType';
|
import { MediaType } from '../utils/MediaType';
|
||||||
|
import { MediaDbPluginSettings } from 'src/settings/Settings';
|
||||||
import MediaDbPlugin from '../main';
|
import MediaDbPlugin from '../main';
|
||||||
|
|
||||||
export abstract class APIModel {
|
export abstract class APIModel {
|
||||||
|
|
@ -19,7 +20,7 @@ export abstract class APIModel {
|
||||||
abstract getById(id: string): Promise<MediaTypeModel>;
|
abstract getById(id: string): Promise<MediaTypeModel>;
|
||||||
|
|
||||||
hasType(type: MediaType): boolean {
|
hasType(type: MediaType): boolean {
|
||||||
if (this.types.contains(type) && !(this.plugin.settings[[this.apiName, type].filter(s => s).join('') as keyof typeof this.plugin.settings] === false)){
|
if (this.types.contains(type) && !(this.plugin.settings[(this.apiName + type) as keyof MediaDbPluginSettings] === false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,6 @@ export class MediaDbSearchModal extends Modal {
|
||||||
|
|
||||||
const placeholder = 'Search by title';
|
const placeholder = 'Search by title';
|
||||||
const searchComponent = new TextComponent(contentEl);
|
const searchComponent = new TextComponent(contentEl);
|
||||||
const toggleComponents = [];
|
|
||||||
let currentToggle: ToggleComponent = null;
|
let currentToggle: ToggleComponent = null;
|
||||||
|
|
||||||
searchComponent.inputEl.style.width = '100%';
|
searchComponent.inputEl.style.width = '100%';
|
||||||
|
|
@ -119,7 +118,6 @@ export class MediaDbSearchModal extends Modal {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
apiToggleComponentWrapper.appendChild(apiToggleComponent.toggleEl);
|
apiToggleComponentWrapper.appendChild(apiToggleComponent.toggleEl);
|
||||||
toggleComponents.push(apiToggleComponent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contentEl.createDiv({ cls: 'media-db-plugin-spacer' });
|
contentEl.createDiv({ cls: 'media-db-plugin-spacer' });
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ export class MediaTypeManager {
|
||||||
mediaTemplateMap: Map<MediaType, string>;
|
mediaTemplateMap: Map<MediaType, string>;
|
||||||
mediaFolderMap: Map<MediaType, string>;
|
mediaFolderMap: Map<MediaType, string>;
|
||||||
|
|
||||||
constructor() {}
|
constructor() { }
|
||||||
|
|
||||||
updateTemplates(settings: MediaDbPluginSettings): void {
|
updateTemplates(settings: MediaDbPluginSettings): void {
|
||||||
this.mediaFileNameTemplateMap = new Map<MediaType, string>();
|
this.mediaFileNameTemplateMap = new Map<MediaType, string>();
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ export function unCamelCase(str: string): string {
|
||||||
// space before last upper in a sequence followed by lower
|
// space before last upper in a sequence followed by lower
|
||||||
.replace(/\b([A-Z]+)([A-Z])([a-z])/, '$1 $2$3')
|
.replace(/\b([A-Z]+)([A-Z])([a-z])/, '$1 $2$3')
|
||||||
// uppercase the first character
|
// uppercase the first character
|
||||||
.replace(/^./, function (str) {
|
.replace(/^./, function(str) {
|
||||||
return str.toUpperCase();
|
return str.toUpperCase();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue