-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🚀 Add basic timing task function
- Loading branch information
Showing
28 changed files
with
1,107 additions
and
538 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 18 additions & 63 deletions
81
src/components/Device/components/BatchActions/Application/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,31 @@ | ||
<template> | ||
<div class="" @click="handleClick"> | ||
<div class="" @click="handleClick(devices)"> | ||
<slot v-bind="{ loading }" /> | ||
<ApplicationProxy ref="applicationProxyRef" /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import ApplicationProxy from '$/components/Device/components/ControlBar/Application/index.vue' | ||
import { allSettledWrapper } from '$/utils' | ||
<script setup> | ||
import { useInstallAction } from '$/composables/useInstallAction/index.js' | ||
export default { | ||
components: { | ||
ApplicationProxy, | ||
}, | ||
props: { | ||
devices: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
}, | ||
data() { | ||
return { | ||
loading: false, | ||
} | ||
}, | ||
methods: { | ||
async handleClick() { | ||
let files = null | ||
try { | ||
files = await this.$electron.ipcRenderer.invoke('show-open-dialog', { | ||
properties: ['openFile', 'multiSelections'], | ||
filters: [ | ||
{ | ||
name: this.$t('device.control.install.placeholder'), | ||
extensions: ['apk'], | ||
}, | ||
], | ||
}) | ||
} | ||
catch (error) { | ||
if (error.message) { | ||
const message | ||
= error.message?.match(/Error: (.*)/)?.[1] || error.message | ||
this.$message.warning(message) | ||
} | ||
return false | ||
} | ||
import { useTaskStore } from '$/store/index.js' | ||
this.loading = true | ||
const closeMessage = this.$message.loading( | ||
this.$t('device.control.install.progress', { | ||
deviceName: window.t('common.device'), | ||
}), | ||
).close | ||
await allSettledWrapper(this.devices, (item) => { | ||
return this.$refs.applicationProxyRef.invoke(item, { | ||
files, | ||
silent: true, | ||
}) | ||
}) | ||
const props = defineProps({ | ||
devices: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
}) | ||
closeMessage() | ||
const { loading, invoke: handleClick } = useInstallAction() | ||
ElMessage.success(window.t('common.success.batch')) | ||
const taskStore = useTaskStore() | ||
this.loading = false | ||
}, | ||
}, | ||
} | ||
taskStore.on('install', (task) => { | ||
taskStore.start({ | ||
task, | ||
handler: handleClick, | ||
}) | ||
}) | ||
</script> | ||
|
||
<style></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 18 additions & 38 deletions
56
src/components/Device/components/BatchActions/Screenshot/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,31 @@ | ||
<template> | ||
<div class="" @click="handleClick"> | ||
<div class="" @click="handleClick(devices)"> | ||
<slot v-bind="{ loading }" /> | ||
<ScreenshotProxy ref="screenshotProxyRef" /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import ScreenshotProxy from '$/components/Device/components/ControlBar/Screenshot/index.vue' | ||
import { allSettledWrapper, sleep } from '$/utils' | ||
<script setup> | ||
import { useTaskStore } from '$/store/index.js' | ||
export default { | ||
components: { | ||
ScreenshotProxy, | ||
}, | ||
props: { | ||
devices: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
}, | ||
data() { | ||
return { | ||
loading: false, | ||
} | ||
}, | ||
methods: { | ||
async handleClick() { | ||
this.loading = true | ||
import { useScreenshotAction } from '$/composables/useScreenshotAction/index.js' | ||
const closeMessage = this.$message.loading( | ||
window.t('device.control.capture.progress', { | ||
deviceName: window.t('common.device'), | ||
}), | ||
).close | ||
await allSettledWrapper(this.devices, (item) => { | ||
return this.$refs.screenshotProxyRef.invoke(item, { silent: true }) | ||
}) | ||
const props = defineProps({ | ||
devices: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
}) | ||
closeMessage() | ||
const { loading, invoke: handleClick } = useScreenshotAction() | ||
ElMessage.success(window.t('common.success.batch')) | ||
const taskStore = useTaskStore() | ||
this.loading = false | ||
}, | ||
}, | ||
} | ||
taskStore.on('screenshot', (task) => { | ||
taskStore.start({ | ||
task, | ||
handler: handleClick, | ||
}) | ||
}) | ||
</script> | ||
|
||
<style></style> |
Oops, something went wrong.