changes for plugin submission review
This commit is contained in:
parent
344c1ebf6c
commit
a5d62ddc24
13 changed files with 134 additions and 237 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import {App, ButtonComponent, Component, Modal, Notice, Setting, TextComponent, ToggleComponent} from 'obsidian';
|
||||
import {MediaTypeModel} from '../models/MediaTypeModel';
|
||||
import {APIManager} from '../api/APIManager';
|
||||
import {debugLog} from '../utils/Utils';
|
||||
|
||||
export class MediaDbAdvancedSearchModal extends Modal {
|
||||
query: string;
|
||||
|
|
@ -28,10 +29,10 @@ export class MediaDbAdvancedSearchModal extends Modal {
|
|||
|
||||
async search(): Promise<MediaTypeModel[]> {
|
||||
|
||||
console.log(this.selectedApis);
|
||||
debugLog(this.selectedApis);
|
||||
|
||||
if (!this.query || this.query.length < 3) {
|
||||
new Notice('MDB: Query to short');
|
||||
new Notice('MDB | Query to short');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ export class MediaDbAdvancedSearchModal extends Modal {
|
|||
}
|
||||
|
||||
if (selectedAPICount === 0) {
|
||||
new Notice('MDB: No API selected');
|
||||
new Notice('MDB | No API selected');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -53,12 +54,9 @@ export class MediaDbAdvancedSearchModal extends Modal {
|
|||
this.searchBtn.setDisabled(false);
|
||||
this.searchBtn.setButtonText('Searching...');
|
||||
|
||||
console.log('MDB | query started with ' + this.query);
|
||||
console.log(`MDB | query started with title ${this.query}`);
|
||||
|
||||
const res = await this.apiManager.query(this.query, this.selectedApis);
|
||||
|
||||
// console.log(res)
|
||||
|
||||
this.onSubmit(null, res);
|
||||
} catch (e) {
|
||||
this.onSubmit(e);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {App, ButtonComponent, DropdownComponent, Modal, Notice, Setting, TextComponent} from 'obsidian';
|
||||
import {MediaTypeModel} from '../models/MediaTypeModel';
|
||||
import {APIManager} from '../api/APIManager';
|
||||
import {debugLog} from '../utils/Utils';
|
||||
|
||||
export class MediaDbIdSearchModal extends Modal {
|
||||
query: string;
|
||||
|
|
@ -25,15 +26,15 @@ export class MediaDbIdSearchModal extends Modal {
|
|||
|
||||
async search(): Promise<MediaTypeModel> {
|
||||
|
||||
console.log(this.selectedApi);
|
||||
debugLog(this.selectedApi);
|
||||
|
||||
if (!this.query) {
|
||||
new Notice('MDB: no Id entered');
|
||||
new Notice('MDB | no Id entered');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.selectedApi) {
|
||||
new Notice('MDB: No API selected');
|
||||
new Notice('MDB | No API selected');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -43,16 +44,13 @@ export class MediaDbIdSearchModal extends Modal {
|
|||
this.searchBtn.setDisabled(false);
|
||||
this.searchBtn.setButtonText('Searching...');
|
||||
|
||||
console.log('MDB | query started with id ' + this.query);
|
||||
console.log(`MDB | query started with id ${this.query}`);
|
||||
|
||||
const api = this.apiManager.getApiByName(this.selectedApi);
|
||||
if (!api) {
|
||||
this.onSubmit(new Error('the selected api does not exist'));
|
||||
}
|
||||
const res = await api.getById({id: this.query} as MediaTypeModel); // TODO: fix jank
|
||||
|
||||
// console.log(res)
|
||||
|
||||
this.onSubmit(null, res);
|
||||
} catch (e) {
|
||||
this.onSubmit(e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue