dinocollab-core 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rollupPluginBabelHelpers.js +67 -10
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/dist/{src/api-context → api-context}/alert-global.js +49 -34
- package/dist/api-context/alert-global.js.map +1 -0
- package/dist/{src/api-context → api-context}/drawer-global.js +40 -33
- package/dist/api-context/drawer-global.js.map +1 -0
- package/dist/{src/api-context → api-context}/global-modal.js +40 -32
- package/dist/api-context/global-modal.js.map +1 -0
- package/dist/{src/api-context → api-context}/popover-global.js +44 -36
- package/dist/api-context/popover-global.js.map +1 -0
- package/dist/api-context/popover.js +94 -0
- package/dist/api-context/popover.js.map +1 -0
- package/dist/{src/api-context → api-context}/ui.units.js +12 -10
- package/dist/api-context/ui.units.js.map +1 -0
- package/dist/components/breadcrumbs.js +65 -0
- package/dist/components/breadcrumbs.js.map +1 -0
- package/dist/{src/components → components}/copy-to-clipboard.js +39 -32
- package/dist/components/copy-to-clipboard.js.map +1 -0
- package/dist/components/help-tooltip.js +104 -0
- package/dist/components/help-tooltip.js.map +1 -0
- package/dist/components/image-with-fallback.js +51 -0
- package/dist/components/image-with-fallback.js.map +1 -0
- package/dist/{src/components → components}/text-editor.js +24 -23
- package/dist/components/text-editor.js.map +1 -0
- package/dist/components/text-editor.preview.js +27 -0
- package/dist/components/text-editor.preview.js.map +1 -0
- package/dist/form/create.autocomplete.chips.js +228 -0
- package/dist/form/create.autocomplete.chips.js.map +1 -0
- package/dist/{src/form → form}/create.date-expired.js +71 -61
- package/dist/form/create.date-expired.js.map +1 -0
- package/dist/{src/form → form}/create.date-picker.js +40 -37
- package/dist/form/create.date-picker.js.map +1 -0
- package/dist/{src/form → form}/create.form-base.js +47 -41
- package/dist/form/create.form-base.js.map +1 -0
- package/dist/form/create.form-comfirm.js +131 -0
- package/dist/form/create.form-comfirm.js.map +1 -0
- package/dist/form/create.form-grid-layout.js +188 -0
- package/dist/form/create.form-grid-layout.js.map +1 -0
- package/dist/{src/form → form}/create.form-grid-layout.units.js +17 -14
- package/dist/form/create.form-grid-layout.units.js.map +1 -0
- package/dist/form/create.input.file.js +79 -0
- package/dist/form/create.input.file.js.map +1 -0
- package/dist/form/create.input.js +276 -0
- package/dist/form/create.input.js.map +1 -0
- package/dist/form/create.select-simple.js +114 -0
- package/dist/form/create.select-simple.js.map +1 -0
- package/dist/form/create.select-with-api.js +277 -0
- package/dist/form/create.select-with-api.js.map +1 -0
- package/dist/form/create.text-editor.js +181 -0
- package/dist/form/create.text-editor.js.map +1 -0
- package/dist/{src/form → form}/dino-form.js +17 -18
- package/dist/form/dino-form.js.map +1 -0
- package/dist/{src/form → form}/helper.js +14 -14
- package/dist/form/helper.js.map +1 -0
- package/dist/{src/form → form}/modal-wrapper.js +32 -25
- package/dist/form/modal-wrapper.js.map +1 -0
- package/dist/{src/form → form}/validator.js +47 -43
- package/dist/form/validator.js.map +1 -0
- package/dist/{src/hooks → hooks}/index.js +1 -1
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +928 -0
- package/dist/{src/index.js → index.js} +10 -3
- package/dist/{src/index.js.map → index.js.map} +1 -1
- package/dist/redux/create.hoc-lazy.js +71 -0
- package/dist/redux/create.hoc-lazy.js.map +1 -0
- package/dist/{src/redux → redux}/dino.js +2 -2
- package/dist/redux/dino.js.map +1 -0
- package/dist/redux/types.js.map +1 -0
- package/dist/redux/ui.error-page.js +89 -0
- package/dist/redux/ui.error-page.js.map +1 -0
- package/dist/redux/vector-404.webp.js.map +1 -0
- package/dist/{src/table → table}/context.js +5 -2
- package/dist/table/context.js.map +1 -0
- package/dist/table/create.action-row.js +144 -0
- package/dist/table/create.action-row.js.map +1 -0
- package/dist/table/create.table.js +246 -0
- package/dist/table/create.table.js.map +1 -0
- package/dist/{src/table → table}/custom.filter-operators.js +2 -2
- package/dist/table/custom.filter-operators.js.map +1 -0
- package/dist/table/dino.js +136 -0
- package/dist/table/dino.js.map +1 -0
- package/dist/{src/table → table}/helpers.js +31 -32
- package/dist/table/helpers.js.map +1 -0
- package/dist/table/model-filter.js.map +1 -0
- package/dist/table/toolbar-pannel.js +143 -0
- package/dist/table/toolbar-pannel.js.map +1 -0
- package/dist/table/ui.buttons.js +67 -0
- package/dist/table/ui.buttons.js.map +1 -0
- package/dist/table/ui.units.js +248 -0
- package/dist/table/ui.units.js.map +1 -0
- package/dist/types/api-context/alert-global.d.ts +29 -0
- package/dist/types/api-context/drawer-global.d.ts +32 -0
- package/dist/types/api-context/global-modal.d.ts +37 -0
- package/dist/types/api-context/index.d.ts +9 -0
- package/dist/types/api-context/popover-global.d.ts +37 -0
- package/dist/types/api-context/popover.d.ts +32 -0
- package/dist/types/api-context/ui.units.d.ts +2 -0
- package/dist/types/components/breadcrumbs.d.ts +13 -0
- package/dist/types/components/copy-to-clipboard.d.ts +26 -0
- package/dist/types/components/help-tooltip.d.ts +15 -0
- package/dist/types/components/image-with-fallback.d.ts +13 -0
- package/dist/types/components/index.d.ts +11 -0
- package/dist/types/components/input-debounce-timer.d.ts +9 -0
- package/dist/types/components/loading-buttons.d.ts +6 -0
- package/dist/types/components/text-editor.d.ts +26 -0
- package/dist/types/components/text-editor.preview.d.ts +5 -0
- package/dist/types/form/create.autocomplete.chips.d.ts +16 -0
- package/dist/types/form/create.date-expired.d.ts +19 -0
- package/dist/types/form/create.date-picker.d.ts +19 -0
- package/dist/types/form/create.form-base.d.ts +30 -0
- package/dist/types/form/create.form-comfirm.d.ts +20 -0
- package/dist/types/form/create.form-grid-layout.d.ts +44 -0
- package/dist/types/form/create.form-grid-layout.units.d.ts +8 -0
- package/dist/types/form/create.input.d.ts +29 -0
- package/dist/types/form/create.input.file.d.ts +16 -0
- package/dist/types/form/create.select-simple.d.ts +24 -0
- package/dist/types/form/create.select-with-api.d.ts +29 -0
- package/dist/types/form/create.text-editor.d.ts +42 -0
- package/dist/types/form/dino-form.d.ts +26 -0
- package/dist/types/form/helper.d.ts +14 -0
- package/dist/types/form/index.d.ts +7 -0
- package/dist/types/form/modal-wrapper.d.ts +14 -0
- package/dist/types/form/types.d.ts +15 -0
- package/dist/types/form/validator.d.ts +64 -0
- package/dist/types/hooks/index.d.ts +4 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/lab/create.autocomplete.simple.d.ts +19 -0
- package/dist/types/lab/create.dino-store.d.ts +1 -0
- package/dist/types/lab/create.multi-select-dropdown.d.ts +23 -0
- package/dist/types/lab/create.select-mul-with-api/index.d.ts +26 -0
- package/dist/types/lab/create.select-mul-with-api/table-custom.d.ts +43 -0
- package/dist/types/lab/create.select-mul-with-api/types.d.ts +21 -0
- package/dist/types/lab/create.select-mul-with-api/ui.units.d.ts +29 -0
- package/dist/types/lab/filter-bar/base.d.ts +34 -0
- package/dist/types/lab/filter-bar/create.filter-bar.d.ts +92 -0
- package/dist/types/lab/filter-bar/create.filter-menu.d.ts +66 -0
- package/dist/types/lab/filter-bar/create.filter-panel.d.ts +117 -0
- package/dist/types/lab/filter-bar/create.filtered.d.ts +59 -0
- package/dist/types/lab/filter-bar/create.sort-menu.d.ts +7 -0
- package/dist/types/lab/filter-bar/demo.d.ts +3 -0
- package/dist/types/lab/filter-bar/index.d.ts +4 -0
- package/dist/types/lab/filter-bar/types.d.ts +81 -0
- package/dist/types/lab/filter-bar/ui.units.d.ts +13 -0
- package/dist/types/lab/grafana-dashboard/configs.d.ts +4 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/absolute-time-rage.d.ts +14 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/helpers.d.ts +36 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/index.d.ts +24 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/menu-wrap.d.ts +19 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/quick-ranges.d.ts +20 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/types.d.ts +8 -0
- package/dist/types/lab/grafana-dashboard/date-time-range/units.d.ts +2 -0
- package/dist/types/lab/grafana-dashboard/helper.d.ts +7 -0
- package/dist/types/lab/grafana-dashboard/hooks.d.ts +10 -0
- package/dist/types/lab/grafana-dashboard/icons.d.ts +5 -0
- package/dist/types/lab/grafana-dashboard/index.d.ts +12 -0
- package/dist/types/lab/grafana-dashboard/top-bar.d.ts +19 -0
- package/dist/types/lab/grafana-dashboard/top-bar.types.d.ts +4 -0
- package/dist/types/lab/grafana-dashboard/types.d.ts +8 -0
- package/dist/types/lab/media-player.core1.d.ts +14 -0
- package/dist/types/lab/media-player.muted.d.ts +10 -0
- package/dist/types/lab/media-player.units.d.ts +36 -0
- package/dist/types/lab/table-grid/create.table-grid.d.ts +4 -0
- package/dist/types/lab/table-grid/demo.d.ts +3 -0
- package/dist/types/lab/table-grid/dino.d.ts +6 -0
- package/dist/types/lab/table-grid/helpers.d.ts +11 -0
- package/dist/types/lab/table-grid/index.d.ts +2 -0
- package/dist/types/lab/table-grid/item-actions.d.ts +93 -0
- package/dist/types/lab/table-grid/toolbar-pannel.d.ts +27 -0
- package/dist/types/lab/table-grid/types.d.ts +56 -0
- package/dist/types/redux/create.hoc-lazy.d.ts +19 -0
- package/dist/types/redux/dino.d.ts +6 -0
- package/dist/types/redux/index.d.ts +4 -0
- package/dist/types/redux/types.d.ts +22 -0
- package/dist/types/redux/ui.error-page.d.ts +3 -0
- package/dist/types/redux/ui.units.d.ts +9 -0
- package/dist/types/table/context.d.ts +8 -0
- package/dist/types/table/create.action-row.d.ts +16 -0
- package/dist/types/table/create.table.d.ts +33 -0
- package/dist/types/table/custom.filter-operators.d.ts +2 -0
- package/dist/types/table/dino.d.ts +41 -0
- package/dist/types/table/helpers.d.ts +23 -0
- package/dist/types/table/index.d.ts +7 -0
- package/dist/types/table/model-filter.d.ts +38 -0
- package/dist/types/table/toolbar-pannel.d.ts +18 -0
- package/dist/types/table/types.d.ts +40 -0
- package/dist/types/table/ui.buttons.d.ts +16 -0
- package/dist/types/table/ui.units.d.ts +62 -0
- package/dist/types/utils/dayjs-config.d.ts +2 -0
- package/dist/types/utils/helpers.d.ts +35 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/json-object.d.ts +9 -0
- package/dist/types/utils/mfe-events.d.ts +12 -0
- package/dist/types/utils/query-param.d.ts +25 -0
- package/dist/utils/dayjs-config.js.map +1 -0
- package/dist/{src/utils → utils}/helpers.js +11 -9
- package/dist/utils/helpers.js.map +1 -0
- package/dist/{src/utils → utils}/json-object.js +13 -13
- package/dist/utils/json-object.js.map +1 -0
- package/dist/{src/utils → utils}/query-param.js +17 -17
- package/dist/utils/query-param.js.map +1 -0
- package/package.json +18 -5
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@1_d0d2002d9033600b6738d939bd598bc6/node_modules/tslib/tslib.es6.js +0 -46
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@1_d0d2002d9033600b6738d939bd598bc6/node_modules/tslib/tslib.es6.js.map +0 -1
- package/dist/src/api-context/alert-global.js.map +0 -1
- package/dist/src/api-context/drawer-global.js.map +0 -1
- package/dist/src/api-context/global-modal.js.map +0 -1
- package/dist/src/api-context/popover-global.js.map +0 -1
- package/dist/src/api-context/popover.js +0 -86
- package/dist/src/api-context/popover.js.map +0 -1
- package/dist/src/api-context/ui.units.js.map +0 -1
- package/dist/src/components/copy-to-clipboard.js.map +0 -1
- package/dist/src/components/custom.breadcrumbs.js +0 -61
- package/dist/src/components/custom.breadcrumbs.js.map +0 -1
- package/dist/src/components/help-tooltip.js +0 -91
- package/dist/src/components/help-tooltip.js.map +0 -1
- package/dist/src/components/image-with-fallback.js +0 -48
- package/dist/src/components/image-with-fallback.js.map +0 -1
- package/dist/src/components/text-editor.js.map +0 -1
- package/dist/src/form/create.autocomplete.chips.js +0 -218
- package/dist/src/form/create.autocomplete.chips.js.map +0 -1
- package/dist/src/form/create.date-expired.js.map +0 -1
- package/dist/src/form/create.date-picker.js.map +0 -1
- package/dist/src/form/create.form-base.js.map +0 -1
- package/dist/src/form/create.form-comfirm.js +0 -119
- package/dist/src/form/create.form-comfirm.js.map +0 -1
- package/dist/src/form/create.form-grid-layout.js +0 -177
- package/dist/src/form/create.form-grid-layout.js.map +0 -1
- package/dist/src/form/create.form-grid-layout.units.js.map +0 -1
- package/dist/src/form/create.input-base.js +0 -260
- package/dist/src/form/create.input-base.js.map +0 -1
- package/dist/src/form/create.input.file.js +0 -74
- package/dist/src/form/create.input.file.js.map +0 -1
- package/dist/src/form/create.select-simple.js +0 -104
- package/dist/src/form/create.select-simple.js.map +0 -1
- package/dist/src/form/create.select-with-api.js +0 -271
- package/dist/src/form/create.select-with-api.js.map +0 -1
- package/dist/src/form/create.text-editor.js +0 -156
- package/dist/src/form/create.text-editor.js.map +0 -1
- package/dist/src/form/dino-form.js.map +0 -1
- package/dist/src/form/helper.js.map +0 -1
- package/dist/src/form/modal-wrapper.js.map +0 -1
- package/dist/src/form/validator.js.map +0 -1
- package/dist/src/hooks/index.js.map +0 -1
- package/dist/src/redux/create.hoc-lazy.js +0 -67
- package/dist/src/redux/create.hoc-lazy.js.map +0 -1
- package/dist/src/redux/dino.js.map +0 -1
- package/dist/src/redux/types.js.map +0 -1
- package/dist/src/redux/ui.error-page.js +0 -80
- package/dist/src/redux/ui.error-page.js.map +0 -1
- package/dist/src/redux/vector-404.webp.js.map +0 -1
- package/dist/src/table/context.js.map +0 -1
- package/dist/src/table/create.action-row.js +0 -135
- package/dist/src/table/create.action-row.js.map +0 -1
- package/dist/src/table/create.status-cell.js +0 -49
- package/dist/src/table/create.status-cell.js.map +0 -1
- package/dist/src/table/create.table.js +0 -233
- package/dist/src/table/create.table.js.map +0 -1
- package/dist/src/table/custom.filter-operators.js.map +0 -1
- package/dist/src/table/dino.js +0 -129
- package/dist/src/table/dino.js.map +0 -1
- package/dist/src/table/helpers.js.map +0 -1
- package/dist/src/table/model-filter.js.map +0 -1
- package/dist/src/table/toolbar-pannel.js +0 -134
- package/dist/src/table/toolbar-pannel.js.map +0 -1
- package/dist/src/table/ui.buttons.js +0 -60
- package/dist/src/table/ui.buttons.js.map +0 -1
- package/dist/src/table/ui.units.js +0 -201
- package/dist/src/table/ui.units.js.map +0 -1
- package/dist/src/utils/dayjs-config.js.map +0 -1
- package/dist/src/utils/helpers.js.map +0 -1
- package/dist/src/utils/json-object.js.map +0 -1
- package/dist/src/utils/query-param.js.map +0 -1
- package/rollup.config.js +0 -39
- package/src/@types/global.d.ts +0 -5
- package/src/api-context/alert-global.tsx +0 -174
- package/src/api-context/drawer-global.tsx +0 -116
- package/src/api-context/global-modal.tsx +0 -109
- package/src/api-context/index.ts +0 -13
- package/src/api-context/popover-global.tsx +0 -107
- package/src/api-context/popover.tsx +0 -89
- package/src/api-context/ui.units.tsx +0 -10
- package/src/components/copy-to-clipboard.tsx +0 -86
- package/src/components/custom.breadcrumbs.tsx +0 -67
- package/src/components/help-tooltip.tsx +0 -75
- package/src/components/image-with-fallback.tsx +0 -51
- package/src/components/index.tsx +0 -1
- package/src/components/input-debounce-timer.tsx +0 -138
- package/src/components/loading-buttons.tsx +0 -35
- package/src/components/text-editor.preview.tsx +0 -30
- package/src/components/text-editor.tsx +0 -125
- package/src/form/README.md +0 -55
- package/src/form/create.autocomplete.chips.tsx +0 -199
- package/src/form/create.date-expired.tsx +0 -195
- package/src/form/create.date-picker.tsx +0 -122
- package/src/form/create.form-base.tsx +0 -102
- package/src/form/create.form-comfirm.tsx +0 -83
- package/src/form/create.form-grid-layout.tsx +0 -170
- package/src/form/create.form-grid-layout.units.tsx +0 -37
- package/src/form/create.input-base.tsx +0 -222
- package/src/form/create.input.file.tsx +0 -76
- package/src/form/create.select-simple.tsx +0 -101
- package/src/form/create.select-with-api.tsx +0 -213
- package/src/form/create.text-editor.tsx +0 -161
- package/src/form/dino-form.tsx +0 -40
- package/src/form/helper.ts +0 -132
- package/src/form/index.ts +0 -12
- package/src/form/modal-wrapper.tsx +0 -75
- package/src/form/types.ts +0 -16
- package/src/form/validator.ts +0 -202
- package/src/hooks/index.ts +0 -44
- package/src/index.ts +0 -7
- package/src/lab/create.autocomplete.simple.tsx +0 -57
- package/src/lab/create.dino-store.ts +0 -59
- package/src/lab/create.multi-select-dropdown.tsx +0 -189
- package/src/lab/create.select-mul-with-api/index.tsx +0 -271
- package/src/lab/create.select-mul-with-api/table-custom.tsx +0 -194
- package/src/lab/create.select-mul-with-api/types.ts +0 -26
- package/src/lab/create.select-mul-with-api/ui.units.tsx +0 -163
- package/src/lab/filter-bar/base.tsx +0 -162
- package/src/lab/filter-bar/create.filter-bar.tsx +0 -190
- package/src/lab/filter-bar/create.filter-menu.tsx +0 -156
- package/src/lab/filter-bar/create.filter-panel.tsx +0 -95
- package/src/lab/filter-bar/create.filtered.tsx +0 -41
- package/src/lab/filter-bar/create.sort-menu.tsx +0 -43
- package/src/lab/filter-bar/demo.tsx +0 -50
- package/src/lab/filter-bar/index.ts +0 -6
- package/src/lab/filter-bar/types.ts +0 -105
- package/src/lab/filter-bar/ui.units.tsx +0 -70
- package/src/lab/grafana-dashboard/configs.ts +0 -43
- package/src/lab/grafana-dashboard/date-time-range/absolute-time-rage.tsx +0 -137
- package/src/lab/grafana-dashboard/date-time-range/helpers.ts +0 -126
- package/src/lab/grafana-dashboard/date-time-range/index.tsx +0 -62
- package/src/lab/grafana-dashboard/date-time-range/menu-wrap.tsx +0 -101
- package/src/lab/grafana-dashboard/date-time-range/quick-ranges.tsx +0 -161
- package/src/lab/grafana-dashboard/date-time-range/types.ts +0 -9
- package/src/lab/grafana-dashboard/date-time-range/units.tsx +0 -18
- package/src/lab/grafana-dashboard/helper.ts +0 -25
- package/src/lab/grafana-dashboard/hooks.tsx +0 -79
- package/src/lab/grafana-dashboard/icons.tsx +0 -67
- package/src/lab/grafana-dashboard/index.tsx +0 -120
- package/src/lab/grafana-dashboard/top-bar.tsx +0 -62
- package/src/lab/grafana-dashboard/top-bar.types.ts +0 -5
- package/src/lab/grafana-dashboard/types.ts +0 -8
- package/src/lab/media-player.core1.tsx +0 -273
- package/src/lab/media-player.muted.tsx +0 -62
- package/src/lab/media-player.units.ts +0 -80
- package/src/lab/table-grid/create.table-grid.tsx +0 -183
- package/src/lab/table-grid/demo.tsx +0 -53
- package/src/lab/table-grid/dino.tsx +0 -8
- package/src/lab/table-grid/helpers.tsx +0 -11
- package/src/lab/table-grid/index.ts +0 -3
- package/src/lab/table-grid/item-actions.tsx +0 -138
- package/src/lab/table-grid/toolbar-pannel.tsx +0 -98
- package/src/lab/table-grid/types.ts +0 -68
- package/src/redux/create.hoc-lazy.tsx +0 -80
- package/src/redux/dino.ts +0 -9
- package/src/redux/index.ts +0 -6
- package/src/redux/types.ts +0 -27
- package/src/redux/ui.error-page.tsx +0 -62
- package/src/redux/ui.units.tsx +0 -41
- package/src/redux/vector-404.webp +0 -0
- package/src/table/context.tsx +0 -16
- package/src/table/create.action-row.tsx +0 -91
- package/src/table/create.status-cell.tsx +0 -51
- package/src/table/create.table.tsx +0 -239
- package/src/table/custom.filter-operators.ts +0 -94
- package/src/table/dino.tsx +0 -120
- package/src/table/helpers.ts +0 -94
- package/src/table/index.ts +0 -13
- package/src/table/model-filter.ts +0 -43
- package/src/table/toolbar-pannel.tsx +0 -106
- package/src/table/types.ts +0 -50
- package/src/table/ui.buttons.tsx +0 -54
- package/src/table/ui.units.tsx +0 -189
- package/src/utils/dayjs-config.ts +0 -13
- package/src/utils/helpers.ts +0 -171
- package/src/utils/index.ts +0 -7
- package/src/utils/json-object.ts +0 -29
- package/src/utils/mfe-events.tsx +0 -34
- package/src/utils/query-param.ts +0 -129
- package/tsconfig.json +0 -20
- /package/dist/{src/redux → redux}/types.js +0 -0
- /package/dist/{src/redux → redux}/vector-404.webp.js +0 -0
- /package/dist/{src/table → table}/model-filter.js +0 -0
- /package/dist/{src/utils → utils}/dayjs-config.js +0 -0
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import React, { Component, PropsWithChildren } from 'react'
|
|
2
|
-
import { Button, Menu, SxProps, Theme, Tooltip, styled } from '@mui/material'
|
|
3
|
-
import AccessTimeIcon from '@mui/icons-material/AccessTime'
|
|
4
|
-
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
|
|
5
|
-
|
|
6
|
-
interface IProps {
|
|
7
|
-
title?: string
|
|
8
|
-
subTitle?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface IState {
|
|
12
|
-
anchorEl: null | HTMLElement
|
|
13
|
-
}
|
|
14
|
-
export interface IMenuWrap {
|
|
15
|
-
close: () => void
|
|
16
|
-
}
|
|
17
|
-
export default class MenuWrap extends Component<PropsWithChildren<IProps>, IState> implements IMenuWrap {
|
|
18
|
-
constructor(props: IProps) {
|
|
19
|
-
super(props)
|
|
20
|
-
this.state = { anchorEl: null }
|
|
21
|
-
}
|
|
22
|
-
render() {
|
|
23
|
-
const { anchorEl } = this.state
|
|
24
|
-
const isOpen = Boolean(anchorEl)
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
{this.renderTooltip(
|
|
29
|
-
<CustomButton
|
|
30
|
-
variant='text'
|
|
31
|
-
color='inherit'
|
|
32
|
-
onClick={this.onOpen}
|
|
33
|
-
startIcon={<AccessTimeIcon />}
|
|
34
|
-
endIcon={<ExpandMoreIcon sx={{ transition: 'linear 0.1s', transform: `rotate(${isOpen ? -180 : 0}deg)` }} />}
|
|
35
|
-
sx={isOpen ? { backgroundColor: 'rgba(0, 0, 0, 0.04)' } : {}}
|
|
36
|
-
>
|
|
37
|
-
{this.props.title || 'Date time range'}
|
|
38
|
-
</CustomButton>
|
|
39
|
-
)}
|
|
40
|
-
<Menu
|
|
41
|
-
keepMounted
|
|
42
|
-
anchorEl={anchorEl}
|
|
43
|
-
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
|
|
44
|
-
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
|
|
45
|
-
slotProps={{ paper: { elevation: 0, sx: sxPaperProps } }}
|
|
46
|
-
open={isOpen}
|
|
47
|
-
onClose={this.close}
|
|
48
|
-
MenuListProps={{ component: 'div', sx: { height: '100%', padding: 0 } }}
|
|
49
|
-
>
|
|
50
|
-
{this.props.children}
|
|
51
|
-
</Menu>
|
|
52
|
-
</>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
renderTooltip = (child: JSX.Element) => {
|
|
57
|
-
const { title, subTitle } = this.props
|
|
58
|
-
const isTooltip = !!subTitle && title !== subTitle
|
|
59
|
-
if (!isTooltip) return child
|
|
60
|
-
return (
|
|
61
|
-
<Tooltip title={this.props.subTitle} placement='left' arrow>
|
|
62
|
-
{child}
|
|
63
|
-
</Tooltip>
|
|
64
|
-
)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
onOpen = (event: React.MouseEvent<HTMLElement>) => this.setState({ ...this.state, anchorEl: event.currentTarget })
|
|
68
|
-
close = () => this.setState({ ...this.state, anchorEl: null })
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const sxPaperProps: SxProps<Theme> = {
|
|
72
|
-
overflow: 'visible',
|
|
73
|
-
filter: 'drop-shadow(0px 2px 8px rgba(99, 99, 99, 0.2))',
|
|
74
|
-
marginTop: '10px',
|
|
75
|
-
width: 'calc(100vw - 24px)',
|
|
76
|
-
maxWidth: '550px',
|
|
77
|
-
height: 'calc(100vh - 24px)',
|
|
78
|
-
maxHeight: '420px',
|
|
79
|
-
'&:before': {
|
|
80
|
-
content: '""',
|
|
81
|
-
display: 'block',
|
|
82
|
-
position: 'absolute',
|
|
83
|
-
top: 0,
|
|
84
|
-
right: 14,
|
|
85
|
-
width: 10,
|
|
86
|
-
height: 10,
|
|
87
|
-
backgroundColor: 'background.paper',
|
|
88
|
-
transform: 'translateY(-50%) rotate(45deg)',
|
|
89
|
-
zIndex: 0
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const CustomButton = styled(Button)({
|
|
94
|
-
textTransform: 'unset',
|
|
95
|
-
fontWeight: 600,
|
|
96
|
-
gap: '6px',
|
|
97
|
-
paddingLeft: '18px',
|
|
98
|
-
paddingRight: '18px',
|
|
99
|
-
minWidth: '220px',
|
|
100
|
-
justifyContent: 'space-between'
|
|
101
|
-
})
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react'
|
|
2
|
-
import { alpha, Box, BoxProps, Button, Collapse, Divider, Fade } from '@mui/material'
|
|
3
|
-
import { IconButton, InputAdornment, Stack, styled, TextField, Typography } from '@mui/material'
|
|
4
|
-
import ClearIcon from '@mui/icons-material/Clear'
|
|
5
|
-
import SearchIcon from '@mui/icons-material/Search'
|
|
6
|
-
import { IQuickRangeConfig } from './types'
|
|
7
|
-
|
|
8
|
-
interface IProps {
|
|
9
|
-
selectedValue?: IQuickRangeConfig
|
|
10
|
-
data: IQuickRangeConfig[]
|
|
11
|
-
onSelect: (item: IQuickRangeConfig) => void
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface IState {
|
|
15
|
-
searchKey: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default class QuickRanges extends Component<IProps, IState> {
|
|
19
|
-
constructor(props: IProps) {
|
|
20
|
-
super(props)
|
|
21
|
-
this.state = { searchKey: '' }
|
|
22
|
-
}
|
|
23
|
-
render = () => {
|
|
24
|
-
const data = this.getData()
|
|
25
|
-
return (
|
|
26
|
-
<Stack sx={{ padding: '2px 0', width: '235px', gap: '2px' }}>
|
|
27
|
-
<TextField
|
|
28
|
-
placeholder='Search quick ranges'
|
|
29
|
-
size='small'
|
|
30
|
-
name='search-pick-ranges'
|
|
31
|
-
value={this.state.searchKey}
|
|
32
|
-
onChange={this.handleChangeSearch}
|
|
33
|
-
InputProps={{
|
|
34
|
-
startAdornment: (
|
|
35
|
-
<InputAdornment position='start'>
|
|
36
|
-
<SearchIcon fontSize='small' />
|
|
37
|
-
</InputAdornment>
|
|
38
|
-
),
|
|
39
|
-
endAdornment: (
|
|
40
|
-
<Fade in={!!this.state.searchKey}>
|
|
41
|
-
<InputAdornment position='end' sx={{ mr: '-8px' }}>
|
|
42
|
-
<IconButton size='small' onClick={() => this.setState({ searchKey: '' })}>
|
|
43
|
-
<ClearIcon fontSize='small' />
|
|
44
|
-
</IconButton>
|
|
45
|
-
</InputAdornment>
|
|
46
|
-
</Fade>
|
|
47
|
-
)
|
|
48
|
-
}}
|
|
49
|
-
/>
|
|
50
|
-
<Collapse in={data.length < 1} unmountOnExit>
|
|
51
|
-
<TypographyNotFoundWrap>
|
|
52
|
-
<Typography variant='caption' sx={{ fontWeight: 600, color: alpha('#000000', 0.6) }}>
|
|
53
|
-
Not found
|
|
54
|
-
</Typography>
|
|
55
|
-
</TypographyNotFoundWrap>
|
|
56
|
-
</Collapse>
|
|
57
|
-
{this.renderQuickRanges(data)}
|
|
58
|
-
</Stack>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
renderQuickRanges = (items: IQuickRangeConfig[]) => (
|
|
62
|
-
<QuickRangeWrap>
|
|
63
|
-
{this.renderQuickRangeCustom(items, this.props.selectedValue)}
|
|
64
|
-
{items.map((item, index) => (
|
|
65
|
-
<React.Fragment key={item.title?.toString() + index}>
|
|
66
|
-
{item.lineAbove && <Divider sx={{ my: '2px' }} />}
|
|
67
|
-
<QuickRangeItem
|
|
68
|
-
{...{ component: 'div', className: this.getClassNameItem(item) }}
|
|
69
|
-
color='inherit'
|
|
70
|
-
size='small'
|
|
71
|
-
onClick={() => this.props.onSelect(item)}
|
|
72
|
-
>
|
|
73
|
-
<Typography variant='subtitle2' sx={{ fontWeight: 600, color: alpha('#000000', 0.6) }}>
|
|
74
|
-
{item.title}
|
|
75
|
-
</Typography>
|
|
76
|
-
</QuickRangeItem>
|
|
77
|
-
</React.Fragment>
|
|
78
|
-
))}
|
|
79
|
-
<Box sx={{ height: '2rem' }} />
|
|
80
|
-
</QuickRangeWrap>
|
|
81
|
-
)
|
|
82
|
-
renderQuickRangeCustom = (items: IQuickRangeConfig[], selected?: IQuickRangeConfig) => {
|
|
83
|
-
const check = !items.some((x) => x.from === selected?.from && x.to === selected?.to)
|
|
84
|
-
return (
|
|
85
|
-
<Collapse in={check} sx={{ transitionDelay: '500ms' }}>
|
|
86
|
-
<Box>
|
|
87
|
-
<QuickRangeItem {...{ component: 'div', className: QuickRangeItemActivatedName }} color='inherit' size='small'>
|
|
88
|
-
<Typography variant='subtitle2' sx={{ fontWeight: 600, color: alpha('#000000', 0.6) }}>
|
|
89
|
-
Custom
|
|
90
|
-
</Typography>
|
|
91
|
-
</QuickRangeItem>
|
|
92
|
-
<Divider sx={{ my: '2px' }} />
|
|
93
|
-
</Box>
|
|
94
|
-
</Collapse>
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
handleChangeSearch: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement> = (e) => {
|
|
99
|
-
this.setState({ searchKey: e.currentTarget.value })
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
getClassNameItem = (item: IQuickRangeConfig) => {
|
|
103
|
-
const selected = this.props.selectedValue
|
|
104
|
-
const check = !!selected && selected?.from === item?.from && selected?.to === item?.to
|
|
105
|
-
return check ? QuickRangeItemActivatedName : ''
|
|
106
|
-
}
|
|
107
|
-
getData = () => {
|
|
108
|
-
if (!!this.state.searchKey) {
|
|
109
|
-
return this.props.data.filter((x) => {
|
|
110
|
-
const t1 = x.title.trim().toLocaleLowerCase()
|
|
111
|
-
const t2 = this.state.searchKey.trim().toLocaleLowerCase()
|
|
112
|
-
return t1.includes(t2)
|
|
113
|
-
})
|
|
114
|
-
}
|
|
115
|
-
return this.props.data
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const QuickRangeWrap = styled(({ children, ...p }: BoxProps) => (
|
|
120
|
-
<Box {...p}>
|
|
121
|
-
<Box>{children}</Box>
|
|
122
|
-
</Box>
|
|
123
|
-
))({
|
|
124
|
-
flex: 1,
|
|
125
|
-
position: 'relative',
|
|
126
|
-
marginRight: '-7px',
|
|
127
|
-
'& > div': {
|
|
128
|
-
overflow: 'auto',
|
|
129
|
-
position: 'absolute',
|
|
130
|
-
top: 0,
|
|
131
|
-
left: 0,
|
|
132
|
-
width: '100%',
|
|
133
|
-
height: '100%',
|
|
134
|
-
padding: '3px 3px 0 0 '
|
|
135
|
-
}
|
|
136
|
-
})
|
|
137
|
-
const QuickRangeItemActivatedName = 'activated'
|
|
138
|
-
const QuickRangeItem = styled(Button)({
|
|
139
|
-
display: 'block',
|
|
140
|
-
padding: '7px 9px',
|
|
141
|
-
textTransform: 'unset',
|
|
142
|
-
justifyContent: 'flex-start',
|
|
143
|
-
'&.hover': {
|
|
144
|
-
backgroundColor: 'rgba(204, 204, 220, 0.16)!important',
|
|
145
|
-
cursor: 'pointer'
|
|
146
|
-
},
|
|
147
|
-
[`&.${QuickRangeItemActivatedName}`]: {
|
|
148
|
-
backgroundColor: 'rgba(204, 204, 220, 0.13)',
|
|
149
|
-
pointerEvents: 'none',
|
|
150
|
-
'& .MuiTypography-root': {
|
|
151
|
-
color: '#397ce0'
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
const TypographyNotFoundWrap = styled(Box)({
|
|
157
|
-
margin: '6px 0',
|
|
158
|
-
backgroundColor: alpha('#000000', 0.05),
|
|
159
|
-
borderRadius: '6px',
|
|
160
|
-
padding: '5px 9px'
|
|
161
|
-
})
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { FC } from 'react'
|
|
2
|
-
import { alpha, Box, Typography } from '@mui/material'
|
|
3
|
-
|
|
4
|
-
//#region UTCTime
|
|
5
|
-
export const UTCTime: FC = () => (
|
|
6
|
-
<Box sx={{ display: 'flex', alignItems: 'center', gap: '6px', padding: '6px 0' }}>
|
|
7
|
-
<Typography variant='subtitle2' sx={{ fontWeight: 600, lineHeight: 1, color: alpha('#000000', 0.7) }}>
|
|
8
|
-
Date and time ranges
|
|
9
|
-
</Typography>
|
|
10
|
-
{/* <Typography variant='subtitle2' sx={{ fontWeight: 600, lineHeight: 1, color: alpha('#000000', 0.7) }}>
|
|
11
|
-
Browser Time
|
|
12
|
-
</Typography>
|
|
13
|
-
<Typography variant='caption' sx={{ lineHeight: 1 }}>
|
|
14
|
-
Ha Noi, VietNam
|
|
15
|
-
</Typography> */}
|
|
16
|
-
</Box>
|
|
17
|
-
)
|
|
18
|
-
//#endregion
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import queryString from 'query-string'
|
|
2
|
-
import { ITopBarInfo } from './top-bar.types'
|
|
3
|
-
import { IGrafanaDashBoardOptions } from './types'
|
|
4
|
-
import { QueryParam } from '../../utils'
|
|
5
|
-
|
|
6
|
-
interface IOptions extends ITopBarInfo, Omit<IGrafanaDashBoardOptions, 'from' | 'to'> {}
|
|
7
|
-
|
|
8
|
-
export const TopBarInfoToQueryParam = (urlBase: string, options?: IOptions) => {
|
|
9
|
-
const obj: IGrafanaDashBoardOptions = {}
|
|
10
|
-
if (!!options?.orgId) obj.orgId = options.orgId
|
|
11
|
-
if (!!options?.QuickRange) {
|
|
12
|
-
obj.from = options.QuickRange.from
|
|
13
|
-
obj.to = options.QuickRange.to
|
|
14
|
-
}
|
|
15
|
-
return `${urlBase}?${queryString.stringify(obj)}`
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const GetTopBarInfoQueryParam = (): IGrafanaDashBoardOptions => {
|
|
19
|
-
try {
|
|
20
|
-
const obj = QueryParam.Gets<IGrafanaDashBoardOptions>('from', 'to')
|
|
21
|
-
return obj as IGrafanaDashBoardOptions
|
|
22
|
-
} catch (error) {
|
|
23
|
-
return {}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { ITopBarInfo } from './top-bar.types'
|
|
3
|
-
import { DefaultTopBarInfo } from './configs'
|
|
4
|
-
import { IGrafanaDashBoardOptions } from './types'
|
|
5
|
-
import { IQuickRangeConfig } from './date-time-range'
|
|
6
|
-
import { QueryParam } from '../../utils'
|
|
7
|
-
|
|
8
|
-
const useQueryParam = (data: ITopBarInfo, activated?: boolean) => {
|
|
9
|
-
React.useEffect(() => {
|
|
10
|
-
if (activated === true) {
|
|
11
|
-
const { QuickRange } = data
|
|
12
|
-
QueryParam.Patch<IGrafanaDashBoardOptions>({ from: QuickRange?.from, to: QuickRange?.to })
|
|
13
|
-
}
|
|
14
|
-
}, [data, activated])
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const useLoading = () => {
|
|
18
|
-
const [isLoading, setIsLoading] = React.useState(true)
|
|
19
|
-
const loading = () => setIsLoading(true)
|
|
20
|
-
const unloading = () => setIsLoading(false)
|
|
21
|
-
return [isLoading, loading, unloading] as [boolean, () => void, () => void]
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const useTopBarInfo = () => {
|
|
25
|
-
const [topBarInfo, setTopBarInfo] = React.useState<ITopBarInfo>(DefaultTopBarInfo)
|
|
26
|
-
const topBarInfoChange = (value?: IQuickRangeConfig) => {
|
|
27
|
-
const obj = { ...topBarInfo }
|
|
28
|
-
obj.QuickRange = value
|
|
29
|
-
setTopBarInfo(obj)
|
|
30
|
-
}
|
|
31
|
-
return [topBarInfo, topBarInfoChange] as [ITopBarInfo, (value?: IQuickRangeConfig, callback?: () => void) => void]
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const ScrollBarCustom = `
|
|
35
|
-
/* width */
|
|
36
|
-
::-webkit-scrollbar {
|
|
37
|
-
width: 8px;
|
|
38
|
-
}
|
|
39
|
-
/* Track */
|
|
40
|
-
::-webkit-scrollbar-track {
|
|
41
|
-
border-radius: 4px;
|
|
42
|
-
background: transparent;
|
|
43
|
-
}
|
|
44
|
-
:hover::-webkit-scrollbar-track {
|
|
45
|
-
background: #f1f1f1;
|
|
46
|
-
}
|
|
47
|
-
/* Handle */
|
|
48
|
-
::-webkit-scrollbar-thumb {
|
|
49
|
-
border-radius: 4px;
|
|
50
|
-
background: rgba(135, 135, 135, 0.15);
|
|
51
|
-
}
|
|
52
|
-
:hover::-webkit-scrollbar-thumb {
|
|
53
|
-
background: #878787;
|
|
54
|
-
}
|
|
55
|
-
/* Handle on hover */
|
|
56
|
-
::-webkit-scrollbar-thumb:hover {
|
|
57
|
-
background: #606060;
|
|
58
|
-
}
|
|
59
|
-
`
|
|
60
|
-
|
|
61
|
-
const useCustomScrollBar = (iframeRef: React.RefObject<HTMLIFrameElement>) => {
|
|
62
|
-
React.useEffect(() => {
|
|
63
|
-
const doc = iframeRef.current?.contentWindow?.document
|
|
64
|
-
if (!!doc) {
|
|
65
|
-
const st = doc.createElement('style')
|
|
66
|
-
st.innerHTML = ScrollBarCustom
|
|
67
|
-
doc.head.append(st)
|
|
68
|
-
}
|
|
69
|
-
return () => {}
|
|
70
|
-
}, [iframeRef])
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const GrafanaDashboardHooks = {
|
|
74
|
-
useQueryParam,
|
|
75
|
-
useLoading,
|
|
76
|
-
useTopBarInfo,
|
|
77
|
-
useCustomScrollBar
|
|
78
|
-
}
|
|
79
|
-
export default GrafanaDashboardHooks
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import { SvgIcon, SvgIconProps } from '@mui/material'
|
|
3
|
-
|
|
4
|
-
export const SvgLoading: React.FC<SvgIconProps & { fill?: string }> = (props) => {
|
|
5
|
-
return (
|
|
6
|
-
<SvgIcon {...props}>
|
|
7
|
-
{/* credit: plus icon from https://heroicons.com/ */}
|
|
8
|
-
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'>
|
|
9
|
-
<circle fill={props.fill} stroke={props.fill} strokeWidth='15' r='15' cx='35' cy='100'>
|
|
10
|
-
<animate
|
|
11
|
-
attributeName='cx'
|
|
12
|
-
calcMode='spline'
|
|
13
|
-
dur='2'
|
|
14
|
-
values='35;165;165;35;35'
|
|
15
|
-
keySplines='0 .1 .5 1;0 .1 .5 1;0 .1 .5 1;0 .1 .5 1'
|
|
16
|
-
repeatCount='indefinite'
|
|
17
|
-
begin='0'
|
|
18
|
-
></animate>
|
|
19
|
-
</circle>
|
|
20
|
-
<circle fill={props.fill} stroke={props.fill} strokeWidth='15' opacity='.8' r='15' cx='35' cy='100'>
|
|
21
|
-
<animate
|
|
22
|
-
attributeName='cx'
|
|
23
|
-
calcMode='spline'
|
|
24
|
-
dur='2'
|
|
25
|
-
values='35;165;165;35;35'
|
|
26
|
-
keySplines='0 .1 .5 1;0 .1 .5 1;0 .1 .5 1;0 .1 .5 1'
|
|
27
|
-
repeatCount='indefinite'
|
|
28
|
-
begin='0.05'
|
|
29
|
-
></animate>
|
|
30
|
-
</circle>
|
|
31
|
-
<circle fill={props.fill} stroke={props.fill} strokeWidth='15' opacity='.6' r='15' cx='35' cy='100'>
|
|
32
|
-
<animate
|
|
33
|
-
attributeName='cx'
|
|
34
|
-
calcMode='spline'
|
|
35
|
-
dur='2'
|
|
36
|
-
values='35;165;165;35;35'
|
|
37
|
-
keySplines='0 .1 .5 1;0 .1 .5 1;0 .1 .5 1;0 .1 .5 1'
|
|
38
|
-
repeatCount='indefinite'
|
|
39
|
-
begin='.1'
|
|
40
|
-
></animate>
|
|
41
|
-
</circle>
|
|
42
|
-
<circle fill={props.fill} stroke={props.fill} strokeWidth='15' opacity='.4' r='15' cx='35' cy='100'>
|
|
43
|
-
<animate
|
|
44
|
-
attributeName='cx'
|
|
45
|
-
calcMode='spline'
|
|
46
|
-
dur='2'
|
|
47
|
-
values='35;165;165;35;35'
|
|
48
|
-
keySplines='0 .1 .5 1;0 .1 .5 1;0 .1 .5 1;0 .1 .5 1'
|
|
49
|
-
repeatCount='indefinite'
|
|
50
|
-
begin='.15'
|
|
51
|
-
></animate>
|
|
52
|
-
</circle>
|
|
53
|
-
<circle fill={props.fill} stroke={props.fill} strokeWidth='15' opacity='.2' r='15' cx='35' cy='100'>
|
|
54
|
-
<animate
|
|
55
|
-
attributeName='cx'
|
|
56
|
-
calcMode='spline'
|
|
57
|
-
dur='2'
|
|
58
|
-
values='35;165;165;35;35'
|
|
59
|
-
keySplines='0 .1 .5 1;0 .1 .5 1;0 .1 .5 1;0 .1 .5 1'
|
|
60
|
-
repeatCount='indefinite'
|
|
61
|
-
begin='.2'
|
|
62
|
-
></animate>
|
|
63
|
-
</circle>
|
|
64
|
-
</svg>
|
|
65
|
-
</SvgIcon>
|
|
66
|
-
)
|
|
67
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import React, { FC, useEffect } from 'react'
|
|
2
|
-
import { Box, Fade, Stack, styled, Typography } from '@mui/material'
|
|
3
|
-
import { SvgLoading } from './icons'
|
|
4
|
-
import { QuickRangeConfigs } from './configs'
|
|
5
|
-
import { TopBarInfoToQueryParam } from './helper'
|
|
6
|
-
import { IGrafanaDashBoardOptions } from './types'
|
|
7
|
-
import TopBar from './top-bar'
|
|
8
|
-
import GrafanaDashboardHooks from './hooks'
|
|
9
|
-
|
|
10
|
-
interface IGrafanaDashboardProps {
|
|
11
|
-
url: string
|
|
12
|
-
title?: string
|
|
13
|
-
options?: IGrafanaDashBoardOptions
|
|
14
|
-
topBar?: boolean
|
|
15
|
-
queryParam?: boolean
|
|
16
|
-
onLoadComplete?: () => void
|
|
17
|
-
}
|
|
18
|
-
export const GrafanaDashboard: FC<IGrafanaDashboardProps> = (props) => {
|
|
19
|
-
const iframeRef = React.useRef<HTMLIFrameElement>(null)
|
|
20
|
-
const [isLoading, loading, unloading] = GrafanaDashboardHooks.useLoading()
|
|
21
|
-
const [topBarInfo, topBarInfoChange] = GrafanaDashboardHooks.useTopBarInfo()
|
|
22
|
-
|
|
23
|
-
GrafanaDashboardHooks.useQueryParam(topBarInfo, props?.queryParam)
|
|
24
|
-
GrafanaDashboardHooks.useCustomScrollBar(iframeRef)
|
|
25
|
-
|
|
26
|
-
// ========= ========= ========= Events ========= ========= =========
|
|
27
|
-
const handleRefresh = () => {
|
|
28
|
-
if (iframeRef.current) {
|
|
29
|
-
loading()
|
|
30
|
-
iframeRef.current.src = iframeRef.current.src
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// ========= ========= ========= Main ========= ========= =========
|
|
35
|
-
const createUrl = () => {
|
|
36
|
-
const a = document.createElement('a')
|
|
37
|
-
a.href = TopBarInfoToQueryParam(props.url, { ...topBarInfo })
|
|
38
|
-
const url = new URL(a.href)
|
|
39
|
-
const params = new URLSearchParams(url.search)
|
|
40
|
-
// Add or update query parameters
|
|
41
|
-
if (!props.options || !props.options.kiosk) {
|
|
42
|
-
params.set('kiosk', 'true')
|
|
43
|
-
}
|
|
44
|
-
const option = props.options
|
|
45
|
-
if (option) {
|
|
46
|
-
Object.keys(option).forEach((key) => params.set(key, (option as any)[key]))
|
|
47
|
-
}
|
|
48
|
-
// Rebuild the URL with the new parameters
|
|
49
|
-
url.search = params.toString()
|
|
50
|
-
return url
|
|
51
|
-
}
|
|
52
|
-
const url = createUrl()
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
loading()
|
|
56
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
57
|
-
}, [url.toString()])
|
|
58
|
-
|
|
59
|
-
React.useEffect(() => {
|
|
60
|
-
const iframe = iframeRef.current
|
|
61
|
-
const onComplete = () => {
|
|
62
|
-
unloading()
|
|
63
|
-
props.onLoadComplete && props.onLoadComplete()
|
|
64
|
-
}
|
|
65
|
-
if (iframe) iframe.addEventListener('load', onComplete)
|
|
66
|
-
return () => {
|
|
67
|
-
// Clean up event
|
|
68
|
-
if (iframe) iframe.removeEventListener('load', onComplete)
|
|
69
|
-
}
|
|
70
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
71
|
-
}, [props, props.onLoadComplete])
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<Wrap>
|
|
75
|
-
{props?.topBar === true && (
|
|
76
|
-
<TopBar
|
|
77
|
-
dateTimeRanges={{ data: QuickRangeConfigs, defaultValue: topBarInfo.QuickRange }}
|
|
78
|
-
onDateTimeRangeChange={(x) => {
|
|
79
|
-
topBarInfoChange(x)
|
|
80
|
-
}}
|
|
81
|
-
onRefresh={handleRefresh}
|
|
82
|
-
/>
|
|
83
|
-
)}
|
|
84
|
-
<Box sx={{ flex: 1, position: 'relative' }}>
|
|
85
|
-
<Box sx={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }}>
|
|
86
|
-
<IFrame ref={iframeRef} src={url.toString()} title={props.title} />
|
|
87
|
-
</Box>
|
|
88
|
-
</Box>
|
|
89
|
-
<Fade in={isLoading} unmountOnExit>
|
|
90
|
-
<Backdrop>
|
|
91
|
-
<SvgLoading sx={{ fontSize: '6.5rem' }} fill='#fb8c1e' />
|
|
92
|
-
<Typography variant='subtitle2'>Loading . . .</Typography>
|
|
93
|
-
</Backdrop>
|
|
94
|
-
</Fade>
|
|
95
|
-
</Wrap>
|
|
96
|
-
)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const IFrame = styled('iframe')({
|
|
100
|
-
border: 0,
|
|
101
|
-
width: '100%',
|
|
102
|
-
height: '100%'
|
|
103
|
-
})
|
|
104
|
-
const Wrap = styled(Stack)({
|
|
105
|
-
flex: 1,
|
|
106
|
-
position: 'relative',
|
|
107
|
-
justifyContent: 'stretch'
|
|
108
|
-
})
|
|
109
|
-
const Backdrop = styled(Box)({
|
|
110
|
-
position: 'absolute',
|
|
111
|
-
top: 0,
|
|
112
|
-
bottom: 0,
|
|
113
|
-
width: '100%',
|
|
114
|
-
height: '100%',
|
|
115
|
-
background: '#fff',
|
|
116
|
-
display: 'flex',
|
|
117
|
-
justifyContent: 'center',
|
|
118
|
-
alignItems: 'center',
|
|
119
|
-
flexDirection: 'column'
|
|
120
|
-
})
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react'
|
|
2
|
-
import { Box, Divider, IconButton, styled, Tooltip } from '@mui/material'
|
|
3
|
-
import SyncIcon from '@mui/icons-material/Sync'
|
|
4
|
-
import DateTimeRange, { IQuickRangeConfig } from './date-time-range'
|
|
5
|
-
|
|
6
|
-
export interface ITopBar {
|
|
7
|
-
onRefresh?: () => void
|
|
8
|
-
onDateTimeRangeChange?: (value?: IQuickRangeConfig) => void
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface IProps extends ITopBar {
|
|
12
|
-
dateTimeRanges: {
|
|
13
|
-
data: IQuickRangeConfig[]
|
|
14
|
-
defaultValue?: IQuickRangeConfig
|
|
15
|
-
}
|
|
16
|
-
after?: JSX.Element
|
|
17
|
-
before?: JSX.Element
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default class TopBar extends Component<IProps> {
|
|
21
|
-
render() {
|
|
22
|
-
return (
|
|
23
|
-
<Wrap>
|
|
24
|
-
{this.props?.after && this.props.after}
|
|
25
|
-
{!!this.props.onDateTimeRangeChange && (
|
|
26
|
-
<DateTimeRange
|
|
27
|
-
data={this.props.dateTimeRanges.data}
|
|
28
|
-
defaultSelected={this.props.dateTimeRanges.defaultValue}
|
|
29
|
-
onChange={this.props.onDateTimeRangeChange}
|
|
30
|
-
/>
|
|
31
|
-
)}
|
|
32
|
-
{!!this.props.onRefresh && (
|
|
33
|
-
<>
|
|
34
|
-
<Divider flexItem orientation='vertical' sx={{ m: '6px 0' }} />
|
|
35
|
-
<Tooltip title='Refresh dashboard' arrow>
|
|
36
|
-
<IconButton onClick={this.props.onRefresh}>
|
|
37
|
-
<SyncIcon fontSize='small' />
|
|
38
|
-
</IconButton>
|
|
39
|
-
</Tooltip>
|
|
40
|
-
</>
|
|
41
|
-
)}
|
|
42
|
-
{this.props?.before && this.props.before}
|
|
43
|
-
<Box sx={{ width: '36px' }} />
|
|
44
|
-
</Wrap>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export const TopBarheight = 43
|
|
50
|
-
const Wrap = styled(Box)(({ theme }) => ({
|
|
51
|
-
display: 'flex',
|
|
52
|
-
justifyContent: 'end',
|
|
53
|
-
padding: '3px 12px',
|
|
54
|
-
margin: '0 -10px',
|
|
55
|
-
gap: '6px',
|
|
56
|
-
boxShadow: theme.app.boxShadow[1],
|
|
57
|
-
position: 'relative',
|
|
58
|
-
zIndex: 1,
|
|
59
|
-
height: `${TopBarheight}px`,
|
|
60
|
-
alignItems: 'center',
|
|
61
|
-
flex: '0 0 auto'
|
|
62
|
-
}))
|