From bd9929ded0d99ebddb8cac20d54fedc47d814778 Mon Sep 17 00:00:00 2001 From: "Listat.an" Date: Wed, 30 Dec 2020 13:11:10 +0200 Subject: [PATCH] fixes sprint2 --- __run.bat | 4 +- .../Item/components/SubType/index.jsx | 20 +--- .../components/Item/index.jsx | 1 + .../App/NotificationIsPrivateTab.jsx | 23 +++++ .../App/NotificationIsPrivateTab.scss | 10 ++ src/containers/App/Router.jsx | 19 ++-- src/containers/App/detectPrivateMode.js | 95 +++++++++++++++++++ .../Factory/components/FormFactory/index.jsx | 13 +++ src/containers/Task/components/Data/index.jsx | 13 ++- 9 files changed, 166 insertions(+), 32 deletions(-) create mode 100644 src/containers/App/NotificationIsPrivateTab.jsx create mode 100644 src/containers/App/NotificationIsPrivateTab.scss create mode 100644 src/containers/App/detectPrivateMode.js diff --git a/__run.bat b/__run.bat index e64afca..4304946 100644 --- a/__run.bat +++ b/__run.bat @@ -1,4 +1,4 @@ -REM SET REACT_APP_API_URL=http://localhost:1337 -SET REACT_APP_API_URL=http://8c9e8772f1e1.ngrok.io +SET REACT_APP_API_URL=http://localhost:1337 +REM SET REACT_APP_API_URL=http://8c9e8772f1e1.ngrok.io yarn start \ No newline at end of file diff --git a/src/components/PermissionsField/components/Item/components/SubType/index.jsx b/src/components/PermissionsField/components/Item/components/SubType/index.jsx index c42e1f2..db552b3 100644 --- a/src/components/PermissionsField/components/Item/components/SubType/index.jsx +++ b/src/components/PermissionsField/components/Item/components/SubType/index.jsx @@ -11,22 +11,6 @@ class SubType extends Component { } - componentWillMount() { - - } - - componentDidMount() { - - } - - componentWillReceiveProps(nextProps) { - - } - - componentWillUnmount() { - - } - render() { let {value, factories, users} = this.props; @@ -36,6 +20,10 @@ class SubType extends Component { let name = value['type']; + if(name == 'filter_factory'){ + return
+ } + let lable = ''; switch (name) { diff --git a/src/components/PermissionsField/components/Item/index.jsx b/src/components/PermissionsField/components/Item/index.jsx index 70aa341..c2c6d5e 100644 --- a/src/components/PermissionsField/components/Item/index.jsx +++ b/src/components/PermissionsField/components/Item/index.jsx @@ -50,6 +50,7 @@ class Item extends Component { Підприємство Користувачі {profile.role == 'admin' && Сторінки} + Показувати фільтер "Підприємств"
diff --git a/src/containers/App/NotificationIsPrivateTab.jsx b/src/containers/App/NotificationIsPrivateTab.jsx new file mode 100644 index 0000000..09d7d1f --- /dev/null +++ b/src/containers/App/NotificationIsPrivateTab.jsx @@ -0,0 +1,23 @@ +import React, { Component } from 'react'; +import detectPrivateMode from './detectPrivateMode'; +import './NotificationIsPrivateTab.scss'; + +class NotificationIsPrivateTab extends Component { + state = {is_private: false} + componentDidMount(){ + detectPrivateMode((is_private) => { + this.setState({is_private}) + }) + } + render() { + const {is_private} = this.state; + if(!is_private){ + return null; + } + return ( +
В приватній вкладці програма буде працювати не коректно
+ ); + } +} + +export default NotificationIsPrivateTab; diff --git a/src/containers/App/NotificationIsPrivateTab.scss b/src/containers/App/NotificationIsPrivateTab.scss new file mode 100644 index 0000000..58f45d1 --- /dev/null +++ b/src/containers/App/NotificationIsPrivateTab.scss @@ -0,0 +1,10 @@ +.NotificationIsPrivateTab{ + position: absolute; + z-index: 99999999; + padding: 10px; + background: #FFB818; + border: 5px; + left: 240px; + top: 10px; + color: white; +} \ No newline at end of file diff --git a/src/containers/App/Router.jsx b/src/containers/App/Router.jsx index 6523778..81566cd 100644 --- a/src/containers/App/Router.jsx +++ b/src/containers/App/Router.jsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useEffect, useState} from 'react'; import { Route, Switch, Redirect } from 'react-router-dom'; import Layout from '../Layout/index'; import MainWrapper from './MainWrapper'; @@ -18,21 +18,14 @@ import Taxonomy from '../Taxonomy'; import Ban from '../Ban'; import Logs from '../Logs'; import Ips from '../Ips'; +import NotificationIsPrivateTab from './NotificationIsPrivateTab'; -const Pages = () => ( - - - - - -); - -const wrappedRoutes = () => ( -
+const wrappedRoutes = () => { + return
+
}/> - @@ -48,7 +41,7 @@ const wrappedRoutes = () => (
-); +}; const Router = () => ( diff --git a/src/containers/App/detectPrivateMode.js b/src/containers/App/detectPrivateMode.js new file mode 100644 index 0000000..fe0d0ac --- /dev/null +++ b/src/containers/App/detectPrivateMode.js @@ -0,0 +1,95 @@ +function retry(isDone, next) { + var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false; + var id = window.setInterval( + function() { + if (isDone()) { + window.clearInterval(id); + next(is_timeout); + } + if (current_trial++ > max_retry) { + window.clearInterval(id); + is_timeout = true; + next(is_timeout); + } + }, + 10 + ); +} + +function isIE10OrLater(user_agent) { + var ua = user_agent.toLowerCase(); + if (ua.indexOf('msie') === 0 && ua.indexOf('trident') === 0) { + return false; + } + var match = /(?:msie|rv:)\s?([\d\.]+)/.exec(ua); + if (match && parseInt(match[1], 10) >= 10) { + return true; + } + return false; +} + +export default function detectPrivateMode(callback) { + var is_private; + + if (window.webkitRequestFileSystem) { + window.webkitRequestFileSystem( + window.TEMPORARY, 1, + function() { + is_private = false; + }, + function(e) { + console.log(e); + is_private = true; + } + ); + } else if (window.indexedDB && /Firefox/.test(window.navigator.userAgent)) { + var db; + try { + db = window.indexedDB.open('test'); + } catch(e) { + is_private = true; + } + + if (typeof is_private === 'undefined') { + retry( + function isDone() { + return db.readyState === 'done' ? true : false; + }, + function next(is_timeout) { + if (!is_timeout) { + is_private = db.result ? false : true; + } + } + ); + } + } else if (isIE10OrLater(window.navigator.userAgent)) { + is_private = false; + try { + if (!window.indexedDB) { + is_private = true; + } + } catch (e) { + is_private = true; + } + } else if (window.localStorage && /Safari/.test(window.navigator.userAgent)) { + try { + window.localStorage.setItem('test', 1); + } catch(e) { + is_private = true; + } + + if (typeof is_private === 'undefined') { + is_private = false; + window.localStorage.removeItem('test'); + } + } + + retry( + function isDone() { + return typeof is_private !== 'undefined' ? true : false; + }, + function next(is_timeout) { + callback(is_private); + } + ); +} \ No newline at end of file diff --git a/src/containers/Factory/components/FormFactory/index.jsx b/src/containers/Factory/components/FormFactory/index.jsx index 4f569a1..969e084 100644 --- a/src/containers/Factory/components/FormFactory/index.jsx +++ b/src/containers/Factory/components/FormFactory/index.jsx @@ -10,6 +10,7 @@ import { genTree } from '../../../../lib/helper'; import _ from 'lodash' import SelectField from '../../../../components/Fields/SelectField'; import { createFactory, updateFactory, showModal } from '../../actions'; +import SelectMultyField from '../../../../components/Fields/SelectMultyField'; @@ -60,6 +61,18 @@ class FormFactory extends Component { label="Директор" options={users.map(item => ({title: item.name, value: item.id}))} /> + diff --git a/src/containers/Task/components/Data/index.jsx b/src/containers/Task/components/Data/index.jsx index 222c022..3b5d8bb 100644 --- a/src/containers/Task/components/Data/index.jsx +++ b/src/containers/Task/components/Data/index.jsx @@ -174,9 +174,11 @@ class Data extends Component { } item.start_date_sort = item.start_date ? moment(item.start_date ).toDate().getTime() : 0; item.end_date_sort = item.end_date ? moment(item.end_date).toDate().getTime() : 0; - item.start_date = item.start_date ? moment(item.start_date ).format('DD-MM-YYYY') : ''; + item.done_date_sort = item.done_date ? moment(item.done_date).toDate().getTime() : 0; + item.start_date = item.start_date ? moment(item.start_date ).format('DD-MM-YYYY') : ''; item.end_date = item.end_date ? moment(item.end_date).format('DD-MM-YYYY') : ''; + item.done_date = item.done_date ? moment(item.done_date).format('DD-MM-YYYY') : ''; item.favorite = profile && profile.favorites && profile.favorites.indexOf(item.id) > -1 ? 'так' : 'ні'; @@ -246,6 +248,15 @@ class Data extends Component { resizable: true, filter: true, }, + { + name: 'Дата виконання', + key: 'done_date', + sort_field: 'done_date_sort', + width: 112, + sortable: true, + resizable: true, + filter: true, + }, { name: 'Хто створив', key: 'user_created_title',