Skip to content

Commit 86cb717

Browse files
mschwrdtnrDanielHabenicht
authored andcommitted
fix(bug-report-dialog): Don't show Bug Report Dialog if no ravenUrl is provided (#220)
* Don't show Bug Report Dialog if no ravenUrl is provided * fix(raven): missing url in deployment * fix(demo): dont use undefined string * chore(frontend): update script to handle optional variables * Update Phonebook.Frontend/substitute_variables.sh * fix(bug-report-dialog): add hasBackdrop resolves #214 resolves #260 resolves part of #99
1 parent 705b54b commit 86cb717

File tree

3 files changed

+35
-19
lines changed

3 files changed

+35
-19
lines changed

Phonebook.Demo/values.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# General Variables
66
host: &host 'demo-phonebook.me'
77
contactUrl: 'https://github.com/T-Systems-MMS/phonebook/issues'
8-
roomPlanningToolUrl: 'undefined'
8+
roomPlanningToolUrl: null
99
contactEmail: &contactEmail 'phonebook-t-systems-mms@mg.telekom.de'
10-
ravenUrl: 'undefined'
11-
employeePictureEndpoint: 'undefined'
10+
ravenUrl: null
11+
employeePictureEndpoint: null
1212
assetsEndpoint: 'https://demo-phonebook.me/assets'
1313
environment: 'preview'
1414
environmentTag: 'demo'

Phonebook.Frontend/src/app/app.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { DisplayNotificationDialog } from 'src/app/shared/dialogs/display-notifi
1111
import { IeWarningComponent } from 'src/app/shared/dialogs/ie-warning/ie-warning.component';
1212
import { AppState, InitTheme, SetSendFeedback } from 'src/app/shared/states/App.state';
1313
import { ReleaseInfoService } from './services/release-info.service';
14+
import { runtimeEnvironment } from 'src/environments/runtime-environment';
1415

1516
@Component({
1617
selector: 'app-root',
@@ -96,8 +97,10 @@ export class AppComponent implements OnInit {
9697

9798
// Ask for Permission to send Bug reports
9899
const test = this.store.selectSnapshot(AppState.sendFeedback);
99-
if (this.store.selectSnapshot(AppState.sendFeedback) == null) {
100-
const matDialogRef = this.matDialog.open(BugReportConsentComponent);
100+
if (this.store.selectSnapshot(AppState.sendFeedback) == null && runtimeEnvironment.ravenURL != null) {
101+
const matDialogRef = this.matDialog.open(BugReportConsentComponent, {
102+
hasBackdrop: true
103+
});
101104
matDialogRef.afterClosed().subscribe(consent => {
102105
this.store.dispatch(new SetSendFeedback(consent));
103106
});
Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/bin/bash
22

3-
# State all variables which are required here
4-
variables=( BASE_URL SERVER_NAME ENVIRONMENT ENVIRONMENT_TAG EMPLOYEE_PICTURES_ENDPOINT ASSETS_ENDPOINT CONTACT_EMAIL CONTACT_URL ROOMPLANNINGTOOL_URL)
3+
# State all required variables here
4+
requiredVariables=( BASE_URL SERVER_NAME ENVIRONMENT ENVIRONMENT_TAG ASSETS_ENDPOINT CONTACT_EMAIL CONTACT_URL)
5+
6+
# State all optional variables here
7+
optionalVariables=( RAVEN_URL EMPLOYEE_PICTURES_ENDPOINT ROOMPLANNINGTOOL_URL)
58

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

@@ -12,27 +15,37 @@ if [[ -z $1 ]]; then
1215
exit 1
1316
fi
1417

15-
for i in "${variables[@]}"
18+
# Variables defined as required will error if not supplied
19+
for i in "${requiredVariables[@]}"
1620
do
1721
# Error if variable is not defined
1822
if [[ -z ${!i} ]]; then
1923
echo 'ERROR: Variable "'$i'" not defined.'
2024
exit 1
2125
fi
26+
done
2227

23-
# Escape special characters, for URLs
24-
replaceString=$(echo ${!i} | sed -e 's/[\/&]/\\&/g')
25-
26-
# Get all files including the environment variable (and ending with '.html') substitute the placeholder with its content
27-
if [ "$DEBUG" = true ]
28-
then
29-
# If DEBUG=true in order to log the replaced files
30-
grep -rl --include \*.html --include \*.xml --include \*.conf "$i" "$1" | xargs sed -i "s/\${""$i""}/$replaceString/Ig;w /dev/stdout"
28+
# Write Variables to files
29+
for i in "${requiredVariables[@]}" "${optionalVariables[@]}"
30+
do
31+
# Inform if a variable is not defined
32+
if [[ -z ${!i} ]]; then
33+
echo 'INFO: Variable "'$i'" not defined.'
3134
else
32-
# If DEBUG=false do it without logging
33-
grep -rl --include \*.html --include \*.xml --include \*.conf "$i" "$1" | xargs sed -i "s/\${""$i""}/$replaceString/Ig"
35+
# Escape special characters, for URLs
36+
replaceString=$(echo ${!i} | sed -e 's/[\/&]/\\&/g')
37+
38+
# Get all files including the environment variable (and ending with '.html') substitute the placeholder with its content
39+
if [ "$DEBUG" = true ]
40+
then
41+
# If DEBUG=true in order to log the replaced files
42+
grep -rl --include \*.html --include \*.xml --include \*.conf "$i" "$1" | xargs sed -i "s/\${""$i""}/$replaceString/Ig;w /dev/stdout"
43+
else
44+
# If DEBUG=false do it without logging
45+
grep -rl --include \*.html --include \*.xml --include \*.conf "$i" "$1" | xargs sed -i "s/\${""$i""}/$replaceString/Ig"
46+
fi
3447
fi
3548
done
3649

3750
# Execute all other parameters
38-
exec "${@:2}"
51+
exec "${@:2}"

0 commit comments

Comments
 (0)