Skip to content

Commit 7c0319b

Browse files
committed
closes #21
1 parent 644abee commit 7c0319b

File tree

8 files changed

+44
-11
lines changed

8 files changed

+44
-11
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.aventstack.extentreports.reporter.configuration;
2+
3+
/**
4+
* Allows selecting a CDN/resource loader for your FileReporter
5+
*
6+
* Note: Some hosts do not allow loading resources via HTTPS protocol:
7+
*
8+
* <ul>
9+
* <li>ExtentReports</li>
10+
* </ul>
11+
*
12+
*/
13+
public enum ResourceCDN {
14+
GITHUB,
15+
EXTENTREPORTS
16+
}

src/main/java/com/aventstack/extentreports/reporter/configuration/RichViewReporterConfiguration.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,12 @@ public void setAutoCreateRelativePathMedia(boolean v) {
8585
usedConfigs.put("autoCreateRelativePathMedia", String.valueOf(v));
8686
}
8787

88+
/**
89+
* Allows selecting a CDN/resource loader for your FileReporter
90+
*
91+
* @param resourceCDN the {@link ResourceCDN}
92+
*/
93+
public void setResourceCDN(ResourceCDN resourceCDN) {
94+
usedConfigs.put("resourceCDN", String.valueOf(resourceCDN).toLowerCase());
95+
}
8896
}
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
<#assign resourceCDN=config.getValue('resourceCDN') cdnURI="cdn.rawgit.com/extent-framework/extent-github-cdn/" csscommit="2bfb90a" jscommit="543bfe2" iconcommit="d74480e">
2+
<#if resourceCDN=="extentreports">
3+
<#assign cdnURI="extentreports.com/resx" csscommit="" jscommit="" iconcommit="">
4+
</#if>
5+
16
<head>
27
<meta charset="utf-8">
38
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
49
<title>${config.getValue("documentTitle")}</title>
5-
<link rel="apple-touch-icon" href="https://cdn.rawgit.com/extent-framework/extent-github-cdn/d74480e/commons/img/logo.png">
6-
<link rel="shortcut icon" href="https://cdn.rawgit.com/extent-framework/extent-github-cdn/d74480e/commons/img/logo.png">
7-
<link href="https://cdn.rawgit.com/extent-framework/extent-github-cdn/2bfb90a/spark/css/style.css" rel="stylesheet" />
10+
<link rel="apple-touch-icon" href="https://${cdnURI}${iconcommit}/commons/img/logo.png">
11+
<link rel="shortcut icon" href="https://${cdnURI}${iconcommit}/commons/img/logo.png">
12+
<link href="https://${cdnURI}${csscommit}/spark/css/style.css" rel="stylesheet" />
813
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
914
</head>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<script src="https://cdn.rawgit.com/extent-framework/extent-github-cdn/543bfe2/spark/js/script.js"></script>
1+
<script src="https://${cdnURI}${jscommit}/spark/js/script.js"></script>
22
<#if config.containsKey("scripts") && config.getValue("scripts")?has_content>
33
<#include "../commons/commons-inject-js.ftl">
44
</#if>

src/main/resources/com/aventstack/extentreports/view/v3html/v3-html-head.ftl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
<#assign timeStampFormat = config.getValue('timeStampFormat')>
2-
<#assign cdn = config.getValue('cdn')>
3-
41
<head>
52
<meta charset='${ config.getValue('encoding') }' />
63
<meta name='description' content='' />
@@ -10,7 +7,7 @@
107

118
<link href='${ config.getValue('protocol') }://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600' rel='stylesheet' type='text/css' />
129
<link href="${ config.getValue('protocol') }://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
13-
<link href='${ config.getValue('protocol') }://cdn.rawgit.com/extent-framework/extent-github-cdn/8644a9c/v3html/css/extent.css' type='text/css' rel='stylesheet' />
10+
<link href='${ config.getValue('protocol') }://${cdnURI}${csscommit}/v3html/css/extent.css' type='text/css' rel='stylesheet' />
1411

1512
<title>${ config.getValue('documentTitle') }</title>
1613

src/main/resources/com/aventstack/extentreports/view/v3html/v3-html-index.ftl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
<#assign parentLabel='suite(s)' childLabel='test(s)' grandChildLabel='method(s)'>
3636
</#if>
3737
</#if>
38+
39+
<#assign timeStampFormat = config.getValue('timeStampFormat')>
40+
<#assign resourceCDN=config.getValue('resourceCDN') cdnURI="cdn.rawgit.com/extent-framework/extent-github-cdn/" csscommit="8644a9c" jscommit="c23457b">
41+
<#if resourceCDN=="extentreports">
42+
<#assign cdnURI="extentreports.com/resx" csscommit="" jscommit="">
43+
</#if>
44+
3845
<!DOCTYPE html>
3946
<html>
4047
<#include 'v3-html-head.ftl'>
@@ -108,7 +115,7 @@
108115
<#if config.getValue('offline')?string == 'true'>
109116
<script src='extent/js/extent.js' type='text/javascript'></script>
110117
<#else>
111-
<script src='${ config.getValue('protocol') }://cdn.rawgit.com/extent-framework/extent-github-cdn/c23457b/v3html/js/extent.js' type='text/javascript'></script>
118+
<script src='${ config.getValue('protocol') }://${cdnURI}${jscommit}/v3html/js/extent.js' type='text/javascript'></script>
112119
</#if>
113120
<#assign hide=(chartVisibleOnOpen=='true')?then(false, true)>
114121
<#if hide>

src/main/resources/html.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ chartVisibilityOnOpen=true
66
documentTitle=ExtentReports
77
reportName=ExtentReports
88
offline=false
9-
cdn=github
9+
resourceCDN=github
1010
timeStampFormat=MMM d, yyyy hh:mm:ss a
1111
enableCategoryView=true
1212
enableExceptionView=true

src/main/resources/spark.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ chartVisibilityOnOpen=true
66
documentTitle=ExtentReports
77
reportName=ExtentReports
88
offline=false
9-
cdn=github
9+
resourceCDN=github
1010
timeStampFormat=MMM d, yyyy hh:mm:ss a
1111
enableCategoryView=true
1212
enableExceptionView=true

0 commit comments

Comments
 (0)