mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Storybook: fix type error (#18934)
* Use window.setTimeout/Interval instead of nodejs versions * Remove awesome-typescript-loader dependency
This commit is contained in:
@@ -28,7 +28,6 @@
|
|||||||
"@types/pretty-format": "20.0.1",
|
"@types/pretty-format": "20.0.1",
|
||||||
"@types/react": "16.8.16",
|
"@types/react": "16.8.16",
|
||||||
"@types/sinon": "^7.0.11",
|
"@types/sinon": "^7.0.11",
|
||||||
"awesome-typescript-loader": "^5.2.1",
|
|
||||||
"lodash": "^4.17.10",
|
"lodash": "^4.17.10",
|
||||||
"pretty-format": "^24.5.0",
|
"pretty-format": "^24.5.0",
|
||||||
"rollup": "1.6.0",
|
"rollup": "1.6.0",
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/systemjs": "^0.20.6",
|
"@types/systemjs": "^0.20.6",
|
||||||
"awesome-typescript-loader": "^5.2.1",
|
|
||||||
"lodash": "^4.17.10",
|
"lodash": "^4.17.10",
|
||||||
"pretty-format": "^24.5.0",
|
"pretty-format": "^24.5.0",
|
||||||
"rollup": "1.6.0",
|
"rollup": "1.6.0",
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ module.exports = ({config, mode}) => {
|
|||||||
test: /\.(ts|tsx)$/,
|
test: /\.(ts|tsx)$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: require.resolve('awesome-typescript-loader'),
|
loader: require.resolve('ts-loader'),
|
||||||
options: {
|
options: {}
|
||||||
configFileName: path.resolve(__dirname+'/../tsconfig.json')
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
@@ -56,5 +54,6 @@ module.exports = ({config, mode}) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
config.resolve.extensions.push('.ts', '.tsx');
|
config.resolve.extensions.push('.ts', '.tsx');
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -69,7 +69,6 @@
|
|||||||
"@types/storybook__addon-knobs": "4.0.4",
|
"@types/storybook__addon-knobs": "4.0.4",
|
||||||
"@types/storybook__react": "4.0.1",
|
"@types/storybook__react": "4.0.1",
|
||||||
"@types/tinycolor2": "1.4.1",
|
"@types/tinycolor2": "1.4.1",
|
||||||
"awesome-typescript-loader": "5.2.1",
|
|
||||||
"pretty-format": "24.5.0",
|
"pretty-format": "24.5.0",
|
||||||
"react-docgen-typescript-loader": "3.0.1",
|
"react-docgen-typescript-loader": "3.0.1",
|
||||||
"react-docgen-typescript-webpack-plugin": "1.1.0",
|
"react-docgen-typescript-webpack-plugin": "1.1.0",
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ const getLogRowWithContextStyles = (theme: GrafanaTheme, state: State) => {
|
|||||||
* When the user requests stats for a field, they will be calculated and rendered below the row.
|
* When the user requests stats for a field, they will be calculated and rendered below the row.
|
||||||
*/
|
*/
|
||||||
class UnThemedLogRow extends PureComponent<Props, State> {
|
class UnThemedLogRow extends PureComponent<Props, State> {
|
||||||
mouseMessageTimer: NodeJS.Timer | null = null;
|
mouseMessageTimer: number | null = null;
|
||||||
|
|
||||||
state: any = {
|
state: any = {
|
||||||
fieldCount: 0,
|
fieldCount: 0,
|
||||||
@@ -150,7 +150,7 @@ class UnThemedLogRow extends PureComponent<Props, State> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Don't parse right away, user might move along
|
// Don't parse right away, user might move along
|
||||||
this.mouseMessageTimer = setTimeout(this.parseMessage, 500);
|
this.mouseMessageTimer = window.setTimeout(this.parseMessage, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
onMouseOutMessage = () => {
|
onMouseOutMessage = () => {
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ interface State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class UnThemedLogRows extends PureComponent<Props, State> {
|
class UnThemedLogRows extends PureComponent<Props, State> {
|
||||||
deferLogsTimer: NodeJS.Timer | null = null;
|
deferLogsTimer: number | null = null;
|
||||||
renderAllTimer: NodeJS.Timer | null = null;
|
renderAllTimer: number | null = null;
|
||||||
|
|
||||||
state: State = {
|
state: State = {
|
||||||
deferLogs: true,
|
deferLogs: true,
|
||||||
@@ -44,14 +44,14 @@ class UnThemedLogRows extends PureComponent<Props, State> {
|
|||||||
const rowCount = data && data.rows ? data.rows.length : 0;
|
const rowCount = data && data.rows ? data.rows.length : 0;
|
||||||
// Render all right away if not too far over the limit
|
// Render all right away if not too far over the limit
|
||||||
const renderAll = rowCount <= PREVIEW_LIMIT * 2;
|
const renderAll = rowCount <= PREVIEW_LIMIT * 2;
|
||||||
this.deferLogsTimer = setTimeout(() => this.setState({ deferLogs: false, renderAll }), rowCount);
|
this.deferLogsTimer = window.setTimeout(() => this.setState({ deferLogs: false, renderAll }), rowCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps: Props, prevState: State) {
|
componentDidUpdate(prevProps: Props, prevState: State) {
|
||||||
// Staged rendering
|
// Staged rendering
|
||||||
if (prevState.deferLogs && !this.state.deferLogs && !this.state.renderAll) {
|
if (prevState.deferLogs && !this.state.deferLogs && !this.state.renderAll) {
|
||||||
this.renderAllTimer = setTimeout(() => this.setState({ renderAll: true }), 2000);
|
this.renderAllTimer = window.setTimeout(() => this.setState({ renderAll: true }), 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
19
yarn.lock
19
yarn.lock
@@ -4252,19 +4252,6 @@ autoprefixer@^9.4.9:
|
|||||||
postcss "^7.0.16"
|
postcss "^7.0.16"
|
||||||
postcss-value-parser "^3.3.1"
|
postcss-value-parser "^3.3.1"
|
||||||
|
|
||||||
awesome-typescript-loader@5.2.1, awesome-typescript-loader@^5.2.1:
|
|
||||||
version "5.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/awesome-typescript-loader/-/awesome-typescript-loader-5.2.1.tgz#a41daf7847515f4925cdbaa3075d61f289e913fc"
|
|
||||||
dependencies:
|
|
||||||
chalk "^2.4.1"
|
|
||||||
enhanced-resolve "^4.0.0"
|
|
||||||
loader-utils "^1.1.0"
|
|
||||||
lodash "^4.17.5"
|
|
||||||
micromatch "^3.1.9"
|
|
||||||
mkdirp "^0.5.1"
|
|
||||||
source-map-support "^0.5.3"
|
|
||||||
webpack-log "^1.2.0"
|
|
||||||
|
|
||||||
aws-sdk@^2.495.0:
|
aws-sdk@^2.495.0:
|
||||||
version "2.495.0"
|
version "2.495.0"
|
||||||
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.495.0.tgz#0b0ad8fcf581cb7bb858864fab88d461f0e67677"
|
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.495.0.tgz#0b0ad8fcf581cb7bb858864fab88d461f0e67677"
|
||||||
@@ -11860,7 +11847,7 @@ micromatch@^2.3.11:
|
|||||||
parse-glob "^3.0.4"
|
parse-glob "^3.0.4"
|
||||||
regex-cache "^0.4.2"
|
regex-cache "^0.4.2"
|
||||||
|
|
||||||
micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8, micromatch@^3.1.9:
|
micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8:
|
||||||
version "3.1.10"
|
version "3.1.10"
|
||||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23"
|
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -16667,7 +16654,7 @@ source-map-resolve@^0.5.0:
|
|||||||
source-map-url "^0.4.0"
|
source-map-url "^0.4.0"
|
||||||
urix "^0.1.0"
|
urix "^0.1.0"
|
||||||
|
|
||||||
source-map-support@^0.5.3, source-map-support@^0.5.6, source-map-support@~0.5.10:
|
source-map-support@^0.5.6, source-map-support@~0.5.10:
|
||||||
version "0.5.12"
|
version "0.5.12"
|
||||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599"
|
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -18357,7 +18344,7 @@ webpack-hot-middleware@^2.24.3:
|
|||||||
querystring "^0.2.0"
|
querystring "^0.2.0"
|
||||||
strip-ansi "^3.0.0"
|
strip-ansi "^3.0.0"
|
||||||
|
|
||||||
webpack-log@^1.1.2, webpack-log@^1.2.0:
|
webpack-log@^1.1.2:
|
||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/webpack-log/-/webpack-log-1.2.0.tgz#a4b34cda6b22b518dbb0ab32e567962d5c72a43d"
|
resolved "https://registry.yarnpkg.com/webpack-log/-/webpack-log-1.2.0.tgz#a4b34cda6b22b518dbb0ab32e567962d5c72a43d"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user