File tree Expand file tree Collapse file tree 6 files changed +47
-7
lines changed
Expand file tree Collapse file tree 6 files changed +47
-7
lines changed Original file line number Diff line number Diff line change @@ -5,3 +5,9 @@ language: {
55source : {
66 kind : " git "
77}
8+ deps : {
9+ " github.com/perses/shared/cue@v0 " : {
10+ v : " v0.53.0-rc.1 "
11+ default : true
12+ }
13+ }
Original file line number Diff line number Diff line change 1313
1414package model
1515
16+ import (" github.com/perses/shared/cue/common " )
17+
1618kind : " LogsTable "
1719spec : close ({
1820 allowWrap ?: bool
1921 enableDetails ?: bool
2022 showTime ?: bool
23+ transforms ?: [...common .#transform ]
2124})
Original file line number Diff line number Diff line change @@ -15,10 +15,14 @@ import { PanelPlugin } from '@perses-dev/plugin-system';
1515import { LogsTableComponent } from './LogsTableComponent' ;
1616import { LogsTableOptions , LogsTableProps } from './model' ;
1717import { LogsTableSettingsEditor } from './LogsTableSettingsEditor' ;
18+ import { LogsTableTransforms } from './components/LogsTableTransforms' ;
1819
1920export const LogsTable : PanelPlugin < LogsTableOptions , LogsTableProps > = {
2021 PanelComponent : LogsTableComponent ,
21- panelOptionsEditorComponents : [ { label : 'Settings' , content : LogsTableSettingsEditor } ] ,
22+ panelOptionsEditorComponents : [
23+ { label : 'Settings' , content : LogsTableSettingsEditor } ,
24+ { label : 'Transforms' , content : LogsTableTransforms } ,
25+ ] ,
2226 supportedQueryTypes : [ 'LogQuery' ] ,
2327 createInitialOptions : ( ) => ( {
2428 showTime : true ,
Original file line number Diff line number Diff line change @@ -17,11 +17,9 @@ import {
1717 ThresholdsEditor ,
1818 ThresholdsEditorProps ,
1919} from '@perses-dev/components' ;
20- import { LegendOptionsEditor , LegendOptionsEditorProps , OptionsEditorProps } from '@perses-dev/plugin-system' ;
20+ import { LegendOptionsEditor , LegendOptionsEditorProps } from '@perses-dev/plugin-system' ;
2121import { ReactElement } from 'react' ;
22- import { LogsTableOptions } from './model' ;
23-
24- type LogsTableSettingsEditorProps = OptionsEditorProps < LogsTableOptions > ;
22+ import { LogsTableSettingsEditorProps } from './model' ;
2523
2624export function LogsTableSettingsEditor ( props : LogsTableSettingsEditorProps ) : ReactElement {
2725 const { onChange, value } = props ;
Original file line number Diff line number Diff line change 1+ // Copyright The Perses Authors
2+ // Licensed under the Apache License, Version 2.0 (the "License");
3+ // you may not use this file except in compliance with the License.
4+ // You may obtain a copy of the License at
5+ //
6+ // http://www.apache.org/licenses/LICENSE-2.0
7+ //
8+ // Unless required by applicable law or agreed to in writing, software
9+ // distributed under the License is distributed on an "AS IS" BASIS,
10+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+ // See the License for the specific language governing permissions and
12+ // limitations under the License.
13+
14+ import { TransformsEditor , TransformsEditorProps } from '@perses-dev/components' ;
15+ import { ReactElement } from 'react' ;
16+ import { LogsTableSettingsEditorProps } from '../model' ;
17+
18+ export const LogsTableTransforms = ( props : LogsTableSettingsEditorProps ) : ReactElement => {
19+ const { onChange, value } = props ;
20+
21+ const handleTransformsChange : TransformsEditorProps [ 'onChange' ] = ( transforms ) => {
22+ onChange ( { ...value , transforms } ) ;
23+ } ;
24+
25+ return < TransformsEditor value = { value . transforms ?? [ ] } onChange = { handleTransformsChange } /> ;
26+ } ;
Original file line number Diff line number Diff line change 1111// See the License for the specific language governing permissions and
1212// limitations under the License.
1313
14- import { LogData , ThresholdOptions } from '@perses-dev/core' ;
15- import { PanelProps , LegendSpecOptions } from '@perses-dev/plugin-system' ;
14+ import { LogData , ThresholdOptions , Transform } from '@perses-dev/core' ;
15+ import { PanelProps , LegendSpecOptions , OptionsEditorProps } from '@perses-dev/plugin-system' ;
1616
1717export type LogsTableProps = PanelProps < LogsTableOptions , LogsQueryData > ;
1818
@@ -27,4 +27,7 @@ export interface LogsTableOptions {
2727 enableDetails ?: boolean ;
2828 showTime ?: boolean ;
2929 showAll ?: boolean ;
30+ transforms ?: Transform [ ] ;
3031}
32+
33+ export type LogsTableSettingsEditorProps = OptionsEditorProps < LogsTableOptions > ;
You can’t perform that action at this time.
0 commit comments