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