-
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.
- Loading branch information
Petr Gadorek
committed
Oct 2, 2024
1 parent
31b6d69
commit c033d22
Showing
5 changed files
with
127 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,109 @@ | ||
<template> | ||
<p>Please select download mirrors. If you are outside mainland china you probably want to use the defaults.</p> | ||
<n-split direction="horizontal" style="height: 200px" :max="0.75" :min="0.25"> | ||
<template #1> | ||
<n-spin :show="loading_idfs"> | ||
<template #default> | ||
<n-radio-group v-model:value="selected_idf_mirror" name="radiogroup"> | ||
<ul> | ||
<n-space> | ||
<li v-for="mirror in idf_mirrors" :key="mirror.value"> | ||
<n-radio :value="mirror.value" :label="mirror.label" /> | ||
</li> | ||
</n-space> | ||
</ul> | ||
</n-radio-group> | ||
</template> | ||
<template #description> | ||
loading available IDF download mirrors... | ||
</template> | ||
</n-spin> | ||
</template> | ||
<template #2> | ||
<n-spin :show="loading_tools"> | ||
<template #default> | ||
<n-radio-group v-model:value="selected_tools_mirror" name="radiogroup"> | ||
<ul> | ||
<n-space> | ||
<li v-for="mirror in tools_mirrors" :key="mirror.value"> | ||
<n-radio :value="mirror.value" :label="mirror.label" /> | ||
</li> | ||
</n-space> | ||
</ul> | ||
</n-radio-group> | ||
</template> | ||
<template #description> | ||
loading available tools download mirrors... | ||
</template> | ||
</n-spin> | ||
</template> | ||
</n-split> | ||
|
||
<n-space> | ||
<n-button @click="processChoices" type="primary" | ||
:disabled="selected_idf_mirror == null || selected_tools_mirror == null">Next</n-button> | ||
</n-space> | ||
</template> | ||
|
||
<script> | ||
import { ref, version } from "vue"; | ||
import { invoke } from "@tauri-apps/api/core"; | ||
import { NButton, NSpin } from 'naive-ui' | ||
import loading from "naive-ui/es/_internal/loading"; | ||
export default { | ||
name: 'MirrorSelect', | ||
props: { | ||
nextstep: Function | ||
}, | ||
components: { NButton, NSpin }, | ||
data: () => ({ | ||
loading_idfs: true, | ||
loading_tools: true, | ||
selected_idf_mirror: null, | ||
selected_tools_mirror: null, | ||
idf_mirrors: [], | ||
tools_mirrors: [], | ||
}), | ||
methods: { | ||
get_avalible_idf_mirrors: async function () { | ||
const idf_mirrors = await invoke("get_idf_mirror_list", {}); | ||
this.idf_mirrors = idf_mirrors.map((mirror, index) => { | ||
return { | ||
value: mirror, | ||
label: mirror, | ||
} | ||
}); | ||
this.selected_idf_mirror = this.idf_mirrors[0].value; | ||
this.loading_idfs = false; | ||
return false; | ||
}, | ||
get_avalible_tools_mirrors: async function () { | ||
const tools_mirrors = await invoke("get_tools_mirror_list", {}); | ||
this.tools_mirrors = tools_mirrors.map((mirror, index) => { | ||
return { | ||
value: mirror, | ||
label: mirror, | ||
} | ||
}); | ||
this.selected_tools_mirror = this.tools_mirrors[0].value; | ||
this.loading_tools = false; | ||
return false; | ||
}, | ||
processChoices: function () { | ||
// todo: send to backend | ||
console.log("Mirror choices:", { | ||
idf_mirror: this.selected_idf_mirror, | ||
tools_mirror: this.selected_tools_mirror, | ||
}); | ||
if (!this.loading_idfs && !this.loading_tools) { | ||
this.nextstep(); | ||
} | ||
} | ||
}, | ||
mounted() { | ||
this.get_avalible_idf_mirrors(); | ||
this.get_avalible_tools_mirrors(); | ||
} | ||
} | ||
</script> |
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