Skip to content

Commit e660944

Browse files
committed
Use slider for total number of data
1 parent 5618b00 commit e660944

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

components/modal/createModelData.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
const model = useModel();
1717
const modelData = useModelData();
1818
const modelDataType = useModelDataType();
19+
const maxCountAllowed = ref(10 - modelData.list.length || 0);
1920
2021
const defaultSchema = model.target?.schema?.map((sch) => ({
2122
max: undefined,
@@ -91,13 +92,14 @@
9192
<form @submit="onSubmit">
9293
<h3 class="text-lg font-bold">Generate Model Data</h3>
9394
<div class="flex">
94-
<section class="form-control mt-2">
95-
<FormInput
95+
<section class="form-control mt-2 w-full">
96+
<label class="mb-2 text-lg">No. of data:</label>
97+
<FormRange
9698
:disabled="isDisabled"
97-
:rules="{ required: 'Increase is required.' }"
99+
:max="maxCountAllowed"
100+
:min="1"
101+
:rules="{ min: 'Number should be greater than 0.' }"
98102
name="increase"
99-
placeholder="Enter increase"
100-
type="number"
101103
/>
102104
</section>
103105
</div>

stores/useModelData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default defineStore('model-data', () => {
5858
},
5959
async onResponse({ response }) {
6060
if (response.status === 200) {
61-
toast.success('Created a model!');
61+
toast.success('Generated new data!');
6262

6363
if (typeof options.onSuccess === 'function') {
6464
options.onSuccess(response._data.secretKey);

0 commit comments

Comments
 (0)