Ver código fonte

Fixed bulk actions and few minor UX bugs.

Alexander 4 anos atrás
pai
commit
b7cf917141

+ 1 - 1
web/js/react/src/components/RRD/RRD.jsx

@@ -17,7 +17,7 @@ const RRD = props => {
     let year = newDate.getFullYear();
     let months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
 
-    return <div className="date">{day} &nbsp; {months[month - 1]} &nbsp; {year}</div>;
+    return <div className="date">{day} &nbsp; {months[month]} &nbsp; {year}</div>;
   }
 
   return (

+ 1 - 7
web/js/react/src/components/Server/Server.jsx

@@ -10,12 +10,6 @@ const Server = props => {
   const { data } = props;
   const { i18n } = useSelector(state => state.session);
 
-  const printTime = seconds => {
-    let hours = seconds / 60;
-    let days = Math.floor(hours / 24);
-    return days;
-  }
-
   const checkItem = () => {
     props.checkItem(data.NAME);
   }
@@ -41,7 +35,7 @@ const Server = props => {
             <div><span>{i18n.Memory}: <span className="stat">{data.MEM} {i18n.mb}</span></span></div>
           </Container>
           <Container className="c-3">
-            <div><span>{i18n.Uptime}: <span className="stat">{printTime(data.RTIME)} {i18n.days}</span></span></div>
+            <div><span>{i18n.Uptime}: <span className="stat">{data.RTIME}</span></span></div>
           </Container>
           <Container className="c-1" />
         </div>

+ 1 - 8
web/js/react/src/components/Server/ServerSys.jsx

@@ -9,13 +9,6 @@ import { useSelector } from 'react-redux';
 const Server = props => {
   const { data } = props;
   const { i18n } = useSelector(state => state.session);
-  const token = localStorage.getItem("token");
-
-  const printTime = seconds => {
-    let hours = seconds / 60;
-    let days = Math.floor(hours / 24);
-    return days;
-  }
 
   const checkItem = () => {
     props.checkItem(props.data.HOSTNAME);
@@ -39,7 +32,7 @@ const Server = props => {
             <div>{i18n['Load Average']}: <span><span className="stat">{data.LOADAVERAGE}</span></span></div>
           </Container>
           <Container className="c-3">
-            <div><span>{i18n.Uptime}: <span className="stat">{printTime(data.UPTIME)} {i18n.days}</span></span></div>
+            <div><span>{i18n.Uptime}: <span className="stat">{data.UPTIME}</span></span></div>
           </Container>
         </div>
       </Container>

+ 2 - 4
web/js/react/src/containers/Backups/Backups.jsx

@@ -285,10 +285,8 @@ const Backups = props => {
       bulkAction(action, selection)
         .then(result => {
           if (result.status === 200) {
-            fetchData().then(() => {
-              refreshMenuCounters();
-              toggleAll(false);
-            });
+            toggleAll(false);
+            fetchData().then(() => refreshMenuCounters());
           }
         })
         .catch(err => console.error(err));

+ 2 - 4
web/js/react/src/containers/CronJobs/CronJobs.jsx

@@ -330,10 +330,8 @@ const CronJobs = props => {
       bulkAction(action, selection)
         .then(result => {
           if (result.status === 200) {
-            fetchData().then(() => {
-              refreshMenuCounters();
-              toggleAll(false);
-            });
+            toggleAll(false);
+            fetchData().then(() => refreshMenuCounters());
           }
         })
         .catch(err => console.error(err));

+ 2 - 4
web/js/react/src/containers/DNSRecords/DNSRecords.jsx

@@ -285,10 +285,8 @@ export default function DnsRecords(props) {
       bulkAction(action, selection, state.domain)
         .then(result => {
           if (result.status === 200) {
-            fetchData().then(() => {
-              refreshMenuCounters();
-              toggleAll(false);
-            });
+            toggleAll(false);
+            fetchData().then(() => refreshMenuCounters());
           }
         })
         .catch(err => console.error(err));

+ 2 - 4
web/js/react/src/containers/Databases/Databases.jsx

@@ -330,10 +330,8 @@ const Databases = props => {
       bulkAction(action, selection)
         .then(result => {
           if (result.status === 200) {
-            fetchData().then(() => {
-              refreshMenuCounters();
-              toggleAll(false);
-            });
+            toggleAll(false);
+            fetchData().then(() => refreshMenuCounters());
           }
         })
         .catch(err => console.error(err));

+ 2 - 4
web/js/react/src/containers/DomainNameSystems/DomainNameSystems.jsx

@@ -346,10 +346,8 @@ const DomainNameSystems = props => {
       bulkDomainAction(action, selection)
         .then(result => {
           if (result.status === 200) {
-            fetchData().then(() => {
-              refreshMenuCounters();
-              toggleAll(false);
-            });
+            toggleAll(false);
+            fetchData().then(() => refreshMenuCounters());
           }
         })
         .catch(err => console.error(err));

+ 2 - 4
web/js/react/src/containers/Firewalls/Banlist/index.jsx

@@ -236,10 +236,8 @@ const BanLists = props => {
       bulkAction(action, selection)
         .then(result => {
           if (result.status === 200) {
-            fetchData().then(() => {
-              refreshMenuCounters();
-              toggleAll(false);
-            });
+            toggleAll(false);
+            fetchData().then(() => refreshMenuCounters());
           }
         })
         .catch(err => console.error(err));

+ 2 - 4
web/js/react/src/containers/Firewalls/Firewalls.jsx

@@ -324,10 +324,8 @@ const Firewalls = props => {
       bulkAction(action, selection)
         .then(result => {
           if (result.status === 200) {
-            fetchData().then(() => {
-              refreshMenuCounters();
-              toggleAll(false);
-            });
+            toggleAll(false);
+            fetchData().then(() => refreshMenuCounters());
           }
         })
         .catch(err => console.error(err));

+ 2 - 4
web/js/react/src/containers/InternetProtocols/InternetProtocols.jsx

@@ -318,10 +318,8 @@ const InternetProtocols = props => {
       bulkAction(action, selection)
         .then(result => {
           if (result.status === 200) {
-            fetchData().then(() => {
-              refreshMenuCounters();
-              toggleAll(false);
-            });
+            toggleAll(false);
+            fetchData().then(() => refreshMenuCounters());
           }
         })
         .catch(err => console.error(err));

+ 2 - 4
web/js/react/src/containers/MailAccounts/MailAccounts.jsx

@@ -324,10 +324,8 @@ export default function MailAccounts(props) {
       bulkMailAccountAction(action, props.domain, selection)
         .then(result => {
           if (result.status === 200) {
-            fetchData().then(() => {
-              refreshMenuCounters();
-              toggleAll(false);
-            });
+            toggleAll(false);
+            fetchData().then(() => refreshMenuCounters());
           }
         })
         .catch(err => console.error(err));

+ 2 - 4
web/js/react/src/containers/Mails/Mails.jsx

@@ -337,10 +337,8 @@ const Mails = props => {
       bulkAction(action, selection)
         .then(result => {
           if (result.status === 200) {
-            fetchData().then(() => {
-              refreshMenuCounters();
-              toggleAll(false);
-            });
+            toggleAll(false);
+            fetchData().then(() => refreshMenuCounters());
           }
         })
         .catch(err => console.error(err));

+ 2 - 4
web/js/react/src/containers/Packages/Packages.jsx

@@ -314,10 +314,8 @@ const Packages = props => {
       bulkAction(action, selection)
         .then(result => {
           if (result.status === 200) {
-            fetchData().then(() => {
-              refreshMenuCounters();
-              toggleAll(false);
-            });
+            toggleAll(false);
+            fetchData().then(() => refreshMenuCounters());
           }
         })
         .catch(err => console.error(err));

+ 2 - 4
web/js/react/src/containers/Servers/Servers.jsx

@@ -259,10 +259,8 @@ const Servers = props => {
             displayModal(res.data.error);
           }
 
-          fetchData().then(() => {
-            refreshMenuCounters();
-            toggleAll(false);
-          });
+          toggleAll(false);
+          fetchData().then(() => refreshMenuCounters());
         })
         .catch(err => console.error(err));
     }

+ 2 - 4
web/js/react/src/containers/Users/Users.jsx

@@ -328,10 +328,8 @@ const Users = props => {
       bulkAction(action, state.selection)
         .then(result => {
           if (result.status === 200) {
-            fetchData().then(() => {
-              refreshMenuCounters();
-              toggleAll(false);
-            });
+            toggleAll(false);
+            fetchData().then(() => refreshMenuCounters());
           }
         })
         .catch(err => console.error(err));

+ 2 - 4
web/js/react/src/containers/Web/Web.jsx

@@ -322,10 +322,8 @@ const Web = props => {
       setLoading(true);
       bulkAction(action, state.selection)
         .then(result => {
-          fetchData().then(() => {
-            refreshMenuCounters();
-            toggleAll(false);
-          });
+          toggleAll(false);
+          fetchData().then(() => refreshMenuCounters());
         })
         .catch(err => console.error(err));
     }