MCPcopy Create free account
hub / github.com/bajrangCoder/setu / render

Method render

src/components/params_editor.rs:140–394  ·  view source on GitHub ↗
(&mut self, _window: &mut Window, cx: &mut Context<Self>)

Source from the content-addressed store, hash-verified

138
139 self.param_rows.push(ParamRow {
140 key_input,
141 value_input,
142 description_input,
143 enabled: entry.enabled,
144 });
145 }
146 }
147
148 pub fn toggle_bulk_mode(&mut self, window: &mut Window, cx: &mut Context<Self>) {
149 if self.bulk_mode {
150 let text = self
151 .bulk_editor
152 .as_ref()
153 .map(|editor| editor.read(cx).text().to_string())
154 .unwrap_or_default();
155 self.replace_from_bulk_entries(parse_bulk_kv(&text), window, cx);
156 self.bulk_mode = false;
157 } else {
158 let text = serialize_bulk_kv(&self.rows_as_bulk_entries(cx));
159 self.ensure_bulk_editor(window, cx);
160 if let Some(ref editor) = self.bulk_editor {
161 editor.update(cx, |state, cx| {
162 state.set_value(text, window, cx);
163 });
164 }
165 self.bulk_mode = true;
166 }
167 cx.notify();
168 }
169
170 /// Replace all params from a simple list (e.g. loading a saved WebSocket request).
171 pub fn set_params(
172 &mut self,
173 params: &[(String, String, bool)],
174 window: &mut Window,
175 cx: &mut Context<Self>,
176 ) {
177 let entries = params
178 .iter()
179 .map(|(key, value, enabled)| BulkKvEntry {
180 key: key.clone(),
181 value: value.clone(),
182 enabled: *enabled,
183 })
184 .collect();
185 self.replace_from_bulk_entries(entries, window, cx);
186 cx.notify();
187 }
188
189 /// Add a new empty param row
190 pub fn add_param(&mut self, window: &mut Window, cx: &mut Context<Self>) {
191 let completion_engine = self.completion_engine.clone();
192 let key_input = cx.new(|cx| {
193 let input = InputState::new(window, cx).placeholder("Param name");
194 if let Some(engine) = completion_engine.as_ref() {
195 engine.configure_input(input, CompletionContext::QueryName)
196 } else {
197 input

Callers

nothing calls this directly

Calls 11

childMethod · 0.80
idMethod · 0.80
clear_all_paramsMethod · 0.80
add_paramMethod · 0.80
move_paramMethod · 0.80
textMethod · 0.80
toggle_paramMethod · 0.80
remove_paramMethod · 0.80
on_clickMethod · 0.45
newMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected