summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts')
-rw-r--r--catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts38
1 files changed, 38 insertions, 0 deletions
diff --git a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts
new file mode 100644
index 0000000000..169cad0411
--- /dev/null
+++ b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts
@@ -0,0 +1,38 @@
+import {Component, OnInit, Input} from "@angular/core";
+import { URLSearchParams } from '@angular/http';
+import {Plugin} from "app/models";
+
+@Component({
+ selector: 'plugin-frame',
+ templateUrl: './plugin-frame.component.html',
+ styleUrls:['plugin-frame.component.less']
+})
+
+export class PluginFrameComponent implements OnInit {
+
+ @Input() plugin: Plugin;
+ @Input() queryParams: Object;
+ pluginUrl: string;
+ private urlSearchParams: URLSearchParams;
+
+ constructor() {
+ this.urlSearchParams = new URLSearchParams();
+ }
+
+ ngOnInit(): void {
+
+ this.pluginUrl = this.plugin.pluginProtocol + "://" +
+ this.plugin.pluginHost + ":" +
+ this.plugin.pluginPort +
+ this.plugin.pluginPath;
+
+ if (this.queryParams && !_.isEmpty(this.queryParams)) {
+ _.forOwn(this.queryParams, (value, key) => {
+ this.urlSearchParams.set(key, value);
+ });
+
+ this.pluginUrl += '?';
+ this.pluginUrl += this.urlSearchParams.toString();
+ }
+ }
+}