mirror of
https://gitlab.com/openlp/web-remote.git
synced 2024-12-21 11:02:49 +00:00
Restructure entities
This commit is contained in:
parent
9a8db9619a
commit
92e343a57a
@ -3,15 +3,19 @@ import { MatBottomSheet } from '@angular/material/bottom-sheet';
|
||||
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { State, Display, DisplayMode } from './responses';
|
||||
import { OpenLPService, WebSocketStatus } from './services/openlp.service';
|
||||
import { State } from './models/state';
|
||||
import { Display } from './models/display';
|
||||
import { DisplayMode } from './enums/display-mode.enum';
|
||||
import { OpenLPService } from './services/openlp.service';
|
||||
import { WebSocketStatus } from './enums/web-socket-status.enum';
|
||||
import { WindowRef } from './services/window-ref.service';
|
||||
import { PageTitleService } from './services/page-title.service';
|
||||
import { fromEvent } from 'rxjs';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
import { DisplayModeSelectorComponent } from './components/display-mode-selector/display-mode-selector.component';
|
||||
import { Shortcuts, ShortcutsService } from './services/shortcuts.service';
|
||||
import { ShortcutPipe } from './components/pipes/shortcut.pipe';
|
||||
import { Shortcuts } from './models/shortcuts';
|
||||
import { ShortcutsService } from './services/shortcuts.service';
|
||||
import { ShortcutPipe } from './pipes/shortcut.pipe';
|
||||
import { SettingsService } from './services/settings.service';
|
||||
import * as supportedBrowsers from '../assets/supportedBrowsers';
|
||||
|
||||
|
@ -40,9 +40,9 @@ import { SearchOptionsComponent } from './components/search/search-options/searc
|
||||
import { SlidesComponent } from './components/slides/slides.component';
|
||||
import { ChordViewComponent } from './components/chord-view/chord-view.component';
|
||||
import { StageViewComponent } from './components/stage-view/stage-view.component';
|
||||
import { Nl2BrPipe } from './components/pipes/nl2br.pipe';
|
||||
import { Nl2BrPipe } from './pipes/nl2br.pipe';
|
||||
import { MainViewComponent } from './components/main-view/main-view.component';
|
||||
import { ChordProPipe } from './components/pipes/chordpro.pipe';
|
||||
import { ChordProPipe } from './pipes/chordpro.pipe';
|
||||
import { LoginComponent } from './components/login/login.component';
|
||||
import { ThemesComponent } from './components/themes/themes.component';
|
||||
import { SlideListComponent } from './components/slides/slide-list/slide-list.component';
|
||||
@ -53,7 +53,7 @@ import { ServiceListComponent } from './components/service/service-list/service-
|
||||
import { ChordViewItemComponent } from './components/chord-view/chord-view-item/chord-view-item.component';
|
||||
import { StageViewItemComponent } from './components/stage-view/stage-view-item/stage-view-item.component';
|
||||
import { DisplayModeSelectorComponent } from './components/display-mode-selector/display-mode-selector.component';
|
||||
import { SentenceCasePipe } from './components/pipes/sentence-case.pipe';
|
||||
import { SentenceCasePipe } from './pipes/sentence-case.pipe';
|
||||
import { SettingsComponent } from './components/settings/settings.component';
|
||||
import { StageChordPreviewComponent } from './components/settings/stage-chord-preview/stage-chord-preview.component';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { Slide } from '../../../responses';
|
||||
import { Slide } from '../../../interfaces/slide.interface';
|
||||
|
||||
@Component({
|
||||
selector: 'app-chord-view-item',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { Slide } from '../../responses';
|
||||
import { Slide } from '../../interfaces/slide.interface';
|
||||
import { StageViewComponent } from '../stage-view/stage-view.component';
|
||||
|
||||
@Component({
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MatBottomSheetRef, MAT_BOTTOM_SHEET_DATA } from '@angular/material/bottom-sheet';
|
||||
import { Display, DisplayMode } from 'src/app/responses';
|
||||
import { Display } from '../../models/display';
|
||||
import { DisplayMode } from '../../enums/display-mode.enum';
|
||||
|
||||
@Component({
|
||||
selector: 'openlp-display-mode-sheet',
|
||||
|
@ -3,7 +3,8 @@ import { ActivatedRoute } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { SettingsService } from '../../services/settings.service';
|
||||
import { OpenLPService } from '../../services/openlp.service';
|
||||
import { ServiceItem, Slide } from '../../responses';
|
||||
import { ServiceItem } from '../../interfaces/service-item.interface';
|
||||
import { Slide } from '../../interfaces/slide.interface';
|
||||
|
||||
@Component({
|
||||
selector: 'app-lower-third',
|
||||
|
@ -3,7 +3,7 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { OpenLPService } from '../../services/openlp.service';
|
||||
import { PageTitleService } from '../../services/page-title.service';
|
||||
import { PluginDescription } from '../../responses';
|
||||
import { PluginDescription } from '../../interfaces/plugin-description.interface';
|
||||
import { SearchOptionsComponent } from './search-options/search-options.component';
|
||||
|
||||
@Component({
|
||||
|
@ -3,7 +3,7 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
import { DeleteConfirmationComponent } from './delete-confirmation/delete-confirmation.component';
|
||||
import { OpenLPService } from '../../../services/openlp.service';
|
||||
import { ServiceItem } from '../../../responses';
|
||||
import { ServiceItem } from '../../../interfaces/service-item.interface';
|
||||
|
||||
@Component({
|
||||
selector: 'openlp-service-item',
|
||||
|
@ -2,7 +2,7 @@ import { Component, EventEmitter, OnDestroy, OnInit, Output } from '@angular/cor
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { OpenLPService } from '../../../services/openlp.service';
|
||||
import { ServiceItem } from '../../../responses';
|
||||
import { ServiceItem } from '../../../interfaces/service-item.interface';
|
||||
|
||||
@Component({
|
||||
selector: 'openlp-service-list',
|
||||
|
@ -4,7 +4,7 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { OpenLPService } from '../../services/openlp.service';
|
||||
import { PageTitleService } from '../../services/page-title.service';
|
||||
import { ServiceItem } from '../../responses';
|
||||
import { ServiceItem } from '../../interfaces/service-item.interface';
|
||||
|
||||
@Component({
|
||||
selector: 'openlp-service',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { Slide } from '../../../responses';
|
||||
import { Slide } from '../../../interfaces/slide.interface';
|
||||
|
||||
@Component({
|
||||
selector: 'openlp-slide-item',
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Component, EventEmitter, OnDestroy, OnInit, Output } from '@angular/core';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { Slide } from '../../../responses';
|
||||
import { Slide } from '../../../interfaces/slide.interface';
|
||||
import { OpenLPService } from '../../../services/openlp.service';
|
||||
|
||||
@Component({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { Slide } from '../../../responses';
|
||||
import { Slide } from '../../../interfaces/slide.interface';
|
||||
|
||||
@Component({
|
||||
selector: 'app-stage-view-item',
|
||||
|
@ -3,7 +3,8 @@ import { ActivatedRoute } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { SettingsProperties, SettingsService } from '../../services/settings.service';
|
||||
import { OpenLPService } from '../../services/openlp.service';
|
||||
import { ServiceItem, Slide } from '../../responses';
|
||||
import { ServiceItem } from '../../interfaces/service-item.interface';
|
||||
import { Slide } from '../../interfaces/slide.interface';
|
||||
|
||||
interface Tag {
|
||||
text: string;
|
||||
|
@ -3,7 +3,7 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
import { OpenLPService } from '../../services/openlp.service';
|
||||
import { PageTitleService } from '../../services/page-title.service';
|
||||
import { Theme } from '../../responses';
|
||||
import { Theme } from '../../interfaces/theme.interface';
|
||||
|
||||
@Component({
|
||||
selector: 'openlp-themes',
|
||||
|
6
src/app/enums/display-mode.enum.ts
Normal file
6
src/app/enums/display-mode.enum.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export enum DisplayMode {
|
||||
Blank,
|
||||
Theme,
|
||||
Desktop,
|
||||
Presentation
|
||||
}
|
4
src/app/enums/web-socket-status.enum.ts
Normal file
4
src/app/enums/web-socket-status.enum.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export enum WebSocketStatus {
|
||||
Open,
|
||||
Closed
|
||||
}
|
3
src/app/interfaces/auth-token.interface.ts
Normal file
3
src/app/interfaces/auth-token.interface.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export interface AuthToken {
|
||||
token: string;
|
||||
}
|
4
src/app/interfaces/credentials.interface.ts
Normal file
4
src/app/interfaces/credentials.interface.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface Credentials {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
3
src/app/interfaces/language.interface.ts
Normal file
3
src/app/interfaces/language.interface.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export interface Language {
|
||||
language: string;
|
||||
}
|
3
src/app/interfaces/main-view.interface.ts
Normal file
3
src/app/interfaces/main-view.interface.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export interface MainView {
|
||||
binary_image: string;
|
||||
}
|
5
src/app/interfaces/message-type.interface.ts
Normal file
5
src/app/interfaces/message-type.interface.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export interface MessageType {
|
||||
plugin: string;
|
||||
key: string;
|
||||
value: any;
|
||||
}
|
4
src/app/interfaces/plugin-description.interface.ts
Normal file
4
src/app/interfaces/plugin-description.interface.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface PluginDescription {
|
||||
key: string;
|
||||
name: string;
|
||||
}
|
9
src/app/interfaces/service-item.interface.ts
Normal file
9
src/app/interfaces/service-item.interface.ts
Normal file
@ -0,0 +1,9 @@
|
||||
export interface ServiceItem {
|
||||
id: string;
|
||||
notes: string;
|
||||
plugin: string;
|
||||
selected: boolean;
|
||||
title: string;
|
||||
is_valid: boolean;
|
||||
slides: object[];
|
||||
}
|
4
src/app/interfaces/shortcut.interface.ts
Normal file
4
src/app/interfaces/shortcut.interface.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface Shortcut {
|
||||
action: string;
|
||||
shortcut: string[];
|
||||
}
|
10
src/app/interfaces/slide.interface.ts
Normal file
10
src/app/interfaces/slide.interface.ts
Normal file
@ -0,0 +1,10 @@
|
||||
export interface Slide {
|
||||
selected: boolean;
|
||||
html: string;
|
||||
tag: string;
|
||||
text: string;
|
||||
chords: string;
|
||||
lines: string[];
|
||||
first_slide_of_tag: boolean;
|
||||
img: string;
|
||||
}
|
6
src/app/interfaces/system-information.interface.ts
Normal file
6
src/app/interfaces/system-information.interface.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export interface SystemInformation {
|
||||
websocket_port: number;
|
||||
login_required: boolean;
|
||||
api_version?: number;
|
||||
api_revision?: number;
|
||||
}
|
5
src/app/interfaces/theme.interface.ts
Normal file
5
src/app/interfaces/theme.interface.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export interface Theme {
|
||||
name: string;
|
||||
selected: boolean;
|
||||
thumbnail: object;
|
||||
}
|
7
src/app/models/display.ts
Normal file
7
src/app/models/display.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { DisplayMode } from '../enums/display-mode.enum';
|
||||
|
||||
export class Display {
|
||||
bigDisplayButtons: boolean;
|
||||
darkTheme: boolean;
|
||||
displayMode: DisplayMode;
|
||||
}
|
7
src/app/models/message.ts
Normal file
7
src/app/models/message.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { MessageType } from '../interfaces/message-type.interface';
|
||||
|
||||
export class Message<T extends MessageType> {
|
||||
plugin: T['plugin'];
|
||||
key: T['key'];
|
||||
value: T['value'];
|
||||
}
|
10
src/app/models/shortcuts.ts
Normal file
10
src/app/models/shortcuts.ts
Normal file
@ -0,0 +1,10 @@
|
||||
export class Shortcuts {
|
||||
previousSlide = ['Up', 'PgUp'];
|
||||
nextSlide = ['Down', 'PgDown'];
|
||||
previousItem = ['Left'];
|
||||
nextItem = ['Right'];
|
||||
showDisplay = ['Space'];
|
||||
themeDisplay = ['t'];
|
||||
blankDisplay = ['.'];
|
||||
desktopDisplay = ['d'];
|
||||
}
|
27
src/app/models/state.ts
Normal file
27
src/app/models/state.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import { DisplayMode } from '../enums/display-mode.enum';
|
||||
|
||||
export class State {
|
||||
isAuthorized: boolean;
|
||||
version: number;
|
||||
slide: number;
|
||||
display: boolean;
|
||||
isSecure: boolean;
|
||||
blank: boolean;
|
||||
twelve: boolean;
|
||||
theme: boolean;
|
||||
item: string;
|
||||
|
||||
live = () => !(this.blank || this.display || this.theme);
|
||||
|
||||
get displayMode() {
|
||||
if (this.blank) {
|
||||
return DisplayMode.Blank;
|
||||
} else if (this.display) {
|
||||
return DisplayMode.Desktop;
|
||||
} else if (this.theme) {
|
||||
return DisplayMode.Theme;
|
||||
} else {
|
||||
return DisplayMode.Presentation;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,111 +0,0 @@
|
||||
export interface PluginDescription {
|
||||
key: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export class State {
|
||||
isAuthorized: boolean;
|
||||
version: number;
|
||||
slide: number;
|
||||
display: boolean;
|
||||
isSecure: boolean;
|
||||
blank: boolean;
|
||||
twelve: boolean;
|
||||
theme: boolean;
|
||||
item: string;
|
||||
|
||||
live = () => !(this.blank || this.display || this.theme);
|
||||
|
||||
get displayMode() {
|
||||
if (this.blank) {
|
||||
return DisplayMode.Blank;
|
||||
} else if (this.display) {
|
||||
return DisplayMode.Desktop;
|
||||
} else if (this.theme) {
|
||||
return DisplayMode.Theme;
|
||||
} else {
|
||||
return DisplayMode.Presentation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class Display {
|
||||
bigDisplayButtons: boolean;
|
||||
darkTheme: boolean;
|
||||
displayMode: DisplayMode;
|
||||
}
|
||||
|
||||
export enum DisplayMode {
|
||||
Blank,
|
||||
Theme,
|
||||
Desktop,
|
||||
Presentation
|
||||
}
|
||||
|
||||
export interface Slide {
|
||||
selected: boolean;
|
||||
html: string;
|
||||
tag: string;
|
||||
text: string;
|
||||
chords: string;
|
||||
lines: string[];
|
||||
first_slide_of_tag: boolean;
|
||||
img: string;
|
||||
}
|
||||
|
||||
export interface ServiceItem {
|
||||
id: string;
|
||||
notes: string;
|
||||
plugin: string;
|
||||
selected: boolean;
|
||||
title: string;
|
||||
is_valid: boolean;
|
||||
slides: object[];
|
||||
}
|
||||
|
||||
export interface Theme {
|
||||
name: string;
|
||||
selected: boolean;
|
||||
thumbnail: object;
|
||||
}
|
||||
|
||||
export interface Language {
|
||||
language: string;
|
||||
}
|
||||
|
||||
export interface MainView {
|
||||
binary_image: string;
|
||||
}
|
||||
|
||||
export interface Shortcut {
|
||||
action: string;
|
||||
shortcut: string[];
|
||||
}
|
||||
|
||||
export interface SystemInformation {
|
||||
websocket_port: number;
|
||||
login_required: boolean;
|
||||
api_version?: number;
|
||||
api_revision?: number;
|
||||
}
|
||||
|
||||
export interface Credentials {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface AuthToken {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export class Message<T extends MessageType> {
|
||||
plugin: T['plugin'];
|
||||
key: T['key'];
|
||||
value: T['value'];
|
||||
}
|
||||
|
||||
export interface MessageType {
|
||||
plugin: string;
|
||||
key: string;
|
||||
value: any;
|
||||
}
|
@ -6,24 +6,22 @@ import { TitleCasePipe } from '@angular/common';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Observable, of, Subscription } from 'rxjs';
|
||||
import { catchError, finalize, shareReplay, tap } from 'rxjs/operators';
|
||||
import { SentenceCasePipe } from '../components/pipes/sentence-case.pipe';
|
||||
import { SentenceCasePipe } from '../pipes/sentence-case.pipe';
|
||||
import { LoginComponent } from '../components/login/login.component';
|
||||
|
||||
import {
|
||||
PluginDescription,
|
||||
State,
|
||||
Slide,
|
||||
ServiceItem,
|
||||
Theme,
|
||||
Language,
|
||||
MainView,
|
||||
Shortcut,
|
||||
SystemInformation,
|
||||
Credentials,
|
||||
AuthToken,
|
||||
Message,
|
||||
MessageType
|
||||
} from '../responses';
|
||||
import { PluginDescription } from '../interfaces/plugin-description.interface';
|
||||
import { State } from '../models/state';
|
||||
import { Slide } from '../interfaces/slide.interface';
|
||||
import { ServiceItem } from '../interfaces/service-item.interface'
|
||||
import { Theme } from '../interfaces/theme.interface';
|
||||
import { Language } from '../interfaces/language.interface';
|
||||
import { MainView } from '../interfaces/main-view.interface';
|
||||
import { Shortcut } from '../interfaces/shortcut.interface';
|
||||
import { SystemInformation } from '../interfaces/system-information.interface';
|
||||
import { Credentials } from '../interfaces/credentials.interface';
|
||||
import { AuthToken } from '../interfaces/auth-token.interface';
|
||||
import { Message } from '../models/message';
|
||||
import { MessageType } from '../interfaces/message-type.interface';
|
||||
import { WebSocketStatus } from '../enums/web-socket-status.enum';
|
||||
import { environment } from '../../environments/environment';
|
||||
import { createWebSocket } from '../openlp-websocket';
|
||||
import { deserialize } from '../utils';
|
||||
@ -37,10 +35,6 @@ const httpOptions = {
|
||||
|
||||
const WEBSOCKET_RECONNECT_TIMEOUT = 5 * 1000;
|
||||
|
||||
export enum WebSocketStatus {
|
||||
Open, Closed
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class OpenLPService {
|
||||
private apiURL: string;
|
||||
|
@ -3,17 +3,7 @@ import { EventEmitter, Inject, Injectable } from '@angular/core';
|
||||
import { EventManager } from '@angular/platform-browser';
|
||||
import { Observable } from 'rxjs';
|
||||
import { OpenLPService } from './openlp.service';
|
||||
|
||||
export class Shortcuts {
|
||||
previousSlide = ['Up', 'PgUp'];
|
||||
nextSlide = ['Down', 'PgDown'];
|
||||
previousItem = ['Left'];
|
||||
nextItem = ['Right'];
|
||||
showDisplay = ['Space'];
|
||||
themeDisplay = ['t'];
|
||||
blankDisplay = ['.'];
|
||||
desktopDisplay = ['d'];
|
||||
}
|
||||
import { Shortcuts } from '../models/shortcuts';
|
||||
|
||||
interface Options {
|
||||
element: any;
|
||||
|
Loading…
Reference in New Issue
Block a user