refactor: replace instanceID - Details with instanceName - Details
- Change API endpoint from POST to GET for instance status - Update proxy target URL in vite config - Add instance name display and remove initSystem from detail view - Improve instance data handling in InstanceDetail component
This commit is contained in:
@@ -83,7 +83,7 @@ export const instanceApi = {
|
||||
restartInstance: (instanceID) =>
|
||||
api.post('/frpcAct/instanceMgr/restart', { instanceID }),
|
||||
getInstanceStatus: (instanceID) =>
|
||||
api.post('/frpcAct/instanceMgr/status', { instanceID }),
|
||||
api.get(`/frpcAct/instanceMgr/status?instanceID=${instanceID}`),
|
||||
getInstanceLogs: (instanceID) =>
|
||||
api.post('/frpcAct/instanceMgr/logs', { instanceID }),
|
||||
getInstanceProxies: (instanceID) =>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<button class="common-btn" @click="goBack">
|
||||
<i class="fas fa-arrow-left"></i> Back
|
||||
</button>
|
||||
<h2>{{ instanceID }} - Details</h2>
|
||||
<h2>{{ instanceName }} - Details</h2>
|
||||
</div>
|
||||
|
||||
<div class="detail-content">
|
||||
@@ -40,10 +40,6 @@
|
||||
<span class="status-key">PID:</span>
|
||||
<span class="status-value">{{ statusInfo.pid }}</span>
|
||||
</div>
|
||||
<div class="status-item" v-if="statusInfo.initSystem">
|
||||
<span class="status-key">Init System:</span>
|
||||
<span class="status-value">{{ statusInfo.initSystem }}</span>
|
||||
</div>
|
||||
<div class="status-item" v-if="statusInfo.serviceName">
|
||||
<span class="status-key">Service Name:</span>
|
||||
<span class="status-value">{{ statusInfo.serviceName }}</span>
|
||||
@@ -284,6 +280,7 @@ export default {
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const instanceID = ref(route.params.id);
|
||||
const instanceName = ref('');
|
||||
const instanceConfig = ref({});
|
||||
const proxies = ref([]);
|
||||
const logs = ref([]);
|
||||
@@ -312,6 +309,7 @@ export default {
|
||||
const result = await instanceApi.listInstances();
|
||||
const instance = result.data.find(i => String(i.instanceID) === instanceID.value);
|
||||
if (instance) {
|
||||
instanceName.value = instance.name;
|
||||
instanceConfig.value = {
|
||||
'Server Address': instance.serverAddr,
|
||||
'Server Port': instance.serverPort,
|
||||
@@ -410,8 +408,10 @@ export default {
|
||||
|
||||
const editConfig = async () => {
|
||||
try {
|
||||
const instance = instanceID.value;
|
||||
const result = await instanceApi.listInstances();
|
||||
const instance = result.data.find(i => String(i.instanceID) === instanceID.value);
|
||||
if (instance) {
|
||||
instanceName.value = instance.name;
|
||||
formData.value = {
|
||||
name: instance.name,
|
||||
auth_method: instance.auth_method || 'token',
|
||||
@@ -525,6 +525,7 @@ export default {
|
||||
|
||||
return {
|
||||
instanceID,
|
||||
instanceName,
|
||||
instanceConfig,
|
||||
proxies,
|
||||
logs,
|
||||
|
||||
@@ -8,7 +8,7 @@ export default defineConfig({
|
||||
port: 3000,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8080',
|
||||
target: 'http://192.168.1.4:38080',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user