-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix start/stop task running flashing
- Loading branch information
Showing
7 changed files
with
164 additions
and
99 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
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {isTaskRunning} from '@/helpers' | ||
import {Ref, computed} from 'vue' | ||
import {useTasksQuery} from './useTasksQuery' | ||
|
||
export function useRunningTask(projectId: Ref) { | ||
const {data: tasks} = useTasksQuery(projectId) | ||
|
||
const task = computed(() => { | ||
return tasks.value?.data[0] | ||
}) | ||
const isRunning = computed<boolean>(() => { | ||
if (task.value) { | ||
return isTaskRunning(task.value) | ||
} | ||
return false | ||
}) | ||
|
||
return {task, isRunning} | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {getTasks} from '@/api' | ||
import {useQuery} from '@tanstack/vue-query' | ||
import {Ref, watch} from 'vue' | ||
|
||
export function useTasksQuery(projectId: Ref) { | ||
watch(projectId, () => { | ||
console.log('projectId changed', projectId.value) | ||
}) | ||
const {statuses} = useSettings() | ||
return useQuery({ | ||
queryKey: ['tasks', projectId, statuses.running], | ||
queryFn: () => getTasks({projectId: projectId.value, taskStatusId: statuses.running}), | ||
staleTime: Infinity | ||
}) | ||
} |
Oops, something went wrong.