@/utils APIs
- logger
- isRedirect
- getSingleArrayVal
- deepCopy
- percentToSeconds
- percentToMinutesAndSeconds
- capture
- secondsToMinutesAndSecondes
- filterDefaults
- extractContentType
- inElectron
- getRandomStr
- applyMixins
- rand
- folderName
- clamp
- expandHomeDir
- scrollBlockEleIntoView
- getBlockNodeByIdx
- copyToClipBoard
- updateQueryStringParameter
- timeFromNow
- getUnixTs
- parseError
- useQuery
- generateID
- Entry
- dynamicPackages
- getShadowRoot
- download
- pxToVw
- sleep
- dataURLtoFile
- ossClient
- getCssProperty
- stringRgba
- $
- isAsyncFunction
- unique
- getRectangleEdges
- getActiveCellsInfo
- getPalette
- getSafetyDataConfig
- customMerge
- copyData
- isPromise
- getNextEdge
- isServer
- generateColumn
- get
- mockId
- filterAttributesByRegExp
- filterAttributes
- isLeaf
- defaultGetChildren
- differenceTempMergedCells
- getEditorRoot
- ActionIconCallback
- getSheetComponentOptions
- getDrillDownCache
- buildDrillDownOptions
- handleDrillDown
- handleActionIconClick
- getDataCellId
- createIndexGetter
- MergedCellConvertTempMergedCells
- mergeTempMergedCell
- updateMergedCells
- removeUnmergedCellsInfo
- getTempMergedCell
- getVisibleInfo
- getInvisibleInfo
- getPolygonPoints
Other Related APIs
@/utils#generateID TypeScript Examples
The following examples show how to use
@/utils#generateID.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.tsx From fe-v5 with Apache License 2.0 | 6 votes |
PanelList: React.FC<PanelListProps> = ({ metrics }) => {
const [panelList, setPanelList] = useState<PanelMeta[]>([{ id: generateID(), defaultPromQL: decodeURIComponent(getUrlParamsByName('promql')) }]);
// 添加一个查询面板
function addPanel() {
setPanelList((a) => [
...panelList,
{
id: generateID(),
},
]);
}
// 删除指定查询面板
function removePanel(id) {
setPanelList(panelList.reduce<PanelMeta[]>((acc, panel) => (panel.id !== id ? [...acc, { ...panel }] : acc), []));
}
return (
<>
{panelList.map(({ id, defaultPromQL = '' }) => (
<Panel key={id} metrics={metrics} defaultPromQL={defaultPromQL} removePanel={() => removePanel(id)} />
))}
<div className='add-prometheus-panel'>
<Button size='large' onClick={addPanel}>
<PlusOutlined />
新增一个查询面板
</Button>
</div>
</>
);
}