refactor: 更新任务表单组件以使用错误消息替代帮助文本,简化任务上下文中的任务查找逻辑
This commit is contained in:
parent
e686aa2d96
commit
d5b2158c1d
@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
import { StyleSheet, ScrollView, Text, View } from 'react-native';
|
||||
import { Input } from '@rneui/themed';
|
||||
import { Task, RobotAction, InputParam } from '../types/task';
|
||||
@ -48,7 +48,7 @@ const TaskForm: React.FC<TaskFormProps> = ({ task, onTaskChange }) => {
|
||||
value={value as string}
|
||||
onChangeText={text => handleParamChange(param.name, text)}
|
||||
placeholder={param.remark}
|
||||
helperText={param.remark}
|
||||
errorMessage={param.remark}
|
||||
inputContainerStyle={styles.inputContainer}
|
||||
/>
|
||||
);
|
||||
@ -60,7 +60,7 @@ const TaskForm: React.FC<TaskFormProps> = ({ task, onTaskChange }) => {
|
||||
value={value as string}
|
||||
onChangeText={text => handleParamChange(param.name, text)}
|
||||
placeholder={param.remark}
|
||||
helperText={param.remark}
|
||||
errorMessage={param.remark}
|
||||
inputContainerStyle={styles.inputContainer}
|
||||
/>
|
||||
);
|
||||
|
@ -14,7 +14,6 @@ import {
|
||||
} from '../types/config';
|
||||
import {
|
||||
getConfig,
|
||||
getSettings,
|
||||
executeTask,
|
||||
clearCachedConfig,
|
||||
} from '../services/configService';
|
||||
@ -141,7 +140,7 @@ export const TasksProvider: React.FC<{ children: ReactNode }> = ({
|
||||
await clearCachedConfig();
|
||||
const config = await getConfig();
|
||||
if (config) {
|
||||
applyConfig(config, false); // Don't load tasks from config
|
||||
applyConfig(config); // Don't load tasks from config
|
||||
setIsConfigLoaded(true);
|
||||
if (config.serverUrl && config.apiEndpoints) {
|
||||
await fetchTasks(config.serverUrl, config.apiEndpoints.getTasks);
|
||||
@ -157,7 +156,7 @@ export const TasksProvider: React.FC<{ children: ReactNode }> = ({
|
||||
};
|
||||
|
||||
const getTaskById = (id: string) => {
|
||||
const task = tasks.find(task => task.id === id);
|
||||
const task = tasks.find(t => t.id === id);
|
||||
if (task && !task.detail) {
|
||||
fetchTaskDetail(id);
|
||||
}
|
||||
|
@ -6,7 +6,8 @@ const CONFIG_CACHE_KEY = 'cached_config';
|
||||
|
||||
// 默认设置
|
||||
const DEFAULT_SETTINGS: AppSettings = {
|
||||
configFileName: 'config',
|
||||
configFileName: 'config.json',
|
||||
serverUrl: '',
|
||||
};
|
||||
|
||||
// 获取设置
|
||||
|
Loading…
x
Reference in New Issue
Block a user