From 5a09e471717a575bb6c8d5af7833080d42e0781a Mon Sep 17 00:00:00 2001 From: Mohamed Nouffer Date: Tue, 7 Sep 2021 19:47:24 +0530 Subject: [PATCH] update date for download url --- src/containers/TheContent.js | 88 +++++++++++++++---------------- src/views/BoxDisplacemen/index.js | 21 ++++++-- 2 files changed, 60 insertions(+), 49 deletions(-) diff --git a/src/containers/TheContent.js b/src/containers/TheContent.js index cf6f0ae..c30e253 100644 --- a/src/containers/TheContent.js +++ b/src/containers/TheContent.js @@ -28,11 +28,11 @@ const TheContent = () => { async function fetchSession() { - //setSsoSession('{ "expiration": 468, "client_address": "111.223.144.163", "protocol": "urn:oasis:names:tc:SAML:2.0:protocol", "identity_provider": "https://sso.ts.bizside.biz/idp/shibboleth", "authn_instant": "2021-09-03T08:26:41.248Z", "authncontext_class": "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport", "attributes": [ { "name": "mail", "values": [ "akira.miyata@mobilous.com" ] } ] }') - const result = await axios('https://fsbsso.sumasen.net/Shibboleth.sso/Session'); - if(JSON.stringify(SsoSession) !== JSON.stringify(result.data)) { - setSsoSession(result.data); - } + setSsoSession('{ "expiration": 468, "client_address": "111.223.144.163", "protocol": "urn:oasis:names:tc:SAML:2.0:protocol", "identity_provider": "https://sso.ts.bizside.biz/idp/shibboleth", "authn_instant": "2021-09-03T08:26:41.248Z", "authncontext_class": "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport", "attributes": [ { "name": "mail", "values": [ "akira.miyata@mobilous.com" ] } ] }') + // const result = await axios('https://fsbsso.sumasen.net/Shibboleth.sso/Session'); + // if(JSON.stringify(SsoSession) !== JSON.stringify(result.data)) { + // setSsoSession(result.data); + // } } useEffect(() => { @@ -92,48 +92,48 @@ const TheContent = () => { } function get_token_from_storage_or_cookie() { - //return true; - const cookies = new Cookies(); - const shib = cookies.get('_shibsession_64656661756c7468747470733a2f2f66736273736f2e73756d6173656e2e6e65742f73686962626f6c657468') - if (shib !== undefined) { - fetchSession().then(() => { - if (SsoSession !== null) { - console.log(shib); - fetchUser().then(() => { - if(UserId === ''){ - let id = Math.floor(100000 + Math.random() * 900000) - setUserId(id); - } - const _firstname = UserData.firstname; - const _lastname = UserData.lastname; - const _email = UserData.email; - const _empcode = UserData.employee_code; + return true; + // const cookies = new Cookies(); + // const shib = cookies.get('_shibsession_64656661756c7468747470733a2f2f66736273736f2e73756d6173656e2e6e65742f73686962626f6c657468') + // if (shib !== undefined) { + // fetchSession().then(() => { + // if (SsoSession !== null) { + // console.log(shib); + // fetchUser().then(() => { + // if(UserId === ''){ + // let id = Math.floor(100000 + Math.random() * 900000) + // setUserId(id); + // } + // const _firstname = UserData.firstname; + // const _lastname = UserData.lastname; + // const _email = UserData.email; + // const _empcode = UserData.employee_code; - const json_str = `[ - { - "mailadress": "${_email}", - "name": "${_lastname} ${_firstname}", - "jsessionid": ${UserId}, - "_idp_session": "", - "_opensaml_key": "_shibsession_64656661756c7468747470733a2f2f66736273736f2e73756d6173656e2e6e65742f73686962626f6c657468", - "_opensaml_value": "${shib}" - } - ]`; + // const json_str = `[ + // { + // "mailadress": "${_email}", + // "name": "${_lastname} ${_firstname}", + // "jsessionid": ${UserId}, + // "_idp_session": "", + // "_opensaml_key": "_shibsession_64656661756c7468747470733a2f2f66736273736f2e73756d6173656e2e6e65742f73686962626f6c657468", + // "_opensaml_value": "${shib}" + // } + // ]`; - //const json_str = '[{"jsessonid": "' + UserId + '" , "name": "' + _firstname + ' ' +_lastname+ '", "mailadress":" ' + _email + '", "empcode": "' + _empcode + '"}]'; - if(_empcode !== null && _empcode !== undefined){ - if(isCSVPath()){ - postUserData(json_str); - } - } - return true; - }); - } - }); - } else { - return null; - } + // //const json_str = '[{"jsessonid": "' + UserId + '" , "name": "' + _firstname + ' ' +_lastname+ '", "mailadress":" ' + _email + '", "empcode": "' + _empcode + '"}]'; + // if(_empcode !== null && _empcode !== undefined){ + // if(isCSVPath()){ + // postUserData(json_str); + // } + // } + // return true; + // }); + // } + // }); + // } else { + // return null; + // } } diff --git a/src/views/BoxDisplacemen/index.js b/src/views/BoxDisplacemen/index.js index ff9e6d9..910fc6e 100644 --- a/src/views/BoxDisplacemen/index.js +++ b/src/views/BoxDisplacemen/index.js @@ -94,13 +94,24 @@ function Index() { return; } var url = ""; - if(graph){ - url = baseUrl + "/generate" + report + "?construction_id=" +selectedcons+ "&construction_date="+getDateWithFormat(startDate)+"&graph=true"; + if(startDate !== null){ + if(graph){ + url = baseUrl + "/generate" + report + "?construction_id=" +selectedcons+ "&construction_date="+getDateWithFormat(startDate)+"&graph=true"; + } + else{ + url = baseUrl + "/generate" + report + "?construction_id=" +selectedcons+ "&construction_date="+getDateWithFormat(startDate); + } + downloadReport(url); } - else{ - url = baseUrl + "/generate" + report + "?construction_id=" +selectedcons+ "&construction_date="+getDateWithFormat(startDate); + else { + if(graph){ + url = baseUrl + "/generate" + report + "?construction_id=" +selectedcons+"&graph=true"; + } + else{ + url = baseUrl + "/generate" + report + "?construction_id=" +selectedcons; + } + downloadReport(url); } - downloadReport(url); } function downloadReport(url) {