|
|
@@ -7,13 +7,13 @@ import URL from '../constants/url.dev.json';
|
|
|
import 'whatwg-fetch';
|
|
|
import { getThemeConfig, applyTheme } from './theme/applyTheme.js';
|
|
|
|
|
|
-import tempdata from '../data/bug/bug.json';
|
|
|
+import tempdata from '../data/testline.json';
|
|
|
|
|
|
class Factory extends React.Component {
|
|
|
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
- this.dev = 'local';
|
|
|
+ this.dev = 'local ';
|
|
|
|
|
|
this.index = 0;
|
|
|
this.state = {
|
|
|
@@ -44,13 +44,13 @@ class Factory extends React.Component {
|
|
|
if(!json.instance) {
|
|
|
throw {message: json.message};
|
|
|
}
|
|
|
- let instance = json.instance;
|
|
|
- if (!me.state.instance) {
|
|
|
- me.setState({
|
|
|
- instance: instance
|
|
|
- }, me.setRefresh);
|
|
|
+ if (!me.instance) {
|
|
|
+ me.instance = json.instance;
|
|
|
}
|
|
|
return json;
|
|
|
+ }).then((json) => {
|
|
|
+ me.setRefresh();
|
|
|
+ return json;
|
|
|
}).then(function (json) {
|
|
|
let modelconfig = json.data[0];
|
|
|
let theme = json.theme;
|
|
|
@@ -93,7 +93,7 @@ class Factory extends React.Component {
|
|
|
}
|
|
|
|
|
|
setRefresh() {
|
|
|
- let { instance } = this.state;
|
|
|
+ let instance = this.instance;
|
|
|
if (!instance) { return; }
|
|
|
let codes = instance.enabledKanbanCodes;
|
|
|
let display = instance.display;
|
|
|
@@ -111,7 +111,7 @@ class Factory extends React.Component {
|
|
|
};
|
|
|
if (refresh.current) {
|
|
|
if (refresh.current.enable) {
|
|
|
- this.refreshThis = setInterval(function () {
|
|
|
+ this.refreshThis = window.setTimeout(() => {
|
|
|
if (this.index == codes.length - 1) {
|
|
|
this.index = 0;
|
|
|
} else {
|
|
|
@@ -119,7 +119,7 @@ class Factory extends React.Component {
|
|
|
}
|
|
|
let reg = /(.*){code}(.*){index}(.*){kanbanCode}(.*)/g;
|
|
|
this.getModelConfig(URL.completelyPath.replace(reg, '$1' + this.props.code + '$2' + this.props.index + '$3' + codes[this.index]));
|
|
|
- }.bind(this), refresh.current.interval * 1000 || 10000)
|
|
|
+ }, refresh.current.interval * 1000 || 10000);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -166,7 +166,8 @@ class Factory extends React.Component {
|
|
|
window.removeEventListener('resize', this.onWindowResize);
|
|
|
if (this.refreshThis) {
|
|
|
if (this.refreshThis.interval > 0) {
|
|
|
- window.clearInterval(this.refreshThis);
|
|
|
+ // window.clearInterval(this.refreshThis);
|
|
|
+ window.clearTimeout(this.refreshThis);
|
|
|
}
|
|
|
}
|
|
|
if (this.refreshNext) {
|