Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(room-plan): smart spaces integration #334

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Phonebook.Demo/values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
host: &host 'demo-phonebook.me'
contactUrl: 'https://github.com/T-Systems-MMS/phonebook/issues'
roomPlanningToolUrl: null
smartSpacesUrl: null
contactEmail: &contactEmail '[email protected]'
ravenUrl: null
employeePictureEndpoint: null
Expand Down
1 change: 1 addition & 0 deletions Phonebook.Frontend/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ services:
RAVEN_URL: 'https://[email protected]/1'
EMPLOYEE_PICTURES_ENDPOINT: 'https://pictures.example.com/'
ASSETS_ENDPOINT: 'https://localhost:8081/api/assets'
SMARTSPACES_URL: 'http://example.com'
ROOMPLANNINGTOOL_URL: 'http://example.com'
ports:
- 80:80
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
<div class="svg-container" [style.display]="floorPlanSVG ? 'block' : 'none'" #floorplanSVG></div>
<!-- Container for Smart Spaces -->
<ng-container *ngIf="floorplan == 'DDR7HausD24' && runtimeEnvironment.smartSpacesUrl">
<mat-slide-toggle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should display it straight away, no asking or toggle required. Just fallback to the old roomplan if there is an error.

color="primary"
class="pb-flex"
(toggleChange)="showSmartSpaces = !showSmartSpaces && (showSpinner = true)"
[checked]="showSmartSpaces"
i18n="Room-planComponent|View Smart Spaces Toggle@@Room-planComponentSmartSpacesToggle"
>View Smart Spaces</mat-slide-toggle
>
<div class="pb-center-element pb-margin-top-20" *ngIf="showSpinner">
<mat-progress-spinner mode="indeterminate"></mat-progress-spinner>
</div>
<iframe
*ngIf="showSmartSpaces"
[src]="this.sanitizer.bypassSecurityTrustResourceUrl(runtimeEnvironment.smartSpacesUrl)"
(load)="iframeLoaded()"
></iframe>
</ng-container>
<!-- Container for floorPlanSVG -->
<div class="svg-container" [style.display]="floorPlanSVG && !showSmartSpaces ? 'block' : 'none'" #floorplanSVG></div>
<!-- Use normal Floorplan picture if it is not yet converted -->
<ng-container *ngIf="!floorPlanSVG">
<img
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@
padding-bottom: 40%;
margin: auto;
}

iframe {
height: 700px;
width: 100%;
border: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, ElementRef, Input, OnChanges, OnInit, SimpleChanges, ViewChi
import { FloorplanService } from 'src/app/services/floorplan.service';
import { RuntimeEnvironmentInterface } from 'src/environments/EnvironmentInterfaces';
import { runtimeEnvironment } from 'src/environments/runtime-environment';
import { DomSanitizer } from '@angular/platform-browser';
@Component({
selector: 'app-room-plan',
templateUrl: './room-plan.component.html',
Expand All @@ -16,9 +17,11 @@ export class RoomPlanComponent implements OnInit, OnChanges {
public element: ElementRef;
public floorPlanSVG: string | null = null;
public floorPlanNotFound: boolean = false;
public showSmartSpaces: boolean = false;
public showSpinner: boolean = false;
public runtimeEnvironment: RuntimeEnvironmentInterface = runtimeEnvironment;

constructor(private floorplanService: FloorplanService) {}
constructor(private floorplanService: FloorplanService, public sanitizer: DomSanitizer) {}

public ngOnInit() {
this.refreshRoomPlan();
Expand Down Expand Up @@ -69,4 +72,8 @@ export class RoomPlanComponent implements OnInit, OnChanges {
});
}
}

public iframeLoaded() {
this.showSpinner = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { NgModule } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { RoomPlanComponent } from 'src/app/shared/components/room-plan/room-plan.component';
import { MatSlideToggleModule, MatProgressSpinnerModule } from '@angular/material';

@NgModule({
imports: [CommonModule, MatIconModule, MatButtonModule],
imports: [CommonModule, MatIconModule, MatButtonModule, MatSlideToggleModule, MatProgressSpinnerModule],
declarations: [RoomPlanComponent],
exports: [RoomPlanComponent]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export interface RuntimeEnvironmentInterface {
* Your Companies Room Planning Tool Url, that users can use to book rooms for meetings etc.
**/
readonly roomPlanningToolUrl?: string;
/**
* Your Companies Smart Spaces Url, that users can use to view the Smart Spaces.
**/
readonly smartSpacesUrl?: string;
}

export enum Environment {
Expand Down
4 changes: 4 additions & 0 deletions Phonebook.Frontend/src/environments/runtime-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ export const runtimeEnvironment: RuntimeEnvironmentInterface = {
assetsEndpoint: ENV.assetsEndpoint !== '${ASSETS_ENDPOINT}' ? ENV.assetsEndpoint : '/external_assets',
contactEmail: ENV.contactEmail !== '${CONTACT_EMAIL}' ? ENV.contactEmail : undefined,
roomPlanningToolUrl: ENV.roomPlanningToolUrl !== '${ROOMPLANNINGTOOL_URL}' ? ENV.roomPlanningToolUrl : undefined,
smartSpacesUrl:
ENV.smartSpacesUrl !== '${SMARTSPACES_URL}'
? ENV.smartSpacesUrl
: undefined,
contactUrl: ENV.contactUrl !== '${CONTACT_URL}' ? ENV.contactUrl : undefined
};
4 changes: 4 additions & 0 deletions Phonebook.Frontend/src/i18n/messages.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,10 @@ Diese Seite nutzt Cookies, um die Bedienung der Seite zu verbessern. Cookies wer
<target state="translated">Die Suche ergab keine Treffer.</target>
<note priority="1" from="description">Sentence displayed if search did not return any results</note>
<note priority="1" from="meaning">TableComponent</note>
</trans-unit><trans-unit id="Room-planComponentSmartSpacesToggle" datatype="html">
<source>View Smart Spaces</source><target state="translated">Smart Spaces öffnen</target>
<note priority="1" from="description">View Smart Spaces Toggle</note>
<note priority="1" from="meaning">Room-planComponent</note>
</trans-unit>
<trans-unit id="OrganigramNodeComponentCopiedFirstPart" datatype="html">
<source>Link to</source>
Expand Down
4 changes: 4 additions & 0 deletions Phonebook.Frontend/src/i18n/messages.en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,10 @@
</target>
<note priority="1" from="description">Sentence displayed if search did not return any results</note>
<note priority="1" from="meaning">TableComponent</note>
</trans-unit><trans-unit id="Room-planComponentSmartSpacesToggle" datatype="html">
<source>View Smart Spaces</source><target state="final">View Smart Spaces</target>
<note priority="1" from="description">View Smart Spaces Toggle</note>
<note priority="1" from="meaning">Room-planComponent</note>
</trans-unit>
<trans-unit id="OrganigramNodeComponentCopiedFirstPart" datatype="html">
<source>Link to</source>
Expand Down
4 changes: 4 additions & 0 deletions Phonebook.Frontend/src/i18n/messages.test.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,10 @@
</source><target state="translated">TEST</target>
<note priority="1" from="description">Sentence displayed if search did not return any results</note>
<note priority="1" from="meaning">TableComponent</note>
</trans-unit><trans-unit id="Room-planComponentSmartSpacesToggle" datatype="html">
<source>View Smart Spaces</source><target state="final">TEST</target>
<note priority="1" from="description">View Smart Spaces Toggle</note>
<note priority="1" from="meaning">Room-planComponent</note>
</trans-unit>
</body>
</file>
Expand Down
60 changes: 32 additions & 28 deletions Phonebook.Frontend/src/i18n/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,7 @@
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="ng2.template">
<body>
<trans-unit id="PageInformationComponentSubTitleContribute" datatype="html">
<source>
Call for Contributors!
</source>
<note priority="1" from="description">Subtitle Contributes</note>
<note priority="1" from="meaning">Page-informationComponent</note>
</trans-unit><trans-unit id="PageInformationComponentSectionContribute" datatype="html">
<source>
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span&gt;"/>
The Phonebook is an Open Source Project and lives from his active contributors. There are many different topics
where you can work on. You can help with solving an
<x id="START_LINK" ctype="x-a" equiv-text="&lt;a&gt;"/>Issue<x id="CLOSE_LINK" ctype="x-a" equiv-text="&lt;/a&gt;"/>, work out an User-Guide or
document new <x id="START_LINK_1" ctype="x-a" equiv-text="&lt;a&gt;"/>Bugs<x id="CLOSE_LINK" ctype="x-a" equiv-text="&lt;/a&gt;"/>.
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span&gt;"/>
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span&gt;"/>
You can get in touch with us
<x id="START_LINK_2" ctype="x-a" equiv-text="&lt;a&gt;"/>in our official Repository<x id="CLOSE_LINK" ctype="x-a" equiv-text="&lt;/a&gt;"/> or you take a
look at our <x id="START_LINK_3" ctype="x-a" equiv-text="&lt;a&gt;"/>Documentation<x id="CLOSE_LINK" ctype="x-a" equiv-text="&lt;/a&gt;"/>.
<x id="START_TAG_DIV" ctype="x-div" equiv-text="&lt;div&gt;"/><x id="START_BOLD_TEXT" ctype="x-b" equiv-text="&lt;b&gt;"/>To be a part of this community it is not required to have programming skills.<x id="CLOSE_BOLD_TEXT" ctype="x-b" equiv-text="&lt;/b&gt;"/><x id="CLOSE_TAG_DIV" ctype="x-div" equiv-text="&lt;/div&gt;"/>
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span&gt;"/>
<x id="START_TAG_DIV_2" ctype="x-div" equiv-text="&lt;div&gt;"/>
<x id="START_HEADING_LEVEL2" ctype="x-h2" equiv-text="&lt;h2&gt;"/>Thanks to our Contributors!<x id="CLOSE_HEADING_LEVEL2" ctype="x-h2" equiv-text="&lt;/h2&gt;"/>
<x id="START_TAG_DIV_1" ctype="x-div" equiv-text="&lt;div&gt;"/><x id="CLOSE_TAG_DIV" ctype="x-div" equiv-text="&lt;/div&gt;"/>
<x id="CLOSE_TAG_DIV" ctype="x-div" equiv-text="&lt;/div&gt;"/>
</source>
<note priority="1" from="description">Text for Contribute</note>
<note priority="1" from="meaning">Page-informationComponent</note>
</trans-unit><trans-unit id="WelcomeHeadline" datatype="html">
<trans-unit id="WelcomeHeadline" datatype="html">
<source>
Welcome to the new Phonebook!
</source>
Expand Down Expand Up @@ -669,6 +642,10 @@
</source>
<note priority="1" from="description">Sentence displayed if search did not return any results</note>
<note priority="1" from="meaning">TableComponent</note>
</trans-unit><trans-unit id="Room-planComponentSmartSpacesToggle" datatype="html">
<source>View Smart Spaces</source>
<note priority="1" from="description">View Smart Spaces Toggle</note>
<note priority="1" from="meaning">Room-planComponent</note>
</trans-unit><trans-unit id="RoomPlanComponentNoPlan" datatype="html">
<source>
<x id="START_PARAGRAPH" ctype="x-p" equiv-text="&lt;p&gt;"/>
Expand Down Expand Up @@ -817,6 +794,33 @@
<source>{VAR_PLURAL, plural, =0 {No Learners } =1 {Learner: } other {Learners: } }</source>
<note priority="1" from="description">Learners Property</note>
<note priority="1" from="meaning">OrganigramNodeComponent</note>
</trans-unit><trans-unit id="PageInformationComponentSubTitleContribute" datatype="html">
<source>
Call for Contributors!
</source>
<note priority="1" from="description">Subtitle Contributes</note>
<note priority="1" from="meaning">Page-informationComponent</note>
</trans-unit><trans-unit id="PageInformationComponentSectionContribute" datatype="html">
<source>
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span&gt;"/>
The Phonebook is an Open Source Project and lives from his active contributors. There are many different topics
where you can work on. You can help with solving an
<x id="START_LINK" ctype="x-a" equiv-text="&lt;a&gt;"/>Issue<x id="CLOSE_LINK" ctype="x-a" equiv-text="&lt;/a&gt;"/>, work out an User-Guide or
document new <x id="START_LINK_1" ctype="x-a" equiv-text="&lt;a&gt;"/>Bugs<x id="CLOSE_LINK" ctype="x-a" equiv-text="&lt;/a&gt;"/>.
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span&gt;"/>
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span&gt;"/>
You can get in touch with us
<x id="START_LINK_2" ctype="x-a" equiv-text="&lt;a&gt;"/>in our official Repository<x id="CLOSE_LINK" ctype="x-a" equiv-text="&lt;/a&gt;"/> or you take a
look at our <x id="START_LINK_3" ctype="x-a" equiv-text="&lt;a&gt;"/>Documentation<x id="CLOSE_LINK" ctype="x-a" equiv-text="&lt;/a&gt;"/>.
<x id="START_TAG_DIV" ctype="x-div" equiv-text="&lt;div&gt;"/><x id="START_BOLD_TEXT" ctype="x-b" equiv-text="&lt;b&gt;"/>To be a part of this community it is not required to have programming skills.<x id="CLOSE_BOLD_TEXT" ctype="x-b" equiv-text="&lt;/b&gt;"/><x id="CLOSE_TAG_DIV" ctype="x-div" equiv-text="&lt;/div&gt;"/>
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span&gt;"/>
<x id="START_TAG_DIV_2" ctype="x-div" equiv-text="&lt;div&gt;"/>
<x id="START_HEADING_LEVEL2" ctype="x-h2" equiv-text="&lt;h2&gt;"/>Thanks to our Contributors!<x id="CLOSE_HEADING_LEVEL2" ctype="x-h2" equiv-text="&lt;/h2&gt;"/>
<x id="START_TAG_DIV_1" ctype="x-div" equiv-text="&lt;div&gt;"/><x id="CLOSE_TAG_DIV" ctype="x-div" equiv-text="&lt;/div&gt;"/>
<x id="CLOSE_TAG_DIV" ctype="x-div" equiv-text="&lt;/div&gt;"/>
</source>
<note priority="1" from="description">Text for Contribute</note>
<note priority="1" from="meaning">Page-informationComponent</note>
</trans-unit><trans-unit id="PageInformationComponentTitle" datatype="html">
<source>
Phonebook
Expand Down
1 change: 1 addition & 0 deletions Phonebook.Frontend/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
assetsEndpoint: '${ASSETS_ENDPOINT}',
contactEmail: '${CONTACT_EMAIL}',
roomPlanningToolUrl: '${ROOMPLANNINGTOOL_URL}',
smartSpacesUrl: '${SMARTSPACES_URL}',
contactUrl: '${CONTACT_URL}'
};
</script>
Expand Down
2 changes: 1 addition & 1 deletion Phonebook.Frontend/substitute_variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
requiredVariables=( BASE_URL SERVER_NAME ENVIRONMENT ENVIRONMENT_TAG ASSETS_ENDPOINT CONTACT_EMAIL CONTACT_URL)

# State all optional variables here
optionalVariables=( RAVEN_URL EMPLOYEE_PICTURES_ENDPOINT ROOMPLANNINGTOOL_URL)
optionalVariables=( RAVEN_URL EMPLOYEE_PICTURES_ENDPOINT ROOMPLANNINGTOOL_URL SMARTSPACES_URL)

# BASE_URL - used througout the whole app (e.g. opensearch.xml) - example: https://example.com/

Expand Down
2 changes: 2 additions & 0 deletions Phonebook/phonebook/templates/frontend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ spec:
value: "{{ .Values.employeePictureEndpoint }}"
- name: ASSETS_ENDPOINT
value: "{{ .Values.assetsEndpoint }}"
- name: SMARTSPACES_URL
value: {{ .Values.smartSpacesUrl }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down
1 change: 1 addition & 0 deletions Phonebook/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ We use [traefik](https://traefik.io/) under the hood.
host: &host 'example.com'
contactUrl: '<Your Contact Url, maybe an issue tracker?>'
roomPlanningToolUrl: '<Url to your Room Planning Tool>'
smartSpacesUrl: '<Url to your Smart Spaces Site>'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the variable in the table below?

contactEmail: &contactEmail '<Your Contact Email>'
employeePictureEndpoint: '<Url To you User Picture Endpoint>'
assetsEndpoint: '<Url To you User Assets Endpoint>'
Expand Down