Skip to content

Commit cd36ab8

Browse files
fix(app): make rocketChat Link work (#429)
* fix(app): make rocketChat Link work Fixes: #270 * build(helm): freeze helm version
1 parent e54902e commit cd36ab8

File tree

11 files changed

+33
-18
lines changed

11 files changed

+33
-18
lines changed

.azure/pipelines/pr/Phonebook.pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- task: HelmInstaller@1
1717
inputs:
18-
helmVersionToInstall: 'latest'
18+
helmVersionToInstall: '2.14.2'
1919
- script: helm dep update
2020
workingDirectory: 'Phonebook/phonebook/'
2121
- task: HelmDeploy@0

Phonebook.Demo/values.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ employeePictureEndpoint: null
1212
assetsEndpoint: 'https://demo-phonebook.me/assets'
1313
environment: 'preview'
1414
environmentTag: 'demo'
15+
rocketChatUrl: 'https://open.rocket.chat'
1516

1617
frontend:
1718
replicaCount: 1

Phonebook.Frontend/src/app/shared/components/user/user-detail/user-detail.component.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@
7171
>Download Contact</span
7272
>
7373
</button>
74-
<!-- TODO: Add Chat Link -->
75-
<a mat-menu-item target="_blank" rel="noopener" [href]="'example.com/chat' + person.Id.toLowerCase()">
74+
<a *ngIf="rocketChatLink" mat-menu-item target="_blank" rel="noopener" [href]="rocketChatLink">
7675
<mat-icon>chat</mat-icon>
7776
<span i18n="User-detailComponent|Share Menu: Rocket Chat Option@@UserDetailComponentShareRocketChat"
7877
>Rocket Chat</span

Phonebook.Frontend/src/app/shared/components/user/user-detail/user-detail.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { WindowRef } from 'src/app/services/windowRef.service';
1010
import { ColumnDefinitions } from 'src/app/shared/config/columnDefinitions';
1111
import { Person, PersonStatus } from 'src/app/shared/models';
1212
import { BookmarksState, ToggleBookmark } from 'src/app/shared/states';
13+
import { runtimeEnvironment } from 'src/environments/runtime-environment';
1314

1415
@Component({
1516
selector: 'app-user-detail',
@@ -34,6 +35,7 @@ export class UserDetailComponent implements OnInit, OnDestroy {
3435

3536
@Input()
3637
public previewView: boolean = false;
38+
public rocketChatLink: string | null = null;
3739
constructor(
3840
private snackBar: MatSnackBar,
3941
private mailService: MailService,
@@ -44,6 +46,7 @@ export class UserDetailComponent implements OnInit, OnDestroy {
4446

4547
public ngOnInit() {
4648
this.getRandomMoney();
49+
this.rocketChatLink = this.getRocketChatLink();
4750
this.bookmarks$.pipe(untilComponentDestroyed(this)).subscribe(bookmarks => {
4851
const index = bookmarks.findIndex(p => p.Id === this.person.Id);
4952
if (index > -1) {
@@ -94,6 +97,10 @@ export class UserDetailComponent implements OnInit, OnDestroy {
9497
this.store.dispatch(new ToggleBookmark(this.person));
9598
}
9699

100+
public getRocketChatLink(): string | null {
101+
return runtimeEnvironment.rocketChatUrl !== undefined ? runtimeEnvironment.rocketChatUrl + '/direct/' + this.person.Id.toLowerCase() : null;
102+
}
103+
97104
public ngOnDestroy() {}
98105

99106
@HostListener('click')

Phonebook.Frontend/src/environments/EnvironmentInterfaces.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ export interface RuntimeEnvironmentInterface {
5050
* Your Companies Room Planning Tool Url, that users can use to book rooms for meetings etc.
5151
**/
5252
readonly roomPlanningToolUrl?: string;
53+
/**
54+
* The Base Url of the RocketChat Messenger
55+
*/
56+
readonly rocketChatUrl?: string;
5357
}
5458

5559
export enum Environment {

Phonebook.Frontend/src/environments/runtime-environment.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ export const runtimeEnvironment: RuntimeEnvironmentInterface = {
1010
assetsEndpoint: ENV.assetsEndpoint !== '${ASSETS_ENDPOINT}' ? ENV.assetsEndpoint : '/external_assets',
1111
contactEmail: ENV.contactEmail !== '${CONTACT_EMAIL}' ? ENV.contactEmail : undefined,
1212
roomPlanningToolUrl: ENV.roomPlanningToolUrl !== '${ROOMPLANNINGTOOL_URL}' ? ENV.roomPlanningToolUrl : undefined,
13-
contactUrl: ENV.contactUrl !== '${CONTACT_URL}' ? ENV.contactUrl : undefined
13+
contactUrl: ENV.contactUrl !== '${CONTACT_URL}' ? ENV.contactUrl : undefined,
14+
rocketChatUrl: ENV.rocketChatUrl !== '${ROCKETCHAT_URL}' ? ENV.rocketChatUrl : undefined
1415
};

Phonebook.Frontend/src/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
assetsEndpoint: '${ASSETS_ENDPOINT}',
1616
contactEmail: '${CONTACT_EMAIL}',
1717
roomPlanningToolUrl: '${ROOMPLANNINGTOOL_URL}',
18-
contactUrl: '${CONTACT_URL}'
18+
contactUrl: '${CONTACT_URL}',
19+
rocketChatUrl: '${ROCKETCHAT_URL}'
1920
};
2021
</script>
2122
<base href="/" />

Phonebook.Frontend/substitute_variables.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
requiredVariables=( BASE_URL SERVER_NAME ENVIRONMENT ENVIRONMENT_TAG ASSETS_ENDPOINT CONTACT_EMAIL CONTACT_URL)
55

66
# State all optional variables here
7-
optionalVariables=( RAVEN_URL EMPLOYEE_PICTURES_ENDPOINT ROOMPLANNINGTOOL_URL)
7+
optionalVariables=( RAVEN_URL EMPLOYEE_PICTURES_ENDPOINT ROOMPLANNINGTOOL_URL ROCKETCHAT_URL)
88

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

Phonebook/phonebook/templates/frontend-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ spec:
6060
value: "{{ .Values.employeePictureEndpoint }}"
6161
- name: ASSETS_ENDPOINT
6262
value: "{{ .Values.assetsEndpoint }}"
63+
- name: ROCKETCHAT_URL
64+
value: "{{ .Values.rocketChatUrl }}"
6365
resources:
6466
{{- toYaml .Values.resources | nindent 12 }}
6567
{{- with .Values.nodeSelector }}

Phonebook/phonebook/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
# General Variables
44
host: &host 'localhost'
5-
contactUrl: 'https://github.com/T-Systems-MMS/phonebook/issues'
65

76
# Frontend Variables
87
frontend:

0 commit comments

Comments
 (0)