diff --git a/shell/app/modules/msp/monitor/status-insight/pages/status/add-modal.tsx b/shell/app/modules/msp/monitor/status-insight/pages/status/add-modal.tsx index c26108655a..15168900dc 100644 --- a/shell/app/modules/msp/monitor/status-insight/pages/status/add-modal.tsx +++ b/shell/app/modules/msp/monitor/status-insight/pages/status/add-modal.tsx @@ -203,13 +203,6 @@ const AddModal = (props: IProps) => { updater.condition(newCondition); }; - const setKey = (index: number, key: string) => { - const newCondition = produce(condition, (draft) => { - draft[index].key = key; - }); - updater.condition(newCondition); - }; - const formatBody = () => { try { body.content = JSON.stringify(JSON.parse(body.content), null, 2); @@ -220,8 +213,7 @@ const AddModal = (props: IProps) => { const setUrlParams = (queryConfig: Obj) => { if (url) { - formRef.current?.setFieldsValue({ url: `${url.split('?')[0]}?${qs.stringify(queryConfig)}` }); - updater.url(`${url.split('?')[0]}?${qs.stringify(queryConfig)}`); + formRef.current?.setFieldsValue({ config: { url: `${url.split('?')[0]}?${qs.stringify(queryConfig)}` } }); } }; @@ -242,7 +234,7 @@ const AddModal = (props: IProps) => { projectId, tenantId: terminusKey, config: { - url, + url: _data.config?.url, retry, interval: frequency, headers, @@ -263,7 +255,7 @@ const AddModal = (props: IProps) => { retry, interval: frequency, headers, - url, + url: _data.config?.url, body: Array.isArray(body.content) ? { ...body, content: qs.stringify(newObj) } : body, method: apiMethod, triggering: condition, @@ -298,7 +290,6 @@ const AddModal = (props: IProps) => { switch (bodyType) { case noneType: updater.textOrJson(''); - updater.headers({}); updater.body({ content: '', type: noneType }); break; case formType: @@ -346,7 +337,7 @@ const AddModal = (props: IProps) => { }, { label: 'URL', - name: 'url', + name: ['config', 'url'], rules: [{ ...regRules.http }], itemProps: { addonBefore: ( @@ -364,11 +355,8 @@ const AddModal = (props: IProps) => { ))} ), - onChange: (e) => { - updater.url(e.target.value); - }, onBlur: () => { - updater.query(qs.parseUrl(url).query); + updater.query(qs.parseUrl(formRef.current?.getFieldValue(['config', 'url']))?.query); }, }, }, @@ -382,11 +370,6 @@ const AddModal = (props: IProps) => { if (key === '2' && bodyType === raw && textOrJson === text) { updater.headers({ ...headers, 'Content-Type': textType }); } - if (key === '2' && bodyType === noneType) { - if (headers['Content-Type'] === ('x-www-form-urlencoded' || 'text/plain' || 'application/json')) { - updater.headers({}); - } - } }} defaultActiveKey="1" > @@ -560,76 +543,79 @@ const AddModal = (props: IProps) => {