mirror of
				https://github.com/CorentinTh/it-tools.git
				synced 2025-11-04 05:53:25 +00:00 
			
		
		
		
	Compare commits
	
		
			5 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					8158f29d62 | ||
| 
						 | 
					830c11f2a8 | ||
| 
						 | 
					c484715c3e | ||
| 
						 | 
					0812385ada | ||
| 
						 | 
					f6d8dc41e6 | 
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
 | 
				
			|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 | 
					The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 | 
				
			||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 | 
					and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Next
 | 
				
			||||||
 | 
					- [fix] [UuidGenerator] added quantity validation rules
 | 
				
			||||||
 | 
					- [refactor] better isInt checker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 1.2.0
 | 
					## 1.2.0
 | 
				
			||||||
- [feat] [UuidGenerator] can generate multiple uuids 
 | 
					- [feat] [UuidGenerator] can generate multiple uuids 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "it-tools",
 | 
					  "name": "it-tools",
 | 
				
			||||||
  "version": "1.2.0",
 | 
					  "version": "1.2.1",
 | 
				
			||||||
  "lockfileVersion": 1,
 | 
					  "lockfileVersion": 1,
 | 
				
			||||||
  "requires": true,
 | 
					  "requires": true,
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "it-tools",
 | 
					  "name": "it-tools",
 | 
				
			||||||
  "description": "",
 | 
					  "description": "",
 | 
				
			||||||
  "version": "1.2.0",
 | 
					  "version": "1.2.1",
 | 
				
			||||||
  "private": true,
 | 
					  "private": true,
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "serve": "vue-cli-service serve",
 | 
					    "serve": "vue-cli-service serve",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,8 +3,18 @@
 | 
				
			|||||||
        <v-card-title>Uuid v4 generator</v-card-title>
 | 
					        <v-card-title>Uuid v4 generator</v-card-title>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <v-card-text>
 | 
					        <v-card-text>
 | 
				
			||||||
            <v-text-field outlined v-model="quantity" type="number" label="Quantity" dense class="quantity"/>
 | 
					            <v-text-field
 | 
				
			||||||
            <v-textarea outlined v-model="token" class="centered-input" :rows="quantity <= 10 ? quantity : 10" readonly/>
 | 
					                    outlined
 | 
				
			||||||
 | 
					                    v-model="quantity"
 | 
				
			||||||
 | 
					                    ref="quantity"
 | 
				
			||||||
 | 
					                    type="number"
 | 
				
			||||||
 | 
					                    label="Quantity"
 | 
				
			||||||
 | 
					                    dense
 | 
				
			||||||
 | 
					                    class="quantity"
 | 
				
			||||||
 | 
					                    :rules="rules.quantity"
 | 
				
			||||||
 | 
					            />
 | 
				
			||||||
 | 
					            <v-textarea outlined v-model="token" class="centered-input" :rows="quantity <= 10 ? quantity : 10"
 | 
				
			||||||
 | 
					                        readonly/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <div class="text-center">
 | 
					            <div class="text-center">
 | 
				
			||||||
                <v-btn @click="refreshBool = !refreshBool" depressed class="mr-4">Refresh</v-btn>
 | 
					                <v-btn @click="refreshBool = !refreshBool" depressed class="mr-4">Refresh</v-btn>
 | 
				
			||||||
@@ -15,7 +25,7 @@
 | 
				
			|||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
    import {copyToClipboard} from "../../utils/helpers";
 | 
					    import {copyToClipboard, isInt} from "../../utils/helpers";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const noop = () => {
 | 
					    const noop = () => {
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
@@ -26,8 +36,19 @@
 | 
				
			|||||||
        name: "UuidGenerator",
 | 
					        name: "UuidGenerator",
 | 
				
			||||||
        data: () => ({
 | 
					        data: () => ({
 | 
				
			||||||
            refreshBool: true,
 | 
					            refreshBool: true,
 | 
				
			||||||
            quantity: 1
 | 
					            quantity: 1,
 | 
				
			||||||
 | 
					            rules: {
 | 
				
			||||||
 | 
					                quantity: [
 | 
				
			||||||
 | 
					                    v => !!v || 'Quantity is required',
 | 
				
			||||||
 | 
					                    v => (v > 0 && v <= 50 ) || 'Quantity should be > 0 and <= 50',
 | 
				
			||||||
 | 
					                    v => isInt(v) || 'Quantity should be an integer'
 | 
				
			||||||
 | 
					                ]
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            isMounted:false
 | 
				
			||||||
        }),
 | 
					        }),
 | 
				
			||||||
 | 
					        mounted() {
 | 
				
			||||||
 | 
					            this.isMounted = true;
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        methods: {
 | 
					        methods: {
 | 
				
			||||||
            copyToken() {
 | 
					            copyToken() {
 | 
				
			||||||
                copyToClipboard(this.token);
 | 
					                copyToClipboard(this.token);
 | 
				
			||||||
@@ -36,9 +57,13 @@
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        computed: {
 | 
					        computed: {
 | 
				
			||||||
            token() {
 | 
					            token() {
 | 
				
			||||||
 | 
					                if (this.isMounted && this.$refs.quantity.validate()) {
 | 
				
			||||||
                    if (this.refreshBool) noop(); // To force recomputation
 | 
					                    if (this.refreshBool) noop(); // To force recomputation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    return Array.from({length: this.quantity}, generateUuid).join('\n');
 | 
					                    return Array.from({length: this.quantity}, generateUuid).join('\n');
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    return '';
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,7 @@ const formatBytes = (bytes, decimals = 2) => {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const isInt = (value) => {
 | 
					const isInt = (value) => {
 | 
				
			||||||
    return !isNaN(value) && ((x) => (x | 0) === x)(parseFloat(value))
 | 
					    return Number.isInteger(value);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export {
 | 
					export {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user