File was renamed from src/components/header/versions/index.jsx |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, notification, Timeline, Icon, Button } from 'antd' |
| | | import { Modal, notification, Timeline, Icon, Button, Typography } from 'antd' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | | // import SettingForm from './settingform' |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const { Paragraph } = Typography |
| | | |
| | | class DataSource extends Component { |
| | | static propTpyes = { |
| | | debug: PropTypes.any |
| | | } |
| | | |
| | | state = { |
| | | visible: false, |
| | | versions: null, |
| | |
| | | } |
| | | |
| | | verup = () => { |
| | | const { debug } = this.props |
| | | |
| | | if (!debug || options.sysType === 'cloud') { |
| | | confirm({ |
| | | title: '版本升级', |
| | | content: '重新加载应用信息', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | if (!window.GLOB.WebSql && !window.GLOB.IndexDB) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '升级失败,请刷新页面重试!', |
| | | duration: 2 |
| | | }) |
| | | resolve() |
| | | } else { |
| | | Api.updateAppVersion() |
| | | setTimeout(() => { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '升级成功!', |
| | | duration: 2 |
| | | }) |
| | | resolve() |
| | | }, 1000) |
| | | } |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | Api.updateAppVersion() |
| | | |
| | | if (!sessionStorage.getItem('CloudUserID') || !sessionStorage.getItem('CloudLoginUID')) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请登录开发机!', |
| | | duration: 2 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _param = { |
| | | func: 's_get_sversions_sys', |
| | | } |
| | |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | queryScript = () => { |
| | |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | {versions ? <Timeline> |
| | | {versions.map(item => { |
| | | <Timeline> |
| | | {versions && versions.map(item => { |
| | | let icon = <Icon type="clock-circle-o" style={{ fontSize: '16px' }} /> |
| | | if (item.status === 'loading') { |
| | | icon = <Icon type="sync" spin style={{ fontSize: '16px' }} /> |
| | |
| | | } |
| | | } |
| | | return ( |
| | | <Timeline.Item key={item.id} dot={icon}>{item.ProgramName}</Timeline.Item> |
| | | <Timeline.Item key={item.id} dot={icon}>{item.ProgramName}(<Paragraph style={{display: 'inline-block', marginBottom: '0px'}} copyable>{item.id}</Paragraph>)</Timeline.Item> |
| | | ) |
| | | })} |
| | | </Timeline> : null} |
| | | </Timeline> |
| | | </Modal> |
| | | </> |
| | | ) |