|
@@ -8,6 +8,7 @@ import {PureTableCard} from "../../../components/PureTableCard";
|
|
|
import {FilterPanel} from "../../../components/FilterPanel";
|
|
|
import {WorkFlowPanel} from "../../../components/WorkFlow";
|
|
|
import {useAppDispatch} from "../../../../redux/configureStore";
|
|
|
+import {CopyToClipboard} from 'react-copy-to-clipboard';
|
|
|
import {
|
|
|
getMetricLineage,
|
|
|
getMetricSQL,
|
|
@@ -81,6 +82,7 @@ export const IndexDetail = memo(({
|
|
|
const invokeRangeRef = useRef({});
|
|
|
const [openLog,setOpenLog] = useState(false);
|
|
|
const logRef = useRef(null);
|
|
|
+ const cacheSQL = useRef(null);
|
|
|
const vokeConfig = persistence?.defaultConfig && JSON.parse(persistence?.defaultConfig);
|
|
|
const rangePresets = [
|
|
|
{
|
|
@@ -243,6 +245,8 @@ export const IndexDetail = memo(({
|
|
|
setVersion(data)
|
|
|
}
|
|
|
}))
|
|
|
+
|
|
|
+ handleMetricSQL()
|
|
|
}
|
|
|
return () => {
|
|
|
clear()
|
|
@@ -374,8 +378,8 @@ export const IndexDetail = memo(({
|
|
|
|
|
|
/** 获取指标的SQL字符串*/
|
|
|
const handleMetricSQL = async ()=>{
|
|
|
- const {data} = await dispatch(getMetricSQL(values?.id))
|
|
|
- console.log(data)
|
|
|
+ const {payload} = await dispatch(getMetricSQL(values?.id));
|
|
|
+ cacheSQL.current = payload;
|
|
|
}
|
|
|
|
|
|
/** 调度记录模块 */
|
|
@@ -386,7 +390,14 @@ export const IndexDetail = memo(({
|
|
|
<RangePicker presets={rangePresets} onChange={onRangeChange} />
|
|
|
<Button type="primary" style={{marginLeft:15}} onClick={()=>onQueryTask()}>{t("button.query")}</Button>
|
|
|
{admin && <Button style={{marginLeft: 15}} onClick={onInvokeTask}>{t("button.invoke")}</Button>}
|
|
|
- {admin && <Button style={{marginLeft: 15}} onClick={handleMetricSQL}>复制SQL</Button>}
|
|
|
+ {admin &&
|
|
|
+ <CopyToClipboard
|
|
|
+ text={cacheSQL.current}
|
|
|
+ onCopy={()=>{message.success('已复制到剪切板')}}
|
|
|
+ >
|
|
|
+ <Button style={{marginLeft: 15}}>复制SQL</Button>
|
|
|
+ </CopyToClipboard>
|
|
|
+ }
|
|
|
</div>
|
|
|
<Table
|
|
|
columns={columns}
|