Skip to content

Commit 6404a1c

Browse files
authored
Merge pull request #108 from cloudera/minor-ui-issues-final
Minor UI issues final
2 parents bf966c1 + 44e8400 commit 6404a1c

File tree

6 files changed

+42
-25
lines changed

6 files changed

+42
-25
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ const Configure: FunctionComponent = () => {
5555
const location = useLocation();
5656
const { template_name, generate_file_name } = useParams();
5757
const [wizardModeType, setWizardModeType] = useState(getWizardModeType(location));
58-
console.log('wizardModeType', wizardModeType);
5958

6059
useEffect(() => {
6160
if (wizardModeType === WizardModeType.DATA_AUGMENTATION) {
@@ -67,10 +66,8 @@ const Configure: FunctionComponent = () => {
6766
}
6867
}, [location, wizardModeType]);
6968

70-
console.log('wizardModeType', wizardModeType);
7169

7270
useEffect(() => {
73-
console.log('useEffect 2');
7471
if (template_name) {
7572
setTimeout(() => {
7673
console.log('setting template name');
@@ -93,7 +90,6 @@ const Configure: FunctionComponent = () => {
9390
delete values.doc_paths;
9491
delete values.output_key;
9592
delete values.output_value;
96-
console.log('validateForm', values);
9793

9894
const allFieldsFilled = Object.values(values).every(value => Boolean(value));
9995
if (allFieldsFilled && isFunction(setIsStepValid)) {

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

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import CustomResultTable from './CustomResultTable';
2121
import SeedResultTable from './SeedResultTable';
2222
import { getFilesURL } from '../Evaluator/util';
2323
import FreeFormTable from './FreeFormTable';
24+
import forEach from 'lodash/forEach';
25+
import isObject from 'lodash/isObject';
2426

2527
const { Title } = Typography;
2628

@@ -118,7 +120,7 @@ const isDemoMode = (numQuestions: number, topics: [], form: FormInstance) => {
118120
return true
119121
}
120122
// set dataset size for SFT & CDG
121-
if (workflow_type === WorkflowType.SUPERVISED_FINE_TUNING && !isEmpty(doc_paths)) {
123+
if (workflow_type === WorkflowType.FREE_FORM_DATA_GENERATION && !isEmpty(doc_paths)) {
122124
const dataset_size = form.getFieldValue('num_questions');
123125
return dataset_size <= DEMO_MODE_THRESHOLD;
124126
}
@@ -137,10 +139,9 @@ const Finish = () => {
137139

138140
const doc_paths = formValues.doc_paths;
139141
if (Array.isArray(doc_paths) && !isEmpty(doc_paths)) {
140-
if (formValues.workflow_type === WorkflowType.SUPERVISED_FINE_TUNING) {
142+
if (formValues.workflow_type === WorkflowType.FREE_FORM_DATA_GENERATION && formValues.use_case === 'custom') {
141143
formValues.doc_paths = doc_paths.map(item => item.value);
142144
} else if (formValues.workflow_type === WorkflowType.CUSTOM_DATA_GENERATION) {
143-
144145
formValues.input_path = doc_paths.map(item => item.value);
145146
delete formValues.doc_paths;
146147
// delete formValues.examples;
@@ -192,6 +193,23 @@ const Finish = () => {
192193
return !Array.isArray(genDatasetResp?.results)
193194
}
194195

196+
const getRawData = (genDatasetResp: unknown) => {
197+
if (genDatasetResp === null || isEmpty(genDatasetResp)) {
198+
return null;
199+
}
200+
if (Array.isArray(genDatasetResp?.results)) {
201+
return genDatasetResp?.results;
202+
} else if (!isEmpty(genDatasetResp?.results) && isObject(genDatasetResp?.results)) {
203+
let data: any[] = [];
204+
const values = Object.values(genDatasetResp?.results);
205+
forEach(values, (value: any[]) => {
206+
data = data.concat(value);
207+
});
208+
return data;
209+
}
210+
return null;
211+
}
212+
195213

196214
const formValues = form.getFieldsValue(true);
197215
let hasDocSeeds = false;
@@ -298,11 +316,9 @@ const Finish = () => {
298316
</>
299317
)
300318
}
301-
console.log('Finish >> ');
302-
console.log('hasTopics', hasTopics(genDatasetResp));
303-
console.log('formValues', formValues);
304-
console.log('isDemo', isDemo);
305-
console.log('topicTabs', topicTabs);
319+
320+
const rawData = genDatasetResp !== null && hasTopics(genDatasetResp) ?
321+
getRawData(genDatasetResp) : genDatasetResp?.results
306322

307323
return (
308324
<div>
@@ -328,6 +344,9 @@ const Finish = () => {
328344
</StyledButton>
329345
</Flex>
330346
)}
347+
{isDemo && !isEmpty(rawData) && formValues.workflow_type === WorkflowType.FREE_FORM_DATA_GENERATION && formValues.use_case === 'custom' &&
348+
<FreeFormTable data={rawData} />}
349+
331350
{(isDemo && formValues.workflow_type === WorkflowType.FREE_FORM_DATA_GENERATION && formValues.use_case !== 'custom' && hasTopics(genDatasetResp) && !hasDocSeeds) && (
332351
<TabsContainer title={'Generated Dataset'}>
333352
<Tabs tabPosition='left' items={topicTabs}/>

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ const FreeFormTable: FunctionComponent<Props> = ({ data }) => {
5151

5252
useEffect(() => {
5353
if (!isEmpty(data)) {
54-
console.log('data', data);
5554
const columnNames = Object.keys(first(data));
5655
const columnDefs = columnNames.map((colName) => ({
5756
field: colName,

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ const SeedsFormItem = styled(StyledFormItem)`
7676

7777
const Prompt = () => {
7878
const form = Form.useFormInstance();
79-
console.log('form', form);
8079
const selectedTopics = Form.useWatch('topics');
8180
const numQuestions = Form.useWatch('num_questions');
8281
const datasetSize = Form.useWatch('num_questions');
@@ -110,12 +109,7 @@ const Prompt = () => {
110109
output_key,
111110
useCase
112111
);
113-
114-
console.log('values', form.getFieldsValue(true));
115-
console.log('values', form);
116-
console.log('workflow_type', workflow_type);
117-
console.log('useCase', useCase);
118-
console.log('dataset_size', dataset_size);
112+
119113
const mutation = useMutation({
120114
mutationFn: fetchSeedList
121115
});

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ const TopicsTable: FC<TopicsTableProps> = ({ formData, topic }) => {
5252
render: (_text: QuestionSolution, record: QuestionSolution) => <>{record.solution}</>
5353
},
5454
]
55-
console.log('topic', topic);
5655
const dataSource = formData.results[topic];
57-
console.log('dataSource', dataSource);
56+
5857
return (
5958
<StyledTable
6059
columns={cols}

app/client/src/pages/Home/HomePage.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const HeaderSection = styled.div`
2424
display: flex;
2525
flex-direction: column;
2626
margin-bottom: 1rem;
27-
height: 150px;
27+
height: 130px;
2828
width: 50%;
2929
padding: 16px;
3030
background-color: #ffffff;
@@ -38,6 +38,8 @@ export const HeaderSection = styled.div`
3838
flex-direction: row;
3939
justify-content: flex-end;
4040
margin-top: 8px;
41+
position: relative;
42+
top: -20px;
4143
}
4244
.left-section {
4345
width: 66px;
@@ -137,6 +139,14 @@ const HomePage: React.FC = () => {
137139
Create synthetic data from scratch using examples, documents, seed instructions and AI assisted prompts.
138140
</div>
139141
</div>
142+
{/* <div className="right-section">
143+
<div>
144+
<Button href="/data-generator">
145+
Get Started
146+
<img src={ArrowRightIcon} alt="Get Started" />
147+
</Button>
148+
</div>
149+
</div> */}
140150
</div>
141151

142152
<div className="bottom-section">
@@ -149,7 +159,7 @@ const HomePage: React.FC = () => {
149159
</div>
150160
</HeaderSection>
151161

152-
<HeaderSection style={{ marginLeft: '1rem' }} onClick={() => navigate('/data-augmentation')}>
162+
{/* <HeaderSection style={{ marginLeft: '1rem' }} onClick={() => navigate('/data-augmentation')}>
153163
<div className="top-section">
154164
<div className="left-section" style={{ padding: '5px' }}>
155165
<img src={DataAugmentationIcon} alt="augmentation" />
@@ -170,7 +180,7 @@ const HomePage: React.FC = () => {
170180
</Button>
171181
</div>
172182
</div>
173-
</HeaderSection>
183+
</HeaderSection> */}
174184
<EvaluateSection />
175185
</Flex>
176186
<Row>

0 commit comments

Comments
 (0)