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

Method execute_command

src/views/main_view.rs:1701–1759  ·  view source on GitHub ↗
(&mut self, cmd_id: CommandId, cx: &mut Context<Self>)

Source from the content-addressed store, hash-verified

1699
1700 fn destination_options(entries: Vec<CollectionDestinationEntry>) -> Vec<DestinationOption> {
1701 entries
1702 .into_iter()
1703 .map(|entry| DestinationOption {
1704 destination: entry.destination,
1705 label: entry.label,
1706 })
1707 .collect()
1708 }
1709
1710 fn active_tab(&self) -> Option<&TabState> {
1711 self.tabs.get(self.active_tab_index)
1712 }
1713
1714 fn cancel_in_flight_for_tab(&mut self, index: usize, cx: &mut Context<Self>) {
1715 let Some(tab) = self.tabs.get_mut(index) else {
1716 return;
1717 };
1718 match &mut tab.content {
1719 TabContent::Request {
1720 request,
1721 response,
1722 in_flight_request,
1723 request_generation,
1724 ..
1725 } => {
1726 if let Some(mut in_flight) = in_flight_request.take() {
1727 let _ = in_flight.cancel();
1728 request_generation.advance();
1729 request.update(cx, |req, cx| req.set_sending(false, cx));
1730 response.update(cx, |resp, cx| resp.set_cancelled(cx));
1731 }
1732 }
1733 TabContent::WebSocket { view } => {
1734 view.update(cx, |v, cx| v.terminate(cx));
1735 }
1736 TabContent::Environment { .. } => {}
1737 }
1738 }
1739
1740 /// Open a WebSocket tab with the given configuration.
1741 pub fn open_websocket_tab(
1742 &mut self,
1743 request: WebSocketRequestData,
1744 tab_name: String,
1745 collection_id: Option<Uuid>,
1746 _window: &mut Window,
1747 cx: &mut Context<Self>,
1748 ) {
1749 self.open_websocket_tab_with_history(request, None, tab_name, collection_id, _window, cx);
1750 }
1751
1752 fn open_websocket_tab_with_history(
1753 &mut self,
1754 request: WebSocketRequestData,
1755 initial_history: Option<WebSocketHistoryResult>,
1756 tab_name: String,
1757 collection_id: Option<Uuid>,
1758 _window: &mut Window,

Callers 1

newMethod · 0.45

Calls 15

send_requestMethod · 0.80
cancel_requestMethod · 0.80
new_tabMethod · 0.80
close_current_tabMethod · 0.80
close_all_tabsMethod · 0.80
next_tabMethod · 0.80
previous_tabMethod · 0.80
go_to_tabMethod · 0.80
go_to_last_tabMethod · 0.80
toggle_sidebarMethod · 0.80

Tested by

no test coverage detected