Add explain crontab tool
This commit is contained in:
47
src/views/ExplainCrontab.vue
Normal file
47
src/views/ExplainCrontab.vue
Normal file
@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<h2 class="tool-title">Explain crontab</h2>
|
||||
<hr class="mt-5 mb-5">
|
||||
|
||||
<div class="input-group">
|
||||
<label for="data">Data</label>
|
||||
<input id="data" class="input" v-model="toolData.data" placeholder="* * * * *" type="text">
|
||||
</div>
|
||||
|
||||
<hr class="mt-5 mb-5">
|
||||
|
||||
<div class="input-group">
|
||||
<label for="result">Result</label>
|
||||
<textarea id="result" v-model="toolResult" style="height: 150px"></textarea>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import cronstrue from 'cronstrue';
|
||||
import { unproxy } from "@/utils/unproxy";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
toolData: {
|
||||
data: '* * * * *',
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
toolResult() {
|
||||
try {
|
||||
return cronstrue.toString(this.toolData.data, {
|
||||
use24HourTimeFormat: true,
|
||||
verbose: true,
|
||||
});
|
||||
} catch (e) {
|
||||
return 'invalid syntax';
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
Reference in New Issue
Block a user