1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat: min and max option for random floats and numbers

This commit is contained in:
2021-02-16 19:13:20 +01:00
parent 9d5ebefdce
commit 6c62052b47
6 changed files with 46 additions and 18 deletions

View File

@ -74,6 +74,17 @@
:type="inputProps().type"
:disabled="!isChecked"
>
<template v-if="methodData && 'params' in methodData" class="columns">
<input
v-for="(option, key) in methodData.params"
:key="key"
v-model="methodParams[option]"
class="form-input column"
:type="inputProps().type"
:disabled="!isChecked"
:placeholder="option"
>
</template>
<slot />
</fieldset>
</template>
@ -107,7 +118,8 @@ export default {
selectedGroup: 'manual',
selectedMethod: '',
selectedValue: '',
debounceTimeout: null
debounceTimeout: null,
methodParams: {}
};
},
computed: {
@ -127,6 +139,9 @@ export default {
},
fakerMethods () {
return FakerMethods.getMethods({ type: this.localType, group: this.selectedGroup });
},
methodData () {
return this.fakerMethods.find(method => method.name === this.selectedMethod);
}
},
watch: {
@ -197,6 +212,7 @@ export default {
this.$emit('update:value', {
group: this.selectedGroup,
method: this.selectedMethod,
params: this.methodParams,
value: this.selectedValue,
length: this.fieldLength
});

View File

@ -5,7 +5,7 @@
<div class="modal-header pl-2">
<div class="modal-title h6">
<div class="d-flex">
<i class="mdi mdi-24px mdi-drama-masks mr-1" /> {{ $t('message.addFakeData') }}
<i class="mdi mdi-24px mdi-playlist-plus mr-1" /> {{ $t('message.tableFiller') }}
</div>
</div>
<a class="btn btn-clear c-hand" @click.stop="closeModal" />
@ -34,7 +34,7 @@
:field-obj="localRow[field.name]"
:value.sync="localRow[field.name]"
>
<span class="input-group-addon text-small" :class="`type-${field.type.toLowerCase()}`">
<span class="input-group-addon field-type" :class="`type-${field.type.toLowerCase()}`">
{{ field.type }} {{ fieldLength(field) | wrapNumber }}
</span>
<label class="form-checkbox ml-3" :title="$t('word.insert')">
@ -256,7 +256,7 @@ export default {
<style scoped>
.modal-container {
max-width: 700px;
max-width: 800px;
}
.form-label {
@ -275,4 +275,8 @@ export default {
justify-content: space-between;
align-items: center;
}
.field-type {
font-size: 0.6rem;
}
</style>

View File

@ -33,16 +33,15 @@
</div>
</div>
<button class="btn btn-dark btn-sm" @click="showAddModal">
<span>{{ $t('word.add') }}</span>
<button
v-if="isTable"
class="btn btn-dark btn-sm"
@click="showFakerModal"
>
<span>{{ $t('message.tableFiller') }}</span>
<i class="mdi mdi-24px mdi-playlist-plus ml-1" />
</button>
<button class="btn btn-dark btn-sm" @click="showFakerModal">
<span>{{ $t('word.faker') }}</span>
<i class="mdi mdi-24px mdi-drama-masks ml-1" />
</button>
<div class="dropdown export-dropdown pr-2">
<button
:disabled="isQuering"
@ -151,6 +150,9 @@ export default {
isSelected () {
return this.workspace.selected_tab === 'data';
},
isTable () {
return !!this.workspace.breadcrumbs.table;
},
fields () {
return this.results.length ? this.results[0].fields : [];
},