Reformat code
This commit is contained in:
parent
a45232998a
commit
e9aecabab4
17 changed files with 41 additions and 33 deletions
|
@ -1,11 +1,11 @@
|
|||
import { NgModule, ApplicationRef } from "@angular/core";
|
||||
import { ApplicationRef, NgModule } from "@angular/core";
|
||||
import { BrowserModule } from "@angular/platform-browser";
|
||||
import { HttpModule } from "@angular/http";
|
||||
import { FormsModule } from "@angular/forms";
|
||||
import { AppComponent } from "./app.component";
|
||||
import { HomeComponent } from "./home/home.component";
|
||||
import { routing } from "./app.routing";
|
||||
import { removeNgStyles, createNewHosts } from "@angularclass/hmr";
|
||||
import { createNewHosts, removeNgStyles } from "@angularclass/hmr";
|
||||
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
|
||||
import { RiotComponent } from "./riot/riot.component";
|
||||
import { ApiService } from "./shared/api.service";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component } from "@angular/core";
|
||||
import { ModalComponent, DialogRef } from "ngx-modialog";
|
||||
import { DialogRef, ModalComponent } from "ngx-modialog";
|
||||
import { WidgetComponent } from "../widget.component";
|
||||
import { ScalarService } from "../../../shared/scalar.service";
|
||||
import { ConfigModalContext } from "../../../integration/integration.component";
|
||||
|
|
|
@ -52,7 +52,8 @@
|
|||
[(ngModel)]="widget.newUrl" name="widget-url-{{widget.id}}"
|
||||
[disabled]="isUpdating">
|
||||
</label>
|
||||
<button type="button" class="btn btn-primary btn-sm" (click)="validateAndSaveWidget(widget)">Save
|
||||
<button type="button" class="btn btn-primary btn-sm" (click)="validateAndSaveWidget(widget)">
|
||||
Save
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline btn-sm" (click)="toggleWidget(widget)">
|
||||
Cancel
|
||||
|
|
|
@ -52,7 +52,8 @@
|
|||
[(ngModel)]="widget.data.newDimChannelName" name="widget-url-{{widget.id}}"
|
||||
[disabled]="isUpdating">
|
||||
</label>
|
||||
<button type="button" class="btn btn-primary btn-sm" (click)="validateAndSaveWidget(widget)">Save
|
||||
<button type="button" class="btn btn-primary btn-sm" (click)="validateAndSaveWidget(widget)">
|
||||
Save
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline btn-sm" (click)="toggleWidget(widget)">
|
||||
Cancel
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component } from "@angular/core";
|
||||
import { ModalComponent, DialogRef } from "ngx-modialog";
|
||||
import { DialogRef, ModalComponent } from "ngx-modialog";
|
||||
import { WidgetComponent } from "../widget.component";
|
||||
import { ScalarService } from "../../../shared/scalar.service";
|
||||
import { ConfigModalContext } from "../../../integration/integration.component";
|
||||
|
@ -33,7 +33,7 @@ export class TwitchWidgetConfigComponent extends WidgetComponent implements Moda
|
|||
|
||||
public validateAndAddWidget() {
|
||||
// Replace channel name with path to embedable Twitch Player
|
||||
const url = "https://player.twitch.tv/?channel="+this.newWidgetUrl;
|
||||
const url = "https://player.twitch.tv/?channel=" + this.newWidgetUrl;
|
||||
|
||||
// TODO Somehow Validate if it is a valid Username
|
||||
if (!url) {
|
||||
|
@ -47,9 +47,9 @@ export class TwitchWidgetConfigComponent extends WidgetComponent implements Moda
|
|||
}
|
||||
|
||||
public validateAndSaveWidget(widget: Widget) {
|
||||
const url = "https://player.twitch.tv/?channel="+widget.data.dimChannelName;
|
||||
const url = "https://player.twitch.tv/?channel=" + widget.data.dimChannelName;
|
||||
|
||||
// TODO Somehow Validate if it is a valid Username
|
||||
// TODO Somehow Validate if it is a valid Username
|
||||
if (!url) {
|
||||
this.toaster.pop("warning", "Please enter a Twitch Livestream Channel Name");
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ScalarService } from "../../shared/scalar.service";
|
||||
import { Widget, ScalarToWidgets } from "../../shared/models/widget";
|
||||
import { ScalarToWidgets, Widget } from "../../shared/models/widget";
|
||||
import { ToasterService } from "angular2-toaster";
|
||||
|
||||
const SCALAR_WIDGET_LINKS = [
|
||||
|
@ -89,7 +89,7 @@ export class WidgetComponent {
|
|||
|
||||
private wrapUrl(url: string): string {
|
||||
let encodedURL = this.wrapperUrl + encodeURIComponent(url);
|
||||
|
||||
|
||||
//don't URL encode $vars of the widget Spec
|
||||
//TODO do the same with vars from the data object
|
||||
encodedURL = encodedURL.replace(encodeURIComponent("$matrix_user_id"), "$matrix_user_id");
|
||||
|
|
|
@ -52,7 +52,8 @@
|
|||
[(ngModel)]="widget.newUrl" name="widget-url-{{widget.id}}"
|
||||
[disabled]="isUpdating">
|
||||
</label>
|
||||
<button type="button" class="btn btn-primary btn-sm" (click)="validateAndSaveWidget(widget)">Save
|
||||
<button type="button" class="btn btn-primary btn-sm" (click)="validateAndSaveWidget(widget)">
|
||||
Save
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline btn-sm" (click)="toggleWidget(widget)">
|
||||
Cancel
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { Component } from "@angular/core";
|
||||
import { ModalComponent, DialogRef } from "ngx-modialog";
|
||||
import { DialogRef, ModalComponent } from "ngx-modialog";
|
||||
import { WidgetComponent } from "../widget.component";
|
||||
import { ScalarService } from "../../../shared/scalar.service";
|
||||
import { ConfigModalContext } from "../../../integration/integration.component";
|
||||
import { ToasterService } from "angular2-toaster";
|
||||
import { Widget, WIDGET_SCALAR_YOUTUBE, WIDGET_DIM_YOUTUBE } from "../../../shared/models/widget";
|
||||
import { Widget, WIDGET_DIM_YOUTUBE, WIDGET_SCALAR_YOUTUBE } from "../../../shared/models/widget";
|
||||
import * as embed from "embed-video";
|
||||
import * as $ from "jquery";
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<button myToggleFullscreen="">
|
||||
<img [src]="isFullscreen ? '/img/exit-fullscreen.png' : '/img/enter-fullscreen.png'" />
|
||||
<img [src]="isFullscreen ? '/img/exit-fullscreen.png' : '/img/enter-fullscreen.png'"/>
|
||||
</button>
|
|
@ -16,6 +16,7 @@
|
|||
</pre>
|
||||
<br/>
|
||||
<br/>
|
||||
<p>Learn more on <a href="https://github.com/turt2live/matrix-dimension">Github</a>. Talk about it in <a href="https://matrix.to/#/#dimension:t2l.io">#dimension:t2l.io</a></p>
|
||||
<p>Learn more on <a href="https://github.com/turt2live/matrix-dimension">Github</a>. Talk about it in <a
|
||||
href="https://matrix.to/#/#dimension:t2l.io">#dimension:t2l.io</a></p>
|
||||
</div>
|
||||
</div>
|
|
@ -4,14 +4,17 @@
|
|||
<b>{{ integration.name }}</b>
|
||||
<div style="display: flex;">
|
||||
<div class="switch" *ngIf="integration.type !== 'bridge' && integration.type !== 'widget'">
|
||||
<ui-switch [checked]="integration.isEnabled" size="small" [disabled]="integration.isBroken" (change)="update()"></ui-switch>
|
||||
<ui-switch [checked]="integration.isEnabled" size="small" [disabled]="integration.isBroken"
|
||||
(change)="update()"></ui-switch>
|
||||
</div>
|
||||
<div class="switch" *ngIf="integration.type == 'bridge' && !integration.isEnabled">
|
||||
<i class="fa fa-warning text-warning" ngbTooltip="{{ integration.bridgeError }}"></i>
|
||||
</div>
|
||||
<div class="toolbar">
|
||||
<i class="fa fa-question-circle text-info" ngbTooltip="{{integration.about}}" *ngIf="integration.about"></i>
|
||||
<i class="fa fa-cog text-info config-icon" (click)="configureIntegration()" *ngIf="integration.isEnabled && integration.hasConfig"></i>
|
||||
<i class="fa fa-question-circle text-info" ngbTooltip="{{integration.about}}"
|
||||
*ngIf="integration.about"></i>
|
||||
<i class="fa fa-cog text-info config-icon" (click)="configureIntegration()"
|
||||
*ngIf="integration.isEnabled && integration.hasConfig"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Component, Input, Output, EventEmitter } from "@angular/core";
|
||||
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
||||
import { Integration } from "../shared/models/integration";
|
||||
import { overlayConfigFactory } from "ngx-modialog";
|
||||
import { Modal, BSModalContext } from "ngx-modialog/plugins/bootstrap";
|
||||
import { BSModalContext, Modal } from "ngx-modialog/plugins/bootstrap";
|
||||
import { IntegrationService } from "../shared/integration.service";
|
||||
|
||||
export class ConfigModalContext extends BSModalContext {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { ToasterService } from "angular2-toaster";
|
|||
import { Integration } from "../shared/models/integration";
|
||||
import { IntegrationService } from "../shared/integration.service";
|
||||
import * as _ from "lodash";
|
||||
import { WIDGET_DIM_CUSTOM, WIDGET_DIM_YOUTUBE, WIDGET_DIM_TWITCH, WIDGET_DIM_ETHERPAD } from "../shared/models/widget";
|
||||
import { WIDGET_DIM_CUSTOM, WIDGET_DIM_ETHERPAD, WIDGET_DIM_TWITCH, WIDGET_DIM_YOUTUBE } from "../shared/models/widget";
|
||||
import { IntegrationComponent } from "../integration/integration.component";
|
||||
|
||||
@Component({
|
||||
|
|
|
@ -14,18 +14,18 @@ export interface Integration {
|
|||
|
||||
export interface RSSIntegration extends Integration {
|
||||
feeds: string[];
|
||||
immutableFeeds: {url: string, ownerId: string}[];
|
||||
immutableFeeds: { url: string, ownerId: string }[];
|
||||
}
|
||||
|
||||
export interface TravisCiIntegration extends Integration {
|
||||
repoTemplates: {repoKey: string, template: string, newTemplate: string}[]; // newTemplate is local
|
||||
immutableRepoTemplates: {repoKey: string, template: string, ownerId: string}[];
|
||||
repoTemplates: { repoKey: string, template: string, newTemplate: string }[]; // newTemplate is local
|
||||
immutableRepoTemplates: { repoKey: string, template: string, ownerId: string }[];
|
||||
webhookUrl: string; // immutable
|
||||
}
|
||||
|
||||
export interface IRCIntegration extends Integration {
|
||||
availableNetworks: {name: string, id: string}[];
|
||||
channels: {[networkId: string]: string[]};
|
||||
availableNetworks: { name: string, id: string }[];
|
||||
channels: { [networkId: string]: string[] };
|
||||
}
|
||||
|
||||
export interface EtherpadWidgetIntegration extends Integration {
|
||||
|
|
|
@ -11,11 +11,11 @@ export interface ScalarUserResponse extends ScalarRoomResponse {
|
|||
}
|
||||
|
||||
export interface ScalarErrorResponse extends ScalarResponse {
|
||||
response: {error: {message: string, _error: Error}};
|
||||
response: { error: { message: string, _error: Error } };
|
||||
}
|
||||
|
||||
export interface ScalarSuccessResponse extends ScalarResponse {
|
||||
response: {success: boolean};
|
||||
response: { success: boolean };
|
||||
}
|
||||
|
||||
export interface MembershipStateResponse extends ScalarUserResponse {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Injectable } from "@angular/core";
|
||||
import * as randomString from "random-string";
|
||||
import {
|
||||
JoinRuleStateResponse,
|
||||
MembershipStateResponse,
|
||||
ScalarSuccessResponse,
|
||||
JoinRuleStateResponse,
|
||||
WidgetsResponse
|
||||
} from "./models/scalar_responses";
|
||||
import { Widget } from "./models/widget";
|
||||
|
@ -11,9 +11,9 @@ import { Widget } from "./models/widget";
|
|||
@Injectable()
|
||||
export class ScalarService {
|
||||
|
||||
private static actionMap: {[key: string]: {resolve: (obj: any) => void, reject: (obj: any) => void}} = {};
|
||||
private static actionMap: { [key: string]: { resolve: (obj: any) => void, reject: (obj: any) => void } } = {};
|
||||
|
||||
public static getAndRemoveActionHandler(requestKey: string): {resolve: (obj: any) => void, reject: (obj: any) => void} {
|
||||
public static getAndRemoveActionHandler(requestKey: string): { resolve: (obj: any) => void, reject: (obj: any) => void } {
|
||||
let handler = ScalarService.actionMap[requestKey];
|
||||
ScalarService.actionMap[requestKey] = null;
|
||||
return handler;
|
||||
|
|
|
@ -6,7 +6,8 @@ import * as screenfull from "screenfull";
|
|||
})
|
||||
export class ToggleFullscreenDirective {
|
||||
|
||||
@HostListener("click") onClick() {
|
||||
@HostListener("click")
|
||||
onClick() {
|
||||
// HACK: This should be behind a service in the event the library changes
|
||||
if (screenfull.enabled) {
|
||||
screenfull.toggle();
|
||||
|
|
Loading…
Reference in a new issue