Skip to content

Commit 8851917

Browse files
ned29emichaf
authored andcommitted
DELETE: subscription template (#16)
1 parent fd7defa commit 8851917

File tree

5 files changed

+14
-178
lines changed

5 files changed

+14
-178
lines changed

src/main/java/com/ericsson/ei/frontend/EIRequestsController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public String getEIBackendSubscriptionAddress() {
128128
*
129129
*/
130130
@CrossOrigin
131-
@RequestMapping(value = {"/subscriptions", "/subscriptions/*", "/information" }, method = RequestMethod.GET)
131+
@RequestMapping(value = {"/subscriptions", "/subscriptions/*", "/information", "/download/subscriptiontemplate"}, method = RequestMethod.GET)
132132
public ResponseEntity<String> getRequests(Model model, HttpServletRequest request) {
133133
String eiBackendAddressSuffix = request.getServletPath();
134134
String newRequestUrl = getEIBackendSubscriptionAddress() + eiBackendAddressSuffix;

src/main/java/com/ericsson/ei/frontend/SubscriptionFilesController.java

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/main/resources/application.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ ei.backendServerPort=8090
2020
ei.backendContextPath=
2121
ei.useSecureHttp=false
2222

23-
###### Subscription Template file ########
24-
ei.subscriptionFilePath=subscriptions/subscriptionsTemplate.json
25-
2623
###### EI Documentation Link Url ##########
2724
ei.eiffelDocumentationUrls={ "EI GitHub": "https://github.com/Ericsson/eiffel-intelligence-frontend",\
2825
"Eiffel Github": "https://github.com/Ericsson/eiffel",\

src/main/resources/static/js/subscription.js

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -394,50 +394,21 @@ jQuery(document).ready(function() {
394394

395395
// /Start ## get_subscription_template #################################################
396396
$('.container').on( 'click', 'button.get_subscription_template', function (event) {
397-
398397
event.stopPropagation();
399398
event.preventDefault();
400-
401-
// Special handling for MS Explorer Download file window
402-
function createDownloadWindowMSExplorer(filename, url) {
403-
404-
var blob = null;
405-
var xhr = new XMLHttpRequest();
406-
xhr.open("GET", url);
407-
xhr.responseType = "blob";
408-
xhr.onload = function()
409-
{
410-
blob = xhr.response;
411-
window.navigator.msSaveBlob(blob, filename);
412-
}
413-
xhr.send();
414-
}
415-
416-
// HTML5 Download File window handling
417-
function createDownloadWindow(filename, url) {
418-
var pom = document.createElement('a');
419-
pom.setAttribute('href', url);
420-
pom.setAttribute('download', filename);
421-
422-
if (document.createEvent) {
423-
var event = document.createEvent('MouseEvents');
424-
event.initEvent('click', true, true);
425-
pom.dispatchEvent(event);
426-
}
427-
else {
428-
pom.click();
429-
}
430-
}
431-
432-
// If MS Internet Explorer -> special handling for creating download file window.
433-
if (window.navigator.msSaveBlob) {
434-
createDownloadWindowMSExplorer("SubscriptionsTemplate.json", "/download/subscriptiontemplate");
435-
436-
}
437-
else {
438-
// HTML5 Download File window handling
439-
createDownloadWindow("SubscriptionsTemplate.json","\/download\/subscriptiontemplate");
440-
}
399+
function getTemplate(){
400+
var req = new XMLHttpRequest();
401+
req.open("GET", '/download/subscriptiontemplate', true);
402+
req.responseType = "blob";
403+
req.onload = function (event) {
404+
var blob = req.response;
405+
var link = document.createElement('a');
406+
link.href = window.URL.createObjectURL(blob);
407+
link.download = 'subscriptionsTemplate.json';
408+
link.click();
409+
};
410+
req.send();}
411+
getTemplate();
441412
});
442413
// /END ## get_subscription_template #################################################
443414

src/main/resources/subscriptionsTemplate.json

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)