|
109 | 109 |
|
110 | 110 | (defn database-selector []
|
111 | 111 | [:div.cellsel
|
112 |
| - [categories [] (category-trie @modeldb)]]) |
| 112 | + (if (seq @modeldb) |
| 113 | + [categories [] (category-trie @modeldb)] |
| 114 | + [:div.empty "There aren't any interfaces yet. Open a different workspace or click \"Add interface\" to get started."])]) |
113 | 115 |
|
114 | 116 | (defn edit-url [cell mod]
|
115 | 117 | (let [mname (str cell "$" mod)]
|
|
130 | 132 | (let [cellname @selcell
|
131 | 133 | cell (get @db cellname)]
|
132 | 134 | [:div.schematics
|
133 |
| - [cm/radiobuttons selmod |
134 |
| - (doall (for [[key mod] (:models cell) |
135 |
| - :when (or (= @selcat ["Everything"]) |
136 |
| - (some (partial = (apply str (interpose "/" @selcat))) (:categories mod))) |
137 |
| - :let [schem? (= (get-in cell [:models key :type]) "schematic") |
138 |
| - icon (if schem? cm/schemmodel cm/codemodel)]] |
139 |
| - ; inactive, active, key, title |
140 |
| - [[:span [icon] " " (get mod :name key)] |
141 |
| - [:span [icon] " " [cm/renamable (r/cursor db [cellname :models key :name])]] |
142 |
| - key key])) |
143 |
| - (fn [key] |
144 |
| - (when (= (get-in cell [:models key :type]) "schematic") |
145 |
| - #(js/window.open (edit-url (second (.split cellname ":")) (name key)), cellname))) |
146 |
| - (fn [key] |
147 |
| - #(schem-context-menu % db cellname key))]])) |
| 135 | + (if @selcell |
| 136 | + [cm/radiobuttons selmod |
| 137 | + (doall (for [[key mod] (:models cell) |
| 138 | + :when (or (= @selcat ["Everything"]) |
| 139 | + (some (partial = (apply str (interpose "/" @selcat))) (:categories mod))) |
| 140 | + :let [schem? (= (get-in cell [:models key :type]) "schematic") |
| 141 | + icon (if schem? cm/schemmodel cm/codemodel)]] |
| 142 | + ; inactive, active, key, title |
| 143 | + [[:span [icon] " " (get mod :name key)] |
| 144 | + [:span [icon] " " [cm/renamable (r/cursor db [cellname :models key :name])]] |
| 145 | + key key])) |
| 146 | + (fn [key] |
| 147 | + (when (= (get-in cell [:models key :type]) "schematic") |
| 148 | + #(js/window.open (edit-url (second (.split cellname ":")) (name key)), cellname))) |
| 149 | + (fn [key] |
| 150 | + #(schem-context-menu % db cellname key))] |
| 151 | + [:div.empty "There are no implementations to show. Select an interface to edit its schematics and SPICE models."])])) |
148 | 152 |
|
149 | 153 |
|
150 | 154 | (defn db-properties []
|
|
207 | 211 | (defn cell-properties [db]
|
208 | 212 | (let [cell @selcell
|
209 | 213 | sc (r/cursor db [cell])]
|
210 |
| - (when cell |
| 214 | + (if cell |
211 | 215 | [:<>
|
212 | 216 | [:div.properties
|
213 | 217 | [background-selector sc]
|
|
217 | 221 | [:label {:for "symurl" :title "image url for this component"} "url"]
|
218 | 222 | [:input {:id "symurl" :type "text"
|
219 | 223 | :default-value (get-in @db [cell :sym])
|
220 |
| - :on-blur #(swap! db assoc-in [cell :sym] (.. % -target -value))}]]]))) |
| 224 | + :on-blur #(swap! db assoc-in [cell :sym] (.. % -target -value))}]]] |
| 225 | + [:div.empty "Select an interface to edit its properties."]))) |
221 | 226 |
|
222 | 227 | (def dialect (r/atom "NgSpice"))
|
223 | 228 |
|
|
256 | 261 | [:<>
|
257 | 262 | [:a {:href (edit-url (second (.split @selcell ":")) (name @selmod))
|
258 | 263 | :target @selcell} "Edit"]]))
|
259 |
| - (when (and @selcell @selmod) |
| 264 | + (if (and @selcell @selmod) |
260 | 265 | [:<>
|
261 | 266 | [:label {:for "categories" :title "Comma-seperated device categories"} "Categories"]
|
262 | 267 | [cm/dbfield :input {:id "categories"} mod
|
263 | 268 | #(apply str (interpose ", " (:categories %)))
|
264 |
| - #(swap! %1 assoc :categories (clojure.string/split %2 #", " -1))]])])) |
| 269 | + #(swap! %1 assoc :categories (clojure.string/split %2 #", " -1))]] |
| 270 | + [:div.empty "Select a schematic or SPICE model to edit its properties."])])) |
265 | 271 |
|
266 | 272 | (defn cell-view []
|
267 | 273 | (let [add-cell #(prompt "Enter the name of the new interface"
|
|
0 commit comments