我的SpeedDialAction看起来像这样:
<SpeedDialAction key="Add" icon={<AddIcon />} tooltipTitle="Add" />
Run Code Online (Sandbox Code Playgroud)
我想在单击操作时导航到 /add 。onClick有没有办法在不使用和手动推送/add历史记录的情况下做到这一点?
例如,按钮允许这样的操作:
<SpeedDialAction key="Add" icon={<AddIcon />} tooltipTitle="Add" />
Run Code Online (Sandbox Code Playgroud) 基本上我的所有 DTO 都是使用可空字段生成的,例如:id?: number;。如何为未标记为可为空的类型创建不可为空的类型。
我的 DTO 架构如下所示:
"UserDTO": {
"type": "object",
"properties": {
"firstName": {
"type": "string",
"nullable": true
},
"lastName": {
"type": "string",
"nullable": true
},
"id": {
"type": "integer",
"format": "int32"
}
}
Run Code Online (Sandbox Code Playgroud)
我生成这样的代码:
openapi-generator generate --additional-properties=prefixParameterInterfaces=true,typescriptThreePlus=true --remove-operation-id-prefix -i libs/services/defs/swagger.json -g typescript-fetch -o libs/services/src/api
我正在寻找一种顺序执行多个命令的方法。我现在所做的是为每个命令创建一个新频道并关闭它。如果我只使用一个频道,我会收到一个错误,提示一个频道不能重复使用。但我不确定这是否是正确的方法,因为为每个命令打开一个通道听起来很昂贵。
我想要做的是创建一个到 OpenWrt 设备的 ssh 连接,该设备包含一个名为 uci 的可执行文件,它可以修改设备上的配置文件并像这样使用它:
uci set network.lan.ipaddr='192.168.1.2'
uci set network.lan.dns='192.168.1.1'
Run Code Online (Sandbox Code Playgroud)
我的代码类似于:
let tcp = TcpStream::connect("127.0.0.1:22").unwrap();
let mut sess = Session::new().unwrap();
sess.set_tcp_stream(tcp);
sess.handshake().unwrap();
sess.userauth_agent("username").unwrap();
let mut channel = sess.channel_session().unwrap();
channel.exec("ls").unwrap();
channel.wait_close();
println!("#1 exit: {}", channel.exit_status().unwrap());
let mut channel = sess.channel_session().unwrap();
channel.exec("ls").unwrap();
channel.wait_close();
println!("#2 exit: {}", channel.exit_status().unwrap());
Run Code Online (Sandbox Code Playgroud)
如果我不关闭通道并按顺序执行 2 个命令,我会收到错误代码 -39(错误使用)。