2021-01-07 16:15:34 -08:00
|
|
|
/*
|
|
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2021-02-24 13:39:51 -08:00
|
|
|
import { ActionEntry } from '../../../server/trace/viewer/traceModel';
|
2021-01-07 16:15:34 -08:00
|
|
|
import './actionList.css';
|
|
|
|
import * as React from 'react';
|
|
|
|
|
2021-01-21 08:29:01 -08:00
|
|
|
export interface ActionListProps {
|
2021-01-07 16:15:34 -08:00
|
|
|
actions: ActionEntry[],
|
2021-01-14 20:16:02 -08:00
|
|
|
selectedAction: ActionEntry | undefined,
|
|
|
|
highlightedAction: ActionEntry | undefined,
|
2021-01-07 16:15:34 -08:00
|
|
|
onSelected: (action: ActionEntry) => void,
|
2021-01-14 20:16:02 -08:00
|
|
|
onHighlighted: (action: ActionEntry | undefined) => void,
|
2021-01-21 08:29:01 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
export const ActionList: React.FC<ActionListProps> = ({
|
|
|
|
actions = [],
|
|
|
|
selectedAction = undefined,
|
|
|
|
highlightedAction = undefined,
|
|
|
|
onSelected = () => {},
|
|
|
|
onHighlighted = () => {},
|
|
|
|
}) => {
|
2021-01-07 16:15:34 -08:00
|
|
|
return <div className='action-list'>{actions.map(actionEntry => {
|
2021-03-10 11:43:26 -08:00
|
|
|
const { metadata, actionId } = actionEntry;
|
2021-01-07 16:15:34 -08:00
|
|
|
return <div
|
2021-03-11 11:22:59 -08:00
|
|
|
className={'action-entry' + (actionEntry === selectedAction ? ' selected' : '')}
|
2021-01-07 16:15:34 -08:00
|
|
|
key={actionId}
|
2021-01-14 20:16:02 -08:00
|
|
|
onClick={() => onSelected(actionEntry)}
|
|
|
|
onMouseEnter={() => onHighlighted(actionEntry)}
|
|
|
|
onMouseLeave={() => (highlightedAction === actionEntry) && onHighlighted(undefined)}
|
2021-01-21 08:29:01 -08:00
|
|
|
>
|
2021-03-11 11:22:59 -08:00
|
|
|
<div className={'action-error codicon codicon-issues'} hidden={!metadata.error} />
|
2021-04-18 17:02:34 -10:00
|
|
|
<div className='action-title'>{metadata.apiName}</div>
|
2021-03-11 11:22:59 -08:00
|
|
|
{metadata.params.selector && <div className='action-selector' title={metadata.params.selector}>{metadata.params.selector}</div>}
|
|
|
|
{metadata.method === 'goto' && metadata.params.url && <div className='action-url' title={metadata.params.url}>{metadata.params.url}</div>}
|
2021-01-07 16:15:34 -08:00
|
|
|
</div>;
|
|
|
|
})}</div>;
|
|
|
|
};
|