Skip to content

Commit 1ddc65e

Browse files
committed
[IGNORE] use single editing component for actions and selections
Signed-off-by: Gabriel Bernal <gbernal@redhat.com>
1 parent c2476c5 commit 1ddc65e

17 files changed

Lines changed: 466 additions & 661 deletions

logstable/src/LogsTable.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@
1313

1414
import { PanelPlugin } from '@perses-dev/plugin-system';
1515
import { LogsTableComponent } from './LogsTableComponent';
16-
import { LogsTableItemActionsEditor } from './LogsTableItemActionsEditor';
17-
import { LogsTableSelectionsEditor } from './LogsTableSelectionsEditor';
16+
import { LogsTableItemSelectionActionsEditor } from './LogsTableItemSelectionActionsEditor';
1817
import { LogsTableSettingsEditor } from './LogsTableSettingsEditor';
1918
import { LogsTableOptions, LogsTableProps } from './model';
2019

2120
export const LogsTable: PanelPlugin<LogsTableOptions, LogsTableProps> = {
2221
PanelComponent: LogsTableComponent,
2322
panelOptionsEditorComponents: [
2423
{ label: 'Settings', content: LogsTableSettingsEditor },
25-
{ label: 'Selections', content: LogsTableSelectionsEditor },
26-
{ label: 'Item Actions', content: LogsTableItemActionsEditor },
24+
{ label: 'Item Actions', content: LogsTableItemSelectionActionsEditor },
2725
],
2826
supportedQueryTypes: ['LogQuery'],
2927
createInitialOptions: () => ({

logstable/src/LogsTableItemActionsEditor.tsx

Lines changed: 0 additions & 24 deletions
This file was deleted.

logstable/src/LogsTableSelectionsEditor.tsx renamed to logstable/src/LogsTableItemSelectionActionsEditor.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,25 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
import { SelectionOptions, SelectionOptionsEditor } from '@perses-dev/plugin-system';
14+
import { ActionOptions, ItemSelectionActionsEditor, SelectionOptions } from '@perses-dev/plugin-system';
1515
import { ReactElement } from 'react';
1616
import { LogsTableSettingsEditorProps } from './model';
1717

18-
export function LogsTableSelectionsEditor({ value, onChange }: LogsTableSettingsEditorProps): ReactElement {
19-
function handleSelectionsChange(selection: SelectionOptions | undefined): void {
18+
export function LogsTableItemSelectionActionsEditor({ value, onChange }: LogsTableSettingsEditorProps): ReactElement {
19+
function handleActionsChange(actions: ActionOptions | undefined): void {
20+
onChange({ ...value, actions: actions });
21+
}
22+
23+
function handleSelectionChange(selection: SelectionOptions | undefined): void {
2024
onChange({ ...value, selection: selection });
2125
}
2226

23-
return <SelectionOptionsEditor value={value.selection} onChange={handleSelectionsChange} />;
27+
return (
28+
<ItemSelectionActionsEditor
29+
actionOptions={value.actions}
30+
onChangeActions={handleActionsChange}
31+
selectionOptions={value.selection}
32+
onChangeSelection={handleSelectionChange}
33+
/>
34+
);
2435
}

0 commit comments

Comments
 (0)