From 246c5ec451ead3a4ff7b0a9ade9f3c1825881126 Mon Sep 17 00:00:00 2001 From: Sabina Talipova <87288324+sabina-talipova@users.noreply.github.com> Date: Mon, 10 Jul 2023 09:53:23 +1200 Subject: [PATCH] MNT ESLint issues (#157) --- client/dist/js/bundle.js | 2 +- client/src/components/LoginSession/LoginSessionContainer.js | 2 +- client/src/components/LoginSession/tests/LoginSession-test.js | 2 +- .../components/LoginSession/tests/LoginSessionContainer-test.js | 2 +- .../src/components/SessionManagerField/SessionManagerField.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index 046f3a4..2dac49a 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1 @@ -!function(){"use strict";var e={274:function(e,t,n){var a,s=(a=n(521))&&a.__esModule?a:{default:a};window.document.addEventListener("DOMContentLoaded",(()=>{(0,s.default)()}))},521:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=u(n(239)),s=u(n(601)),o=u(n(592)),r=u(n(648));function u(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.component.registerMany({LoginSession:a.default,LoginSessionContainer:s.default,SessionManagerField:o.default})}},239:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=l(n(754)),s=l(n(86)),o=l(n(363)),r=l(n(488)),u=l(n(17));function l(e){return e&&e.__esModule?e:{default:e}}const i="L LT";function d(e){const t=a.default._t("SessionManager.CURRENT","Current"),n=e.submitting||e.complete&&!e.failed?a.default._t("SessionManager.LOGGING_OUT","Logging out..."):a.default._t("SessionManager.LOG_OUT","Log out");return o.default.createElement("div",{className:"login-session "+(e.complete&&!e.failed?"hidden":"")},o.default.createElement("p",null,e.UserAgent),o.default.createElement("p",{className:"text-muted"},e.IPAddress,function(){r.default.locale(a.default.detectLocale());const t=r.default.utc(e.Created).local(),n=r.default.utc(e.LastAccessed).local(),s=t.fromNow(),u=n.fromNow(),l=a.default.inject(a.default._t("Admin.ACTIVITY_TOOLTIP_TEXT","Signed in {signedIn}, Last active {lastActive}"),{signedIn:t.format(i),lastActive:n.format(i)}),d=e.IsCurrent?a.default.inject(a.default._t("SessionManager.AUTHENTICATED","authenticated {createdElapsed}..."),{createdElapsed:s}):a.default.inject(a.default._t("SessionManager.LAST_ACTIVE","last active {lastAccessedElapsed}..."),{lastAccessedElapsed:u});return o.default.createElement("span",{"data-toggle":"tooltip","data-placement":"top",title:l},", ",d)}()),o.default.createElement("p",null,e.IsCurrent&&o.default.createElement("strong",{className:"text-success"},t),!e.IsCurrent&&o.default.createElement(u.default,{color:"link",className:"login-session__logout",onClick:()=>{e.submitting||e.complete||e.logout()}},n)))}d.propTypes={IPAddress:s.default.string.isRequired,IsCurrent:s.default.bool,UserAgent:s.default.string,Created:s.default.string.isRequired,LastAccessed:s.default.string.isRequired,submitting:s.default.bool.isRequired,complete:s.default.bool.isRequired,failed:s.default.bool.isRequired};var c=d;t.default=c},601:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Component=p,t.default=void 0;var a=f(n(86)),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var a={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var r=s?Object.getOwnPropertyDescriptor(e,o):null;r&&(r.get||r.set)?Object.defineProperty(a,o,r):a[o]=e[o]}a.default=e,n&&n.set(e,a);return a}(n(363)),o=n(624),r=f(n(159)),u=f(n(510)),l=f(n(239)),i=n(123),d=f(n(754));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function f(e){return e&&e.__esModule?e:{default:e}}function p(e){const[t,n]=(0,s.useState)(!1),[a,o]=(0,s.useState)(!1),[i,c]=(0,s.useState)(!1);const{ID:f,...p}=e,g={logout:function(){var t;return c(!0),(t=e.LogOutEndpoint,r.default.createEndpointFetcher({url:`${t}/:id`.replace("//","/"),method:"delete",payloadSchema:{id:{urlReplacement:":id",remove:!0},SecurityID:{querystring:!0}}}))({id:e.ID,SecurityID:u.default.get("SecurityID")}).then((t=>{e.displayToastSuccess(t.message)})).catch((t=>(o(!0),t.response.text().then((t=>{const n=JSON.parse(t);return"object"!=typeof n||"string"!=typeof n.message?Promise.reject("No readable error message"):(e.displayToastFailure(n.message),Promise.resolve())}))))).catch((()=>{e.displayToastFailure(d.default._t("SessionManager.COULD_NOT_LOGOUT","Could not log out of session. Try again later."))})).finally((()=>{n(!0),c(!1)}))},complete:t,failed:a,submitting:i,...p};return s.default.createElement(l.default,g)}p.propTypes={ID:a.default.number.isRequired,LogOutEndpoint:a.default.string.isRequired,displayToastSuccess:a.default.func.isRequired,displayToastFailure:a.default.func.isRequired,IPAddress:a.default.string.isRequired,IsCurrent:a.default.bool,UserAgent:a.default.string,Created:a.default.string.isRequired,LastAccessed:a.default.string.isRequired};var g=(0,o.connect)((()=>({})),(function(e){return{displayToastSuccess(t){e((0,i.success)(t))},displayToastFailure(t){e((0,i.error)(t))}}}))(p);t.default=g},592:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(n(363)),s=r(n(601)),o=r(n(86));function r(e){return e&&e.__esModule?e:{default:e}}function u(e){return a.default.createElement("ul",{className:"session-manager-field list-unstyled"},e.loginSessions.map((e=>a.default.createElement("li",{key:e.ID,className:"list-unstyled"},a.default.createElement(s.default,e)))))}u.propTypes={loginSessions:o.default.arrayOf(s.default.propTypes)};var l=u;t.default=l},224:function(e,t,n){var a=u(n(363)),s=n(691),o=n(648),r=u(n(311));function u(e){return e&&e.__esModule?e:{default:e}}r.default.entwine("ss",(e=>{e('.js-injector-boot [data-field-type="session-manager-field"]').entwine({onmatch(){!function(e){const t=(0,o.loadComponent)("SessionManagerField"),{schema:{loginSessions:n}}=e.data("schema");(0,s.createRoot)(e[0]).render(a.default.createElement(t,{loginSessions:n}))}(this)}})}))},924:function(e,t,n){n(224)},159:function(e){e.exports=Backend},17:function(e){e.exports=Button},510:function(e){e.exports=Config},648:function(e){e.exports=Injector},86:function(e){e.exports=PropTypes},363:function(e){e.exports=React},691:function(e){e.exports=ReactDomClient},624:function(e){e.exports=ReactRedux},123:function(e){e.exports=ToastsActions},754:function(e){e.exports=i18n},311:function(e){e.exports=jQuery},488:function(e){e.exports=moment}},t={};function n(a){var s=t[a];if(void 0!==s)return s.exports;var o=t[a]={exports:{}};return e[a](o,o.exports,n),o.exports}n(924),n(274)}(); \ No newline at end of file +!function(){"use strict";var e={274:function(e,t,n){var a,s=(a=n(521))&&a.__esModule?a:{default:a};window.document.addEventListener("DOMContentLoaded",(()=>{(0,s.default)()}))},521:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=u(n(239)),s=u(n(601)),o=u(n(592)),r=u(n(648));function u(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.component.registerMany({LoginSession:a.default,LoginSessionContainer:s.default,SessionManagerField:o.default})}},239:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=l(n(754)),s=l(n(86)),o=l(n(363)),r=l(n(488)),u=l(n(17));function l(e){return e&&e.__esModule?e:{default:e}}const i="L LT";function d(e){const t=a.default._t("SessionManager.CURRENT","Current"),n=e.submitting||e.complete&&!e.failed?a.default._t("SessionManager.LOGGING_OUT","Logging out..."):a.default._t("SessionManager.LOG_OUT","Log out");return o.default.createElement("div",{className:"login-session "+(e.complete&&!e.failed?"hidden":"")},o.default.createElement("p",null,e.UserAgent),o.default.createElement("p",{className:"text-muted"},e.IPAddress,function(){r.default.locale(a.default.detectLocale());const t=r.default.utc(e.Created).local(),n=r.default.utc(e.LastAccessed).local(),s=t.fromNow(),u=n.fromNow(),l=a.default.inject(a.default._t("Admin.ACTIVITY_TOOLTIP_TEXT","Signed in {signedIn}, Last active {lastActive}"),{signedIn:t.format(i),lastActive:n.format(i)}),d=e.IsCurrent?a.default.inject(a.default._t("SessionManager.AUTHENTICATED","authenticated {createdElapsed}..."),{createdElapsed:s}):a.default.inject(a.default._t("SessionManager.LAST_ACTIVE","last active {lastAccessedElapsed}..."),{lastAccessedElapsed:u});return o.default.createElement("span",{"data-toggle":"tooltip","data-placement":"top",title:l},", ",d)}()),o.default.createElement("p",null,e.IsCurrent&&o.default.createElement("strong",{className:"text-success"},t),!e.IsCurrent&&o.default.createElement(u.default,{color:"link",className:"login-session__logout",onClick:()=>{e.submitting||e.complete||e.logout()}},n)))}d.propTypes={IPAddress:s.default.string.isRequired,IsCurrent:s.default.bool,UserAgent:s.default.string,Created:s.default.string.isRequired,LastAccessed:s.default.string.isRequired,submitting:s.default.bool.isRequired,complete:s.default.bool.isRequired,failed:s.default.bool.isRequired};var c=d;t.default=c},601:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Component=p,t.default=void 0;var a=f(n(86)),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var a={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var r=s?Object.getOwnPropertyDescriptor(e,o):null;r&&(r.get||r.set)?Object.defineProperty(a,o,r):a[o]=e[o]}a.default=e,n&&n.set(e,a);return a}(n(363)),o=n(624),r=f(n(159)),u=f(n(510)),l=n(123),i=f(n(754)),d=f(n(239));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function f(e){return e&&e.__esModule?e:{default:e}}function p(e){const[t,n]=(0,s.useState)(!1),[a,o]=(0,s.useState)(!1),[l,c]=(0,s.useState)(!1);const{ID:f,...p}=e,g={logout:function(){var t;return c(!0),(t=e.LogOutEndpoint,r.default.createEndpointFetcher({url:`${t}/:id`.replace("//","/"),method:"delete",payloadSchema:{id:{urlReplacement:":id",remove:!0},SecurityID:{querystring:!0}}}))({id:e.ID,SecurityID:u.default.get("SecurityID")}).then((t=>{e.displayToastSuccess(t.message)})).catch((t=>(o(!0),t.response.text().then((t=>{const n=JSON.parse(t);return"object"!=typeof n||"string"!=typeof n.message?Promise.reject("No readable error message"):(e.displayToastFailure(n.message),Promise.resolve())}))))).catch((()=>{e.displayToastFailure(i.default._t("SessionManager.COULD_NOT_LOGOUT","Could not log out of session. Try again later."))})).finally((()=>{n(!0),c(!1)}))},complete:t,failed:a,submitting:l,...p};return s.default.createElement(d.default,g)}p.propTypes={ID:a.default.number.isRequired,LogOutEndpoint:a.default.string.isRequired,displayToastSuccess:a.default.func.isRequired,displayToastFailure:a.default.func.isRequired,IPAddress:a.default.string.isRequired,IsCurrent:a.default.bool,UserAgent:a.default.string,Created:a.default.string.isRequired,LastAccessed:a.default.string.isRequired};var g=(0,o.connect)((()=>({})),(function(e){return{displayToastSuccess(t){e((0,l.success)(t))},displayToastFailure(t){e((0,l.error)(t))}}}))(p);t.default=g},592:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(n(363)),s=r(n(86)),o=r(n(601));function r(e){return e&&e.__esModule?e:{default:e}}function u(e){return a.default.createElement("ul",{className:"session-manager-field list-unstyled"},e.loginSessions.map((e=>a.default.createElement("li",{key:e.ID,className:"list-unstyled"},a.default.createElement(o.default,e)))))}u.propTypes={loginSessions:s.default.arrayOf(o.default.propTypes)};var l=u;t.default=l},224:function(e,t,n){var a=u(n(363)),s=n(691),o=n(648),r=u(n(311));function u(e){return e&&e.__esModule?e:{default:e}}r.default.entwine("ss",(e=>{e('.js-injector-boot [data-field-type="session-manager-field"]').entwine({onmatch(){!function(e){const t=(0,o.loadComponent)("SessionManagerField"),{schema:{loginSessions:n}}=e.data("schema");(0,s.createRoot)(e[0]).render(a.default.createElement(t,{loginSessions:n}))}(this)}})}))},924:function(e,t,n){n(224)},159:function(e){e.exports=Backend},17:function(e){e.exports=Button},510:function(e){e.exports=Config},648:function(e){e.exports=Injector},86:function(e){e.exports=PropTypes},363:function(e){e.exports=React},691:function(e){e.exports=ReactDomClient},624:function(e){e.exports=ReactRedux},123:function(e){e.exports=ToastsActions},754:function(e){e.exports=i18n},311:function(e){e.exports=jQuery},488:function(e){e.exports=moment}},t={};function n(a){var s=t[a];if(void 0!==s)return s.exports;var o=t[a]={exports:{}};return e[a](o,o.exports,n),o.exports}n(924),n(274)}(); \ No newline at end of file diff --git a/client/src/components/LoginSession/LoginSessionContainer.js b/client/src/components/LoginSession/LoginSessionContainer.js index 8673b25..3abd0a5 100644 --- a/client/src/components/LoginSession/LoginSessionContainer.js +++ b/client/src/components/LoginSession/LoginSessionContainer.js @@ -3,9 +3,9 @@ import React, { useState } from 'react'; import { connect } from 'react-redux'; import backend from 'lib/Backend'; import Config from 'lib/Config'; // eslint-disable-line -import LoginSession from './LoginSession'; import { success, error } from 'state/toasts/ToastsActions'; import i18n from 'i18n'; +import LoginSession from './LoginSession'; function createEndpoint(logOutEndpoint) { return backend.createEndpointFetcher({ diff --git a/client/src/components/LoginSession/tests/LoginSession-test.js b/client/src/components/LoginSession/tests/LoginSession-test.js index 7db7559..e20896a 100644 --- a/client/src/components/LoginSession/tests/LoginSession-test.js +++ b/client/src/components/LoginSession/tests/LoginSession-test.js @@ -1,8 +1,8 @@ /* global jest, test, describe, it, expect, beforeEach, Event */ import React from 'react'; -import LoginSession from '../LoginSession'; import { render } from '@testing-library/react'; +import LoginSession from '../LoginSession'; jest.useFakeTimers().setSystemTime(new Date('2021-03-12 03:47:22')); diff --git a/client/src/components/LoginSession/tests/LoginSessionContainer-test.js b/client/src/components/LoginSession/tests/LoginSessionContainer-test.js index 2dfab6c..4cf83f3 100644 --- a/client/src/components/LoginSession/tests/LoginSessionContainer-test.js +++ b/client/src/components/LoginSession/tests/LoginSessionContainer-test.js @@ -1,8 +1,8 @@ /* global jest, test, describe, it, expect, beforeEach, Event, global */ import React from 'react'; -import { Component as LoginSessionContainer } from '../LoginSessionContainer'; import { fireEvent, render, screen } from '@testing-library/react'; +import { Component as LoginSessionContainer } from '../LoginSessionContainer'; let doResolve; let doReject; diff --git a/client/src/components/SessionManagerField/SessionManagerField.js b/client/src/components/SessionManagerField/SessionManagerField.js index fab8b6d..9bdc99e 100644 --- a/client/src/components/SessionManagerField/SessionManagerField.js +++ b/client/src/components/SessionManagerField/SessionManagerField.js @@ -1,7 +1,7 @@ /* global window */ import React from 'react'; -import LoginSessionContainer from '../LoginSession/LoginSessionContainer'; import PropTypes from 'prop-types'; +import LoginSessionContainer from '../LoginSession/LoginSessionContainer'; function SessionManagerField(props) { return (