| 240 | } |
| 241 | |
| 242 | fetchStatic() { |
| 243 | if (this.staticFetching) { |
| 244 | return |
| 245 | } |
| 246 | this.staticFetching = true |
| 247 | fetchVerion(this.typeFlag) |
| 248 | .then((res: any) => { |
| 249 | console.log('fetchVerion res: ', res) |
| 250 | for (const item of res) { |
| 251 | const find = this.static.find( |
| 252 | (d) => d.url === item.url && d.version === item.version && d.bin === item.bin |
| 253 | ) |
| 254 | if (!find) { |
| 255 | const findDowing = this.staticDowing.find( |
| 256 | (d) => d.url === item.url && d.version === item.version && d.bin === item.bin |
| 257 | ) |
| 258 | if (findDowing) { |
| 259 | this.static.push(findDowing) |
| 260 | } else { |
| 261 | const obj = reactive(new ModuleStaticItem(item)) |
| 262 | obj.typeFlag = this.typeFlag |
| 263 | obj.fetchCommand = obj.fetchCommand.bind(obj) |
| 264 | obj.copyCommand = obj.copyCommand.bind(obj) |
| 265 | obj.runCommand = obj.runCommand.bind(obj) |
| 266 | this.static.push(obj) |
| 267 | } |
| 268 | } else { |
| 269 | console.log('find: ', find, item) |
| 270 | const downing = find?.downing ?? false |
| 271 | Object.assign(find, item) |
| 272 | find.downing = downing |
| 273 | } |
| 274 | } |
| 275 | this.staticFetching = false |
| 276 | }) |
| 277 | .catch(() => { |
| 278 | this.staticFetching = false |
| 279 | }) |
| 280 | } |
| 281 | |
| 282 | fetchSdkman() { |
| 283 | if (this.sdkmanFetching) { |