Skip to content

Commit 5aa059b

Browse files
committed
Another attempt to merge the UI into the main project
1 parent d84e696 commit 5aa059b

File tree

349 files changed

+159548
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

349 files changed

+159548
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,6 @@ k8s/ex-prod\.yaml
123123
*secrets*
124124
k8s/ex-*-snapshots.yaml
125125
node_modules
126+
bower_components
126127

127128
*.DotSettings

Dockerfile

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
ARG UI_VERSION="ui:3.1.10"
2-
FROM exceptionless/${UI_VERSION} AS ui
3-
41
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
52
WORKDIR /app
63

@@ -47,24 +44,39 @@ ENTRYPOINT [ "dotnet", "Exceptionless.Job.dll" ]
4744
FROM build AS api-publish
4845
WORKDIR /app/src/Exceptionless.Web
4946

47+
RUN apt-get update -yq
48+
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -yq nodejs && npm install -g bower
49+
5050
RUN dotnet publish -c Release -o out
5151

5252
# api
5353

5454
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS api
5555
WORKDIR /app
5656
COPY --from=api-publish /app/src/Exceptionless.Web/out ./
57-
ENTRYPOINT [ "dotnet", "Exceptionless.Web.dll" ]
57+
COPY ./build/app-docker-entrypoint.sh ./
58+
COPY ./build/update-config.sh ./
59+
60+
ENV EX_ConnectionStrings__Storage=provider=folder;path=/app/storage \
61+
EX_RunJobsInProcess=true \
62+
ASPNETCORE_URLS=http://+:80 \
63+
EX_Html5Mode=true
64+
65+
RUN chmod +x /app/app-docker-entrypoint.sh
66+
RUN chmod +x /app/update-config.sh
67+
68+
EXPOSE 80
69+
70+
ENTRYPOINT ["/app/app-docker-entrypoint.sh"]
5871

5972
# app
6073

6174
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS app
6275

6376
WORKDIR /app
6477
COPY --from=api-publish /app/src/Exceptionless.Web/out ./
65-
COPY --from=ui /app ./wwwroot
66-
COPY --from=ui /usr/local/bin/update-config /usr/local/bin/update-config
6778
COPY ./build/app-docker-entrypoint.sh ./
79+
COPY ./build/update-config.sh ./
6880

6981
ENV EX_ConnectionStrings__Storage=provider=folder;path=/app/storage \
7082
EX_RunJobsInProcess=true \
@@ -84,8 +96,6 @@ FROM exceptionless/elasticsearch:8.6.2 AS exceptionless
8496
WORKDIR /app
8597
COPY --from=job-publish /app/src/Exceptionless.Job/out ./
8698
COPY --from=api-publish /app/src/Exceptionless.Web/out ./
87-
COPY --from=ui /app ./wwwroot
88-
COPY --from=ui /usr/local/bin/update-config /usr/local/bin/update-config
8999
COPY ./build/docker-entrypoint.sh ./
90100
COPY ./build/supervisord.conf /etc/
91101

@@ -140,8 +150,6 @@ FROM exceptionless/elasticsearch:7.17.9 AS exceptionless7
140150
WORKDIR /app
141151
COPY --from=job-publish /app/src/Exceptionless.Job/out ./
142152
COPY --from=api-publish /app/src/Exceptionless.Web/out ./
143-
COPY --from=ui /app ./wwwroot
144-
COPY --from=ui /usr/local/bin/update-config /usr/local/bin/update-config
145153
COPY ./build/docker-entrypoint.sh ./
146154
COPY ./build/supervisord.conf /etc/
147155

build/update-config.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
ApiUrl="${EX_ApiUrl:-}"
4+
Html5Mode="${EX_Html5Mode:-false}"
5+
EnableSsl="${EX_EnableSsl:-false}"
6+
EnableAccountCreation="${EX_EnableAccountCreation:-true}"
7+
8+
OAuth="${EX_ConnectionStrings__OAuth:-}"
9+
IFS=';' read -a oauthParts <<< "$OAuth"
10+
for part in ${oauthParts[@]}
11+
do
12+
key="$( cut -d '=' -f 1 <<< $part )"; echo "key: $key"
13+
value="$( cut -d '=' -f 2- <<< $part )"; echo "value: $value"
14+
15+
if [ "$key" == "FacebookId" ]; then
16+
FacebookAppId=$value
17+
fi
18+
if [ "$key" == "GitHubId" ]; then
19+
GitHubAppId=$value
20+
fi
21+
if [ "$key" == "GoogleId" ]; then
22+
GoogleAppId=$value
23+
fi
24+
if [ "$key" == "IntercomId" ]; then
25+
IntercomAppId=$value
26+
fi
27+
if [ "$key" == "MicrosoftId" ]; then
28+
MicrosoftAppId=$value
29+
fi
30+
if [ "$key" == "SlackId" ]; then
31+
SlackAppId=$value
32+
fi
33+
done
34+
35+
config_header="(function () {
36+
'use strict';
37+
38+
angular.module('app.config', [])"
39+
40+
config="
41+
.constant('BASE_URL', '$ApiUrl' || window.location.origin)
42+
.constant('EXCEPTIONLESS_API_KEY', '$EX_ExceptionlessApiKey')
43+
.constant('EXCEPTIONLESS_SERVER_URL', '$EX_ExceptionlessServerUrl')
44+
.constant('FACEBOOK_APPID', '$FacebookAppId')
45+
.constant('GITHUB_APPID', '$GitHubAppId')
46+
.constant('GOOGLE_APPID', '$GoogleAppId')
47+
.constant('INTERCOM_APPID', '$IntercomAppId')
48+
.constant('LIVE_APPID', '$MicrosoftAppId')
49+
.constant('SLACK_APPID', '$SlackAppId')
50+
.constant('STRIPE_PUBLISHABLE_KEY', '$EX_StripePublishableApiKey')
51+
.constant('SYSTEM_NOTIFICATION_MESSAGE', '$EX_NotificationMessage')
52+
.constant('USE_HTML5_MODE', $Html5Mode)
53+
.constant('USE_SSL', $EnableSsl)
54+
.constant('ENABLE_ACCOUNT_CREATION', $EnableAccountCreation);"
55+
config_footer="
56+
}());"
57+
58+
echo "Exceptionless UI Config"
59+
echo "$config"
60+
61+
checksum=`echo -n $config | md5sum | cut -c 1-32`
62+
echo "$config_header$config$config_footer" > "app.config.$checksum.js"
63+
64+
CONTENT=$(cat index.html)
65+
echo "$CONTENT" | sed -E "s/app\.config\..+\.js/app.config.$checksum.js/" > index.html
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory" : "bower_components"
3+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"curly": false,
3+
"eqeqeq": true,
4+
"immed": true,
5+
"latedef": false,
6+
"newcap": true,
7+
"noarg": true,
8+
"sub": true,
9+
"undef": true,
10+
"boss": true,
11+
"eqnull": true,
12+
"browser": true,
13+
"smarttabs": true,
14+
"globals": {
15+
"jQuery": true,
16+
"angular": true,
17+
"console": true,
18+
"$": true,
19+
"_": true,
20+
"moment": true,
21+
"describe": true,
22+
"beforeEach": true,
23+
"module": true,
24+
"inject": true,
25+
"it": true,
26+
"expect": true,
27+
"xdescribe": true,
28+
"xit": true,
29+
"spyOn": true
30+
}
31+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
temp/
2+
dist/
3+
node_modules/
4+
_SpecRunner.html
5+
.DS_Store
6+
test-results.xml
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "chrome",
9+
"request": "attach",
10+
"port": 5100,
11+
"webRoot": "${workspaceFolder}",
12+
"name": "grunt:serve",
13+
"preLaunchTask": "serve",
14+
}
15+
]
16+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "shell",
6+
"label": "build",
7+
"dependsOn": [
8+
"npm install",
9+
"bower install"
10+
],
11+
"command": "npx",
12+
"args": [
13+
"grunt",
14+
"build"
15+
],
16+
"group": {
17+
"kind": "build",
18+
"isDefault": true
19+
},
20+
"problemMatcher": [
21+
"$lessCompile",
22+
"$jshint"
23+
]
24+
},
25+
{
26+
"type": "shell",
27+
"label": "test",
28+
"dependsOn": "build",
29+
"command": "npx",
30+
"args": [
31+
"grunt",
32+
"test"
33+
],
34+
"group": {
35+
"kind": "test",
36+
"isDefault": true
37+
}
38+
},
39+
{
40+
"type": "shell",
41+
"label": "serve",
42+
"command": "npx",
43+
"args": [
44+
"grunt",
45+
"serve"
46+
],
47+
"problemMatcher": []
48+
},
49+
{
50+
"type": "npm",
51+
"label": "npm install",
52+
"script": "install",
53+
"problemMatcher": []
54+
},
55+
{
56+
"type": "shell",
57+
"label": "bower install",
58+
"dependsOn": "npm install",
59+
"command": "npx",
60+
"args": [
61+
"bower",
62+
"install"
63+
],
64+
"problemMatcher": []
65+
}
66+
]
67+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/* jslint node: true */
2+
'use strict';
3+
4+
//Using exclusion patterns slows down Grunt significantly
5+
//instead of creating a set of patterns like '**/*.js' and '!**/node_modules/**'
6+
//this method is used to create a set of inclusive patterns for all subdirectories
7+
//skipping node_modules, bower_components, dist, and any .dirs
8+
//This enables users to create any directory structure they desire.
9+
var createFolderGlobs = function (fileTypePatterns) {
10+
fileTypePatterns = Array.isArray(fileTypePatterns) ? fileTypePatterns : [fileTypePatterns];
11+
var ignore = ['node_modules', 'bower_components', 'dist', 'temp', 'grunt'];
12+
var fs = require('fs');
13+
return fs.readdirSync(process.cwd())
14+
.map(function (file) {
15+
if (ignore.indexOf(file) !== -1 ||
16+
file.indexOf('.') === 0 || !fs.lstatSync(file).isDirectory()) {
17+
return null;
18+
} else {
19+
return fileTypePatterns.map(function (pattern) {
20+
return file + '/**/' + pattern;
21+
});
22+
}
23+
})
24+
.filter(function (patterns) {
25+
return patterns;
26+
})
27+
.concat(fileTypePatterns);
28+
};
29+
30+
module.exports = function (grunt) {
31+
var path = require('path');
32+
33+
// load createFolderGlobs in options so it can be used across task configurations
34+
grunt.option('folderGlobs', createFolderGlobs);
35+
36+
// load all task configurations
37+
require('load-grunt-config')(grunt, {
38+
configPath: path.join(process.cwd(), 'grunt/task-configs'),
39+
init: true,
40+
loadGruntTasks: {
41+
pattern: 'grunt-*',
42+
config: require('./package.json'),
43+
scope: 'devDependencies'
44+
}
45+
});
46+
47+
grunt.registerTask('build', ['jshint', /* 'htmlangular', */ 'clean:before', 'less', 'dom_munger', 'ngtemplates', 'cssmin', 'concat', 'ngAnnotate', 'uglify', 'copy', 'htmlmin', 'replace', 'cacheBust', 'clean:after']);
48+
grunt.registerTask('default', ['build']);
49+
grunt.registerTask('serve', ['dom_munger:read', 'jshint', 'configureProxies:main', 'connect', 'watch']);
50+
51+
grunt.event.on('watch', function (action, filepath) {
52+
//https://github.com/gruntjs/grunt-contrib-watch/issues/156
53+
54+
var tasksToRun = [];
55+
56+
if (filepath.lastIndexOf('.html') !== -1 && filepath.lastIndexOf('.html') === filepath.length - 5) {
57+
//validate the changed html file
58+
grunt.config('htmlangular.main.files.src', [filepath]);
59+
tasksToRun.push('htmlangular');
60+
}
61+
62+
if (filepath.lastIndexOf('.js') !== -1 && filepath.lastIndexOf('.js') === filepath.length - 3) {
63+
//lint the changed js file
64+
grunt.config('jshint.main.src', filepath);
65+
tasksToRun.push('jshint');
66+
}
67+
68+
//if index.html changed, we need to reread the <script> tags so our next run of karma
69+
//will have the correct environment
70+
if (filepath === 'index.html') {
71+
tasksToRun.push('dom_munger:read');
72+
}
73+
74+
grunt.config('watch.main.tasks', tasksToRun);
75+
});
76+
};

0 commit comments

Comments
 (0)