Add hostname syncing between source url and kapacitor url in kapacitorStep
parent
4ba951dd36
commit
b5eba4d92b
|
@ -57,6 +57,13 @@ const getActiveKapacitor = (source: Source, sources: Source[]): Kapacitor => {
|
||||||
return activeKapacitor
|
return activeKapacitor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const syncHostnames = (source: Source, kapacitor: Kapacitor) => {
|
||||||
|
const sourceURL = new URL(source.url)
|
||||||
|
const kapacitorURL = new URL(kapacitor.url)
|
||||||
|
kapacitorURL.hostname = sourceURL.hostname
|
||||||
|
return {...kapacitor, url: kapacitorURL.href}
|
||||||
|
}
|
||||||
|
|
||||||
@ErrorHandling
|
@ErrorHandling
|
||||||
class KapacitorStep extends Component<Props, State> {
|
class KapacitorStep extends Component<Props, State> {
|
||||||
public static defaultProps: Partial<Props> = {
|
public static defaultProps: Partial<Props> = {
|
||||||
|
@ -66,13 +73,15 @@ class KapacitorStep extends Component<Props, State> {
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
const kapacitor = props.showNewKapacitor
|
let kapacitor = getActiveKapacitor(props.source, props.sources)
|
||||||
? DEFAULT_KAPACITOR
|
|
||||||
: getActiveKapacitor(props.source, props.sources) || DEFAULT_KAPACITOR
|
|
||||||
|
|
||||||
this.state = {
|
if (!kapacitor || props.showNewKapacitor) {
|
||||||
kapacitor,
|
kapacitor = DEFAULT_KAPACITOR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kapacitor = syncHostnames(props.source, kapacitor)
|
||||||
|
|
||||||
|
this.state = {kapacitor}
|
||||||
}
|
}
|
||||||
|
|
||||||
public next = async () => {
|
public next = async () => {
|
||||||
|
|
Loading…
Reference in New Issue