chore: gpu selector, source dropdown
This commit is contained in:
@@ -6,20 +6,22 @@ import _ from 'lodash';
|
||||
import { memo } from 'react';
|
||||
import './index.less';
|
||||
|
||||
type Trigger = 'click' | 'hover';
|
||||
interface DropdownButtonsProps {
|
||||
items: MenuProps['items'];
|
||||
size?: 'small' | 'middle' | 'large';
|
||||
trigger?: Trigger[];
|
||||
onSelect: (val: any, item?: any) => void;
|
||||
}
|
||||
|
||||
const DropdownButtons: React.FC<DropdownButtonsProps> = ({
|
||||
items,
|
||||
size = 'middle',
|
||||
trigger = ['hover'],
|
||||
onSelect
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
const handleMenuClick = (item: any) => {
|
||||
console.log('menu click', item.key);
|
||||
const selectItem = _.find(items, { key: item.key });
|
||||
onSelect(item.key, selectItem);
|
||||
};
|
||||
@@ -48,6 +50,7 @@ const DropdownButtons: React.FC<DropdownButtonsProps> = ({
|
||||
</Tooltip>
|
||||
) : (
|
||||
<Dropdown.Button
|
||||
trigger={trigger}
|
||||
dropdownRender={(menus: any) => {
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -12,6 +12,16 @@ class AnsiParser {
|
||||
private uid: number = 0;
|
||||
private isProcessing: boolean = false;
|
||||
private taskQueue: string[] = [];
|
||||
private colorMap = {
|
||||
'30': 'black',
|
||||
'31': 'red',
|
||||
'32': 'green',
|
||||
'33': 'yellow',
|
||||
'34': 'blue',
|
||||
'35': 'magenta',
|
||||
'36': 'cyan',
|
||||
'37': 'white'
|
||||
};
|
||||
|
||||
constructor() {
|
||||
this.reset();
|
||||
@@ -82,7 +92,12 @@ class AnsiParser {
|
||||
this.reset();
|
||||
}
|
||||
break;
|
||||
case 'm': // style: do not handle now
|
||||
case 'm':
|
||||
// if (match[1] === '0') {
|
||||
// currentStyle = '';
|
||||
// } else if (colorMap[match[1]]) {
|
||||
// currentStyle = `color: ${colorMap[match[1]]};`;
|
||||
// }
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user