mirror of
https://github.com/grafana/grafana.git
synced 2025-09-23 18:52:33 +08:00
Live: remove the 'canPublish' check from the UI (#39016)
This commit is contained in:
@ -15,7 +15,6 @@ import {
|
|||||||
applyFieldOverrides,
|
applyFieldOverrides,
|
||||||
StreamingDataFrame,
|
StreamingDataFrame,
|
||||||
LiveChannelAddress,
|
LiveChannelAddress,
|
||||||
LiveChannelConfig,
|
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { TablePanel } from '../table/TablePanel';
|
import { TablePanel } from '../table/TablePanel';
|
||||||
import { LivePanelOptions, MessageDisplayMode } from './types';
|
import { LivePanelOptions, MessageDisplayMode } from './types';
|
||||||
@ -28,7 +27,6 @@ interface Props extends PanelProps<LivePanelOptions> {}
|
|||||||
interface State {
|
interface State {
|
||||||
error?: any;
|
error?: any;
|
||||||
addr?: LiveChannelAddress;
|
addr?: LiveChannelAddress;
|
||||||
info?: LiveChannelConfig;
|
|
||||||
status?: LiveChannelStatusEvent;
|
status?: LiveChannelStatusEvent;
|
||||||
message?: any;
|
message?: any;
|
||||||
changed: number;
|
changed: number;
|
||||||
@ -88,7 +86,6 @@ export class LivePanel extends PureComponent<Props, State> {
|
|||||||
this.unsubscribe();
|
this.unsubscribe();
|
||||||
this.setState({
|
this.setState({
|
||||||
addr: undefined,
|
addr: undefined,
|
||||||
info: undefined,
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -104,7 +101,6 @@ export class LivePanel extends PureComponent<Props, State> {
|
|||||||
this.unsubscribe();
|
this.unsubscribe();
|
||||||
this.setState({
|
this.setState({
|
||||||
addr: undefined,
|
addr: undefined,
|
||||||
info: undefined,
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -146,9 +142,9 @@ export class LivePanel extends PureComponent<Props, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onPublishClicked = async () => {
|
onPublishClicked = async () => {
|
||||||
const { addr, info } = this.state;
|
const { addr } = this.state;
|
||||||
if (!info?.canPublish || !addr) {
|
if (!addr) {
|
||||||
console.log('channel does not support publishing');
|
console.log('invalid address');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,16 +201,7 @@ export class LivePanel extends PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderPublish(height: number) {
|
renderPublish(height: number) {
|
||||||
const { info } = this.state;
|
|
||||||
if (!info) {
|
|
||||||
return <div>No info</div>;
|
|
||||||
}
|
|
||||||
if (!info.canPublish) {
|
|
||||||
return <div>This channel does not support publishing</div>;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { options } = this.props;
|
const { options } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
|
Reference in New Issue
Block a user