diff --git a/.gitignore b/.gitignore
index f25efcb..2e1814b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,4 +25,5 @@ test/
node_modules/
-agent.md
\ No newline at end of file
+agent.md
+api-backend.md
\ No newline at end of file
diff --git a/src/views/Instances.vue b/src/views/Instances.vue
index 8cc8755..e12fd63 100644
--- a/src/views/Instances.vue
+++ b/src/views/Instances.vue
@@ -54,6 +54,109 @@
+
+
@@ -74,6 +177,21 @@ export default {
setup(props) {
const router = useRouter();
const instances = ref([]);
+ const showAddModal = ref(false);
+ const loading = ref(false);
+ const formData = ref({
+ name: '',
+ auth_method: 'token',
+ serverAddr: '',
+ serverPort: '',
+ token: '',
+ clientId: '',
+ clientSecret: '',
+ audience: '',
+ tokenEndpoint: '',
+ bootAtStart: false,
+ runUser: ''
+ });
const filteredInstances = computed(() => {
if (!props.searchQuery) return instances.value;
@@ -118,6 +236,60 @@ export default {
router.push(`/instances/${instanceName}`);
};
+ const handleAddInstance = async () => {
+ loading.value = true;
+ try {
+ const instanceInfo = {
+ name: formData.value.name,
+ serverAddr: formData.value.serverAddr,
+ serverPort: formData.value.serverPort,
+ auth_method: formData.value.auth_method
+ };
+
+ const additionalProperties = {};
+ if (formData.value.auth_method === 'token') {
+ additionalProperties.auth_token = formData.value.token;
+ } else if (formData.value.auth_method === 'oidc') {
+ additionalProperties.oidc_client_id = formData.value.clientId;
+ additionalProperties.oidc_client_secret = formData.value.clientSecret;
+ additionalProperties.oidc_audience = formData.value.audience;
+ additionalProperties.oidc_token_endpoint = formData.value.tokenEndpoint;
+ }
+
+ await instanceApi.createInstance(
+ instanceInfo,
+ formData.value.bootAtStart,
+ formData.value.runUser || 'root',
+ additionalProperties
+ );
+
+ showNotification('Instance created successfully', 'success');
+ closeAddModal();
+ await loadInstances();
+ } catch (error) {
+ showNotification(error.message || 'Failed to create instance', 'error');
+ } finally {
+ loading.value = false;
+ }
+ };
+
+ const closeAddModal = () => {
+ showAddModal.value = false;
+ formData.value = {
+ name: '',
+ auth_method: 'token',
+ serverAddr: '',
+ serverPort: '',
+ token: '',
+ clientId: '',
+ clientSecret: '',
+ audience: '',
+ tokenEndpoint: '',
+ bootAtStart: false,
+ runUser: ''
+ };
+ };
+
onMounted(() => {
loadInstances();
});
@@ -129,7 +301,12 @@ export default {
stopInstance,
goToDetail,
formatDate,
- highlightText
+ highlightText,
+ showAddModal,
+ loading,
+ formData,
+ handleAddInstance,
+ closeAddModal
};
}
};
@@ -138,6 +315,12 @@ export default {
diff --git a/src/views/Sessions.vue b/src/views/Sessions.vue
index fe86f79..a6c6ef2 100644
--- a/src/views/Sessions.vue
+++ b/src/views/Sessions.vue
@@ -97,6 +97,9 @@ export default {
.session-card {
transition: background-color 0.3s;
+ background-color: var(--card-bg);
+ padding: 16px;
+ border-radius: 8px;
}
.session-icon {
diff --git a/src/views/Users.vue b/src/views/Users.vue
index 5a48ee1..c92c10f 100644
--- a/src/views/Users.vue
+++ b/src/views/Users.vue
@@ -3,7 +3,7 @@