provisioning needs to call other api endpoints as dashboard

This commit is contained in:
Johannes Zellner
2025-05-06 14:43:53 +02:00
parent 7aca2a1b36
commit c8976daf96
3 changed files with 152 additions and 39 deletions

View File

@@ -4,20 +4,26 @@ import { ref, onMounted, watch } from 'vue';
import { Button, InputGroup, SingleSelect, FormGroup, TextInput, Checkbox, PasswordInput, NumberInput } from 'pankow';
import { prettyBinarySize } from 'pankow/utils';
import { BACKUP_FORMATS, STORAGE_PROVIDERS, REGIONS_CONTABO, REGIONS_VULTR, REGIONS_IONOS, REGIONS_OVH, REGIONS_LINODE, REGIONS_SCALEWAY, REGIONS_EXOSCALE, REGIONS_DIGITALOCEAN, REGIONS_HETZNER, REGIONS_WASABI, REGIONS_S3 } from '../constants.js';
import ProvisionModel from '../models/ProvisionModel.js';
import SystemModel from '../models/SystemModel.js';
import { mountlike, s3like } from '../utils.js';
const provider = defineModel('provider');
const providerConfig = defineModel('providerConfig');
const formError = defineProps({
const props = defineProps({
formError: {},
importOnly: {
type: Boolean,
default: false,
}
},
provisioning: {
type: Boolean,
default: false,
},
});
const systemModel = SystemModel.create();
const provisionModel = ProvisionModel.create();
const storageProviders = STORAGE_PROVIDERS.concat([
{ name: 'No-op (Only for testing)', value: 'noop' }
@@ -65,8 +71,13 @@ function onGcsKeyChange(event) {
gcsKeyFileName.value = event.target.files[0].name;
}
async function getBlockDevices() {
const [error, result] = await systemModel.blockDevices();
let error, result;
if (props.provisioning) [error, result] = await provisionModel.blockDevices();
else [error, result] = await systemModel.blockDevices();
if (error) return console.error(error);
// amend label for UI
@@ -87,6 +98,11 @@ async function getBlockDevices() {
}
async function getMemory() {
if (props.provisioning) {
maxMemoryLimit.value = 4 * 1024 * 1024 * 1024;
return;
}
const [error, result] = await systemModel.memory();
if (error) return console.error(error);