forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
736b3bf
commit 5b9cf17
Showing
4 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!package/dist/ |
65 changes: 65 additions & 0 deletions
65
superset-frontend/plugins/calendar-picker/package/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# calendar-picker | ||
|
||
This is the Calendar Picker Superset Chart Plugin. | ||
|
||
### Usage | ||
|
||
To build the plugin, run the following commands: | ||
|
||
``` | ||
npm ci | ||
npm run build | ||
``` | ||
|
||
Alternatively, to run the plugin in development mode (=rebuilding whenever changes are made), start the dev server with the following command: | ||
|
||
``` | ||
npm run dev | ||
``` | ||
|
||
To add the package to Superset, go to the `superset-frontend` subdirectory in your Superset source folder (assuming both the `calendar-picker` plugin and `superset` repos are in the same root directory) and run | ||
``` | ||
npm i -S ../../calendar-picker | ||
``` | ||
|
||
If your Superset plugin exists in the `superset-frontend` directory and you wish to resolve TypeScript errors about `@superset-ui/core` not being resolved correctly, add the following to your `tsconfig.json` file: | ||
|
||
``` | ||
"references": [ | ||
{ | ||
"path": "../../packages/superset-ui-chart-controls" | ||
}, | ||
{ | ||
"path": "../../packages/superset-ui-core" | ||
} | ||
] | ||
``` | ||
|
||
You may also wish to add the following to the `include` array in `tsconfig.json` to make Superset types available to your plugin: | ||
|
||
``` | ||
"../../types/**/*" | ||
``` | ||
|
||
Finally, if you wish to ensure your plugin `tsconfig.json` is aligned with the root Superset project, you may add the following to your `tsconfig.json` file: | ||
|
||
``` | ||
"extends": "../../tsconfig.json", | ||
``` | ||
|
||
After this edit the `superset-frontend/src/visualizations/presets/MainPreset.js` and make the following changes: | ||
|
||
```js | ||
import { CalendarPicker } from 'calendar-picker'; | ||
``` | ||
|
||
to import the plugin and later add the following to the array that's passed to the `plugins` property: | ||
```js | ||
new CalendarPicker().configure({ key: 'calendar-picker' }), | ||
``` | ||
|
||
After that the plugin should show up when you run Superset, e.g. the development server: | ||
|
||
``` | ||
npm run dev-server | ||
``` |
Large diffs are not rendered by default.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
superset-frontend/plugins/calendar-picker/package/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"name": "calendar-picker", | ||
"version": "0.1.6", | ||
"description": "Calendar Picker", | ||
"sideEffects": false, | ||
"private": true, | ||
"main": "dist/lib.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "npm run build-cjs && npm run build-esm && npx webpack --config webpack.config.js", | ||
"build-cjs": "babel src --extensions \".ts,.tsx,.js,.jsx\" --copy-files --out-dir lib", | ||
"build-clean": "npm run clean && npm run build", | ||
"build-esm": "BABEL_OUTPUT=esm babel src --extensions \".ts,.tsx,.js,.jsx\" --copy-files --out-dir esm", | ||
"dev": "BABEL_OUTPUT=esm babel src --extensions \".ts,.tsx,.js,.jsx\" --watch --copy-files --out-dir esm", | ||
"prebuild": "rimraf {lib,esm,tsconfig.tsbuildinfo}", | ||
"ts-types": "tsc --build", | ||
"test": "jest" | ||
}, | ||
"author": "Aldrin Rayen", | ||
"license": "Apache-2.0", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@types/node": "^20.8.9", | ||
"date-fns": "^2.30.0", | ||
"jquery": "^3.7.1", | ||
"path": "^0.12.7", | ||
"react-date-range": "^1.4.0", | ||
"react-dom": "^16.14.0" | ||
}, | ||
"peerDependencies": { | ||
"@airbnb/config-babel": "^2.0.1", | ||
"@superset-ui/chart-controls": "^0.18.25", | ||
"@superset-ui/core": "^0.18.25", | ||
"react": "^16.14.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.16.0", | ||
"@babel/core": "^7.23.2", | ||
"@babel/plugin-transform-modules-commonjs": "^7.23.0", | ||
"@babel/preset-env": "^7.23.2", | ||
"@babel/preset-react": "^7.22.15", | ||
"@types/dotenv": "^8.2.0", | ||
"@types/jest": "^26.0.4", | ||
"@types/jquery": "^3.5.27", | ||
"@types/react-date-range": "^1.4.7", | ||
"@types/react-dom": "^18.2.17", | ||
"babel-loader": "^9.1.3", | ||
"compression-webpack-plugin": "^10.0.0", | ||
"crypto-browserify": "^3.12.0", | ||
"css-loader": "^6.8.1", | ||
"file-loader": "^6.2.0", | ||
"javascript-obfuscator": "^4.1.0", | ||
"jest": "^26.6.3", | ||
"jscrambler-webpack-plugin": "^6.4.19", | ||
"rimraf": "^3.0.2", | ||
"style-loader": "^3.3.3", | ||
"terser-webpack-plugin": "^5.3.9", | ||
"typescript": "^4.1.2", | ||
"webpack-cli": "^5.1.4", | ||
"webpack-node-externals": "^3.0.0", | ||
"webpack-obfuscator": "^3.5.1" | ||
}, | ||
"browser": { | ||
"crypto": false | ||
} | ||
} |