update date for download url

This commit is contained in:
Mohamed Nouffer
2021-09-07 19:47:24 +05:30
parent 599d1325c2
commit 5a09e47171
2 changed files with 60 additions and 49 deletions

View File

@ -28,11 +28,11 @@ const TheContent = () => {
async function fetchSession() { 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" ] } ] }') 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'); // const result = await axios('https://fsbsso.sumasen.net/Shibboleth.sso/Session');
if(JSON.stringify(SsoSession) !== JSON.stringify(result.data)) { // if(JSON.stringify(SsoSession) !== JSON.stringify(result.data)) {
setSsoSession(result.data); // setSsoSession(result.data);
} // }
} }
useEffect(() => { useEffect(() => {
@ -92,48 +92,48 @@ const TheContent = () => {
} }
function get_token_from_storage_or_cookie() { function get_token_from_storage_or_cookie() {
//return true; return true;
const cookies = new Cookies(); // const cookies = new Cookies();
const shib = cookies.get('_shibsession_64656661756c7468747470733a2f2f66736273736f2e73756d6173656e2e6e65742f73686962626f6c657468') // const shib = cookies.get('_shibsession_64656661756c7468747470733a2f2f66736273736f2e73756d6173656e2e6e65742f73686962626f6c657468')
if (shib !== undefined) { // if (shib !== undefined) {
fetchSession().then(() => { // fetchSession().then(() => {
if (SsoSession !== null) { // if (SsoSession !== null) {
console.log(shib); // console.log(shib);
fetchUser().then(() => { // fetchUser().then(() => {
if(UserId === ''){ // if(UserId === ''){
let id = Math.floor(100000 + Math.random() * 900000) // let id = Math.floor(100000 + Math.random() * 900000)
setUserId(id); // setUserId(id);
} // }
const _firstname = UserData.firstname; // const _firstname = UserData.firstname;
const _lastname = UserData.lastname; // const _lastname = UserData.lastname;
const _email = UserData.email; // const _email = UserData.email;
const _empcode = UserData.employee_code; // const _empcode = UserData.employee_code;
const json_str = `[ // const json_str = `[
{ // {
"mailadress": "${_email}", // "mailadress": "${_email}",
"name": "${_lastname} ${_firstname}", // "name": "${_lastname} ${_firstname}",
"jsessionid": ${UserId}, // "jsessionid": ${UserId},
"_idp_session": "", // "_idp_session": "",
"_opensaml_key": "_shibsession_64656661756c7468747470733a2f2f66736273736f2e73756d6173656e2e6e65742f73686962626f6c657468", // "_opensaml_key": "_shibsession_64656661756c7468747470733a2f2f66736273736f2e73756d6173656e2e6e65742f73686962626f6c657468",
"_opensaml_value": "${shib}" // "_opensaml_value": "${shib}"
} // }
]`; // ]`;
//const json_str = '[{"jsessonid": "' + UserId + '" , "name": "' + _firstname + ' ' +_lastname+ '", "mailadress":" ' + _email + '", "empcode": "' + _empcode + '"}]'; // //const json_str = '[{"jsessonid": "' + UserId + '" , "name": "' + _firstname + ' ' +_lastname+ '", "mailadress":" ' + _email + '", "empcode": "' + _empcode + '"}]';
if(_empcode !== null && _empcode !== undefined){ // if(_empcode !== null && _empcode !== undefined){
if(isCSVPath()){ // if(isCSVPath()){
postUserData(json_str); // postUserData(json_str);
} // }
} // }
return true; // return true;
}); // });
} // }
}); // });
} else { // } else {
return null; // return null;
} // }
} }

View File

@ -94,13 +94,24 @@ function Index() {
return; return;
} }
var url = ""; var url = "";
if(graph){ if(startDate !== null){
url = baseUrl + "/generate" + report + "?construction_id=" +selectedcons+ "&construction_date="+getDateWithFormat(startDate)+"&graph=true"; 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{ else {
url = baseUrl + "/generate" + report + "?construction_id=" +selectedcons+ "&construction_date="+getDateWithFormat(startDate); 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) { function downloadReport(url) {