mirror of
https://gitlab.com/openlp/web-remote.git
synced 2024-12-22 19:32:49 +00:00
Merge branch 'bibleversionapi' into 'master'
Bible search options See merge request openlp/web-remote!23
This commit is contained in:
commit
fae84f278b
11783
package-lock.json
generated
Normal file
11783
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -2,14 +2,18 @@
|
|||||||
"name": "@openlp/web-remote",
|
"name": "@openlp/web-remote",
|
||||||
"version": "0.9.4",
|
"version": "0.9.4",
|
||||||
"description": "The web remote for OpenLP, written in Angular",
|
"description": "The web remote for OpenLP, written in Angular",
|
||||||
"keywords": ["OpenLP", "Angular", "Remote"],
|
"keywords": [
|
||||||
|
"OpenLP",
|
||||||
|
"Angular",
|
||||||
|
"Remote"
|
||||||
|
],
|
||||||
"homepage": "https://openlp.org/",
|
"homepage": "https://openlp.org/",
|
||||||
"bugs": "https://gitlab.com/openlp/web-remote",
|
"bugs": "https://gitlab.com/openlp/web-remote",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"author": "OpenLP Developers",
|
"author": "OpenLP Developers",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type" : "git",
|
"type": "git",
|
||||||
"url" : "https://gitlab.com/openlp/web-remote.git"
|
"url": "https://gitlab.com/openlp/web-remote.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
|
@ -24,6 +24,7 @@ import { AppRoutingModule } from './app.routing';
|
|||||||
import { ServiceComponent } from './components/service/service.component';
|
import { ServiceComponent } from './components/service/service.component';
|
||||||
import { AlertComponent } from './components/alert/alert.component';
|
import { AlertComponent } from './components/alert/alert.component';
|
||||||
import { SearchComponent } from './components/search/search.component';
|
import { SearchComponent } from './components/search/search.component';
|
||||||
|
import { SearchOptionsComponent } from './components/search/search-options/search-options.component';
|
||||||
import { SlidesComponent } from './components/slides/slides.component';
|
import { SlidesComponent } from './components/slides/slides.component';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { ChordViewComponent } from './components/chord-view/chord-view.component';
|
import { ChordViewComponent } from './components/chord-view/chord-view.component';
|
||||||
@ -47,6 +48,7 @@ import { ThemesComponent } from './components/themes/themes.component';
|
|||||||
ServiceComponent,
|
ServiceComponent,
|
||||||
AlertComponent,
|
AlertComponent,
|
||||||
SearchComponent,
|
SearchComponent,
|
||||||
|
SearchOptionsComponent,
|
||||||
SlidesComponent,
|
SlidesComponent,
|
||||||
ThemesComponent
|
ThemesComponent
|
||||||
],
|
],
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
<mat-form-field >
|
||||||
|
<mat-select [(ngModel)]="selectedSearchOption" (selectionChange)="setSearchOption($event)" name="selectedSearchOption" [placeholder]="searchOptionsTitle">
|
||||||
|
<mat-option *ngFor="let option of searchOptions" name="searchOptions" [value]="option">
|
||||||
|
{{option}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<br>
|
@ -0,0 +1,3 @@
|
|||||||
|
mat-form-field {
|
||||||
|
width: 100%;
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
import { OpenLPService } from '../../../openlp.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'openlp-search-options',
|
||||||
|
templateUrl: './search-options.component.html',
|
||||||
|
styleUrls: ['./search-options.component.scss'],
|
||||||
|
providers: [OpenLPService]
|
||||||
|
})
|
||||||
|
export class SearchOptionsComponent {
|
||||||
|
public selectedPlugin: string;
|
||||||
|
public searchOptions: Array<string>;
|
||||||
|
public selectedSearchOption: string;
|
||||||
|
public searchOptionsTitle: String = '';
|
||||||
|
|
||||||
|
constructor(private openlpService: OpenLPService) {}
|
||||||
|
|
||||||
|
// Used to display search-options for certain plugins
|
||||||
|
onPluginChange(plugin) {
|
||||||
|
this.selectedPlugin = plugin;
|
||||||
|
if (this.selectedPlugin === 'bibles') {
|
||||||
|
this.searchOptionsTitle = 'Bible version:';
|
||||||
|
this.getSearchOptions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getSearchOptions() {
|
||||||
|
this.openlpService.getSearchOptions(this.selectedPlugin).subscribe(res => {
|
||||||
|
if (this.selectedPlugin === 'bibles') {
|
||||||
|
this.searchOptions = res['bibles'];
|
||||||
|
this.selectedSearchOption = res['primary'];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setSearchOption(option) {
|
||||||
|
this.openlpService.setSearchOption(this.selectedPlugin, option.value).subscribe(res => {});
|
||||||
|
this.selectedSearchOption = option.value;
|
||||||
|
}
|
||||||
|
}
|
@ -1,18 +1,21 @@
|
|||||||
<h3>Search</h3>
|
<h3>Search</h3>
|
||||||
<form #searchForm="ngForm">
|
<form #searchForm="ngForm">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select [(ngModel)]="selectedPlugin" name="selectedPlugin" placeholder="Search for:">
|
<mat-select [(ngModel)]="selectedPlugin" (selectionChange)="onPluginChange($event)" name="selectedPlugin" placeholder="Search for:">
|
||||||
<mat-option *ngFor="let plugin of searchPlugins" name="searchPlugins" [value]="plugin.key">
|
<mat-option *ngFor="let plugin of searchPlugins" name="searchPlugins" [value]="plugin.key">
|
||||||
{{plugin.name}}
|
{{plugin.name}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<br>
|
|
||||||
<mat-form-field>
|
|
||||||
<input matInput [(ngModel)]="searchText" name="searchText" placeholder="Search Text" required>
|
|
||||||
</mat-form-field>
|
|
||||||
<br>
|
<br>
|
||||||
<button mat-raised-button id="searchButton" color="primary" [disabled]="!searchForm.form.valid" (click)="onSubmit()">Search</button>
|
<div [hidden]="!displaySearchOptions">
|
||||||
|
<openlp-search-options></openlp-search-options>
|
||||||
|
</div>
|
||||||
|
<mat-form-field>
|
||||||
|
<input matInput [(ngModel)]="searchText" name="searchText" placeholder="Search Text" required>
|
||||||
|
</mat-form-field>
|
||||||
|
<br>
|
||||||
|
<button mat-raised-button id="searchButton" color="primary" [disabled]="!searchForm.form.valid" (click)="onSubmit()">Search</button>
|
||||||
</form>
|
</form>
|
||||||
<div *ngIf="searchResults">
|
<div *ngIf="searchResults">
|
||||||
<h3>Search Results:</h3>
|
<h3>Search Results:</h3>
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
|
|
||||||
import { OpenLPService } from '../../openlp.service';
|
import { OpenLPService } from '../../openlp.service';
|
||||||
import { PageTitleService } from '../../page-title.service';
|
import { PageTitleService } from '../../page-title.service';
|
||||||
import { PluginDescription } from '../../responses';
|
import { PluginDescription } from '../../responses';
|
||||||
|
import { SearchOptionsComponent } from './search-options/search-options.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'openlp-search',
|
selector: 'openlp-search',
|
||||||
@ -16,6 +17,8 @@ export class SearchComponent implements OnInit {
|
|||||||
public searchResults = null;
|
public searchResults = null;
|
||||||
public selectedPlugin = 'songs';
|
public selectedPlugin = 'songs';
|
||||||
public currentPlugin: string;
|
public currentPlugin: string;
|
||||||
|
public displaySearchOptions: Boolean = false;
|
||||||
|
@ViewChild(SearchOptionsComponent, {static: false}) searchOptions: SearchOptionsComponent;
|
||||||
|
|
||||||
constructor(private pageTitleService: PageTitleService, private openlpService: OpenLPService) {
|
constructor(private pageTitleService: PageTitleService, private openlpService: OpenLPService) {
|
||||||
pageTitleService.changePageTitle('Search');
|
pageTitleService.changePageTitle('Search');
|
||||||
@ -26,6 +29,19 @@ export class SearchComponent implements OnInit {
|
|||||||
this.openlpService.search(this.currentPlugin, this.searchText).subscribe(items => this.searchResults = items);
|
this.openlpService.search(this.currentPlugin, this.searchText).subscribe(items => this.searchResults = items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used to display search-options for certain plugins
|
||||||
|
onPluginChange() {
|
||||||
|
if (this.selectedPlugin === 'bibles') {
|
||||||
|
this.searchOptions.onPluginChange(this.selectedPlugin);
|
||||||
|
this.displaySearchOptions = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this.displaySearchOptions) {
|
||||||
|
this.displaySearchOptions = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sendLive(id) {
|
sendLive(id) {
|
||||||
this.openlpService.sendItemLive(this.currentPlugin, id).subscribe(res => {});
|
this.openlpService.sendItemLive(this.currentPlugin, id).subscribe(res => {});
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,14 @@ export class OpenLPService {
|
|||||||
return this.http.get(`${this.apiURL}/plugins/${plugin}/search?text=${text}`, httpOptions);
|
return this.http.get(`${this.apiURL}/plugins/${plugin}/search?text=${text}`, httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSearchOptions(plugin): Observable<any> {
|
||||||
|
return this.http.get(`${this.apiURL}/plugins/${plugin}/search-options`, httpOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
setSearchOption(plugin, option): Observable<any> {
|
||||||
|
return this.http.post(`${this.apiURL}/plugins/${plugin}/search-options`, {'option': option}, httpOptions);
|
||||||
|
}
|
||||||
|
|
||||||
getServiceItems(): Observable<ServiceItem[]> {
|
getServiceItems(): Observable<ServiceItem[]> {
|
||||||
return this.http.get<ServiceItem[]>(`${this.apiURL}/service/items`, httpOptions);
|
return this.http.get<ServiceItem[]>(`${this.apiURL}/service/items`, httpOptions);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user