MCPcopy Create free account
hub / github.com/Tong89/smartNode / submitRequest

Function submitRequest

frontend/app.js:1207–1243  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1205 },
1206
1207 async submitRequest() {
1208 this.submitting = true;
1209 try {
1210 const selectedGroundStations = this.requestForm.ground_station_id
1211 ? [this.requestForm.ground_station_id]
1212 : [];
1213
1214 const payload = {
1215 data_type: this.requestForm.data_type,
1216 data_size: Number(this.requestForm.data_size),
1217 priority: Number(this.requestForm.priority),
1218 max_delay: Number(this.requestForm.max_delay),
1219 selected_ground_stations: selectedGroundStations,
1220 };
1221
1222 if (this.requestForm.satellite_id) {
1223 payload.satellite_id = this.requestForm.satellite_id;
1224 }
1225
1226 const result = await this.fetchJson('/api/request', {
1227 method: 'POST',
1228 body: JSON.stringify(payload),
1229 });
1230
1231 if (result && result.status === 'rejected') {
1232 this.setNotice(`请求被拒绝:${result.reject_reason || '资源暂不可用'}`, 'error');
1233 } else {
1234 this.setNotice(`请求已提交:${result.id || '已进入队列'}`);
1235 }
1236
1237 await this.refreshAll();
1238 } catch (error) {
1239 this.setNotice(error.message || '提交失败', 'error');
1240 } finally {
1241 this.submitting = false;
1242 }
1243 },
1244
1245 async updateGroundStations() {
1246 await this.updateResource('/api/update_ground_stations', {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected