Skip to content

Commit

Permalink
[WEB] insert modelling tool via i frame in fbs (#1500)
Browse files Browse the repository at this point in the history
* added fbs modelling component to tabs

* removed unnecessary element

* add temp admin restriction

* lint fix

---------

Co-authored-by: Johannes Kunz <[email protected]>
  • Loading branch information
trKhaled and Medienkunzt authored Nov 10, 2023
1 parent 38eed59 commit 84d6f95
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/fbs-core/web/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { SqlCheckerComponent } from "./page-components/sql-checker/sql-checker.c
import { SqlCheckerResultsComponent } from "./page-components/sql-checker/sql-checker-results/sql-checker-results.component";
import { SqlPlaygroundComponent } from "./page-components/sql-playground/sql-playground.component";
import { AnalyticsToolComponent } from "./page-components/analytics-tool/analytics-tool.component";
import { FbsModellingComponent } from "./page-components/fbs-modelling/fbs-modelling.component";

const routes: Routes = [
{ path: "login", component: LoginComponent },
Expand Down Expand Up @@ -86,6 +87,12 @@ const routes: Routes = [
component: AnalyticsToolComponent,
canActivate: [AuthGuard],
},
// Modelling
{
path: "modelling",
component: FbsModellingComponent,
canActivate: [AuthGuard],
},

// Admin
{
Expand Down
2 changes: 2 additions & 0 deletions modules/fbs-core/web/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ import { HighlightedInputComponent } from "./page-components/sql-playground/sql-
import "mathlive";
import "@cortex-js/compute-engine";
import { MathInputComponent } from "./tool-components/math-input/math-input.component";
import { FbsModellingComponent } from "./page-components/fbs-modelling/fbs-modelling.component";
import { I18NextModule } from "angular-i18next";
import { I18N_PROVIDERS } from "./util/i18n";
import { LanguageMenuComponent } from "./page-components/sidebar/language-menu/language-menu.component";
Expand Down Expand Up @@ -208,6 +209,7 @@ export const httpInterceptorProviders = [
ExportTasksDialogComponent,
HighlightedInputComponent,
MathInputComponent,
FbsModellingComponent,
LanguageMenuComponent,
],
imports: [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<iframe [src]="getURL()" title="FBS-Modellierung" frameBorder="0"></iframe>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
iframe{
width: 100%;
position: absolute;
left: 0;
height: calc(100% - 64px);
margin-top: -10px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Component, OnInit } from "@angular/core";
import { AuthService } from "src/app/service/auth.service";
import { TitlebarService } from "src/app/service/titlebar.service";
import { DomSanitizer, SafeResourceUrl } from "@angular/platform-browser";

@Component({
selector: "app-fbs-modelling",
templateUrl: "./fbs-modelling.component.html",
styleUrls: ["./fbs-modelling.component.scss"],
})
export class FbsModellingComponent implements OnInit {
token: string;
safeUrl: SafeResourceUrl;

constructor(
private titlebar: TitlebarService,
private auth: AuthService,
private sanitizer: DomSanitizer
) {
this.token = this.auth.loadToken();
}
ngOnInit() {
this.titlebar.emitTitle("FBS Modellierung");
}

getURL(): SafeResourceUrl {
const url = `http://localhost:8080/?jsessionid=${this.token}`;
this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(url);
return this.safeUrl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ <h1>
<mat-icon>bar_chart</mat-icon>
<p>{{ "sidebar.label.analyticsPlatform" | i18nextEager }}</p>
</a>

<a
mat-list-item
routerLink="/modelling"
routerLinkActive="selected"
*ngIf="isAdmin || isModerator"
>
<mat-icon> format_shapes</mat-icon>
<p>FBS Modellierung</p>
</a>
</mat-nav-list>

<span class="filler"></span>
Expand Down

0 comments on commit 84d6f95

Please sign in to comment.