Skip to content

Commit 05b3fa2

Browse files
authored
Merge pull request #79 from cloudera/DSE-44371
DSE-44371: Swap the Examples step with Prompt step This PR concludes the changes for the prompt tab improements with moving the restore button to the top of the prompt textarea and make it as icon button.
2 parents 779d4a0 + 88c67ef commit 05b3fa2

File tree

3 files changed

+51
-26
lines changed

3 files changed

+51
-26
lines changed

app/client/src/pages/DataGenerator/Prompt.tsx

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import TextArea from 'antd/es/input/TextArea';
1919
import FileSelectorButton from './FileSelectorButton';
2020
import { useMutation } from '@tanstack/react-query';
2121
import first from 'lodash/first';
22+
import ResetIcon from './ResetIcon';
2223

2324
const { Title } = Typography;
2425

@@ -254,6 +255,33 @@ const Prompt = () => {
254255
setPrompt={setPrompt}
255256
/>
256257
}
258+
<RestoreDefaultBtn
259+
icon={<ResetIcon />}
260+
type="link"
261+
onClick={() => {
262+
return Modal.warning({
263+
title: 'Restore Default Prompt',
264+
closable: true,
265+
content: <>{'Are you sure you want to restore to the default prompt? Your current prompt will be lost.'}</>,
266+
footer: (
267+
<ModalButtonGroup gap={8} justify='end'>
268+
<Button onClick={() => Modal.destroyAll()}>{'Cancel'}</Button>
269+
<Button
270+
onClick={() => {
271+
form.setFieldValue('custom_prompt', defaultPromptRef.current)
272+
Modal.destroyAll()
273+
}}
274+
type='primary'
275+
>
276+
{'Confirm'}
277+
</Button>
278+
</ModalButtonGroup>
279+
),
280+
maskClosable: true,
281+
})
282+
}}>
283+
{'Restore'}
284+
</RestoreDefaultBtn>
257285
</Flex>
258286
</div>
259287
}
@@ -263,31 +291,7 @@ const Prompt = () => {
263291
>
264292
<StyledTextArea autoSize placeholder={'Enter a prompt'}/>
265293
</StyledPromptFormItem>
266-
<RestoreDefaultBtn
267-
onClick={() => {
268-
return Modal.warning({
269-
title: 'Restore Default Prompt',
270-
closable: true,
271-
content: <>{'Are you sure you want to restore to the default prompt? Your current prompt will be lost.'}</>,
272-
footer: (
273-
<ModalButtonGroup gap={8} justify='end'>
274-
<Button onClick={() => Modal.destroyAll()}>{'Cancel'}</Button>
275-
<Button
276-
onClick={() => {
277-
form.setFieldValue('custom_prompt', defaultPromptRef.current)
278-
Modal.destroyAll()
279-
}}
280-
type='primary'
281-
>
282-
{'Confirm'}
283-
</Button>
284-
</ModalButtonGroup>
285-
),
286-
maskClosable: true,
287-
})
288-
}}>
289-
{'Restore'}
290-
</RestoreDefaultBtn>
294+
291295

292296
</div>
293297
{((workflow_type === WorkflowType.CUSTOM_DATA_GENERATION && !isEmpty(doc_paths)) ||
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
3+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4+
const ResetIcon = (props: any) =>
5+
/*#__PURE__*/ React.createElement(
6+
"svg",
7+
{
8+
viewBox: "0 0 24 24",
9+
fill: "none",
10+
width: "1em",
11+
height: "1em",
12+
className: "cdp-icon-ai-assistant",
13+
...props,
14+
},
15+
/*#__PURE__*/ React.createElement("path", {
16+
d: "M11.013 10.99h-7.99V3h1.998v3.39c1.646-2.048 4.163-3.367 6.991-3.367 4.956 0 8.988 4.032 8.988 8.988 0 4.957-4.032 8.99-8.988 8.99-3.905 0-7.227-2.508-8.464-5.993h2.157c1.124 2.357 3.525 3.995 6.307 3.995 3.855 0 6.99-3.137 6.99-6.992 0-3.854-3.135-6.99-6.99-6.99-2.772 0-5.164 1.626-6.294 3.971h5.295v1.997z",
17+
fill: "currentColor",
18+
}),
19+
);
20+
21+
export default ResetIcon;

app/client/src/pages/Evaluator/FreeFromEvaluationTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
import { themeMaterial } from "ag-grid-community";
1919
import get from 'lodash/get';
2020
import { getColorCode } from './util';
21-
import { Badge, Popover, Tooltip } from 'antd';
21+
import { Badge, Popover } from 'antd';
2222
import styled from 'styled-components';
2323

2424
interface Props {

0 commit comments

Comments
 (0)