mirror of
https://github.com/unraid/api.git
synced 2026-01-05 08:00:33 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced API capabilities with improved GraphQL interfaces for remote access, parity checks, notifications, and virtual machine controls. - Introduction of dynamic remote access settings and refined online status and service monitoring. - New `ParityCheckMutationsResolver` for managing parity check operations through GraphQL. - **Refactor** - Consolidated and renamed internal types and schema definitions to improve consistency and performance. - Removed deprecated legacy schemas to streamline the API. - Updated import paths for various types to reflect new module structures. - **Chore** - Updated environment configurations and test setups to support the new logging and configuration mechanisms. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
61 lines
2.0 KiB
Vue
61 lines
2.0 KiB
Vue
<script lang="ts" setup>
|
|
import { WanAccessType, WanForwardType } from '~/composables/gql/graphql';
|
|
import { useUnraidApiSettingsStore } from '~/store/unraidApiSettings';
|
|
|
|
const apiSettingsStore = useUnraidApiSettingsStore();
|
|
|
|
const accessType = ref<WanAccessType>(WanAccessType.DISABLED);
|
|
const forwardType = ref<WanForwardType | null>(null);
|
|
const port = ref<number | null>(null);
|
|
|
|
onMounted(async () => {
|
|
const remoteAccessSettings = await apiSettingsStore.getRemoteAccess();
|
|
accessType.value =
|
|
remoteAccessSettings?.accessType ?? WanAccessType.DISABLED;
|
|
forwardType.value = remoteAccessSettings?.forwardType ?? null;
|
|
port.value = remoteAccessSettings?.port ?? null;
|
|
});
|
|
|
|
const setRemoteAccess = () => {
|
|
apiSettingsStore.setupRemoteAccess({
|
|
accessType: accessType.value,
|
|
...(forwardType.value ? { forwardType: forwardType.value } : {}),
|
|
...(port.value ? { port: port.value } : {}),
|
|
});
|
|
};
|
|
|
|
watch(accessType, (newVal) => {
|
|
if (newVal !== WanAccessType.DISABLED) {
|
|
forwardType.value = WanForwardType.STATIC;
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div class="flex flex-col">
|
|
<h2>Setup Remote Access</h2>
|
|
<label for="forwardType">Forward Type</label>
|
|
<select id="accessType" v-model="accessType">
|
|
<option v-for="(val, index) in Object.values(WanAccessType)" :key="index" :value="val">
|
|
{{ val }}
|
|
</option>
|
|
</select>
|
|
<template v-if="accessType !== WanAccessType.DISABLED">
|
|
<label for="forwardType">Forward Type</label>
|
|
<select id="forwardType" v-model="forwardType">
|
|
<option v-for="(val, index) in Object.values(WanForwardType)" :key="index" :value="val">
|
|
{{ val }}
|
|
</option>
|
|
</select>
|
|
</template>
|
|
<template v-if="forwardType === WanForwardType.STATIC && accessType !== WanAccessType.DISABLED">
|
|
<label for="port">Port</label>
|
|
<input id="port" v-model="port" type="number">
|
|
</template>
|
|
|
|
<button @click="setRemoteAccess">
|
|
Save
|
|
</button>
|
|
</div>
|
|
</template>
|