Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amundsen_dev
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Surendar Reddy Mangannagari
amundsen_dev
Commits
65daf096
Unverified
Commit
65daf096
authored
Jun 20, 2019
by
Daniel
Committed by
GitHub
Jun 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made google analytics disabled by default (#198)
* Made google analytics disabled by default
parent
85ce0f9f
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
56 additions
and
39 deletions
+56
-39
config-custom.ts
amundsen_application/static/js/config/config-custom.ts
+1
-0
config-default.ts
amundsen_application/static/js/config/config-default.ts
+1
-0
config-types.ts
amundsen_application/static/js/config/config-types.ts
+1
-0
google-analytics-loader.html
...n/static/templates/fragments/google-analytics-loader.html
+9
-0
google-analytics-post-loader.html
...tic/templates/fragments/google-analytics-post-loader.html
+15
-0
index.html
amundsen_application/static/templates/index.html
+6
-25
webpack.common.ts
amundsen_application/static/webpack.common.ts
+20
-11
email.html
amundsen_application/tests/templates/email.html
+0
-0
index.html
amundsen_application/tests/templates/index.html
+0
-0
test_v0.py
tests/unit/api/mail/test_v0.py
+1
-1
test_v0.py
tests/unit/api/metadata/test_v0.py
+1
-1
test_v0.py
tests/unit/api/search/test_v0.py
+1
-1
No files found.
amundsen_application/static/js/config/config-custom.ts
View file @
65daf096
...
...
@@ -8,6 +8,7 @@ const configCustom: AppConfigCustom = {
showAllTags
:
true
,
},
google
:
{
enabled
:
false
,
key
:
'default-key'
,
sampleRate
:
100
,
},
...
...
amundsen_application/static/js/config/config-default.ts
View file @
65daf096
...
...
@@ -6,6 +6,7 @@ const configDefault: AppConfig = {
showAllTags
:
true
,
},
google
:
{
enabled
:
false
,
key
:
'default-key'
,
sampleRate
:
100
,
},
...
...
amundsen_application/static/js/config/config-types.ts
View file @
65daf096
...
...
@@ -29,6 +29,7 @@ export interface AppConfigCustom {
* Sample Rate - The percentage of users (0 - 100) to track site speed.
*/
interface
GoogleAnalyticsConfig
{
enabled
:
boolean
;
key
:
string
;
sampleRate
:
number
;
}
...
...
amundsen_application/static/templates/fragments/google-analytics-loader.html
0 → 100644
View file @
65daf096
<script
async
src=
"https://www.googletagmanager.com/gtag/js?id=<%= htmlWebpackPlugin.options.config.google.key%>"
></script>
<script>
const
google
=
<%=
JSON
.
stringify
(
htmlWebpackPlugin
.
options
.
config
.
google
)
%>
;
window
.
dataLayer
=
window
.
dataLayer
||
[];
function
gtag
()
{
dataLayer
.
push
(
arguments
);
}
gtag
(
'js'
,
new
Date
());
gtag
(
'config'
,
google
.
key
);
gtag
(
'create'
,
google
.
key
,
{
'siteSpeedSampleRate'
:
google
.
sampleRate
});
</script>
amundsen_application/static/templates/fragments/google-analytics-post-loader.html
0 → 100644
View file @
65daf096
<script
type=
"text/javascript"
>
// Feature detects Navigation Timing API support.
if
(
window
.
performance
)
{
// Gets the number of milliseconds since page load
// (and rounds the result since the value must be an integer).
const
timeSincePageLoad
=
Math
.
round
(
performance
.
now
());
// Sends the timing event to Google Analytics.
gtag
(
'event'
,
'timing_complete'
,
{
'name'
:
'load'
,
'value'
:
timeSincePageLoad
,
'event_category'
:
'JS Dependencies'
});
}
</script>
amundsen_application/static/templates/index.html
View file @
65daf096
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script
async
src=
"https://www.googletagmanager.com/gtag/js?id=<%= htmlWebpackPlugin.options.config.google.key%>"
></script>
<script>
const
google
=
<%=
JSON
.
stringify
(
htmlWebpackPlugin
.
options
.
config
.
google
)
%>
;
window
.
dataLayer
=
window
.
dataLayer
||
[];
function
gtag
()
{
dataLayer
.
push
(
arguments
);
}
gtag
(
'js'
,
new
Date
());
gtag
(
'config'
,
google
.
key
);
gtag
(
'create'
,
google
.
key
,
{
'siteSpeedSampleRate'
:
google
.
sampleRate
});
</script>
{% if
<
%=
htmlWebpackPlugin
.
options
.
config
.
google
.
enabled
%
>
%}
{% include 'fragments/google-analytics-loader.html' %}
{% endif %}
<meta
charset=
"utf-8"
>
<link
rel=
"shortcut icon"
href=
"/static/images/favicon.png"
>
<link
href=
"/static/dist/main.css"
type=
"text/css"
rel=
"stylesheet"
/>
...
...
@@ -20,19 +13,7 @@
<script
src=
"/static/dist/vendors.js"
type=
"text/javascript"
></script>
<script
src=
"/static/dist/main.js"
type=
"text/javascript"
></script>
</body>
<script
type=
"text/javascript"
>
// Feature detects Navigation Timing API support.
if
(
window
.
performance
)
{
// Gets the number of milliseconds since page load
// (and rounds the result since the value must be an integer).
const
timeSincePageLoad
=
Math
.
round
(
performance
.
now
());
// Sends the timing event to Google Analytics.
gtag
(
'event'
,
'timing_complete'
,
{
'name'
:
'load'
,
'value'
:
timeSincePageLoad
,
'event_category'
:
'JS Dependencies'
});
}
</script>
{% if
<
%=
htmlWebpackPlugin
.
options
.
config
.
google
.
enabled
%
>
%}
{% include 'fragments/google-analytics-post-loader.html' %}
{% endif %}
</html>
amundsen_application/static/webpack.common.ts
View file @
65daf096
import
*
as
path
from
'path'
;
import
*
as
fs
from
'fs'
;
import
*
as
webpack
from
'webpack'
;
import
HtmlWebpackPlugin
from
'html-webpack-plugin'
;
import
MiniCssExtractPlugin
from
'mini-css-extract-plugin'
;
import
appConfig
from
'./js/config/config'
;
const
walkSync
=
(
dir
,
filelist
=
[])
=>
{
fs
.
readdirSync
(
dir
).
forEach
(
file
=>
{
filelist
=
fs
.
statSync
(
path
.
join
(
dir
,
file
)).
isDirectory
()
?
walkSync
(
path
.
join
(
dir
,
file
),
filelist
)
:
filelist
.
concat
(
path
.
join
(
dir
,
file
));
});
return
filelist
;
};
const
templatesList
=
walkSync
(
'templates'
);
const
htmlWebpackPluginConfig
=
templatesList
.
map
(
file
=>
{
return
new
HtmlWebpackPlugin
({
filename
:
file
,
template
:
file
,
config
:
appConfig
,
inject
:
false
,
});
});
const
config
:
webpack
.
Configuration
=
{
entry
:
{
main
:
[
'babel-polyfill'
,
path
.
join
(
__dirname
,
'/css/styles.scss'
),
path
.
join
(
__dirname
,
'/js/index.tsx'
)],
...
...
@@ -51,17 +70,7 @@ const config: webpack.Configuration = {
},
plugins
:
[
new
MiniCssExtractPlugin
(),
new
HtmlWebpackPlugin
({
template
:
path
.
join
(
__dirname
,
'templates/index.html'
),
filename
:
'templates/index.html'
,
config
:
appConfig
,
inject
:
false
,
}),
new
HtmlWebpackPlugin
({
template
:
path
.
join
(
__dirname
,
'templates/email.html'
),
filename
:
'templates/email.html'
,
inject
:
false
,
}),
...
htmlWebpackPluginConfig
,
],
optimization
:
{
splitChunks
:
{
...
...
amundsen_application/tests/templates/email.html
0 → 100644
View file @
65daf096
amundsen_application/tests/templates/index.html
0 → 100644
View file @
65daf096
tests/unit/api/mail/test_v0.py
View file @
65daf096
...
...
@@ -8,7 +8,7 @@ from flask import Response, jsonify, make_response
from
amundsen_application
import
create_app
from
amundsen_application.base.base_mail_client
import
BaseMailClient
local_app
=
create_app
(
'amundsen_application.config.
LocalConfig'
,
'static
/templates'
)
local_app
=
create_app
(
'amundsen_application.config.
TestConfig'
,
'tests
/templates'
)
class
MockMailClient
(
BaseMailClient
):
...
...
tests/unit/api/metadata/test_v0.py
View file @
65daf096
...
...
@@ -10,7 +10,7 @@ from amundsen_application.api.metadata.v0 import \
from
amundsen_application.tests.test_utils
import
TEST_USER_ID
local_app
=
create_app
(
'amundsen_application.config.TestConfig'
)
local_app
=
create_app
(
'amundsen_application.config.TestConfig'
,
'tests/templates'
)
class
MetadataTest
(
unittest
.
TestCase
):
...
...
tests/unit/api/search/test_v0.py
View file @
65daf096
...
...
@@ -7,7 +7,7 @@ from http import HTTPStatus
from
amundsen_application
import
create_app
from
amundsen_application.api.search.v0
import
_create_url_with_field
,
SEARCH_ENDPOINT
local_app
=
create_app
(
'amundsen_application.config.
LocalConfig'
,
'static
/templates'
)
local_app
=
create_app
(
'amundsen_application.config.
TestConfig'
,
'tests
/templates'
)
class
SearchTest
(
unittest
.
TestCase
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment