Make the wrapper more generic in the event we support other wrappers

This commit is contained in:
Travis Ralston 2017-10-09 20:49:26 -06:00
parent 751e1b9c8c
commit c5146d84ff
9 changed files with 15 additions and 13 deletions

View File

@ -21,6 +21,7 @@ Change the values in Riot's `config.json` as shown below. If you do not have a `
```
"integrations_ui_url": "https://dimension.t2bot.io/riot",
"integrations_rest_url": "https://dimension.t2bot.io/api/v1/scalar",
"integrations_widgets_urls": ["https://dimension.t2bot.io/widgets"],
```
The remaining settings should be tailored for your Riot deployment.

View File

@ -32,7 +32,7 @@ class Dimension {
this._app.use(bodyParser.json());
// Register routes for angular app
this._app.get(['/riot', '/riot/*', '/widget_wrapper', '/widget_wrapper/*'], (req, res) => {
this._app.get(['/riot', '/riot/*', '/widgets', '/widgets/*'], (req, res) => {
res.sendFile(path.join(__dirname, "..", "web-dist", "index.html"));
});

View File

@ -24,7 +24,7 @@ import { IrcApiService } from "./shared/irc-api.service";
import { TravisCiConfigComponent } from "./configs/travisci/travisci-config.component";
import { CustomWidgetConfigComponent } from "./configs/widget/custom_widget/custom_widget-config.component";
import { MyFilterPipe } from "./shared/my-filter.pipe";
import { WidgetWrapperComponent } from "./widget_wrapper/widget_wrapper.component";
import { GenericWidgetWrapperComponent } from "./widget_wrappers/generic/generic.component";
@NgModule({
imports: [
@ -50,7 +50,7 @@ import { WidgetWrapperComponent } from "./widget_wrapper/widget_wrapper.componen
TravisCiConfigComponent,
CustomWidgetConfigComponent,
MyFilterPipe,
WidgetWrapperComponent,
GenericWidgetWrapperComponent,
// Vendor
],

View File

@ -1,12 +1,12 @@
import { RouterModule, Routes } from "@angular/router";
import { HomeComponent } from "./home/home.component";
import { RiotComponent } from "./riot/riot.component";
import { WidgetWrapperComponent } from "./widget_wrapper/widget_wrapper.component";
import { GenericWidgetWrapperComponent } from "./widget_wrappers/generic/generic.component";
const routes: Routes = [
{path: "", component: HomeComponent},
{path: "riot", component: RiotComponent},
{path: "riot/widget_wrapper", component: WidgetWrapperComponent},
{path: "widgets/generic", component: GenericWidgetWrapperComponent},
];
export const routing = RouterModule.forRoot(routes);

View File

@ -40,7 +40,7 @@ export class CustomWidgetConfigComponent extends WidgetComponent implements Moda
}
});
this.wrapperUrl = window.location.origin + "/riot/widget_wrapper?url=";
this.wrapperUrl = window.location.origin + "/widgets/generic?url=";
}
private getWrappedUrl(url: string): string {

View File

@ -10,8 +10,9 @@
<br/>
<p>Point your Riot <code>config.json</code> to Dimension to start using it:</p>
<pre>
"integrations_ui_url": "https://dimension.t2bot.io/riot"
"integrations_rest_url": "https://dimension.t2bot.io/api/v1/scalar"
"integrations_ui_url": "https://dimension.t2bot.io/riot",
"integrations_rest_url": "https://dimension.t2bot.io/api/v1/scalar",
"integrations_widgets_urls": ["https://dimension.t2bot.io/widgets"],
</pre>
<br/>
<br/>

View File

@ -1,14 +1,14 @@
import { Component } from "@angular/core";
import { ApiService } from "../shared/api.service";
import { ApiService } from "../../shared/api.service";
import { ActivatedRoute } from "@angular/router";
import { DomSanitizer, SafeUrl } from "@angular/platform-browser";
@Component({
selector: "my-widget-wrapper",
templateUrl: "widget_wrapper.component.html",
styleUrls: ["widget_wrapper.component.scss"],
selector: "my-generic-widget-wrapper",
templateUrl: "generic.component.html",
styleUrls: ["generic.component.scss"],
})
export class WidgetWrapperComponent {
export class GenericWidgetWrapperComponent {
public isLoading = true;
public canEmbed = false;