({ blockId, nodeModel, tabModel }: ViewModelInitType)
| 86 | searchAtoms?: SearchAtoms; |
| 87 | |
| 88 | constructor({ blockId, nodeModel, tabModel }: ViewModelInitType) { |
| 89 | this.viewType = "term"; |
| 90 | this.blockId = blockId; |
| 91 | this.tabModel = tabModel; |
| 92 | this.termWshClient = new TermWshClient(blockId, this); |
| 93 | DefaultRouter.registerRoute(makeFeBlockRouteId(blockId), this.termWshClient); |
| 94 | this.nodeModel = nodeModel; |
| 95 | this.blockAtom = WOS.getWaveObjectAtom<Block>(`block:${blockId}`); |
| 96 | this.vdomBlockId = jotai.atom((get) => { |
| 97 | const blockData = get(this.blockAtom); |
| 98 | return blockData?.meta?.["term:vdomblockid"]; |
| 99 | }); |
| 100 | this.vdomToolbarBlockId = jotai.atom((get) => { |
| 101 | const blockData = get(this.blockAtom); |
| 102 | return blockData?.meta?.["term:vdomtoolbarblockid"]; |
| 103 | }); |
| 104 | this.vdomToolbarTarget = jotai.atom<VDomTargetToolbar>(null) as jotai.PrimitiveAtom<VDomTargetToolbar>; |
| 105 | this.termMode = jotai.atom((get) => { |
| 106 | const blockData = get(this.blockAtom); |
| 107 | return blockData?.meta?.["term:mode"] ?? "term"; |
| 108 | }); |
| 109 | this.isRestarting = jotai.atom(false); |
| 110 | this.viewIcon = jotai.atom((get) => { |
| 111 | const termMode = get(this.termMode); |
| 112 | if (termMode == "vdom") { |
| 113 | return { elemtype: "iconbutton", icon: "bolt" }; |
| 114 | } |
| 115 | return { elemtype: "iconbutton", icon: "terminal" }; |
| 116 | }); |
| 117 | this.viewName = jotai.atom((get) => { |
| 118 | const blockData = get(this.blockAtom); |
| 119 | const termMode = get(this.termMode); |
| 120 | if (termMode == "vdom") { |
| 121 | return "Wave App"; |
| 122 | } |
| 123 | if (blockData?.meta?.controller == "cmd") { |
| 124 | return ""; |
| 125 | } |
| 126 | return ""; |
| 127 | }); |
| 128 | this.viewText = jotai.atom((get) => { |
| 129 | const termMode = get(this.termMode); |
| 130 | if (termMode == "vdom") { |
| 131 | return [ |
| 132 | { |
| 133 | elemtype: "iconbutton", |
| 134 | icon: "square-terminal", |
| 135 | title: "Switch back to Terminal", |
| 136 | click: () => { |
| 137 | this.setTermMode("term"); |
| 138 | }, |
| 139 | }, |
| 140 | ]; |
| 141 | } |
| 142 | const vdomBlockId = get(this.vdomBlockId); |
| 143 | const rtn: HeaderElem[] = []; |
| 144 | if (vdomBlockId) { |
| 145 | rtn.push({ |
nothing calls this directly
no test coverage detected