mirror of
https://github.com/frappe/books.git
synced 2024-11-08 23:00:56 +00:00
fix: don't log telemetry on setup or dummy create
- add a baseCount modal if dev mode for dummy create
This commit is contained in:
parent
b47347c26a
commit
5945db10dc
@ -14,7 +14,7 @@ import {
|
|||||||
flow,
|
flow,
|
||||||
getFlowConstant,
|
getFlowConstant,
|
||||||
getRandomDates,
|
getRandomDates,
|
||||||
purchaseItemPartyMap,
|
purchaseItemPartyMap
|
||||||
} from './helpers';
|
} from './helpers';
|
||||||
import items from './items.json';
|
import items from './items.json';
|
||||||
import logo from './logo';
|
import logo from './logo';
|
||||||
@ -29,8 +29,6 @@ export async function setupDummyInstance(
|
|||||||
baseCount: number = 1000,
|
baseCount: number = 1000,
|
||||||
notifier?: Notifier
|
notifier?: Notifier
|
||||||
) {
|
) {
|
||||||
fyo.store.skipTelemetryLogging = true;
|
|
||||||
|
|
||||||
fyo.purgeCache();
|
fyo.purgeCache();
|
||||||
notifier?.(fyo.t`Setting Up Instance`, -1);
|
notifier?.(fyo.t`Setting Up Instance`, -1);
|
||||||
const options = {
|
const options = {
|
||||||
@ -46,6 +44,7 @@ export async function setupDummyInstance(
|
|||||||
chartOfAccounts: 'India - Chart of Accounts',
|
chartOfAccounts: 'India - Chart of Accounts',
|
||||||
};
|
};
|
||||||
await setupInstance(dbPath, options, fyo);
|
await setupInstance(dbPath, options, fyo);
|
||||||
|
fyo.store.skipTelemetryLogging = true;
|
||||||
|
|
||||||
years = Math.floor(years);
|
years = Math.floor(years);
|
||||||
notifier?.(fyo.t`Creating Items and Parties`, -1);
|
notifier?.(fyo.t`Creating Items and Parties`, -1);
|
||||||
|
@ -168,6 +168,46 @@
|
|||||||
:percent="creationPercent"
|
:percent="creationPercent"
|
||||||
:message="creationMessage"
|
:message="creationMessage"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- Base Count Selection when Dev -->
|
||||||
|
<Modal :open-modal="openModal" @closemodal="openModal = false">
|
||||||
|
<div class="p-4 text-gray-900">
|
||||||
|
<h2 class="text-xl font-semibold select-none">Set Base Count</h2>
|
||||||
|
<p class="text-base mt-2">
|
||||||
|
Base Count is a lower bound on the number of entries made when
|
||||||
|
creating the dummy instance.
|
||||||
|
</p>
|
||||||
|
<div class="flex my-12 justify-center items-baseline gap-4 text-base">
|
||||||
|
<label for="basecount" class="text-gray-600">Base Count</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="basecount"
|
||||||
|
v-model="baseCount"
|
||||||
|
class="
|
||||||
|
bg-gray-100
|
||||||
|
focus:bg-gray-200
|
||||||
|
rounded-md
|
||||||
|
px-2
|
||||||
|
py-1
|
||||||
|
outline-none
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-between">
|
||||||
|
<Button @click="openModal = false">Cancel</Button>
|
||||||
|
<Button
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
openModal = false;
|
||||||
|
startDummyInstanceSetup();
|
||||||
|
}
|
||||||
|
"
|
||||||
|
type="primary"
|
||||||
|
>Create</Button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -176,9 +216,11 @@ import { ipcRenderer } from 'electron';
|
|||||||
import { t } from 'fyo';
|
import { t } from 'fyo';
|
||||||
import { ConfigKeys } from 'fyo/core/types';
|
import { ConfigKeys } from 'fyo/core/types';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
|
import Button from 'src/components/Button.vue';
|
||||||
import LanguageSelector from 'src/components/Controls/LanguageSelector.vue';
|
import LanguageSelector from 'src/components/Controls/LanguageSelector.vue';
|
||||||
import FeatherIcon from 'src/components/FeatherIcon.vue';
|
import FeatherIcon from 'src/components/FeatherIcon.vue';
|
||||||
import Loading from 'src/components/Loading.vue';
|
import Loading from 'src/components/Loading.vue';
|
||||||
|
import Modal from 'src/components/Modal.vue';
|
||||||
import { fyo } from 'src/initFyo';
|
import { fyo } from 'src/initFyo';
|
||||||
import { deleteDb, getSavePath } from 'src/utils/ipcCalls';
|
import { deleteDb, getSavePath } from 'src/utils/ipcCalls';
|
||||||
import { addNewConfigFile } from 'src/utils/misc';
|
import { addNewConfigFile } from 'src/utils/misc';
|
||||||
@ -190,6 +232,8 @@ export default {
|
|||||||
emits: ['file-selected'],
|
emits: ['file-selected'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
openModal: false,
|
||||||
|
baseCount: 100,
|
||||||
creationMessage: '',
|
creationMessage: '',
|
||||||
creationPercent: 0,
|
creationPercent: 0,
|
||||||
creatingDemo: false,
|
creatingDemo: false,
|
||||||
@ -231,19 +275,24 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
async createDemo() {
|
async createDemo() {
|
||||||
|
if (!fyo.store.isDevelopment) {
|
||||||
|
this.startDummyInstanceSetup();
|
||||||
|
} else {
|
||||||
|
this.openModal = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async startDummyInstanceSetup() {
|
||||||
const { filePath, canceled } = await getSavePath('demo', 'db');
|
const { filePath, canceled } = await getSavePath('demo', 'db');
|
||||||
if (canceled || !filePath) {
|
if (canceled || !filePath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.creatingDemo = true;
|
this.creatingDemo = true;
|
||||||
const baseCount = fyo.store.isDevelopment ? 1000 : 100;
|
|
||||||
|
|
||||||
const { companyName, instanceId } = await setupDummyInstance(
|
const { companyName, instanceId } = await setupDummyInstance(
|
||||||
filePath,
|
filePath,
|
||||||
fyo,
|
fyo,
|
||||||
1,
|
1,
|
||||||
baseCount,
|
this.baseCount,
|
||||||
(message, percent) => {
|
(message, percent) => {
|
||||||
this.creationMessage = message;
|
this.creationMessage = message;
|
||||||
this.creationPercent = percent;
|
this.creationPercent = percent;
|
||||||
@ -316,6 +365,8 @@ export default {
|
|||||||
LanguageSelector,
|
LanguageSelector,
|
||||||
Loading,
|
Loading,
|
||||||
FeatherIcon,
|
FeatherIcon,
|
||||||
|
Modal,
|
||||||
|
Button,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user