-
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.
feature: Discovery operations (list,create,run,delete)
- Loading branch information
1 parent
e0dfea8
commit 8fe460a
Showing
15 changed files
with
585 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<script setup lang="ts"> | ||
import { useProfileStore } from "@/stores/profile" | ||
import type { IProfile } from "@/models/Profile" | ||
import { computed, onMounted, ref } from "vue" | ||
import { useI18n } from "vue-i18n" | ||
const store = useProfileStore() | ||
const { t } = useI18n() | ||
const props = defineProps<{ | ||
profile: IProfile | ||
}>() | ||
const emit = defineEmits<{ | ||
(event: "update:profile", ...args: any[]): void | ||
}>() | ||
const value = computed({ | ||
get() { | ||
return props.profile | ||
}, | ||
set(value) { | ||
emit("update:profile", value) | ||
}, | ||
}) | ||
const createDebounce = () => { | ||
let timeout: number | undefined = 0 | ||
return function (fnc: () => void, delayMs: any) { | ||
clearTimeout(timeout) | ||
timeout = setTimeout(() => { | ||
fnc() | ||
}, delayMs || 500) | ||
} | ||
} | ||
const searchDebounce = createDebounce() | ||
const loading = ref(true) | ||
const search = (query: string) => { | ||
loading.value = true | ||
searchDebounce(() => { | ||
store | ||
.fetch({ | ||
search: query, | ||
per_page: 20, | ||
}) | ||
.then(() => { | ||
loading.value = false | ||
}) | ||
}, 300) | ||
} | ||
onMounted(() => { | ||
store.fetch().then(() => { | ||
loading.value = false | ||
}) | ||
}) | ||
</script> | ||
|
||
<template> | ||
<n-select | ||
v-model:value="value" | ||
filterable | ||
:placeholder="t('profile.select.placeholder')" | ||
:options="store.get.records" | ||
:loading="loading" | ||
clearable | ||
remote | ||
:clear-filter-after-select="false" | ||
@search="search" | ||
label-field="name" | ||
value-field="id" | ||
/> | ||
</template> |
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 |
---|---|---|
@@ -1,15 +1,16 @@ | ||
import type { IDiscovery } from "./Discovery" | ||
|
||
export interface IAsset { | ||
id: string | ||
created_at: string | ||
updated_at: string | ||
deleted_at: string | ||
hostname: string | ||
address: string | ||
serial_number: string | ||
vendor: string | ||
model: string | ||
discovery_id: string | ||
discovery: any | ||
packages: any | ||
} | ||
|
||
id: string | ||
created_at: string | ||
updated_at: string | ||
deleted_at: string | ||
hostname: string | ||
address: string | ||
serial_number: string | ||
vendor: string | ||
model: string | ||
discovery_id: string | ||
discovery: IDiscovery | ||
packages: any | ||
} |
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,18 @@ | ||
import type { IProfile } from "./Profile" | ||
|
||
export interface IDiscovery { | ||
id: string | ||
created_at: string | ||
updated_at: string | ||
deleted_at: string | ||
ip_range: string | ||
profile_id: string | ||
profile: IProfile | ||
discovery_status: string | ||
message: string | ||
} | ||
|
||
export interface IDiscoveryCreate { | ||
ip_range: string | ||
profile_id: string | null | ||
} |
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
Oops, something went wrong.