8000 [feat][monitor] Add rkt-query-inspector-monitor - feat/rtk query monitor by FaberVitale · Pull Request #750 · reduxjs/redux-devtools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[feat][monitor] Add rkt-query-inspector-monitor - feat/rtk query monitor #750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 62 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
1449d5a
chore: copy rtk-query example from toolkit
FaberVitale Jun 9, 2021
e9f397b
feat(rtk-query): complete initial setup of rtk-query
FaberVitale Jun 11, 2021
75aa663
feat: complete inspector layout and add initial JSONTree setup
FaberVitale Jun 12, 2021
143a01e
fix: unintentional removal of tsconfig
FaberVitale Jun 12, 2021
ad5b52a
feat(search): add search logic and refactor monitor state shape
FaberVitale Jun 12, 2021
01b92ee
fix: inverted monitor theme inside devtoop-app
FaberVitale Jun 13, 2021
c943b04
fix: rtk monitor reducer not working in app
FaberVitale Jun 13, 2021
1f189f3
refactor(rtk-query): simplify theme config
FaberVitale Jun 13, 2021
5a485a4
feat(rtk-query-monitor): add query preview tabs
FaberVitale Jun 14, 2021
6924ed0
fix: wip
FaberVitale Jun 14, 2021
20f4f54
refactor(examples): add rtk-query-polling to workspace
FaberVitale Jun 14, 2021
825a468
chore(rtk-query-inspector): add demo to monorepo
FaberVitale Jun 14, 2021
2ce2dc6
feat(rtk-query): add multiple filter options
FaberVitale Jun 16, 2021
1cda9ad
8000 chore(rtk-queery): rename demo build script and add SKIP_PREFLIGHT_CH…
FaberVitale Jun 16, 2021
6f4ae9b
feat(rtk-query): display status flags in QueryPreviewInfo
FaberVitale Jun 17, 2021
25dadc3
chore(rtk-query): update typescript versions in rkt-inspector-monitor…
FaberVitale Jun 17, 2021
b7d9f22
docs(rtk-query): add proper README
FaberVitale Jun 17, 2021
0f10ae9
docs(rtk-query): improve rtk-query-inspector-monitor demo gif
FaberVitale Jun 17, 2021
d34ee05
docs(rtk-query): clean up demo
FaberVitale Jun 17, 2021
b4b5a49
fix(rtk-query): clear button not updating redux state
FaberVitale Jun 17, 2021
1e4b547
docs(rtk-query): add link to rtk-query-inspector-monitor demo site
FaberVitale Jun 17, 2021
5eb9a58
chore(rtk-query): run prettier after prettier upgrade (55e2284)
FaberVitale Jun 18, 2021
82f0333
docs(rtk.query): clean up readme add features, todo and development s…
FaberVitale Jun 18, 2021
f145746
docs(rtk-query): fix link href
FaberVitale Jun 18, 2021
d574358
chore(rtk-query): clean up rtk-query-imspector-monitor-demo and add p…
FaberVitale Jun 19, 2021
e649318
feat(rtk-query): add counters on tags & subs tab buttons
FaberVitale Jun 19, 2021
7663ba8
fix(rtk-query): layering issue between queryPreview tabList and select
FaberVitale Jun 19, 2021
2db7db8
fix: revert accidental changes packages/redux-devtools-serialize/tsco…
FaberVitale Jun 19, 2021
bad8d49
chore: change QueryComparators.fulfilledTimeStamp label
FaberVitale Jun 19, 2021
6922091
feat(rtk-query): display api stats
FaberVitale Jun 19, 2021
f495c6a
refactor: remove rtk-query-polling example from monorepo
FaberVitale Jun 20, 2021
bcb493c
chore: regenerate lock file and add @types/react as monorepo devDep
FaberVitale Jun 20, 2021
b8ee704
chore: display apiState
FaberVitale Jun 20, 2021
a87b5b6
fix(rtk-query): resolve CI errors
FaberVitale Jun 20, 2021
c986ca5
chore(rtk-query): rename package to '@redux-devtools/rtk-query-monitor'
FaberVitale Jun 21, 2021
3598bc8
fix(rtk-query): lint:all error
FaberVitale Jun 21, 2021
9f1d718
feat(rtk-query): add fallback message if there are no rtk-query apis
FaberVitale Jun 21, 2021
e84c0dc
refactor(rtk-query): move Inspector & Monitor to containers clean up …
FaberVitale Jun 21, 2021
e5ce000
fix(rtk-query): incorrect link color
FaberVitale Jun 21, 2021
136fd02
refactor(rtk-query): simplify sort order control
FaberVitale Jun 21, 2021
c3b6887
feat(rtk-query): add timings to apiStats sections
FaberVitale Jun 22, 2021
f1430bf
feat(rtk-query): add slowest and fastest in timings section
FaberVitale Jun 22, 2021
07eefb5
feat(rtk-query): improve formatting of timings and display average lo…
FaberVitale Jun 23, 2021
ad02c0a
fix(rtk-query): rtk-query imports
FaberVitale Jun 24, 2021
71b483b
refactor(rtk-query): reduce selector computations
FaberVitale Jun 24, 2021
7a274d9
feat(rtk-query): add actions tab
FaberVitale Jun 26, 2021
dc5045f
refactor(rtk-query): add custom logic for TreeView shouldExpandNode
FaberVitale Jun 27, 2021
990521b
chore(rtk-query): improve demo visibility on small devices
FaberVitale Jun 27, 2021
0319b81
feat(rtk-query): do not display tree node preview
FaberVitale Jun 27, 2021
692d63e
chore(rtk-query): improve responsiveness
FaberVitale Jun 28, 2021
15d8c72
refactor(rtk-query): move preview to containers remove unnecessary co…
FaberVitale Jun 28, 2021
323a5d9
feat(rtk-query): display median of timings
FaberVitale Jun 28, 2021
76f00bd
refactor(rtk-query-monitor): conform demo setup to repo standards
FaberVitale Jul 21, 2021
1a482e7
chore(rtk-query-monitor): add option to select active devtools
FaberVitale Jul 21, 2021
0ae7deb
chore(rtk-query-monitor): remove redux-devtools/examples/rtk-query-po…
FaberVitale Jul 21, 2021
6a87019
refactor(rtk-query): improve UI of api tab
FaberVitale Jul 31, 2021
95da893
feat(rtk-query): add regex search
FaberVitale Aug 1, 2021
e4c5720
feat(rtk-query): display mutations in queryList
FaberVitale Aug 1, 2021
c563e48
refactor(rtk-query): track all fulfilled requests using actions
FaberVitale Aug 15, 2021
bfd6e91
Merge branch 'master' of https://github.com/reduxjs/redux-devtools in…
FaberVitale Aug 26, 2021
8a49ed9
chore(rtk-query): update @redux-devtools/rtk-query-monitor dependencies
FaberVitale Aug 26, 2021
6c3db1e
fix(rtk-query): demo build failing caused by a typing error
FaberVitale Aug 26, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ node_modules
__snapshots__
dev
.yarn/*
**/.yarn/*
**/demo/public/**
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.2"
},
"resolutions": {
"@types/react": "16.14.8"
},
"scripts": {
"lerna": "lerna",
"build:all": "lerna run build",
Expand Down
2 changes: 2 additions & 0 deletions packages/redux-devtools-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
"@redux-devtools 10000 /inspector-monitor-test-tab": "^0.7.2",
"@redux-devtools/inspector-monitor-trace-tab": "^0.2.2",
"@redux-devtools/log-monitor": "^2.3.0",
"@redux-devtools/rtk-query-monitor": "^1.0.0",
"@redux-devtools/slider-monitor": "^2.0.0-8",
"@reduxjs/toolkit": "^1.6.0",
"d3-state-visualizer": "^1.4.0",
"devui": "^1.0.0-9",
"javascript-stringify": "^2.1.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/redux-devtools-app/src/utils/getMonitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import React from 'react';
import LogMonitor from '@redux-devtools/log-monitor';
import ChartMonitorWrapper from '../containers/monitors/ChartMonitorWrapper';
import InspectorWrapper from '../containers/monitors/InspectorWrapper';
import RtkQueryMonitor from '@redux-devtools/rtk-query-monitor';

export const monitors = [
{ value: 'InspectorMonitor', name: 'Inspector' },
{ value: 'LogMonitor', name: 'Log monitor' },
{ value: 'ChartMonitor', name: 'Chart' },
{ value: 'RtkQueryMonitor', name: 'RTK Query' },
];

export default function getMonitor({ monitor }: { monitor: string }) {
Expand All @@ -17,6 +19,8 @@ export default function getMonitor({ monitor }: { monitor: string }) {
);
case 'ChartMonitor':
return <ChartMonitorWrapper />;
case 'RtkQueryMonitor':
return <RtkQueryMonitor />;
default:
return <InspectorWrapper />;
}
Expand Down
Empty file modified packages/redux-devtools-cli/bin/redux-devtools.js
100644 → 100755
Empty file.
8 changes: 8 additions & 0 deletions packages/redux-devtools-rtk-query-monitor/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": ["@babel/plugin-proposal-class-properties"]
}
2 changes: 2 additions & 0 deletions packages/redux-devtools-rtk-query-monitor/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lib
demo/
13 changes: 13 additions & 0 deletions packages/redux-devtools-rtk-query-monitor/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
extends: '../../.eslintrc',
overrides: [
{
files: ['*.ts', '*.tsx'],
extends: '../../eslintrc.ts.react.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
},
],
};
21 changes: 21 additions & 0 deletions packages/redux-devtools-rtk-query-monitor/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2021 Fabrizio Vitale

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE S 3D11 OFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
108 changes: 108 additions & 0 deletions packages/redux-devtools-rtk-query-monitor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Redux DevTools RTK Query inspector monitor

A monitor that displays [RTK query](https://redux-toolkit.js.org/rtk-query/overview) queries and mutations for [Redux DevTools](https://github.com/gaearon/redux-devtools).

Created by [FaberVitale](https://github.com/FaberVitale), inspired by [react-query devtools](https://github.com/tannerlinsley/react-query/tree/master/devtools).

## Demo

- [link](https://rtk-query-monitor-demo.netlify.app/)
- [demo source](https://github.com/FaberVitale/redux-devtools/tree/feat/rtk-query-monitor/packages/redux-devtools-rtk-query-monitor/demo)

## Preview

![RTK Query inspector monitor demo](./monitor-demo.gif)

## Installation

### npm

```bash
npm i @redux-devtools/rtk-query-monitor --save
```

### yarn

```bash
yarn add @redux-devtools/rtk-query-monitor
```

## Usage

You can use `RtkQueryMonitor` as the only monitor in your app:

##### `containers/DevTools.js`

```ts
import React from 'react';
import { createDevTools } from '@redux-devtools/core';
import RtkQueryrMonitor from '@redux-devtools/rtk-query-monitor';

export default createDevTools(<RtkQueryrMonitor />);
```

Then you can render `<DevTools>` to any place inside app or even into a separate popup window.

Alternatively, you can use it together with [`DockMonitor`](https://github.com/reduxjs/redux-devtools/tree/master/packages/redux-devtools-dock-monitor) to make it dockable.

See also

- [`DockMonitor` README](https://github.com/reduxjs/redux-devtools/tree/master/packages/redux-devtools-dock-monitor)

- [Read how to start using Redux DevTools.](https://github.com/reduxjs/redux-devtools)

- [Redux Devtools walkthrough](https://github.com/reduxjs/redux-devtools/tree/master/docs/Walkthrough.md)

## Features

- sorts queries in ascending or descending order by:
- fulfilledTimeStamp
- query key
- query status
- endpoint
- api reducerPath
- filters queries by:
- fulfilledTimeStamp
- query key
- query status
- endpoint
- api reducerPath
- displays
- status flags
- query state
- tags
- subscriptions
- api state
- api stats

## TODO

- [ ] display mutations
- [ ] filter by tags types
- [ ] download query.data
- [ ] upload query.data(?)
- [ ] refetch query button(?)
- ...suggestions are welcome

## Redux DevTools props

| Name | Description |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `theme` | Either a string referring to one of the themes provided by [redux-devtools-themes](https://github.com/gaearon/redux-devtools-themes) (feel free to contribute!) or a custom object of the same format. Optional. By default, set to [`'nicinabox'`](https://github.com/gaearon/redux-devtools-themes/blob/master/src/nicinabox.js). |
| `invertTheme` | Boolean value that will invert the colors of the selected theme. Optional. By default, set to `false` |

<br/>

### Development

#### Start Demo

```bash
yarn lerna run start --stream --scope @redux-devtools/rtk-query-monitor
```

<br/>

## License

[MIT](./LICENSE.md)
11 changes: 11 additions & 0 deletions packages/redux-devtools-rtk-query-monitor/demo/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-runtime"
]
}
3 changes: 3 additions & 0 deletions packages/redux-devtools-rtk-query-monitor/demo/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['react-app'],
};
4 changes: 4 additions & 0 deletions packages/redux-devtools-rtk-query-monitor/demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.snowpack
build
node_modules
.yarn/*
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"resolveJsonModule": true
},
"include": ["webpack.config.ts"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import * as path from 'path';
import * as webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import * as pkg from '../../package.json';
const CopyWebpackPlugin = require('copy-webpack-plugin');
const isProduction = process.env.NODE_ENV === 'production';

const demoSrc = path.join(__dirname, '../src');
const libSrc = path.join(__dirname, '../../src');
const publicDir = path.join(__dirname, '../public');

module.exports = {
mode: process.env.NODE_ENV || 'development',
entry: isProduction
? ['./demo/src/index']
: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./demo/src/index',
],
output: {
path: path.join(__dirname, '../dist'),
filename: isProduction ? '[name].[contenthash:8].js' : 'js/bundle.js',
},
module: {
rules: [
{
test: /\.(js|ts)x?$/,
loader: 'babel-loader',
exclude: /node_modules/,
include: [demoSrc, libSrc],
},
{
test: /\.css?$/,
loaders: ['style-loader', 'css-loader'],
include: demoSrc,
},
],
},
resolve: {
modules: ['node_modules', demoSrc],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
optimization: {
minimize: isProduction,
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
inject: true,
template: 'demo/public/index.html',
package: pkg,
}),
new CopyWebpackPlugin({
patterns: [
{
from: 'demo/public/assets/*.js',
to: ({ absoluteFilename }: any) => {
return `./${path.basename(absoluteFilename)}`;
},
globOptions: {
ignore: ['*.DS_Store'],
},
},
],
}),
new ForkTsCheckerWebpackPlugin({
typescript: {
configFile: 'demo/tsconfig.json',
},
}),
].concat(isProduction ? [] : [new webpack.HotModuleReplacementPlugin()]),
devServer: isProduction
? {}
: {
quiet: false,
port: 3000,
hot: true,
stats: {
chunkModules: false,
colors: true,
},
historyApiFallback: true,
},
devtool: isProduction ? 'source-map' : 'cheap-module-source-map',
};
Loading
0