mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-18 21:35:27 -04:00
Compare commits
752 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9484904f60 | |||
| a4f210855e | |||
| bc4ad574fc | |||
| a5ea19ddfb | |||
| 858c690543 | |||
| 8e169561f2 | |||
| 994faa60c6 | |||
| a4a18d6121 | |||
| 0407564784 | |||
| 0a61e66ef1 | |||
| 051451eb2a | |||
| a4e3be721d | |||
| 224e74605b | |||
| 6c581b7e3c | |||
| 6588ba8435 | |||
| ce4c2e4fcc | |||
| b1f77007dc | |||
| 8bab0a06dd | |||
| 5b135addaa | |||
| 4904e85887 | |||
| c4978022eb | |||
| 15e9350601 | |||
| 2e1289b924 | |||
| 7dac00d5aa | |||
| 3796c9e30f | |||
| f2f4edad0c | |||
| b0b15c78ff | |||
| 64c421c187 | |||
| 6440151053 | |||
| cf6b21aef6 | |||
| 1610e54650 | |||
| c40fbeed50 | |||
| b57e7e2db0 | |||
| 478866b2bb | |||
| ae201f5299 | |||
| 642f4f97bc | |||
| 37cb978f18 | |||
| 7fdc4d6638 | |||
| 309b55fe38 | |||
| d6f265c7b5 | |||
| e757dca038 | |||
| 9ebe043bd9 | |||
| f055e8a3e5 | |||
| 8c697afa67 | |||
| 8d68879edd | |||
| e9c82078da | |||
| f0798550af | |||
| d9c7838329 | |||
| b00229e53c | |||
| 880628fb68 | |||
| b09c6f0811 | |||
| b376b63c9e | |||
| 99feaa34d2 | |||
| d7f82a72c2 | |||
| bd20ebfad7 | |||
| 71553ad67b | |||
| 41c39f1f28 | |||
| d0066358eb | |||
| 6f1d461dad | |||
| 6ccab3cfc8 | |||
| 5e47cc3baa | |||
| 78ca30d1f8 | |||
| f9d0abada3 | |||
| 4bdb0408f1 | |||
| 40ea6ce4e5 | |||
| ccf33033dc | |||
| 996c0e9f50 | |||
| 8b7f9daab0 | |||
| dfb6fdfbeb | |||
| 29d0073ee6 | |||
| 9cf6be32fa | |||
| fee3f8150e | |||
| 010bbbd222 | |||
| d3c3a6ebce | |||
| f26344ae75 | |||
| 034f731308 | |||
| 4b50861a6b | |||
| f977b8ba1b | |||
| 8374ebc25b | |||
| 71851d038c | |||
| 9ffcd141a5 | |||
| a6f50408f2 | |||
| 6e43b08dab | |||
| 90c4791d5f | |||
| 030910babc | |||
| 59af86cea4 | |||
| 4cb25228b6 | |||
| bf34b43094 | |||
| 1cdca8ef3e | |||
| 103b1335b9 | |||
| b3d830c475 | |||
| a279240335 | |||
| 3eed84c679 | |||
| 51c17fd312 | |||
| 70c74fc176 | |||
| cfda24536c | |||
| 14e324ee30 | |||
| 32ba06ecd0 | |||
| 61807fede0 | |||
| 2a1efe5f59 | |||
| 0f43f8c9f6 | |||
| a853c537db | |||
| f9dccd6ec7 | |||
| 72b3b825eb | |||
| 818ae02a7a | |||
| 5ba3ff5987 | |||
| e38deb3422 | |||
| f35888e053 | |||
| a50d256264 | |||
| 70165bddc8 | |||
| 4258e94e90 | |||
| 066b39032b | |||
| 728df146ad | |||
| 751a07bb40 | |||
| d4ce60bd41 | |||
| 4b868d3f06 | |||
| 817d13e85c | |||
| fae014c8be | |||
| 2fa02472ee | |||
| 7c3c577811 | |||
| 9fdf545f47 | |||
| e537a2dc8f | |||
| 1047e71b7d | |||
| 415498efb3 | |||
| cf08e947c4 | |||
| bb872ee35b | |||
| ab0d8352e8 | |||
| 9683b0af35 | |||
| 76b1130b68 | |||
| 5be58249f8 | |||
| 4d67b8ae2b | |||
| 66633b9b07 | |||
| 4728fa29ef | |||
| 9cb9c711be | |||
| d62eea604a | |||
| 3185315343 | |||
| e52b68ee7d | |||
| f7eece32e7 | |||
| c96c47af9e | |||
| a5999b1410 | |||
| ac1bb497ef | |||
| 9bd619ccfe | |||
| dfbf12b711 | |||
| 0ae07898ba | |||
| 2314d0b506 | |||
| 2093f08a57 | |||
| 0a7ffb64f0 | |||
| 41b65abd1d | |||
| 0f904e0917 | |||
| f8e57b0985 | |||
| 9e774f4026 | |||
| 2acc4c8865 | |||
| 0fcd92e441 | |||
| b103005aa2 | |||
| 41b5118938 | |||
| c84699ed5d | |||
| bdd975da0f | |||
| 08d1bcb351 | |||
| 5fb632eb46 | |||
| da29de4cfe | |||
| 83b2c9e97a | |||
| 095126bfe8 | |||
| 6aee9c7fd5 | |||
| 20c2d59e9a | |||
| 7ee90fb05d | |||
| 1a8ba51260 | |||
| 2e66cd2a1e | |||
| 6115236d38 | |||
| 7ff8c9e18d | |||
| f0e320f3aa | |||
| 9f29b06ca4 | |||
| 08c0c5aa30 | |||
| 64956d7be7 | |||
| b598795262 | |||
| 9756a3df38 | |||
| 94f64435f5 | |||
| a324052deb | |||
| e08c9d5501 | |||
| 1449941471 | |||
| 28c4f0cef2 | |||
| e199710c15 | |||
| e3a048790d | |||
| 6dc47755ec | |||
| 01f7783519 | |||
| e9f59188b1 | |||
| a6e6b7518d | |||
| 38cd63ec04 | |||
| 71f1593fd9 | |||
| 3d951f6db8 | |||
| 0f16837b59 | |||
| f0d0eb9a7a | |||
| 608fc29086 | |||
| 8acd154206 | |||
| 6f451b2206 | |||
| 3cb6f866cc | |||
| 649ed04f8a | |||
| fef00dccf8 | |||
| cbc5127a14 | |||
| 38746fc95b | |||
| 24ce10006e | |||
| c034282f45 | |||
| b2214fd912 | |||
| 4db4388236 | |||
| 093ee5b88d | |||
| f58dfc5605 | |||
| 1c9a0232ad | |||
| c86822b114 | |||
| 5342416659 | |||
| 5d7c94f8e9 | |||
| 6d8c3f15b3 | |||
| efef9f88ff | |||
| 8748cdb1bf | |||
| 7a9b6d3262 | |||
| c902735927 | |||
| 156d306334 | |||
| d09e7893b3 | |||
| 3e2e8e9388 | |||
| 99fc61e636 | |||
| 271979d637 | |||
| b572a6f759 | |||
| 950330b091 | |||
| 8940ef8b81 | |||
| 91bdf06214 | |||
| 5678f98344 | |||
| 05d57aa913 | |||
| b22d598ebf | |||
| e22dd15443 | |||
| 1fa532dd3e | |||
| 350dea10dd | |||
| d3777dd43c | |||
| a72288a14e | |||
| e506eb6d03 | |||
| 591b569bdd | |||
| 094df71301 | |||
| 31e02bdead | |||
| b122ee9670 | |||
| 0f9e063e21 | |||
| 609e964794 | |||
| 5cebec6ae4 | |||
| 33da537a63 | |||
| 11c945c2dc | |||
| 1b0a20535c | |||
| 1734fcaa8f | |||
| b99e06acc0 | |||
| 5d16169e52 | |||
| a2670a5804 | |||
| 9e5ebdc624 | |||
| e62aa5e041 | |||
| 80a8176c58 | |||
| 39f1c669b8 | |||
| 5208f5e966 | |||
| bb0ad312f1 | |||
| 413d6b996b | |||
| 79474f26e9 | |||
| 18bbb8bbd1 | |||
| 374c6d13f6 | |||
| 92f0aa4e8f | |||
| 7345c06003 | |||
| ff08b914f3 | |||
| e40c8f3e3e | |||
| 2fd1fea4cb | |||
| a72bc164a9 | |||
| d9a86bcb31 | |||
| 553c4aeae1 | |||
| 5a47f34ef9 | |||
| 15b070119d | |||
| 7b133bd80d | |||
| ce6536f8ab | |||
| c6eb6c3cd8 | |||
| f4f3fdfb0b | |||
| 6b92627004 | |||
| c3f9cd12af | |||
| 6f871a1bfb | |||
| ab1f8bdbd9 | |||
| b72b1d5e5c | |||
| 87c840974b | |||
| ee46e6378a | |||
| 7644cec376 | |||
| d3153685ac | |||
| 7035bb2944 | |||
| 6dc16f3ddd | |||
| 0e1474579a | |||
| 7b4bd50f18 | |||
| 4849d1da10 | |||
| 8482f3da1a | |||
| 782af002d6 | |||
| 8f6d9f3bf4 | |||
| 699120a8fd | |||
| 0fdeb05663 | |||
| 7c64911b6b | |||
| 3035521b93 | |||
| 45c53bea86 | |||
| 4c6d6b726e | |||
| 1765feac03 | |||
| 92db4769be | |||
| 6838f068bc | |||
| b218461678 | |||
| 10e3a237ef | |||
| 6e008a8e85 | |||
| 27f81117ed | |||
| 839658a698 | |||
| 1bc1b080d1 | |||
| 572bdc979c | |||
| cde0a31ff0 | |||
| 60529f0bac | |||
| 5ed7780ed7 | |||
| 89c8a10e0d | |||
| fd09ca6e71 | |||
| 95929dd9c2 | |||
| 23bc6a157c | |||
| 756e985b66 | |||
| a2fd23c84d | |||
| 32ce09648c | |||
| 20e1a8d116 | |||
| 12a1ef0387 | |||
| 2935d148a8 | |||
| a90c13e86f | |||
| 9a7ddd751e | |||
| a1d4bb5399 | |||
| 9d0acba000 | |||
| ee1a0a1f71 | |||
| f35a27449d | |||
| 4e65669c48 | |||
| fa38498db0 | |||
| 3b024443c5 | |||
| 4ba9b21bb7 | |||
| e37684e045 | |||
| 103ccd74f3 | |||
| ba22992265 | |||
| 963395b969 | |||
| 970df1a1d8 | |||
| 2ac139ab4d | |||
| c69db1ff92 | |||
| 6dae2f0d84 | |||
| 87934c7761 | |||
| fe8478f42a | |||
| a840bb5423 | |||
| 8f5d628c55 | |||
| acebe87dba | |||
| 7d77500667 | |||
| ec73a13396 | |||
| fa0f77659c | |||
| 1609f0c964 | |||
| 1fea0b3d10 | |||
| 3c8268c428 | |||
| c589c4f85e | |||
| f843107c25 | |||
| 035c474f10 | |||
| 4dcc015fb1 | |||
| 1969e0107f | |||
| ac7c05c050 | |||
| 8aad79fd3e | |||
| f05e552e8e | |||
| 8cd5cd603a | |||
| ef358e6f24 | |||
| fae24e98fb | |||
| c885fb81f9 | |||
| 514c04935f | |||
| 4b14368736 | |||
| 1c30ecd66d | |||
| f7b54f9d6b | |||
| ce7d8a175e | |||
| ab49268bac | |||
| 608f67a074 | |||
| 9a69222c9a | |||
| 82c526e15c | |||
| 983b079c82 | |||
| edfc12e27a | |||
| ed10b63fa0 | |||
| 016b571838 | |||
| bfcd017012 | |||
| 2e83d59f61 | |||
| c39fb4fe6f | |||
| 220b4bc257 | |||
| 99e25cec0f | |||
| 5d1d44e09e | |||
| 3b00112447 | |||
| cb7489ce8f | |||
| b552d4e9f7 | |||
| c0e264cfc5 | |||
| 811eb36c7b | |||
| 1484809099 | |||
| 024462c52d | |||
| e70aef9690 | |||
| 36633b5d08 | |||
| 1374240321 | |||
| f1d54d2a9a | |||
| 03b8c4c28e | |||
| 4e4bf3507f | |||
| 34ae65c087 | |||
| ebe23104d4 | |||
| e8c3aa20bd | |||
| 6c231cbe6a | |||
| 8ce688186e | |||
| 04ebf03fb5 | |||
| c38debab1b | |||
| 32f66922e7 | |||
| ed536a85ad | |||
| c62fc9d05b | |||
| fb9a5efe05 | |||
| 8cb58a63d8 | |||
| 4c41a4f368 | |||
| e039dc45e2 | |||
| 776143cc81 | |||
| 8c67a3bdee | |||
| 160151c6e0 | |||
| efd48710e4 | |||
| 00c16cd06b | |||
| 65d07fa99e | |||
| bd656ae7f6 | |||
| 62bcf397dd | |||
| f9606518ee | |||
| 40f4ef27b2 | |||
| 93c3f6d1d6 | |||
| 417af2b915 | |||
| 4491df3ae7 | |||
| a90866a73e | |||
| 2f62494adc | |||
| e361f18837 | |||
| 183b8b574a | |||
| 12c1eb86f2 | |||
| 5034d83062 | |||
| dba3a82439 | |||
| b51a490979 | |||
| 8b38ccfb63 | |||
| 91c5e6f122 | |||
| dcbef6b7b7 | |||
| ca0bb14027 | |||
| 3e99917e9d | |||
| 936cf699ff | |||
| 202190d032 | |||
| f739fd0900 | |||
| 88f4016fe0 | |||
| 78fb20282d | |||
| 6677fd1116 | |||
| e28b7c3df6 | |||
| 67a1ecb0fe | |||
| 5bc943583c | |||
| ceeec091f8 | |||
| 675e3cd38a | |||
| 45a62a2e59 | |||
| ae7c07e02f | |||
| 4e9ef57e3d | |||
| 59f3be0813 | |||
| fb540040ef | |||
| b8af3af9f1 | |||
| 78cf13d341 | |||
| 978349e241 | |||
| a77bf64352 | |||
| 832de3e75e | |||
| 8d4ba77b12 | |||
| 409823c7e8 | |||
| 8e636d7a37 | |||
| 38c0135d7c | |||
| 22005dc8c5 | |||
| 73208e2f60 | |||
| 1df0ba9e5a | |||
| 020ed32fcf | |||
| 3ddc6ac6de | |||
| 0f225b05c0 | |||
| e006b40532 | |||
| e88f25d3bf | |||
| 1fcfb88d2a | |||
| 804eaa1227 | |||
| c41e3ce1e3 | |||
| 682d2b4e1b | |||
| c114e2ddb7 | |||
| f8a879f4c1 | |||
| 33139d4b53 | |||
| de69d8ec7e | |||
| 03b9c957b8 | |||
| 41ddacc395 | |||
| 8a558b379a | |||
| 240a0339be | |||
| ff724b7f40 | |||
| fcf68d9259 | |||
| 404e6d68ea | |||
| df672487cf | |||
| 0bc4903954 | |||
| 10b55bbee6 | |||
| 20ef22be94 | |||
| 57534db2f8 | |||
| 1e89a1a3cb | |||
| f502eaffe3 | |||
| fe40d83aa4 | |||
| 07374de747 | |||
| 135b5c2ddd | |||
| 0784f56b9a | |||
| 562e0dd7c0 | |||
| 28599f87af | |||
| 86446a7686 | |||
| 2f1793d87a | |||
| a641f2897a | |||
| 32fa63d24d | |||
| ebfa000375 | |||
| 39074b0b1d | |||
| 354ed96572 | |||
| c8f419b014 | |||
| a001216957 | |||
| a6735e7a3f | |||
| ea0bfed700 | |||
| 620220b269 | |||
| c435fcd685 | |||
| 3828e475cc | |||
| e6e1078c15 | |||
| 6660db22ec | |||
| bc0fc623ee | |||
| da610a1f40 | |||
| 6d0f10b877 | |||
| 4f0e1c54c1 | |||
| 2f0ca42341 | |||
| 768af433d1 | |||
| 8bf0298227 | |||
| a7cb264cc8 | |||
| 10302323af | |||
| dc1524c64f | |||
| 4d7a3d0909 | |||
| 30a52d11aa | |||
| be4a9e9491 | |||
| e196c1be69 | |||
| 106ffd410c | |||
| c199fd05d3 | |||
| 75fae9262c | |||
| faf9173b3b | |||
| 0fa8e24f48 | |||
| 27da041388 | |||
| ca38a9b577 | |||
| 4b72a0a4e8 | |||
| 9875e550a8 | |||
| c9aa59340c | |||
| 30c36fdc3b | |||
| 3976e5daf7 | |||
| fca8c36156 | |||
| 85f53e8cb1 | |||
| a73a5cc85c | |||
| 89d730cdfd | |||
| 99fc52039f | |||
| e6bd58453a | |||
| 9603f0b086 | |||
| d84c450094 | |||
| 97ebaf2796 | |||
| 31bf9e313e | |||
| 6cccacd4d7 | |||
| 3c857135c5 | |||
| 750a9353f8 | |||
| 71a19377d9 | |||
| 4b5ff3927d | |||
| 4d8a443681 | |||
| 6a332b40ac | |||
| a929548ae3 | |||
| 55363f4e3d | |||
| f20ac9dc34 | |||
| 8b20a9449c | |||
| 24f03fc1e9 | |||
| 5513d7bc5d | |||
| a9072ac460 | |||
| 55aaaa5c40 | |||
| ee99c3895d | |||
| e1e10e195c | |||
| 0b9a212f33 | |||
| 0e384ee3aa | |||
| d903529389 | |||
| 6f51e72d00 | |||
| 66cead6b48 | |||
| 7f0696c574 | |||
| 1584311914 | |||
| 278c7891a3 | |||
| 0a0e03dca0 | |||
| 546e9fd1d0 | |||
| c80bd81bb9 | |||
| e1cbc4a782 | |||
| 53d8c9ba8d | |||
| 9136ee4ad9 | |||
| 44fab9a96c | |||
| 66e4b7c819 | |||
| 98c4cbdd13 | |||
| 25d9f09a43 | |||
| 7ea1301221 | |||
| f033799d7a | |||
| cfa2f4d4c6 | |||
| 882b54be61 | |||
| 041fdd3929 | |||
| 4548dcdf97 | |||
| 4e14ce022c | |||
| a9b93dd9c6 | |||
| 50d7e8fed4 | |||
| 402db9128c | |||
| 846333ddf0 | |||
| dde28cbd7e | |||
| 8ceb306bf1 | |||
| 8af4246ff9 | |||
| a2e06e9e65 | |||
| ae7b187e41 | |||
| 63b4998c8e | |||
| 45665886d6 | |||
| 860424ac22 | |||
| 14005d8d10 | |||
| da7d17f5e8 | |||
| ea331feb88 | |||
| 7dca9060ca | |||
| 8af12cc4e7 | |||
| aa488019cf | |||
| 47a05ecb36 | |||
| 35baebaf72 | |||
| aedcd046fc | |||
| f45713bff8 | |||
| 911a3d4c1e | |||
| e16ace54a8 | |||
| 84710a31bd | |||
| 093a239e77 | |||
| ee69351733 | |||
| e92a67ad78 | |||
| 3eca63a67c | |||
| 8484a8beba | |||
| cd3a1c18ab | |||
| dc7a16a03a | |||
| 84338f4c50 | |||
| 12ac123d5a | |||
| ef829c6ace | |||
| 592b6f7f7c | |||
| be5b449de4 | |||
| 9b144e9ade | |||
| 9af2f137f4 | |||
| d4bd7865f6 | |||
| cf921480ec | |||
| 639b53887d | |||
| 3b29096e40 | |||
| 2d237ae6b7 | |||
| d713b83a36 | |||
| 2f04b037a1 | |||
| 7b87de2e93 | |||
| eb2fd13509 | |||
| ffdb08cfe6 | |||
| 37c4647f24 | |||
| f7a58aab33 | |||
| 4b186e894e | |||
| 35a2bc9403 | |||
| cc03ce04f1 | |||
| 363f8fc347 | |||
| 0877a6718d | |||
| 8b253c36ea | |||
| e6f82270a9 | |||
| 813965e6a2 | |||
| 0d914f4c53 | |||
| ae7f73208a | |||
| 4c86d673ea | |||
| b1527f9abb | |||
| 291d792810 | |||
| 9b528eb829 | |||
| 4c0b896174 | |||
| 4ff83f9efc | |||
| 217611d716 | |||
| 1299a97579 | |||
| 4c0de55672 | |||
| 78a0def46a | |||
| 11a9dcb389 | |||
| 4eab168267 | |||
| c9b5a1258a | |||
| 9127a91dfc | |||
| cc85a28ff7 | |||
| 72db8099e0 | |||
| ebc5cdb335 | |||
| d6d90a64a3 | |||
| d46f4b2154 | |||
| 76650af9fd | |||
| 824ed0a369 | |||
| ee80564dd4 | |||
| 3824eff5eb | |||
| 15e3c3efb1 | |||
| f2f4a98eed | |||
| bc7799139e | |||
| 33b62a2def | |||
| 5ac6c0e651 | |||
| 60cba74c39 | |||
| 5c2c490cb2 | |||
| 63fdf8ca8f | |||
| e791f4b743 | |||
| 6dd85a5af9 | |||
| a80f5b794b | |||
| 578f95546b | |||
| 9a613afa35 | |||
| 5ad3d2efcc | |||
| 1ad722acda | |||
| bde5f68142 | |||
| fbda2d54c7 | |||
| 2a26c6722a | |||
| b7dfb8999d | |||
| 1662521d40 | |||
| f8d75d174a | |||
| 80ca1a6ac2 | |||
| f59c0b16ca | |||
| 0e95ba2021 | |||
| c023fc7008 | |||
| 19466aa290 | |||
| 4b5ef4907b | |||
| 7b8d606a1b | |||
| 6a4824c029 | |||
| 1a1c8e6c08 | |||
| e35b39b4b1 | |||
| d3f14d5f5e | |||
| 06936c4f22 | |||
| 0a28ff84e8 | |||
| 703dee9383 | |||
| dca5239420 | |||
| 1aaa9a14bc | |||
| c6c37a408a | |||
| ae4a97b4ae | |||
| 3afae968eb | |||
| c01abbf3b5 | |||
| f5ccf98162 | |||
| 6afd3bd344 | |||
| acaf5cd353 | |||
| e97e5bfe8f | |||
| 678872b879 | |||
| 10e9735c1c | |||
| 293a1bc618 | |||
| 0c883f7886 | |||
| 46c7de379c | |||
| a83b521766 | |||
| 1d06e40acb | |||
| bfcdc89f6a | |||
| 67943edfbc | |||
| 04f8595498 | |||
| 81ac73299a | |||
| a779a5fad2 | |||
| bfe6a740fa | |||
| c9ea40b874 | |||
| 4ee0ae1418 | |||
| ac1da45ecd | |||
| 5c327d5be3 | |||
| 55c1ce2e3d | |||
| fd7f0ea973 | |||
| d5dff8e8d6 | |||
| 8099ba10af | |||
| 143ccb1e2a | |||
| 29480d9544 | |||
| 6de536a7ad | |||
| bce848facf | |||
| ea4fe392a0 | |||
| 45fe585944 | |||
| a0d2933134 | |||
| 4c622fd412 | |||
| fb060730c7 | |||
| 6d5ff9c4d6 | |||
| 63bed3e670 | |||
| e684c10432 | |||
| d2509798e9 | |||
| 6c39855ebe | |||
| a30e9da767 | |||
| f8e81396d4 | |||
| 7fccf590a8 | |||
| e1b937e8d5 |
@@ -2,11 +2,11 @@
|
|||||||
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
|
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
|
||||||
{
|
{
|
||||||
"name": "Sonarr",
|
"name": "Sonarr",
|
||||||
"image": "mcr.microsoft.com/devcontainers/dotnet:1-6.0",
|
"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0",
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers/features/node:1": {
|
"ghcr.io/devcontainers/features/node:1": {
|
||||||
"nodeGypDependencies": true,
|
"nodeGypDependencies": true,
|
||||||
"version": "16",
|
"version": "20",
|
||||||
"nvmVersion": "latest"
|
"nvmVersion": "latest"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,188 @@
|
|||||||
|
name: Build Backend
|
||||||
|
description: Builds the backend and packages it
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
branch:
|
||||||
|
description: "Branch name for this build"
|
||||||
|
required: true
|
||||||
|
version:
|
||||||
|
description: "Version number to build"
|
||||||
|
required: true
|
||||||
|
framework:
|
||||||
|
description: ".net framework used for the build"
|
||||||
|
required: true
|
||||||
|
runtime:
|
||||||
|
description: "Run time to build for"
|
||||||
|
required: true
|
||||||
|
package_tests:
|
||||||
|
description: "True if tests should be packaged for later testing steps"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v5
|
||||||
|
|
||||||
|
- name: Setup Environment Variables
|
||||||
|
id: variables
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
DOTNET_VERSION=$(jq -r '.sdk.version' global.json)
|
||||||
|
|
||||||
|
echo "SDK_PATH=${{ env.DOTNET_ROOT }}/sdk/${DOTNET_VERSION}" >> "$GITHUB_ENV"
|
||||||
|
echo "SONARR_VERSION=${{ inputs.version }}" >> "$GITHUB_ENV"
|
||||||
|
echo "BRANCH=${{ inputs.branch }}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
if [ "$RUNNER_OS" == "Windows" ]; then
|
||||||
|
echo "NUGET_PACKAGES=D:\nuget\packages" >> "$GITHUB_ENV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Enable Extra Platforms In SDK
|
||||||
|
if: ${{ inputs.runtime == 'freebsd-x64' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
BUNDLEDVERSIONS="${SDK_PATH}/Microsoft.NETCoreSdk.BundledVersions.props"
|
||||||
|
|
||||||
|
if grep -q freebsd-x64 "$BUNDLEDVERSIONS"; then
|
||||||
|
echo "Extra platforms already enabled"
|
||||||
|
else
|
||||||
|
echo "Enabling extra platform support"
|
||||||
|
sed -i.ORI 's/osx-x64/osx-x64;freebsd-x64/' "$BUNDLEDVERSIONS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -qv freebsd-x64 src/Directory.Build.props; then
|
||||||
|
sed -i'' -e "s^<RuntimeIdentifiers>\(.*\)</RuntimeIdentifiers>^<RuntimeIdentifiers>\1;freebsd-x64</RuntimeIdentifiers>^g" src/Directory.Build.props
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Update Version Number
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ "$SONARR_VERSION" != "" ]; then
|
||||||
|
echo "Updating version info to: $SONARR_VERSION"
|
||||||
|
sed -i'' -e "s/<AssemblyVersion>[0-9.*]\+<\/AssemblyVersion>/<AssemblyVersion>$SONARR_VERSION<\/AssemblyVersion>/g" src/Directory.Build.props
|
||||||
|
sed -i'' -e "s/<AssemblyConfiguration>[\$()A-Za-z-]\+<\/AssemblyConfiguration>/<AssemblyConfiguration>${BRANCH}<\/AssemblyConfiguration>/g" src/Directory.Build.props
|
||||||
|
sed -i'' -e "s/<string>10.0.0.0<\/string>/<string>$SONARR_VERSION<\/string>/g" distribution/macOS/Sonarr.app/Contents/Info.plist
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build Backend
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
runtime="${{ inputs.runtime }}"
|
||||||
|
platform=Windows
|
||||||
|
slnFile=src/Sonarr.sln
|
||||||
|
targetingWindows=false
|
||||||
|
|
||||||
|
IFS='-' read -ra SPLIT <<< "$runtime"
|
||||||
|
|
||||||
|
if [ "${SPLIT[0]}" == "win" ]; then
|
||||||
|
platform=Windows
|
||||||
|
targetingWindows=true
|
||||||
|
else
|
||||||
|
platform=Posix
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf _output
|
||||||
|
rm -rf _tests
|
||||||
|
|
||||||
|
echo "Building Sonarr for $runtime, Platform: $platform"
|
||||||
|
|
||||||
|
dotnet msbuild -restore $slnFile -p:SelfContained=True -p:Configuration=Release -p:Platform=$platform -p:RuntimeIdentifiers=$runtime -p:EnableWindowsTargeting=true -t:PublishAllRids
|
||||||
|
|
||||||
|
- name: Package
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
framework="${{ inputs.framework }}"
|
||||||
|
runtime="${{ inputs.runtime }}"
|
||||||
|
|
||||||
|
IFS='-' read -ra SPLIT <<< "$runtime"
|
||||||
|
|
||||||
|
case "${SPLIT[0]}" in
|
||||||
|
linux|freebsd*)
|
||||||
|
folder=_artifacts/$runtime/$framework/Sonarr
|
||||||
|
|
||||||
|
echo "Packaging files"
|
||||||
|
rm -rf $folder
|
||||||
|
mkdir -p $folder
|
||||||
|
cp -r _output/$framework/$runtime/publish/* $folder
|
||||||
|
cp -r _output/Sonarr.Update/$framework/$runtime/publish $folder/Sonarr.Update
|
||||||
|
cp LICENSE.md $folder
|
||||||
|
|
||||||
|
echo "Removing Service helpers"
|
||||||
|
rm -f $folder/ServiceUninstall.*
|
||||||
|
rm -f $folder/ServiceInstall.*
|
||||||
|
|
||||||
|
echo "Removing Sonarr.Windows"
|
||||||
|
rm $folder/Sonarr.Windows.*
|
||||||
|
|
||||||
|
echo "Adding Sonarr.Mono to UpdatePackage"
|
||||||
|
cp $folder/Sonarr.Mono.* $folder/Sonarr.Update
|
||||||
|
cp $folder/Mono.Posix.NETStandard.* $folder/Sonarr.Update
|
||||||
|
cp $folder/libMonoPosixHelper.* $folder/Sonarr.Update
|
||||||
|
;;
|
||||||
|
win)
|
||||||
|
folder=_artifacts/$runtime/$framework/Sonarr
|
||||||
|
|
||||||
|
echo "Packaging files"
|
||||||
|
rm -rf $folder
|
||||||
|
mkdir -p $folder
|
||||||
|
cp -r _output/$framework/$runtime/publish/* $folder
|
||||||
|
cp -r _output/Sonarr.Update/$framework/$runtime/publish $folder/Sonarr.Update
|
||||||
|
cp LICENSE.md $folder
|
||||||
|
cp -r _output/$framework-windows/$runtime/publish/* $folder
|
||||||
|
|
||||||
|
echo "Removing Sonarr.Mono"
|
||||||
|
rm -f $folder/Sonarr.Mono.*
|
||||||
|
rm -f $folder/Mono.Posix.NETStandard.*
|
||||||
|
rm -f $folder/libMonoPosixHelper.*
|
||||||
|
|
||||||
|
echo "Adding Sonarr.Windows to UpdatePackage"
|
||||||
|
cp $folder/Sonarr.Windows.* $folder/Sonarr.Update
|
||||||
|
|
||||||
|
;;
|
||||||
|
osx)
|
||||||
|
folder=_artifacts/$runtime/$framework/Sonarr
|
||||||
|
|
||||||
|
echo "Packaging files"
|
||||||
|
rm -rf $folder
|
||||||
|
mkdir -p $folder
|
||||||
|
cp -r _output/$framework/$runtime/publish/* $folder
|
||||||
|
cp -r _output/Sonarr.Update/$framework/$runtime/publish $folder/Sonarr.Update
|
||||||
|
cp LICENSE.md $folder
|
||||||
|
|
||||||
|
echo "Removing Service helpers"
|
||||||
|
rm -f $folder/ServiceUninstall.*
|
||||||
|
rm -f $folder/ServiceInstall.*
|
||||||
|
|
||||||
|
echo "Removing Sonarr.Windows"
|
||||||
|
rm $folder/Sonarr.Windows.*
|
||||||
|
|
||||||
|
echo "Adding Sonarr.Mono to UpdatePackage"
|
||||||
|
cp $folder/Sonarr.Mono.* $folder/Sonarr.Update
|
||||||
|
cp $folder/Mono.Posix.NETStandard.* $folder/Sonarr.Update
|
||||||
|
cp $folder/libMonoPosixHelper.* $folder/Sonarr.Update
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
- name: Package Tests
|
||||||
|
if: ${{ inputs.package_tests }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
framework="${{ inputs.framework }}"
|
||||||
|
runtime="${{ inputs.runtime }}"
|
||||||
|
|
||||||
|
cp scripts/test.sh "_tests/$framework/$runtime/publish"
|
||||||
|
|
||||||
|
rm -f _tests/$framework/$runtime/*.log.config
|
||||||
|
|
||||||
|
- name: Upload Test Artifacts
|
||||||
|
if: ${{ inputs.package_tests }}
|
||||||
|
uses: ./.github/actions/publish-test-artifact
|
||||||
|
with:
|
||||||
|
framework: ${{ inputs.framework }}
|
||||||
|
runtime: ${{ inputs.runtime }}
|
||||||
|
|
||||||
|
- name: Upload Artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: build-${{ inputs.runtime }}
|
||||||
|
path: _artifacts/**/*
|
||||||
@@ -2,34 +2,34 @@ name: Package
|
|||||||
description: Packages binaries for deployment
|
description: Packages binaries for deployment
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
platform:
|
runtime:
|
||||||
description: 'Binary platform'
|
description: "Binary runtime"
|
||||||
required: true
|
required: true
|
||||||
framework:
|
framework:
|
||||||
description: '.net framework'
|
description: ".net framework"
|
||||||
required: true
|
required: true
|
||||||
artifact:
|
artifact:
|
||||||
description: 'Binary artifact'
|
description: "Binary artifact"
|
||||||
required: true
|
required: true
|
||||||
branch:
|
branch:
|
||||||
description: 'Git branch used for this build'
|
description: "Git branch used for this build"
|
||||||
required: true
|
required: true
|
||||||
major_version:
|
major_version:
|
||||||
description: 'Sonarr major version'
|
description: "Sonarr major version"
|
||||||
required: true
|
required: true
|
||||||
version:
|
version:
|
||||||
description: 'Sonarr version'
|
description: "Sonarr version"
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Download Artifact
|
- name: Download Artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs.artifact }}
|
name: ${{ inputs.artifact }}
|
||||||
path: _output
|
path: _output
|
||||||
|
|
||||||
- name: Download UI Artifact
|
- name: Download UI Artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -49,7 +49,7 @@ runs:
|
|||||||
run: $GITHUB_ACTION_PATH/package.sh
|
run: $GITHUB_ACTION_PATH/package.sh
|
||||||
|
|
||||||
- name: Create Windows Installer (x64)
|
- name: Create Windows Installer (x64)
|
||||||
if: ${{ inputs.platform == 'windows' }}
|
if: ${{ inputs.runtime == 'win-x64' }}
|
||||||
working-directory: distribution/windows/setup
|
working-directory: distribution/windows/setup
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
@@ -58,7 +58,7 @@ runs:
|
|||||||
build.bat
|
build.bat
|
||||||
|
|
||||||
- name: Create Windows Installer (x86)
|
- name: Create Windows Installer (x86)
|
||||||
if: ${{ inputs.platform == 'windows' }}
|
if: ${{ inputs.runtime == 'win-x86' }}
|
||||||
working-directory: distribution/windows/setup
|
working-directory: distribution/windows/setup
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
@@ -69,7 +69,7 @@ runs:
|
|||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: release_${{ inputs.platform }}
|
name: release-${{ inputs.runtime }}
|
||||||
compression-level: 0
|
compression-level: 0
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
path: |
|
path: |
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
outputFolder=_output
|
outputFolder=_output
|
||||||
artifactsFolder=_artifacts
|
artifactsFolder=_artifacts
|
||||||
uiFolder="$outputFolder/UI"
|
uiFolder="$outputFolder/UI"
|
||||||
framework="${FRAMEWORK:=net6.0}"
|
framework="${FRAMEWORK:=net8.0}"
|
||||||
|
|
||||||
rm -rf $artifactsFolder
|
rm -rf $artifactsFolder
|
||||||
mkdir $artifactsFolder
|
mkdir $artifactsFolder
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ description: Runs unit/integration tests
|
|||||||
inputs:
|
inputs:
|
||||||
use_postgres:
|
use_postgres:
|
||||||
description: 'Whether postgres should be used for the database'
|
description: 'Whether postgres should be used for the database'
|
||||||
|
postgres-version:
|
||||||
|
description: 'Which postgres version should be used for the database'
|
||||||
os:
|
os:
|
||||||
description: 'OS that the tests are running on'
|
description: 'OS that the tests are running on'
|
||||||
required: true
|
required: true
|
||||||
@@ -27,16 +29,18 @@ runs:
|
|||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v4
|
uses: actions/setup-dotnet@v5
|
||||||
|
|
||||||
- name: Setup Postgres
|
- name: Setup Postgres
|
||||||
if: ${{ inputs.use_postgres }}
|
if: ${{ inputs.use_postgres }}
|
||||||
uses: ikalnytskyi/action-setup-postgres@v4
|
uses: ikalnytskyi/action-setup-postgres@v7
|
||||||
|
with:
|
||||||
|
postgres-version: ${{ inputs.postgres-version }}
|
||||||
|
|
||||||
- name: Setup Test Variables
|
- name: Setup Test Variables
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "RESULTS_NAME=${{ inputs.integration_tests && 'integation-' || 'unit-' }}${{ inputs.artifact }}${{ inputs.use_postgres && '-postgres' }}" >> "$GITHUB_ENV"
|
echo "RESULTS_NAME=${{ inputs.integration_tests && 'integation-' || 'unit-' }}${{ inputs.artifact }}${{ inputs.use_postgres && '-postgres' }}${{ inputs.use_postgres && inputs.postgres-version && inputs.postgres-version }}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Setup Postgres Environment Variables
|
- name: Setup Postgres Environment Variables
|
||||||
if: ${{ inputs.use_postgres }}
|
if: ${{ inputs.use_postgres }}
|
||||||
@@ -48,14 +52,14 @@ runs:
|
|||||||
echo "Sonarr__Postgres__Password=postgres" >> "$GITHUB_ENV"
|
echo "Sonarr__Postgres__Password=postgres" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Download Artifact
|
- name: Download Artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v5
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs.artifact }}
|
name: ${{ inputs.artifact }}
|
||||||
path: _tests
|
path: _tests
|
||||||
|
|
||||||
- name: Download Binary Artifact
|
- name: Download Binary Artifact
|
||||||
if: ${{ inputs.integration_tests }}
|
if: ${{ inputs.integration_tests }}
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v5
|
||||||
with:
|
with:
|
||||||
name: ${{ inputs.binary_artifact }}
|
name: ${{ inputs.binary_artifact }}
|
||||||
path: _output
|
path: _output
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
name: 'API Docs'
|
name: "API Docs"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * 1'
|
- cron: "0 0 * * 1"
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- develop
|
- v5-develop
|
||||||
paths:
|
paths:
|
||||||
- ".github/workflows/api_docs.yml"
|
- ".github/workflows/api_docs.yml"
|
||||||
- "docs.sh"
|
- "docs.sh"
|
||||||
@@ -33,7 +33,7 @@ jobs:
|
|||||||
id: setup-dotnet
|
id: setup-dotnet
|
||||||
|
|
||||||
- name: Create openapi.json
|
- name: Create openapi.json
|
||||||
run: ./docs.sh Linux
|
run: ./scripts/docs.sh Linux x64
|
||||||
|
|
||||||
- name: Commit API Docs Change
|
- name: Commit API Docs Change
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -46,7 +46,20 @@ jobs:
|
|||||||
then
|
then
|
||||||
git commit -am 'Automated API Docs update' -m "ignore-downstream"
|
git commit -am 'Automated API Docs update' -m "ignore-downstream"
|
||||||
git push -f --set-upstream origin api-docs
|
git push -f --set-upstream origin api-docs
|
||||||
curl -X POST -H "Authorization: Bearer ${{ secrets.OPENAPI_PAT }}" -H "Accept: application/vnd.github+json" https://api.github.com/repos/sonarr/sonarr/pulls -d '{"head":"api-docs","base":"develop","title":"Update API docs"}'
|
curl -X POST -H "Authorization: Bearer ${{ secrets.OPENAPI_PAT }}" -H "Accept: application/vnd.github+json" https://api.github.com/repos/sonarr/sonarr/pulls -d '{"head":"api-docs","base":"v5-develop","title":"Update API docs"}'
|
||||||
else
|
else
|
||||||
echo "No changes since last run"
|
echo "No changes since last run"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Notify
|
||||||
|
if: failure()
|
||||||
|
uses: tsickert/discord-webhook@v6.0.0
|
||||||
|
with:
|
||||||
|
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
|
username: "GitHub Actions"
|
||||||
|
avatar-url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
|
||||||
|
embed-title: "${{ github.workflow }}: Failure"
|
||||||
|
embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||||
|
embed-description: |
|
||||||
|
Failed to update API docs
|
||||||
|
embed-color: "15158332"
|
||||||
|
|||||||
@@ -1,249 +0,0 @@
|
|||||||
name: Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
- main
|
|
||||||
paths-ignore:
|
|
||||||
- 'src/Sonarr.Api.*/openapi.json'
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
paths-ignore:
|
|
||||||
- 'src/NzbDrone.Core/Localization/Core/**'
|
|
||||||
- 'src/Sonarr.Api.*/openapi.json'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
env:
|
|
||||||
FRAMEWORK: net6.0
|
|
||||||
RAW_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
|
||||||
SONARR_MAJOR_VERSION: 4
|
|
||||||
VERSION: 4.0.5
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
backend:
|
|
||||||
runs-on: windows-latest
|
|
||||||
outputs:
|
|
||||||
framework: ${{ steps.variables.outputs.framework }}
|
|
||||||
major_version: ${{ steps.variables.outputs.major_version }}
|
|
||||||
version: ${{ steps.variables.outputs.version }}
|
|
||||||
steps:
|
|
||||||
- name: Check out
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup .NET
|
|
||||||
uses: actions/setup-dotnet@v4
|
|
||||||
|
|
||||||
- name: Setup Environment Variables
|
|
||||||
id: variables
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
# Add 800 to the build number because GitHub won't let us pick an arbitrary starting point
|
|
||||||
SONARR_VERSION="${{ env.VERSION }}.$((${{ github.run_number }}+800))"
|
|
||||||
DOTNET_VERSION=$(jq -r '.sdk.version' global.json)
|
|
||||||
|
|
||||||
echo "SDK_PATH=${{ env.DOTNET_ROOT }}/sdk/${DOTNET_VERSION}" >> "$GITHUB_ENV"
|
|
||||||
echo "SONARR_VERSION=$SONARR_VERSION" >> "$GITHUB_ENV"
|
|
||||||
echo "BRANCH=${RAW_BRANCH_NAME//\//-}" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
echo "framework=${{ env.FRAMEWORK }}" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "major_version=${{ env.SONARR_MAJOR_VERSION }}" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "version=$SONARR_VERSION" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Enable Extra Platforms In SDK
|
|
||||||
shell: bash
|
|
||||||
run: ./build.sh --enable-extra-platforms-in-sdk
|
|
||||||
|
|
||||||
- name: Build Backend
|
|
||||||
shell: bash
|
|
||||||
run: ./build.sh --backend --enable-extra-platforms --packages
|
|
||||||
|
|
||||||
# Test Artifacts
|
|
||||||
|
|
||||||
- name: Publish win-x64 Test Artifact
|
|
||||||
uses: ./.github/actions/publish-test-artifact
|
|
||||||
with:
|
|
||||||
framework: ${{ env.FRAMEWORK }}
|
|
||||||
runtime: win-x64
|
|
||||||
|
|
||||||
- name: Publish linux-x64 Test Artifact
|
|
||||||
uses: ./.github/actions/publish-test-artifact
|
|
||||||
with:
|
|
||||||
framework: ${{ env.FRAMEWORK }}
|
|
||||||
runtime: linux-x64
|
|
||||||
|
|
||||||
- name: Publish osx-arm64 Test Artifact
|
|
||||||
uses: ./.github/actions/publish-test-artifact
|
|
||||||
with:
|
|
||||||
framework: ${{ env.FRAMEWORK }}
|
|
||||||
runtime: osx-arm64
|
|
||||||
|
|
||||||
# Build Artifacts (grouped by OS)
|
|
||||||
|
|
||||||
- name: Publish FreeBSD Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build_freebsd
|
|
||||||
path: _artifacts/freebsd-*/**/*
|
|
||||||
- name: Publish Linux Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build_linux
|
|
||||||
path: _artifacts/linux-*/**/*
|
|
||||||
- name: Publish macOS Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build_macos
|
|
||||||
path: _artifacts/osx-*/**/*
|
|
||||||
- name: Publish Windows Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build_windows
|
|
||||||
path: _artifacts/win-*/**/*
|
|
||||||
|
|
||||||
frontend:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Volta
|
|
||||||
uses: volta-cli/action@v4
|
|
||||||
|
|
||||||
- name: Yarn Install
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: Lint
|
|
||||||
run: yarn lint
|
|
||||||
|
|
||||||
- name: Stylelint
|
|
||||||
run: yarn stylelint -f github
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: yarn build --env production
|
|
||||||
|
|
||||||
- name: Publish UI Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: build_ui
|
|
||||||
path: _output/UI/**/*
|
|
||||||
|
|
||||||
unit_test:
|
|
||||||
needs: backend
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
artifact: tests-linux-x64
|
|
||||||
filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory!=IntegrationTest&TestCategory!=AutomationTest
|
|
||||||
- os: macos-latest
|
|
||||||
artifact: tests-osx-arm64
|
|
||||||
filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory!=IntegrationTest&TestCategory!=AutomationTest
|
|
||||||
- os: windows-latest
|
|
||||||
artifact: tests-win-x64
|
|
||||||
filter: TestCategory!=ManualTest&TestCategory!=LINUX&TestCategory!=IntegrationTest&TestCategory!=AutomationTest
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Check out
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
uses: ./.github/actions/test
|
|
||||||
with:
|
|
||||||
os: ${{ matrix.os }}
|
|
||||||
artifact: ${{ matrix.artifact }}
|
|
||||||
pattern: Sonarr.*.Test.dll
|
|
||||||
filter: ${{ matrix.filter }}
|
|
||||||
|
|
||||||
unit_test_postgres:
|
|
||||||
needs: backend
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
uses: ./.github/actions/test
|
|
||||||
with:
|
|
||||||
os: ubuntu-latest
|
|
||||||
artifact: tests-linux-x64
|
|
||||||
pattern: Sonarr.*.Test.dll
|
|
||||||
filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory!=IntegrationTest&TestCategory!=AutomationTest
|
|
||||||
use_postgres: true
|
|
||||||
|
|
||||||
integration_test:
|
|
||||||
needs: backend
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
artifact: tests-linux-x64
|
|
||||||
filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory=IntegrationTest
|
|
||||||
binary_artifact: build_linux
|
|
||||||
binary_path: linux-x64/${{ needs.backend.outputs.framework }}/Sonarr
|
|
||||||
- os: macos-latest
|
|
||||||
artifact: tests-osx-arm64
|
|
||||||
filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory=IntegrationTest
|
|
||||||
binary_artifact: build_macos
|
|
||||||
binary_path: osx-arm64/${{ needs.backend.outputs.framework }}/Sonarr
|
|
||||||
- os: windows-latest
|
|
||||||
artifact: tests-win-x64
|
|
||||||
filter: TestCategory!=ManualTest&TestCategory!=LINUX&TestCategory=IntegrationTest
|
|
||||||
binary_artifact: build_windows
|
|
||||||
binary_path: win-x64/${{ needs.backend.outputs.framework }}/Sonarr
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Check out
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
uses: ./.github/actions/test
|
|
||||||
with:
|
|
||||||
os: ${{ matrix.os }}
|
|
||||||
artifact: ${{ matrix.artifact }}
|
|
||||||
pattern: Sonarr.*.Test.dll
|
|
||||||
filter: ${{ matrix.filter }}
|
|
||||||
integration_tests: true
|
|
||||||
binary_artifact: ${{ matrix.binary_artifact }}
|
|
||||||
binary_path: ${{ matrix.binary_path }}
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
if: ${{ github.ref_name == 'develop' || github.ref_name == 'main' }}
|
|
||||||
needs: [backend, frontend, unit_test, unit_test_postgres, integration_test]
|
|
||||||
secrets: inherit
|
|
||||||
uses: ./.github/workflows/deploy.yml
|
|
||||||
with:
|
|
||||||
framework: ${{ needs.backend.outputs.framework }}
|
|
||||||
branch: ${{ github.ref_name }}
|
|
||||||
major_version: ${{ needs.backend.outputs.major_version }}
|
|
||||||
version: ${{ needs.backend.outputs.version }}
|
|
||||||
|
|
||||||
notify:
|
|
||||||
name: Discord Notification
|
|
||||||
needs: [backend, frontend, unit_test, unit_test_postgres, integration_test, deploy]
|
|
||||||
if: ${{ !cancelled() && (github.ref_name == 'develop' || github.ref_name == 'main') }}
|
|
||||||
env:
|
|
||||||
STATUS: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Notify
|
|
||||||
uses: tsickert/discord-webhook@v6.0.0
|
|
||||||
with:
|
|
||||||
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
|
||||||
username: 'GitHub Actions'
|
|
||||||
avatar-url: 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
|
|
||||||
embed-title: "${{ github.workflow }}: ${{ env.STATUS == 'success' && 'Success' || 'Failure' }}"
|
|
||||||
embed-url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
|
|
||||||
embed-description: |
|
|
||||||
**Branch** ${{ github.ref }}
|
|
||||||
**Build** ${{ needs.backend.outputs.version }}
|
|
||||||
embed-color: ${{ env.STATUS == 'success' && '3066993' || '15158332' }}
|
|
||||||
@@ -0,0 +1,259 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- v5-develop
|
||||||
|
- v5-main
|
||||||
|
paths-ignore:
|
||||||
|
- "src/Sonarr.Api.*/openapi.json"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- v5-develop
|
||||||
|
paths-ignore:
|
||||||
|
- "src/NzbDrone.Core/Localization/Core/**"
|
||||||
|
- "src/Sonarr.Api.*/openapi.json"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
FRAMEWORK: net8.0
|
||||||
|
RAW_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||||
|
SONARR_MAJOR_VERSION: 5
|
||||||
|
VERSION: 5.0.0
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
framework: ${{ steps.variables.outputs.framework }}
|
||||||
|
major_version: ${{ steps.variables.outputs.major_version }}
|
||||||
|
version: ${{ steps.variables.outputs.version }}
|
||||||
|
branch: ${{ steps.variables.outputs.branch }}
|
||||||
|
steps:
|
||||||
|
- name: Setup Environment Variables
|
||||||
|
id: variables
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "framework=${{ env.FRAMEWORK }}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "major_version=${{ env.SONARR_MAJOR_VERSION }}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "version=${{ env.VERSION }}.$((${{ github.run_number }}))" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "branch=${RAW_BRANCH_NAME//\//-}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
backend:
|
||||||
|
needs: prepare
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- runtime: freebsd-x64
|
||||||
|
package_tests: false
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: linux-arm
|
||||||
|
package_tests: false
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: linux-arm64
|
||||||
|
package_tests: false
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: linux-musl-arm64
|
||||||
|
package_tests: false
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: linux-musl-x64
|
||||||
|
package_tests: false
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: linux-x64
|
||||||
|
package_tests: true
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: osx-arm64
|
||||||
|
package_tests: true
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: osx-x64
|
||||||
|
package_tests: false
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: win-x64
|
||||||
|
package_tests: true
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: win-x86
|
||||||
|
package_tests: false
|
||||||
|
os: ubuntu-latest
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Check out
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
uses: ./.github/actions/build
|
||||||
|
with:
|
||||||
|
branch: ${{ needs.prepare.outputs.branch }}
|
||||||
|
version: ${{ needs.prepare.outputs.version }}
|
||||||
|
framework: ${{ needs.prepare.outputs.framework }}
|
||||||
|
runtime: ${{ matrix.runtime }}
|
||||||
|
package_tests: ${{ matrix.package_tests }}
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- name: Volta
|
||||||
|
uses: volta-cli/action@v4
|
||||||
|
|
||||||
|
- name: Yarn Install
|
||||||
|
run: yarn install
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: yarn lint
|
||||||
|
|
||||||
|
- name: Stylelint
|
||||||
|
run: yarn stylelint -f github
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: yarn build --env production
|
||||||
|
|
||||||
|
- name: Publish UI Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: build_ui
|
||||||
|
path: _output/UI/**/*
|
||||||
|
|
||||||
|
unit_test:
|
||||||
|
needs: backend
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
artifact: tests-linux-x64
|
||||||
|
filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory!=IntegrationTest&TestCategory!=AutomationTest
|
||||||
|
- os: macos-latest
|
||||||
|
artifact: tests-osx-arm64
|
||||||
|
filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory!=IntegrationTest&TestCategory!=AutomationTest
|
||||||
|
- os: windows-latest
|
||||||
|
artifact: tests-win-x64
|
||||||
|
filter: TestCategory!=ManualTest&TestCategory!=LINUX&TestCategory!=IntegrationTest&TestCategory!=AutomationTest
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Check out
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
uses: ./.github/actions/test
|
||||||
|
with:
|
||||||
|
os: ${{ matrix.os }}
|
||||||
|
artifact: ${{ matrix.artifact }}
|
||||||
|
pattern: Sonarr.*.Test.dll
|
||||||
|
filter: ${{ matrix.filter }}
|
||||||
|
|
||||||
|
unit_test_postgres:
|
||||||
|
needs: backend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
postgres-version: [16, 17]
|
||||||
|
steps:
|
||||||
|
- name: Check out
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
uses: ./.github/actions/test
|
||||||
|
with:
|
||||||
|
os: ubuntu-latest
|
||||||
|
artifact: tests-linux-x64
|
||||||
|
pattern: Sonarr.*.Test.dll
|
||||||
|
filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory!=IntegrationTest&TestCategory!=AutomationTest
|
||||||
|
use_postgres: true
|
||||||
|
postgres-version: ${{ matrix.postgres-version }}
|
||||||
|
|
||||||
|
integration_test:
|
||||||
|
needs: [prepare, backend]
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
artifact: tests-linux-x64
|
||||||
|
filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory=IntegrationTest
|
||||||
|
binary_artifact: build-linux-x64
|
||||||
|
binary_path: linux-x64/${{ needs.prepare.outputs.framework }}/Sonarr
|
||||||
|
- os: macos-latest
|
||||||
|
artifact: tests-osx-arm64
|
||||||
|
filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory=IntegrationTest
|
||||||
|
binary_artifact: build-osx-arm64
|
||||||
|
binary_path: osx-arm64/${{ needs.prepare.outputs.framework }}/Sonarr
|
||||||
|
- os: windows-latest
|
||||||
|
artifact: tests-win-x64
|
||||||
|
filter: TestCategory!=ManualTest&TestCategory!=LINUX&TestCategory=IntegrationTest
|
||||||
|
binary_artifact: build-win-x64
|
||||||
|
binary_path: win-x64/${{ needs.prepare.outputs.framework }}/Sonarr
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Check out
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
uses: ./.github/actions/test
|
||||||
|
with:
|
||||||
|
os: ${{ matrix.os }}
|
||||||
|
artifact: ${{ matrix.artifact }}
|
||||||
|
pattern: Sonarr.*.Test.dll
|
||||||
|
filter: ${{ matrix.filter }}
|
||||||
|
integration_tests: true
|
||||||
|
binary_artifact: ${{ matrix.binary_artifact }}
|
||||||
|
binary_path: ${{ matrix.binary_path }}
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
if: ${{ github.ref_name == 'v5-develop-final' || github.ref_name == 'v5-main-final' }}
|
||||||
|
needs:
|
||||||
|
[
|
||||||
|
prepare,
|
||||||
|
backend,
|
||||||
|
frontend,
|
||||||
|
unit_test,
|
||||||
|
unit_test_postgres,
|
||||||
|
integration_test,
|
||||||
|
]
|
||||||
|
secrets: inherit
|
||||||
|
uses: ./.github/workflows/deploy.yml
|
||||||
|
with:
|
||||||
|
framework: ${{ needs.prepare.outputs.framework }}
|
||||||
|
branch: ${{ github.ref_name }}
|
||||||
|
major_version: ${{ needs.prepare.outputs.major_version }}
|
||||||
|
version: ${{ needs.prepare.outputs.version }}
|
||||||
|
|
||||||
|
notify:
|
||||||
|
name: Discord Notification
|
||||||
|
needs:
|
||||||
|
[
|
||||||
|
prepare,
|
||||||
|
backend,
|
||||||
|
frontend,
|
||||||
|
unit_test,
|
||||||
|
unit_test_postgres,
|
||||||
|
integration_test,
|
||||||
|
deploy,
|
||||||
|
]
|
||||||
|
if: ${{ !cancelled() && (github.ref_name == 'v5-develop-final' || github.ref_name == 'v5-main-final') }}
|
||||||
|
env:
|
||||||
|
STATUS: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Notify
|
||||||
|
uses: tsickert/discord-webhook@v6.0.0
|
||||||
|
with:
|
||||||
|
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
|
username: "GitHub Actions"
|
||||||
|
avatar-url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
|
||||||
|
embed-title: "${{ github.workflow }}: ${{ env.STATUS == 'success' && 'Success' || 'Failure' }}"
|
||||||
|
embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||||
|
embed-description: |
|
||||||
|
**Branch** ${{ github.ref }}
|
||||||
|
**Build** ${{ needs.prepare.outputs.version }}
|
||||||
|
embed-color: ${{ env.STATUS == 'success' && '3066993' || '15158332' }}
|
||||||
@@ -7,6 +7,7 @@ on:
|
|||||||
pull_request_target:
|
pull_request_target:
|
||||||
branches:
|
branches:
|
||||||
- develop
|
- develop
|
||||||
|
- v5-develop
|
||||||
types: [synchronize]
|
types: [synchronize]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -21,6 +22,5 @@ jobs:
|
|||||||
- name: Apply label
|
- name: Apply label
|
||||||
uses: eps1lon/actions-label-merge-conflict@v3
|
uses: eps1lon/actions-label-merge-conflict@v3
|
||||||
with:
|
with:
|
||||||
dirtyLabel: 'merge-conflict'
|
dirtyLabel: "merge-conflict"
|
||||||
repoToken: '${{ secrets.GITHUB_TOKEN }}'
|
repoToken: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
|
||||||
|
|||||||
+126
-115
@@ -3,20 +3,20 @@ name: Deploy
|
|||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
framework:
|
framework:
|
||||||
description: '.net framework'
|
description: ".net framework"
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
branch:
|
branch:
|
||||||
description: 'Git branch used for this build'
|
description: "Git branch used for this build"
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
major_version:
|
major_version:
|
||||||
description: 'Sonarr major version'
|
description: "Sonarr major version"
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
version:
|
version:
|
||||||
description: 'Sonarr version'
|
description: "Sonarr version"
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
secrets:
|
secrets:
|
||||||
@@ -27,31 +27,42 @@ jobs:
|
|||||||
package:
|
package:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
platform: [freebsd, linux, macos, windows]
|
|
||||||
include:
|
include:
|
||||||
- platform: freebsd
|
- runtime: freebsd-x64
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- platform: linux
|
- runtime: linux-arm
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- platform: macos
|
- runtime: linux-arm64
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- platform: windows
|
- runtime: linux-musl-arm64
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: linux-musl-x64
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: linux-x64
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: osx-arm64
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: osx-x64
|
||||||
|
os: ubuntu-latest
|
||||||
|
- runtime: win-x64
|
||||||
|
os: windows-latest
|
||||||
|
- runtime: win-x86
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out
|
- name: Check out
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
uses: ./.github/actions/package
|
uses: ./.github/actions/package
|
||||||
with:
|
with:
|
||||||
framework: ${{ inputs.framework }}
|
framework: ${{ inputs.framework }}
|
||||||
platform: ${{ matrix.platform }}
|
runtime: ${{ matrix.runtime }}
|
||||||
artifact: build_${{ matrix.platform }}
|
artifact: build-${{ matrix.runtime }}
|
||||||
branch: ${{ inputs.branch }}
|
branch: ${{ inputs.branch }}
|
||||||
major_version: ${{ inputs.major_version }}
|
major_version: ${{ inputs.major_version }}
|
||||||
version: ${{ inputs.version }}
|
version: ${{ inputs.version }}
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: package
|
needs: package
|
||||||
@@ -59,102 +70,102 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Check out
|
- name: Check out
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download release artifacts
|
- name: Download release artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: _artifacts
|
path: _artifacts
|
||||||
pattern: release_*
|
pattern: release-*
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Get Previous Release
|
- name: Get Previous Release
|
||||||
id: previous-release
|
id: previous-release
|
||||||
uses: cardinalby/git-get-release-action@v1
|
uses: cardinalby/git-get-release-action@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
with:
|
with:
|
||||||
latest: true
|
latest: true
|
||||||
prerelease: ${{ inputs.branch != 'main' }}
|
prerelease: ${{ inputs.branch != 'main' }}
|
||||||
|
|
||||||
- name: Generate Release Notes
|
- name: Generate Release Notes
|
||||||
id: generate-release-notes
|
id: generate-release-notes
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
github-token: ${{ github.token }}
|
github-token: ${{ github.token }}
|
||||||
result-encoding: string
|
result-encoding: string
|
||||||
script: |
|
script: |
|
||||||
const { data } = await github.rest.repos.generateReleaseNotes({
|
const { data } = await github.rest.repos.generateReleaseNotes({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
tag_name: 'v${{ inputs.version }}',
|
tag_name: 'v${{ inputs.version }}',
|
||||||
target_commitish: '${{ github.sha }}',
|
target_commitish: '${{ github.sha }}',
|
||||||
previous_tag_name: '${{ steps.previous-release.outputs.tag_name }}',
|
previous_tag_name: '${{ steps.previous-release.outputs.tag_name }}',
|
||||||
})
|
})
|
||||||
return data.body
|
return data.body
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@v1
|
||||||
with:
|
with:
|
||||||
artifacts: _artifacts/Sonarr.*
|
artifacts: _artifacts/Sonarr.*
|
||||||
commit: ${{ github.sha }}
|
commit: ${{ github.sha }}
|
||||||
generateReleaseNotes: false
|
generateReleaseNotes: false
|
||||||
body: ${{ steps.generate-release-notes.outputs.result }}
|
body: ${{ steps.generate-release-notes.outputs.result }}
|
||||||
name: ${{ inputs.version }}
|
name: ${{ inputs.version }}
|
||||||
prerelease: ${{ inputs.branch != 'main' }}
|
prerelease: ${{ inputs.branch != 'main' }}
|
||||||
skipIfReleaseExists: true
|
skipIfReleaseExists: true
|
||||||
tag: v${{ inputs.version }}
|
tag: v${{ inputs.version }}
|
||||||
|
|
||||||
- name: Publish to Services
|
- name: Publish to Services
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: _artifacts
|
working-directory: _artifacts
|
||||||
run: |
|
run: |
|
||||||
branch=${{ inputs.branch }}
|
branch=${{ inputs.branch }}
|
||||||
version=${{ inputs.version }}
|
version=${{ inputs.version }}
|
||||||
lastCommit=${{ github.sha }}
|
lastCommit=${{ github.sha }}
|
||||||
|
|
||||||
hashes="["
|
hashes="["
|
||||||
|
|
||||||
addHash() {
|
addHash() {
|
||||||
path=$1
|
path=$1
|
||||||
os=$2
|
os=$2
|
||||||
arch=$3
|
arch=$3
|
||||||
type=$4
|
type=$4
|
||||||
|
|
||||||
local hash=$(sha256sum *.$version.$path | awk '{ print $1; }')
|
local hash=$(sha256sum *.$version.$path | awk '{ print $1; }')
|
||||||
echo "{ \""Os\"": \""$os\"", \""Arch\"": \""$arch\"", \""Type\"": \""$type\"", \""Hash\"": \""$hash\"" }"
|
echo "{ \""Os\"": \""$os\"", \""Arch\"": \""$arch\"", \""Type\"": \""$type\"", \""Hash\"": \""$hash\"" }"
|
||||||
}
|
}
|
||||||
|
|
||||||
hashes="$hashes $(addHash "linux-arm.tar.gz" "linux" "arm" "archive")"
|
hashes="$hashes $(addHash "linux-arm.tar.gz" "linux" "arm" "archive")"
|
||||||
hashes="$hashes, $(addHash "linux-arm64.tar.gz" "linux" "arm64" "archive")"
|
hashes="$hashes, $(addHash "linux-arm64.tar.gz" "linux" "arm64" "archive")"
|
||||||
hashes="$hashes, $(addHash "linux-x64.tar.gz" "linux" "x64" "archive")"
|
hashes="$hashes, $(addHash "linux-x64.tar.gz" "linux" "x64" "archive")"
|
||||||
# hashes="$hashes, $(addHash "linux-x86.tar.gz" "linux" "x86" "archive")"
|
# hashes="$hashes, $(addHash "linux-x86.tar.gz" "linux" "x86" "archive")"
|
||||||
|
|
||||||
# hashes="$hashes, $(addHash "linux-musl-arm.tar.gz" "linuxmusl" "arm" "archive")"
|
# hashes="$hashes, $(addHash "linux-musl-arm.tar.gz" "linuxmusl" "arm" "archive")"
|
||||||
hashes="$hashes, $(addHash "linux-musl-arm64.tar.gz" "linuxmusl" "arm64" "archive")"
|
hashes="$hashes, $(addHash "linux-musl-arm64.tar.gz" "linuxmusl" "arm64" "archive")"
|
||||||
hashes="$hashes, $(addHash "linux-musl-x64.tar.gz" "linuxmusl" "x64" "archive")"
|
hashes="$hashes, $(addHash "linux-musl-x64.tar.gz" "linuxmusl" "x64" "archive")"
|
||||||
|
|
||||||
hashes="$hashes, $(addHash "osx-arm64.tar.gz" "osx" "arm64" "archive")"
|
hashes="$hashes, $(addHash "osx-arm64.tar.gz" "osx" "arm64" "archive")"
|
||||||
hashes="$hashes, $(addHash "osx-x64.tar.gz" "osx" "x64" "archive")"
|
hashes="$hashes, $(addHash "osx-x64.tar.gz" "osx" "x64" "archive")"
|
||||||
|
|
||||||
hashes="$hashes, $(addHash "osx-arm64-app.zip" "osx" "arm64" "installer")"
|
hashes="$hashes, $(addHash "osx-arm64-app.zip" "osx" "arm64" "installer")"
|
||||||
hashes="$hashes, $(addHash "osx-x64-app.zip" "osx" "x64" "installer")"
|
hashes="$hashes, $(addHash "osx-x64-app.zip" "osx" "x64" "installer")"
|
||||||
|
|
||||||
hashes="$hashes, $(addHash "win-x64.zip" "windows" "x64" "archive")"
|
hashes="$hashes, $(addHash "win-x64.zip" "windows" "x64" "archive")"
|
||||||
hashes="$hashes, $(addHash "win-x86.zip" "windows" "x86" "archive")"
|
hashes="$hashes, $(addHash "win-x86.zip" "windows" "x86" "archive")"
|
||||||
|
|
||||||
hashes="$hashes, $(addHash "win-x64-installer.exe" "windows" "x64" "installer")"
|
hashes="$hashes, $(addHash "win-x64-installer.exe" "windows" "x64" "installer")"
|
||||||
hashes="$hashes, $(addHash "win-x86-installer.exe" "windows" "x86" "installer")"
|
hashes="$hashes, $(addHash "win-x86-installer.exe" "windows" "x86" "installer")"
|
||||||
|
|
||||||
hashes="$hashes, $(addHash "freebsd-x64.tar.gz" "freebsd" "x64" "archive")"
|
hashes="$hashes, $(addHash "freebsd-x64.tar.gz" "freebsd" "x64" "archive")"
|
||||||
|
|
||||||
hashes="$hashes ]"
|
hashes="$hashes ]"
|
||||||
|
|
||||||
json="{\""branch\"":\""$branch\"", \""version\"":\""$version\"", \""lastCommit\"":\""$lastCommit\"", \""hashes\"":$hashes, \""gitHubRelease\"":true}"
|
json="{\""branch\"":\""$branch\"", \""version\"":\""$version\"", \""lastCommit\"":\""$lastCommit\"", \""hashes\"":$hashes, \""gitHubRelease\"":true}"
|
||||||
url="https://services.sonarr.tv/v1/update"
|
url="https://services.sonarr.tv/v1/update"
|
||||||
|
|
||||||
echo "Publishing update $version ($branch) to: $url"
|
echo "Publishing update $version ($branch) to: $url"
|
||||||
echo "$json"
|
echo "$json"
|
||||||
|
|
||||||
curl -H "Content-Type: application/json" -H "X-Api-Key: ${{ secrets.SERVICES_API_KEY }}" -X POST -d "$json" --fail-with-body $url
|
curl -H "Content-Type: application/json" -H "X-Api-Key: ${{ secrets.SERVICES_API_KEY }}" -X POST -d "$json" --fail-with-body $url
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
name: 'Support Requests'
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [labeled, unlabeled, reopened]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
action:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.repository == 'Sonarr/Sonarr'
|
||||||
|
steps:
|
||||||
|
- uses: dessant/support-requests@v4
|
||||||
|
with:
|
||||||
|
github-token: ${{ github.token }}
|
||||||
|
support-label: 'support'
|
||||||
|
issue-comment: >
|
||||||
|
:wave: @{issue-author}, we use the issue tracker exclusively
|
||||||
|
for bug reports and feature requests. However, this issue appears
|
||||||
|
to be a support request. Please use one of the support channels:
|
||||||
|
[forums](https://forums.sonarr.tv/), [subreddit](https://www.reddit.com/r/sonarr/),
|
||||||
|
[discord](https://discord.gg/Ex7FmFK), or [IRC](https://web.libera.chat/?channels=#sonarr)
|
||||||
|
for support/questions.
|
||||||
|
close-issue: true
|
||||||
|
issue-close-reason: 'not planned'
|
||||||
|
lock-issue: false
|
||||||
|
issue-lock-reason: 'off-topic'
|
||||||
@@ -162,3 +162,6 @@ src/.idea/
|
|||||||
|
|
||||||
# API doc generation
|
# API doc generation
|
||||||
.config/
|
.config/
|
||||||
|
|
||||||
|
# Ignore Jetbrains IntelliJ Workspace Directories
|
||||||
|
.idea/
|
||||||
|
|||||||
Vendored
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build dotnet",
|
"preLaunchTask": "build dotnet",
|
||||||
// If you have changed target frameworks, make sure to update the program path.
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
"program": "${workspaceFolder}/_output/net6.0/Sonarr",
|
"program": "${workspaceFolder}/_output/net8.0/Sonarr",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
||||||
|
|||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"typescript.tsdk": "node_modules\\typescript\\lib"
|
||||||
|
}
|
||||||
+15
-11
@@ -1,32 +1,35 @@
|
|||||||
# How to Contribute #
|
# How to Contribute
|
||||||
|
|
||||||
We're always looking for people to help make Sonarr even better, there are a number of ways to contribute.
|
We're always looking for people to help make Sonarr even better, there are a number of ways to contribute.
|
||||||
|
|
||||||
## Documentation ##
|
## Documentation
|
||||||
|
|
||||||
Setup guides, [FAQ](https://wiki.servarr.com/sonarr/faq), the more information we have on the [wiki](https://wiki.servarr.com/sonarr) the better.
|
Setup guides, [FAQ](https://wiki.servarr.com/sonarr/faq), the more information we have on the [wiki](https://wiki.servarr.com/sonarr) the better.
|
||||||
|
|
||||||
## Development ##
|
## Development
|
||||||
|
|
||||||
### Tools required ###
|
### Tools required
|
||||||
- Visual Studio 2019 or higher (https://www.visualstudio.com/vs/). The community version is free and works (https://www.visualstudio.com/downloads/).
|
|
||||||
|
- Visual Studio 2019 or higher (https://www.visualstudio.com/vs/). The community version is free and works (https://www.visualstudio.com/downloads/).
|
||||||
- HTML/Javascript editor of choice (VS Code/Sublime Text/Webstorm/Atom/etc)
|
- HTML/Javascript editor of choice (VS Code/Sublime Text/Webstorm/Atom/etc)
|
||||||
- [Git](https://git-scm.com/downloads)
|
- [Git](https://git-scm.com/downloads)
|
||||||
- [NodeJS](https://nodejs.org/en/download/) (Node 10.X.X or higher)
|
- [NodeJS](https://nodejs.org/en/download/) (Node 10.X.X or higher)
|
||||||
- [Yarn](https://yarnpkg.com/)
|
- [Yarn](https://yarnpkg.com/)
|
||||||
|
|
||||||
### Getting started ###
|
### Getting started
|
||||||
|
|
||||||
1. Fork Sonarr
|
1. Fork Sonarr
|
||||||
2. Clone the repository into your development machine. [*info*](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
|
2. Clone the repository into your development machine. [_info_](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
|
||||||
3. Install the required Node Packages `yarn install`
|
3. Install the required Node Packages `yarn install`
|
||||||
4. Start webpack to monitor your dev environment for any frontend changes that need post processing using `yarn start` command.
|
4. Start webpack to monitor your dev environment for any frontend changes that need post processing using `yarn start` command.
|
||||||
5. Build the project in Visual Studio, Setting startup project to `Sonarr.Console` and framework to `x86`
|
5. Build the project in Visual Studio, Setting startup project to `Sonarr.Console` and framework to `x86`
|
||||||
6. Debug the project in Visual Studio
|
6. Debug the project in Visual Studio
|
||||||
7. Open http://localhost:8989
|
7. Open http://localhost:8989
|
||||||
|
|
||||||
### Contributing Code ###
|
### Contributing Code
|
||||||
|
|
||||||
- If you're adding a new, already requested feature, please comment on [Github Issues](https://github.com/Sonarr/Sonarr/issues "Github Issues") so work is not duplicated (If you want to add something not already on there, please talk to us first)
|
- If you're adding a new, already requested feature, please comment on [Github Issues](https://github.com/Sonarr/Sonarr/issues "Github Issues") so work is not duplicated (If you want to add something not already on there, please talk to us first)
|
||||||
- Rebase from Sonarr's `develop` branch, don't merge
|
- Rebase from Sonarr's `v5-develop` branch, don't merge
|
||||||
- Make meaningful commits, or squash them
|
- Make meaningful commits, or squash them
|
||||||
- Feel free to make a pull request before work is complete, this will let us see where its at and make comments/suggest improvements
|
- Feel free to make a pull request before work is complete, this will let us see where its at and make comments/suggest improvements
|
||||||
- Reach out to us on our [forums](https://forums.sonarr.tv/), [subreddit](https://www.reddit.com/r/sonarr/), [discord](https://discord.gg/Ex7FmFK), or [IRC](https://web.libera.chat/?channels=#sonarr) if you have any questions
|
- Reach out to us on our [forums](https://forums.sonarr.tv/), [subreddit](https://www.reddit.com/r/sonarr/), [discord](https://discord.gg/Ex7FmFK), or [IRC](https://web.libera.chat/?channels=#sonarr) if you have any questions
|
||||||
@@ -35,8 +38,9 @@ Setup guides, [FAQ](https://wiki.servarr.com/sonarr/faq), the more information w
|
|||||||
- One feature/bug fix per pull request to keep things clean and easy to understand
|
- One feature/bug fix per pull request to keep things clean and easy to understand
|
||||||
- Use 4 spaces instead of tabs, this should be the default for VS 2019 and WebStorm
|
- Use 4 spaces instead of tabs, this should be the default for VS 2019 and WebStorm
|
||||||
|
|
||||||
### Pull Requesting ###
|
### Pull Requesting
|
||||||
- Only make pull requests to develop (currently `develop`), never `main`, if you make a PR to master we'll comment on it and close it
|
|
||||||
|
- Only make pull requests to the default branch (currently `v5-develop`), never `main`, if you make a PR to main we'll comment on it and close it
|
||||||
- You're probably going to get some comments or questions from us, they will be to ensure consistency and maintainability
|
- You're probably going to get some comments or questions from us, they will be to ensure consistency and maintainability
|
||||||
- We'll try to respond to pull requests as soon as possible, if its been a day or two, please reach out to us, we may have missed it
|
- We'll try to respond to pull requests as soon as possible, if its been a day or two, please reach out to us, we may have missed it
|
||||||
- Each PR should come from its own [feature branch](http://martinfowler.com/bliki/FeatureBranch.html) not develop in your fork, it should have a meaningful branch name (what is being added/fixed)
|
- Each PR should come from its own [feature branch](http://martinfowler.com/bliki/FeatureBranch.html) not develop in your fork, it should have a meaningful branch name (what is being added/fixed)
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
width="70px" height="70px" viewBox="0 0 70 70" style="enable-background:new 0 0 70 70;" xml:space="preserve">
|
|
||||||
<g>
|
|
||||||
<g>
|
|
||||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-1.3318" y1="43.7371" x2="67.0419" y2="26.0967">
|
|
||||||
<stop offset="0.1237" style="stop-color:#7866FF"/>
|
|
||||||
<stop offset="0.5376" style="stop-color:#FE2EB6"/>
|
|
||||||
<stop offset="0.8548" style="stop-color:#FD0486"/>
|
|
||||||
</linearGradient>
|
|
||||||
<polygon style="fill:url(#SVGID_1_);" points="67.3,16 43.7,0 0,31.1 11.1,70 58.9,60.3 "/>
|
|
||||||
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="45.9148" y1="38.9098" x2="67.6577" y2="9.0989">
|
|
||||||
<stop offset="0.1237" style="stop-color:#FF0080"/>
|
|
||||||
<stop offset="0.2587" style="stop-color:#FE0385"/>
|
|
||||||
<stop offset="0.4109" style="stop-color:#FA0C92"/>
|
|
||||||
<stop offset="0.5713" style="stop-color:#F41BA9"/>
|
|
||||||
<stop offset="0.7363" style="stop-color:#EB2FC8"/>
|
|
||||||
<stop offset="0.8656" style="stop-color:#E343E6"/>
|
|
||||||
</linearGradient>
|
|
||||||
<polygon style="fill:url(#SVGID_2_);" points="67.3,16 43.7,0 38,15.7 38,47.8 70,47.8 "/>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
<rect x="13.4" y="13.4" style="fill:#000000;" width="43.2" height="43.2"/>
|
|
||||||
<rect x="17.4" y="48.5" style="fill:#FFFFFF;" width="16.2" height="2.7"/>
|
|
||||||
<g>
|
|
||||||
<path style="fill:#FFFFFF;" d="M17.4,19.1h6.9c5.6,0,9.5,3.8,9.5,8.9V28c0,5-3.9,8.9-9.5,8.9h-6.9V19.1z M21.4,22.7v10.7h3
|
|
||||||
c3.2,0,5.4-2.2,5.4-5.3V28c0-3.2-2.2-5.4-5.4-5.4H21.4z"/>
|
|
||||||
<polygon style="fill:#FFFFFF;" points="40.3,22.7 34.9,22.7 34.9,19.1 49.6,19.1 49.6,22.7 44.2,22.7 44.2,37 40.3,37 "/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,66 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
width="120.1px" height="130.2px" viewBox="0 0 120.1 130.2" style="enable-background:new 0 0 120.1 130.2;" xml:space="preserve"
|
|
||||||
>
|
|
||||||
<g>
|
|
||||||
<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.8412" y1="120.5578" x2="110.2402" y2="73.24">
|
|
||||||
<stop offset="0" style="stop-color:#FCEE39"/>
|
|
||||||
<stop offset="1" style="stop-color:#F37B3D"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path id="XMLID_3041_" style="fill:url(#XMLID_2_);" d="M118.6,71.8c0.9-0.8,1.4-1.9,1.5-3.2c0.1-2.6-1.8-4.7-4.4-4.9
|
|
||||||
c-1.2-0.1-2.4,0.4-3.3,1.1l0,0l-83.8,45.9c-1.9,0.8-3.6,2.2-4.7,4.1c-2.9,4.8-1.3,11,3.6,13.9c3.4,2,7.5,1.8,10.7-0.2l0,0l0,0
|
|
||||||
c0.2-0.2,0.5-0.3,0.7-0.5l78-54.8C117.3,72.9,118.4,72.1,118.6,71.8L118.6,71.8L118.6,71.8z"/>
|
|
||||||
<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="48.3607" y1="6.9083" x2="119.9179" y2="69.5546">
|
|
||||||
<stop offset="0" style="stop-color:#EF5A6B"/>
|
|
||||||
<stop offset="0.57" style="stop-color:#F26F4E"/>
|
|
||||||
<stop offset="1" style="stop-color:#F37B3D"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path id="XMLID_3049_" style="fill:url(#XMLID_3_);" d="M118.8,65.1L118.8,65.1L55,2.5C53.6,1,51.6,0,49.3,0
|
|
||||||
c-4.3,0-7.7,3.5-7.7,7.7v0c0,2.1,0.8,3.9,2.1,5.3l0,0l0,0c0.4,0.4,0.8,0.7,1.2,1l67.4,57.7l0,0c0.8,0.7,1.8,1.2,3,1.3
|
|
||||||
c2.6,0.1,4.7-1.8,4.9-4.4C120.2,67.3,119.7,66,118.8,65.1z"/>
|
|
||||||
<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="52.9467" y1="63.6407" x2="10.5379" y2="37.1562">
|
|
||||||
<stop offset="0" style="stop-color:#7C59A4"/>
|
|
||||||
<stop offset="0.3852" style="stop-color:#AF4C92"/>
|
|
||||||
<stop offset="0.7654" style="stop-color:#DC4183"/>
|
|
||||||
<stop offset="0.957" style="stop-color:#ED3D7D"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path id="XMLID_3042_" style="fill:url(#XMLID_4_);" d="M57.1,59.5C57,59.5,17.7,28.5,16.9,28l0,0l0,0c-0.6-0.3-1.2-0.6-1.8-0.9
|
|
||||||
c-5.8-2.2-12.2,0.8-14.4,6.6c-1.9,5.1,0.2,10.7,4.6,13.4l0,0l0,0C6,47.5,6.6,47.8,7.3,48c0.4,0.2,45.4,18.8,45.4,18.8l0,0
|
|
||||||
c1.8,0.8,3.9,0.3,5.1-1.2C59.3,63.7,59,61,57.1,59.5z"/>
|
|
||||||
<linearGradient id="XMLID_5_" gradientUnits="userSpaceOnUse" x1="52.1736" y1="3.7019" x2="10.7706" y2="37.8971">
|
|
||||||
<stop offset="0" style="stop-color:#EF5A6B"/>
|
|
||||||
<stop offset="0.364" style="stop-color:#EE4E72"/>
|
|
||||||
<stop offset="1" style="stop-color:#ED3D7D"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path id="XMLID_3057_" style="fill:url(#XMLID_5_);" d="M49.3,0c-1.7,0-3.3,0.6-4.6,1.5L4.9,28.3c-0.1,0.1-0.2,0.1-0.2,0.2l-0.1,0
|
|
||||||
l0,0c-1.7,1.2-3.1,3-3.9,5.1C-1.5,39.4,1.5,45.9,7.3,48c3.6,1.4,7.5,0.7,10.4-1.4l0,0l0,0c0.7-0.5,1.3-1,1.8-1.6l34.6-31.2l0,0
|
|
||||||
c1.8-1.4,3-3.6,3-6.1v0C57.1,3.5,53.6,0,49.3,0z"/>
|
|
||||||
<g id="XMLID_3008_">
|
|
||||||
<rect id="XMLID_3033_" x="34.6" y="37.4" style="fill:#000000;" width="51" height="51"/>
|
|
||||||
<rect id="XMLID_3032_" x="39" y="78.8" style="fill:#FFFFFF;" width="19.1" height="3.2"/>
|
|
||||||
<g id="XMLID_3009_">
|
|
||||||
<path id="XMLID_3030_" style="fill:#FFFFFF;" d="M38.8,50.8l1.5-1.4c0.4,0.5,0.8,0.8,1.3,0.8c0.6,0,0.9-0.4,0.9-1.2l0-5.3l2.3,0
|
|
||||||
l0,5.3c0,1-0.3,1.8-0.8,2.3c-0.5,0.5-1.3,0.8-2.3,0.8C40.2,52.2,39.4,51.6,38.8,50.8z"/>
|
|
||||||
<path id="XMLID_3028_" style="fill:#FFFFFF;" d="M45.3,43.8l6.7,0v1.9l-4.4,0V47l4,0l0,1.8l-4,0l0,1.3l4.5,0l0,2l-6.7,0
|
|
||||||
L45.3,43.8z"/>
|
|
||||||
<path id="XMLID_3026_" style="fill:#FFFFFF;" d="M55,45.8l-2.5,0l0-2l7.3,0l0,2l-2.5,0l0,6.3l-2.3,0L55,45.8z"/>
|
|
||||||
<path id="XMLID_3022_" style="fill:#FFFFFF;" d="M39,54l4.3,0c1,0,1.8,0.3,2.3,0.7c0.3,0.3,0.5,0.8,0.5,1.4v0
|
|
||||||
c0,1-0.5,1.5-1.3,1.9c1,0.3,1.6,0.9,1.6,2v0c0,1.4-1.2,2.3-3.1,2.3l-4.3,0L39,54z M43.8,56.6c0-0.5-0.4-0.7-1-0.7l-1.5,0l0,1.5
|
|
||||||
l1.4,0C43.4,57.3,43.8,57.1,43.8,56.6L43.8,56.6z M43,59l-1.8,0l0,1.5H43c0.7,0,1.1-0.3,1.1-0.8v0C44.1,59.2,43.7,59,43,59z"/>
|
|
||||||
<path id="XMLID_3019_" style="fill:#FFFFFF;" d="M46.8,54l3.9,0c1.3,0,2.1,0.3,2.7,0.9c0.5,0.5,0.7,1.1,0.7,1.9v0
|
|
||||||
c0,1.3-0.7,2.1-1.7,2.6l2,2.9l-2.6,0l-1.7-2.5h-1l0,2.5l-2.3,0L46.8,54z M50.6,58c0.8,0,1.2-0.4,1.2-1v0c0-0.7-0.5-1-1.2-1
|
|
||||||
l-1.5,0v2H50.6z"/>
|
|
||||||
<path id="XMLID_3016_" style="fill:#FFFFFF;" d="M56.8,54l2.2,0l3.5,8.4l-2.5,0l-0.6-1.5l-3.2,0l-0.6,1.5l-2.4,0L56.8,54z
|
|
||||||
M58.8,59l-0.9-2.3L57,59L58.8,59z"/>
|
|
||||||
<path id="XMLID_3014_" style="fill:#FFFFFF;" d="M62.8,54l2.3,0l0,8.3l-2.3,0L62.8,54z"/>
|
|
||||||
<path id="XMLID_3012_" style="fill:#FFFFFF;" d="M65.7,54l2.1,0l3.4,4.4l0-4.4l2.3,0l0,8.3l-2,0L68,57.8l0,4.6l-2.3,0L65.7,54z"
|
|
||||||
/>
|
|
||||||
<path id="XMLID_3010_" style="fill:#FFFFFF;" d="M73.7,61.1l1.3-1.5c0.8,0.7,1.7,1,2.7,1c0.6,0,1-0.2,1-0.6v0
|
|
||||||
c0-0.4-0.3-0.5-1.4-0.8c-1.8-0.4-3.1-0.9-3.1-2.6v0c0-1.5,1.2-2.7,3.2-2.7c1.4,0,2.5,0.4,3.4,1.1l-1.2,1.6
|
|
||||||
c-0.8-0.5-1.6-0.8-2.3-0.8c-0.6,0-0.8,0.2-0.8,0.5v0c0,0.4,0.3,0.5,1.4,0.8c1.9,0.4,3.1,1,3.1,2.6v0c0,1.7-1.3,2.7-3.4,2.7
|
|
||||||
C76.1,62.5,74.7,62,73.7,61.1z"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 4.8 KiB |
@@ -1,50 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
width="70px" height="70px" viewBox="0 0 70 70" style="enable-background:new 0 0 70 70;" xml:space="preserve">
|
|
||||||
<g>
|
|
||||||
<g>
|
|
||||||
<g>
|
|
||||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="22.9451" y1="75.7869" x2="74.7868" y2="20.6415">
|
|
||||||
<stop offset="1.612903e-002" style="stop-color:#B35BA3"/>
|
|
||||||
<stop offset="0.4044" style="stop-color:#C41E57"/>
|
|
||||||
<stop offset="0.4677" style="stop-color:#C41E57"/>
|
|
||||||
<stop offset="0.6505" style="stop-color:#EB8523"/>
|
|
||||||
<stop offset="0.9516" style="stop-color:#FEBD11"/>
|
|
||||||
</linearGradient>
|
|
||||||
<polygon style="fill:url(#SVGID_1_);" points="49.8,15.2 36,36.7 58.4,70 70,23.1 "/>
|
|
||||||
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="17.7187" y1="73.2922" x2="69.5556" y2="18.1519">
|
|
||||||
<stop offset="1.612903e-002" style="stop-color:#B35BA3"/>
|
|
||||||
<stop offset="0.4044" style="stop-color:#C41E57"/>
|
|
||||||
<stop offset="0.4677" style="stop-color:#C41E57"/>
|
|
||||||
<stop offset="0.7043" style="stop-color:#EB8523"/>
|
|
||||||
</linearGradient>
|
|
||||||
<polygon style="fill:url(#SVGID_2_);" points="51.1,15.7 49,0 18.8,33.6 27.6,42.3 20.8,70 58.4,70 "/>
|
|
||||||
</g>
|
|
||||||
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="1.8281" y1="53.4275" x2="48.8245" y2="9.2255">
|
|
||||||
<stop offset="1.612903e-002" style="stop-color:#B35BA3"/>
|
|
||||||
<stop offset="0.6613" style="stop-color:#C41E57"/>
|
|
||||||
</linearGradient>
|
|
||||||
<polygon style="fill:url(#SVGID_3_);" points="49,0 11.6,0 0,47.1 55.6,47.1 "/>
|
|
||||||
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="49.8935" y1="-11.5569" x2="48.8588" y2="24.0352">
|
|
||||||
<stop offset="0.5" style="stop-color:#C41E57"/>
|
|
||||||
<stop offset="0.6668" style="stop-color:#D13F48"/>
|
|
||||||
<stop offset="0.7952" style="stop-color:#D94F39"/>
|
|
||||||
<stop offset="0.8656" style="stop-color:#DD5433"/>
|
|
||||||
</linearGradient>
|
|
||||||
<polygon style="fill:url(#SVGID_4_);" points="55.3,47.1 51.1,15.7 49,0 41.7,23 "/>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
|
|
||||||
<rect x="13.4" y="13.5" transform="matrix(-1 2.577289e-003 -2.577289e-003 -1 70.0288 70.081)" style="fill:#000000;" width="43.2" height="43.2"/>
|
|
||||||
|
|
||||||
<rect x="17.6" y="48.6" transform="matrix(1 -2.577289e-003 2.577289e-003 1 -0.1287 6.634109e-002)" style="fill:#FFFFFF;" width="16.2" height="2.7"/>
|
|
||||||
<path style="fill:#FFFFFF;" d="M17.4,19.1l8.2,0c2.3,0,4,0.6,5.2,1.8c1,1,1.5,2.4,1.5,4.1l0,0.1c0,1.5-0.3,2.6-1.1,3.5
|
|
||||||
c-0.7,0.9-1.6,1.6-2.8,2l4.4,6.4l-4.6,0l-3.7-5.5l-3.3,0l0,5.5l-3.9,0L17.4,19.1z M25.3,27.8c1,0,1.7-0.2,2.2-0.7
|
|
||||||
c0.5-0.5,0.8-1.1,0.8-1.8l0-0.1c0-0.9-0.3-1.5-0.8-1.9c-0.5-0.4-1.3-0.6-2.3-0.6l-3.9,0l0,5.1L25.3,27.8z"/>
|
|
||||||
<path style="fill:#FFFFFF;" d="M36,33.2l-1.9,0l0-3.3l2.5,0l0.6-3.8l-2.3,0l0-3.3l2.8,0l0.6-3.7l3.4,0l-0.6,3.7l3.7,0l0.6-3.7
|
|
||||||
l3.4,0l-0.6,3.7l1.9,0l0,3.3l-2.5,0L47,29.9l2.3,0l0,3.3l-2.8,0L45.8,37l-3.4,0l0.7-3.8l-3.7,0L38.7,37l-3.4,0L36,33.2z
|
|
||||||
M43.7,29.9l0.6-3.8l-3.7,0L40,29.9L43.7,29.9z"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -1,64 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 70 70" style="enable-background:new 0 0 70 70;" xml:space="preserve">
|
|
||||||
<g>
|
|
||||||
<g>
|
|
||||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="1.7738" y1="31.2729" x2="40.1662" y2="31.2729">
|
|
||||||
<stop offset="0" style="stop-color:#905CFB"/>
|
|
||||||
<stop offset="6.772543e-002" style="stop-color:#776CF9"/>
|
|
||||||
<stop offset="0.1729" style="stop-color:#5681F7"/>
|
|
||||||
<stop offset="0.2865" style="stop-color:#3B92F5"/>
|
|
||||||
<stop offset="0.4097" style="stop-color:#269FF4"/>
|
|
||||||
<stop offset="0.5474" style="stop-color:#17A9F3"/>
|
|
||||||
<stop offset="0.7111" style="stop-color:#0FAEF2"/>
|
|
||||||
<stop offset="0.9677" style="stop-color:#0CB0F2"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path style="fill:url(#SVGID_1_);" d="M39.7,47.9l-6.1-34c-0.4-2.4-1.2-4.8-2.7-7.1c-2-3.2-5.2-5.4-8.8-6.3
|
|
||||||
C7.9-2.9-2.6,11.3,3.6,23.9c0,0,0,0,0,0l14.8,31.7c0.4,1,1,2,1.7,2.9c1.2,1.6,2.8,2.8,4.7,3.4C34.4,64.9,42.1,56.4,39.7,47.9z"/>
|
|
||||||
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="5.3113" y1="9.6691" x2="69.2278" y2="43.8664">
|
|
||||||
<stop offset="0" style="stop-color:#905CFB"/>
|
|
||||||
<stop offset="6.772543e-002" style="stop-color:#776CF9"/>
|
|
||||||
<stop offset="0.1729" style="stop-color:#5681F7"/>
|
|
||||||
<stop offset="0.2865" style="stop-color:#3B92F5"/>
|
|
||||||
<stop offset="0.4097" style="stop-color:#269FF4"/>
|
|
||||||
<stop offset="0.5474" style="stop-color:#17A9F3"/>
|
|
||||||
<stop offset="0.7111" style="stop-color:#0FAEF2"/>
|
|
||||||
<stop offset="0.9677" style="stop-color:#0CB0F2"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path style="fill:url(#SVGID_2_);" d="M67.4,26.5c-1.4-2.2-3.4-3.9-5.7-4.9L25.5,1.7l0,0c-1-0.5-2.1-1-3.3-1.3
|
|
||||||
C6.7-3.2-4.4,13.8,5.5,27c1.5,2,3.6,3.6,6,4.5L48,47.9c0.8,0.5,1.6,0.8,2.5,1.1C64.5,53.4,75.1,38.6,67.4,26.5z"/>
|
|
||||||
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="-19.2836" y1="70.8198" x2="55.9833" y2="33.1863">
|
|
||||||
<stop offset="0" style="stop-color:#3BEA62"/>
|
|
||||||
<stop offset="0.117" style="stop-color:#31DE80"/>
|
|
||||||
<stop offset="0.3025" style="stop-color:#24CEA8"/>
|
|
||||||
<stop offset="0.4844" style="stop-color:#1AC1C9"/>
|
|
||||||
<stop offset="0.6592" style="stop-color:#12B7DF"/>
|
|
||||||
<stop offset="0.8238" style="stop-color:#0EB2ED"/>
|
|
||||||
<stop offset="0.9677" style="stop-color:#0CB0F2"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path style="fill:url(#SVGID_3_);" d="M67.4,26.5c-1.8-2.8-4.6-4.8-7.9-5.6c-3.5-0.8-6.8-0.5-9.6,0.7L11.4,36.1
|
|
||||||
c0,0-0.2,0.1-0.6,0.4C0.9,40.4-4,53.3,4,64c1.8,2.4,4.3,4.2,7.1,5c5.3,1.6,10.1,1,14-1.1c0,0,0.1,0,0.1,0l37.6-20.1
|
|
||||||
c0,0,0,0,0.1-0.1C69.5,43.9,72.6,34.6,67.4,26.5z"/>
|
|
||||||
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="38.9439" y1="5.8503" x2="5.4232" y2="77.5093">
|
|
||||||
<stop offset="0" style="stop-color:#3BEA62"/>
|
|
||||||
<stop offset="9.397750e-002" style="stop-color:#2FDB87"/>
|
|
||||||
<stop offset="0.196" style="stop-color:#24CEA8"/>
|
|
||||||
<stop offset="0.3063" style="stop-color:#1BC3C3"/>
|
|
||||||
<stop offset="0.4259" style="stop-color:#14BAD8"/>
|
|
||||||
<stop offset="0.5596" style="stop-color:#10B5E7"/>
|
|
||||||
<stop offset="0.7185" style="stop-color:#0DB1EF"/>
|
|
||||||
<stop offset="0.9677" style="stop-color:#0CB0F2"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path style="fill:url(#SVGID_4_);" d="M50.3,12.8c1.2-2.7,1.1-6-0.9-9c-1.1-1.8-2.9-3-4.9-3.5c-4.5-1.1-8.3,1-10.1,4.2L3.5,42
|
|
||||||
c0,0,0,0,0,0.1C-0.9,47.9-1.6,56.5,4,64c1.8,2.4,4.3,4.2,7.1,5c10.5,3.3,19.3-2.5,22.1-10.8L50.3,12.8z"/>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
<rect x="13.4" y="13.4" style="fill:#000000;" width="43.2" height="43.2"/>
|
|
||||||
<rect x="17.5" y="48.5" style="fill:#FFFFFF;" width="16.2" height="2.7"/>
|
|
||||||
<polygon style="fill:#FFFFFF;" points="22.9,22.7 17.5,22.7 17.5,19.1 32.3,19.1 32.3,22.7 26.8,22.7 26.8,37 22.9,37 "/>
|
|
||||||
<path style="fill:#FFFFFF;" d="M32.5,28.1L32.5,28.1c0-5.1,3.8-9.3,9.3-9.3c3.4,0,5.4,1.1,7.1,2.8l-2.5,2.9c-1.4-1.3-2.8-2-4.6-2
|
|
||||||
c-3,0-5.2,2.5-5.2,5.6V28c0,3.1,2.1,5.6,5.2,5.6c2,0,3.3-0.8,4.7-2.1l2.5,2.5c-1.8,2-3.9,3.2-7.3,3.2
|
|
||||||
C36.4,37.3,32.5,33.2,32.5,28.1"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 4.0 KiB |
@@ -1,6 +1,6 @@
|
|||||||
# <img width="24px" src="./Logo/256.png" alt="Sonarr"></img> Sonarr
|
# <img width="24px" src="./Logo/256.png" alt="Sonarr"></img> Sonarr
|
||||||
|
|
||||||
[](https://translate.servarr.com/engage/servarr/)
|
[](https://translate.servarr.com/engage/servarr/)
|
||||||
[](#backers)
|
[](#backers)
|
||||||
[](#sponsors)
|
[](#sponsors)
|
||||||
[](#mega-sponsors)
|
[](#mega-sponsors)
|
||||||
@@ -12,7 +12,7 @@ Sonarr is a PVR for Usenet and BitTorrent users. It can monitor multiple RSS fee
|
|||||||
- [Download/Installation](https://sonarr.tv/#downloads-v3)
|
- [Download/Installation](https://sonarr.tv/#downloads-v3)
|
||||||
- [FAQ](https://wiki.servarr.com/sonarr/faq)
|
- [FAQ](https://wiki.servarr.com/sonarr/faq)
|
||||||
- [Wiki](https://wiki.servarr.com/Sonarr)
|
- [Wiki](https://wiki.servarr.com/Sonarr)
|
||||||
- [v4 Beta API Documentation](https://sonarr.tv/docs/api)
|
- [API Documentation](https://sonarr.tv/docs/api)
|
||||||
- [Donate](https://sonarr.tv/donate)
|
- [Donate](https://sonarr.tv/donate)
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
@@ -33,7 +33,7 @@ Note: GitHub Issues are for Bugs and Feature Requests Only
|
|||||||
- Support for major platforms: Windows, Linux, macOS, Raspberry Pi, etc.
|
- Support for major platforms: Windows, Linux, macOS, Raspberry Pi, etc.
|
||||||
- Automatically detects new episodes
|
- Automatically detects new episodes
|
||||||
- Can scan your existing library and download any missing episodes
|
- Can scan your existing library and download any missing episodes
|
||||||
- Can watch for better quality of the episodes you already have and do an automatic upgrade. *eg. from DVD to Blu-Ray*
|
- Can watch for better quality of the episodes you already have and do an automatic upgrade. _eg. from DVD to Blu-Ray_
|
||||||
- Automatic failed download handling will try another release if one fails
|
- Automatic failed download handling will try another release if one fails
|
||||||
- Manual search so you can pick any release or to see why a release was not downloaded automatically
|
- Manual search so you can pick any release or to see why a release was not downloaded automatically
|
||||||
- Fully configurable episode renaming
|
- Fully configurable episode renaming
|
||||||
@@ -52,7 +52,7 @@ This project exists thanks to all the people who contribute. [Contribute](CONTRI
|
|||||||
|
|
||||||
### Supporters
|
### Supporters
|
||||||
|
|
||||||
This project would not be possible without the support of our users and software providers.
|
This project would not be possible without the support of our users and software providers.
|
||||||
[**Become a sponsor or backer**](https://opencollective.com/sonarr) to help us out!
|
[**Become a sponsor or backer**](https://opencollective.com/sonarr) to help us out!
|
||||||
|
|
||||||
#### Mega Sponsors
|
#### Mega Sponsors
|
||||||
@@ -69,13 +69,17 @@ This project would not be possible without the support of our users and software
|
|||||||
|
|
||||||
#### JetBrains
|
#### JetBrains
|
||||||
|
|
||||||
Thank you to [<img src="/Logo/Jetbrains/jetbrains.svg" alt="JetBrains" width="32"> JetBrains](http://www.jetbrains.com/) for providing us with free licenses to their great tools
|
Thank you to [<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.png" alt="JetBrains" width="96">](http://www.jetbrains.com/) for providing us with free licenses to their great tools
|
||||||
|
|
||||||
* [<img src="/Logo/Jetbrains/teamcity.svg" alt="TeamCity" width="32"> TeamCity](http://www.jetbrains.com/teamcity/)
|
[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/TeamCity.png" alt="TeamCity" width="64">](http://www.jetbrains.com/teamcity/)
|
||||||
* [<img src="/Logo/Jetbrains/resharper.svg" alt="ReSharper" width="32"> ReSharper](http://www.jetbrains.com/resharper/)
|
|
||||||
* [<img src="/Logo/Jetbrains/dottrace.svg" alt="dotTrace" width="32"> dotTrace](http://www.jetbrains.com/dottrace/)
|
[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/ReSharper.png" alt="ReSharper" width="64">](http://www.jetbrains.com/resharper/)
|
||||||
|
|
||||||
|
[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/dotTrace.png" alt="dotTrace" width="64">](http://www.jetbrains.com/dottrace/)
|
||||||
|
|
||||||
|
[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/Rider.png" alt="Rider" width="64">](http://www.jetbrains.com/rider/)
|
||||||
|
|
||||||
### Licenses
|
### Licenses
|
||||||
|
|
||||||
- [GNU GPL v3](http://www.gnu.org/licenses/gpl.html)
|
- [GNU GPL v3](http://www.gnu.org/licenses/gpl.html)
|
||||||
- Copyright 2010-2023
|
- Copyright 2010-2025
|
||||||
|
|||||||
@@ -1,455 +0,0 @@
|
|||||||
#! /usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
outputFolder='_output'
|
|
||||||
testPackageFolder='_tests'
|
|
||||||
artifactsFolder="_artifacts";
|
|
||||||
framework="${FRAMEWORK:=net6.0}"
|
|
||||||
|
|
||||||
ProgressStart()
|
|
||||||
{
|
|
||||||
echo "::group::$1"
|
|
||||||
echo "Start '$1'"
|
|
||||||
}
|
|
||||||
|
|
||||||
ProgressEnd()
|
|
||||||
{
|
|
||||||
echo "Finish '$1'"
|
|
||||||
echo "::endgroup::"
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateVersionNumber()
|
|
||||||
{
|
|
||||||
if [ "$SONARR_VERSION" != "" ]; then
|
|
||||||
echo "Updating version info to: $SONARR_VERSION"
|
|
||||||
sed -i'' -e "s/<AssemblyVersion>[0-9.*]\+<\/AssemblyVersion>/<AssemblyVersion>$SONARR_VERSION<\/AssemblyVersion>/g" src/Directory.Build.props
|
|
||||||
sed -i'' -e "s/<AssemblyConfiguration>[\$()A-Za-z-]\+<\/AssemblyConfiguration>/<AssemblyConfiguration>${BRANCH}<\/AssemblyConfiguration>/g" src/Directory.Build.props
|
|
||||||
sed -i'' -e "s/<string>10.0.0.0<\/string>/<string>$SONARR_VERSION<\/string>/g" distribution/macOS/Sonarr.app/Contents/Info.plist
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
EnableExtraPlatformsInSDK()
|
|
||||||
{
|
|
||||||
BUNDLEDVERSIONS="${SDK_PATH}/Microsoft.NETCoreSdk.BundledVersions.props"
|
|
||||||
if grep -q freebsd-x64 "$BUNDLEDVERSIONS"; then
|
|
||||||
echo "Extra platforms already enabled"
|
|
||||||
else
|
|
||||||
echo "Enabling extra platform support"
|
|
||||||
sed -i.ORI 's/osx-x64/osx-x64;freebsd-x64/' "$BUNDLEDVERSIONS"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
EnableExtraPlatforms()
|
|
||||||
{
|
|
||||||
if grep -qv freebsd-x64 src/Directory.Build.props; then
|
|
||||||
sed -i'' -e "s^<RuntimeIdentifiers>\(.*\)</RuntimeIdentifiers>^<RuntimeIdentifiers>\1;freebsd-x64</RuntimeIdentifiers>^g" src/Directory.Build.props
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
LintUI()
|
|
||||||
{
|
|
||||||
ProgressStart 'ESLint'
|
|
||||||
yarn lint
|
|
||||||
ProgressEnd 'ESLint'
|
|
||||||
|
|
||||||
ProgressStart 'Stylelint'
|
|
||||||
yarn stylelint
|
|
||||||
ProgressEnd 'Stylelint'
|
|
||||||
}
|
|
||||||
|
|
||||||
Build()
|
|
||||||
{
|
|
||||||
ProgressStart 'Build'
|
|
||||||
|
|
||||||
rm -rf $outputFolder
|
|
||||||
rm -rf $testPackageFolder
|
|
||||||
|
|
||||||
slnFile=src/Sonarr.sln
|
|
||||||
|
|
||||||
if [ $os = "windows" ]; then
|
|
||||||
platform=Windows
|
|
||||||
else
|
|
||||||
platform=Posix
|
|
||||||
fi
|
|
||||||
|
|
||||||
dotnet clean $slnFile -c Debug
|
|
||||||
dotnet clean $slnFile -c Release
|
|
||||||
|
|
||||||
if [[ -z "$RID" || -z "$FRAMEWORK" ]];
|
|
||||||
then
|
|
||||||
dotnet msbuild -restore $slnFile -p:Configuration=Release -p:Platform=$platform -t:PublishAllRids
|
|
||||||
else
|
|
||||||
dotnet msbuild -restore $slnFile -p:Configuration=Release -p:Platform=$platform -p:RuntimeIdentifiers=$RID -t:PublishAllRids
|
|
||||||
fi
|
|
||||||
|
|
||||||
ProgressEnd 'Build'
|
|
||||||
}
|
|
||||||
|
|
||||||
YarnInstall()
|
|
||||||
{
|
|
||||||
ProgressStart 'yarn install'
|
|
||||||
yarn install --frozen-lockfile --network-timeout 120000
|
|
||||||
ProgressEnd 'yarn install'
|
|
||||||
}
|
|
||||||
|
|
||||||
RunWebpack()
|
|
||||||
{
|
|
||||||
ProgressStart 'Running webpack'
|
|
||||||
yarn run build --env production
|
|
||||||
ProgressEnd 'Running webpack'
|
|
||||||
}
|
|
||||||
|
|
||||||
PackageFiles()
|
|
||||||
{
|
|
||||||
local folder="$1"
|
|
||||||
local framework="$2"
|
|
||||||
local runtime="$3"
|
|
||||||
|
|
||||||
rm -rf $folder
|
|
||||||
mkdir -p $folder
|
|
||||||
cp -r $outputFolder/$framework/$runtime/publish/* $folder
|
|
||||||
cp -r $outputFolder/Sonarr.Update/$framework/$runtime/publish $folder/Sonarr.Update
|
|
||||||
|
|
||||||
if [ "$FRONTEND" = "YES" ];
|
|
||||||
then
|
|
||||||
cp -r $outputFolder/UI $folder
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Adding LICENSE"
|
|
||||||
cp LICENSE.md $folder
|
|
||||||
}
|
|
||||||
|
|
||||||
PackageLinux()
|
|
||||||
{
|
|
||||||
local framework="$1"
|
|
||||||
local runtime="$2"
|
|
||||||
|
|
||||||
ProgressStart "Creating $runtime Package for $framework"
|
|
||||||
|
|
||||||
local folder=$artifactsFolder/$runtime/$framework/Sonarr
|
|
||||||
|
|
||||||
PackageFiles "$folder" "$framework" "$runtime"
|
|
||||||
|
|
||||||
echo "Removing Service helpers"
|
|
||||||
rm -f $folder/ServiceUninstall.*
|
|
||||||
rm -f $folder/ServiceInstall.*
|
|
||||||
|
|
||||||
echo "Removing Sonarr.Windows"
|
|
||||||
rm $folder/Sonarr.Windows.*
|
|
||||||
|
|
||||||
echo "Adding Sonarr.Mono to UpdatePackage"
|
|
||||||
cp $folder/Sonarr.Mono.* $folder/Sonarr.Update
|
|
||||||
if [ "$framework" = "$framework" ]; then
|
|
||||||
cp $folder/Mono.Posix.NETStandard.* $folder/Sonarr.Update
|
|
||||||
cp $folder/libMonoPosixHelper.* $folder/Sonarr.Update
|
|
||||||
fi
|
|
||||||
|
|
||||||
ProgressEnd "Creating $runtime Package for $framework"
|
|
||||||
}
|
|
||||||
|
|
||||||
PackageMacOS()
|
|
||||||
{
|
|
||||||
local framework="$1"
|
|
||||||
local runtime="$2"
|
|
||||||
|
|
||||||
ProgressStart "Creating $runtime Package for $framework"
|
|
||||||
|
|
||||||
local folder=$artifactsFolder/$runtime/$framework/Sonarr
|
|
||||||
|
|
||||||
PackageFiles "$folder" "$framework" "$runtime"
|
|
||||||
|
|
||||||
echo "Removing Service helpers"
|
|
||||||
rm -f $folder/ServiceUninstall.*
|
|
||||||
rm -f $folder/ServiceInstall.*
|
|
||||||
|
|
||||||
echo "Removing Sonarr.Windows"
|
|
||||||
rm $folder/Sonarr.Windows.*
|
|
||||||
|
|
||||||
echo "Adding Sonarr.Mono to UpdatePackage"
|
|
||||||
cp $folder/Sonarr.Mono.* $folder/Sonarr.Update
|
|
||||||
if [ "$framework" = "$framework" ]; then
|
|
||||||
cp $folder/Mono.Posix.NETStandard.* $folder/Sonarr.Update
|
|
||||||
cp $folder/libMonoPosixHelper.* $folder/Sonarr.Update
|
|
||||||
fi
|
|
||||||
|
|
||||||
ProgressEnd "Creating $runtime Package for $framework"
|
|
||||||
}
|
|
||||||
|
|
||||||
PackageMacOSApp()
|
|
||||||
{
|
|
||||||
local framework="$1"
|
|
||||||
local runtime="$2"
|
|
||||||
|
|
||||||
ProgressStart "Creating $runtime App Package for $framework"
|
|
||||||
|
|
||||||
local folder=$artifactsFolder/$runtime-app/$framework
|
|
||||||
|
|
||||||
rm -rf $folder
|
|
||||||
mkdir -p $folder
|
|
||||||
cp -r distribution/macOS/Sonarr.app $folder
|
|
||||||
mkdir -p $folder/Sonarr.app/Contents/MacOS
|
|
||||||
|
|
||||||
echo "Copying Binaries"
|
|
||||||
cp -r $artifactsFolder/$runtime/$framework/Sonarr/* $folder/Sonarr.app/Contents/MacOS
|
|
||||||
|
|
||||||
echo "Removing Update Folder"
|
|
||||||
rm -r $folder/Sonarr.app/Contents/MacOS/Sonarr.Update
|
|
||||||
|
|
||||||
ProgressEnd "Creating $runtime App Package for $framework"
|
|
||||||
}
|
|
||||||
|
|
||||||
PackageWindows()
|
|
||||||
{
|
|
||||||
local framework="$1"
|
|
||||||
local runtime="$2"
|
|
||||||
|
|
||||||
ProgressStart "Creating Windows Package for $framework"
|
|
||||||
|
|
||||||
local folder=$artifactsFolder/$runtime/$framework/Sonarr
|
|
||||||
|
|
||||||
PackageFiles "$folder" "$framework" "$runtime"
|
|
||||||
cp -r $outputFolder/$framework-windows/$runtime/publish/* $folder
|
|
||||||
|
|
||||||
echo "Removing Sonarr.Mono"
|
|
||||||
rm -f $folder/Sonarr.Mono.*
|
|
||||||
rm -f $folder/Mono.Posix.NETStandard.*
|
|
||||||
rm -f $folder/libMonoPosixHelper.*
|
|
||||||
|
|
||||||
echo "Adding Sonarr.Windows to UpdatePackage"
|
|
||||||
cp $folder/Sonarr.Windows.* $folder/Sonarr.Update
|
|
||||||
|
|
||||||
ProgressEnd "Creating Windows Package for $framework"
|
|
||||||
}
|
|
||||||
|
|
||||||
Package()
|
|
||||||
{
|
|
||||||
local framework="$1"
|
|
||||||
local runtime="$2"
|
|
||||||
local SPLIT
|
|
||||||
|
|
||||||
IFS='-' read -ra SPLIT <<< "$runtime"
|
|
||||||
|
|
||||||
case "${SPLIT[0]}" in
|
|
||||||
linux|freebsd*)
|
|
||||||
PackageLinux "$framework" "$runtime"
|
|
||||||
;;
|
|
||||||
win)
|
|
||||||
PackageWindows "$framework" "$runtime"
|
|
||||||
;;
|
|
||||||
osx)
|
|
||||||
PackageMacOS "$framework" "$runtime"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
PackageTests()
|
|
||||||
{
|
|
||||||
local framework="$1"
|
|
||||||
local runtime="$2"
|
|
||||||
|
|
||||||
ProgressStart "Creating $runtime Test Package for $framework"
|
|
||||||
|
|
||||||
cp test.sh "$testPackageFolder/$framework/$runtime/publish"
|
|
||||||
|
|
||||||
rm -f $testPackageFolder/$framework/$runtime/*.log.config
|
|
||||||
|
|
||||||
ProgressEnd "Creating $runtime Test Package for $framework"
|
|
||||||
}
|
|
||||||
|
|
||||||
UploadTestArtifacts()
|
|
||||||
{
|
|
||||||
local framework="$1"
|
|
||||||
|
|
||||||
ProgressStart 'Publishing Test Artifacts'
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
for dir in $testPackageFolder/$framework/*
|
|
||||||
do
|
|
||||||
local runtime=$(basename "$dir")
|
|
||||||
echo "##teamcity[publishArtifacts '$testPackageFolder/$framework/$runtime/publish/** => tests.$runtime.zip']"
|
|
||||||
done
|
|
||||||
|
|
||||||
ProgressEnd 'Publishing Test Artifacts'
|
|
||||||
}
|
|
||||||
|
|
||||||
UploadArtifacts()
|
|
||||||
{
|
|
||||||
local framework="$1"
|
|
||||||
|
|
||||||
ProgressStart 'Publishing Artifacts'
|
|
||||||
|
|
||||||
# Releases
|
|
||||||
for dir in $artifactsFolder/*
|
|
||||||
do
|
|
||||||
local runtime=$(basename "$dir")
|
|
||||||
|
|
||||||
echo "##teamcity[publishArtifacts '$artifactsFolder/$runtime/$framework/** => Sonarr.$BRANCH.$SONARR_VERSION.$runtime.zip']"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Debian Package / Windows installer / macOS app
|
|
||||||
echo "##teamcity[publishArtifacts 'distribution/** => distribution.zip']"
|
|
||||||
|
|
||||||
ProgressEnd 'Publishing Artifacts'
|
|
||||||
}
|
|
||||||
|
|
||||||
UploadUIArtifacts()
|
|
||||||
{
|
|
||||||
local framework="$1"
|
|
||||||
|
|
||||||
ProgressStart 'Publishing UI Artifacts'
|
|
||||||
|
|
||||||
# UI folder
|
|
||||||
echo "##teamcity[publishArtifacts '$outputFolder/UI/** => UI.zip']"
|
|
||||||
|
|
||||||
ProgressEnd 'Publishing UI Artifacts'
|
|
||||||
}
|
|
||||||
|
|
||||||
# Use mono or .net depending on OS
|
|
||||||
case "$(uname -s)" in
|
|
||||||
CYGWIN*|MINGW32*|MINGW64*|MSYS*)
|
|
||||||
# on windows, use dotnet
|
|
||||||
os="windows"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# otherwise use mono
|
|
||||||
os="posix"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
POSITIONAL=()
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
echo "No arguments provided, building everything"
|
|
||||||
BACKEND=YES
|
|
||||||
FRONTEND=YES
|
|
||||||
PACKAGES=YES
|
|
||||||
LINT=YES
|
|
||||||
ENABLE_EXTRA_PLATFORMS=NO
|
|
||||||
ENABLE_EXTRA_PLATFORMS_IN_SDK=NO
|
|
||||||
fi
|
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]
|
|
||||||
do
|
|
||||||
key="$1"
|
|
||||||
|
|
||||||
case $key in
|
|
||||||
--backend)
|
|
||||||
BACKEND=YES
|
|
||||||
shift # past argument
|
|
||||||
;;
|
|
||||||
--enable-bsd|--enable-extra-platforms)
|
|
||||||
ENABLE_EXTRA_PLATFORMS=YES
|
|
||||||
shift # past argument
|
|
||||||
;;
|
|
||||||
--enable-extra-platforms-in-sdk)
|
|
||||||
ENABLE_EXTRA_PLATFORMS_IN_SDK=YES
|
|
||||||
shift # past argument
|
|
||||||
;;
|
|
||||||
-r|--runtime)
|
|
||||||
RID="$2"
|
|
||||||
shift # past argument
|
|
||||||
shift # past value
|
|
||||||
;;
|
|
||||||
-f|--framework)
|
|
||||||
FRAMEWORK="$2"
|
|
||||||
shift # past argument
|
|
||||||
shift # past value
|
|
||||||
;;
|
|
||||||
--frontend)
|
|
||||||
FRONTEND=YES
|
|
||||||
shift # past argument
|
|
||||||
;;
|
|
||||||
--packages)
|
|
||||||
PACKAGES=YES
|
|
||||||
shift # past argument
|
|
||||||
;;
|
|
||||||
--lint)
|
|
||||||
LINT=YES
|
|
||||||
shift # past argument
|
|
||||||
;;
|
|
||||||
--all)
|
|
||||||
BACKEND=YES
|
|
||||||
FRONTEND=YES
|
|
||||||
PACKAGES=YES
|
|
||||||
LINT=YES
|
|
||||||
shift # past argument
|
|
||||||
;;
|
|
||||||
*) # unknown option
|
|
||||||
POSITIONAL+=("$1") # save it in an array for later
|
|
||||||
shift # past argument
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
set -- "${POSITIONAL[@]}" # restore positional parameters
|
|
||||||
|
|
||||||
if [ "$ENABLE_EXTRA_PLATFORMS_IN_SDK" = "YES" ];
|
|
||||||
then
|
|
||||||
EnableExtraPlatformsInSDK
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$BACKEND" = "YES" ];
|
|
||||||
then
|
|
||||||
UpdateVersionNumber
|
|
||||||
if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ];
|
|
||||||
then
|
|
||||||
EnableExtraPlatforms
|
|
||||||
fi
|
|
||||||
|
|
||||||
Build
|
|
||||||
|
|
||||||
if [[ -z "$RID" || -z "$FRAMEWORK" ]];
|
|
||||||
then
|
|
||||||
PackageTests "$framework" "win-x64"
|
|
||||||
PackageTests "$framework" "win-x86"
|
|
||||||
PackageTests "$framework" "linux-x64"
|
|
||||||
PackageTests "$framework" "linux-musl-x64"
|
|
||||||
PackageTests "$framework" "osx-x64"
|
|
||||||
if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ];
|
|
||||||
then
|
|
||||||
PackageTests "$framework" "freebsd-x64"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
PackageTests "$FRAMEWORK" "$RID"
|
|
||||||
fi
|
|
||||||
|
|
||||||
UploadTestArtifacts "$framework"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$FRONTEND" = "YES" ];
|
|
||||||
then
|
|
||||||
YarnInstall
|
|
||||||
|
|
||||||
if [ "$LINT" = "YES" ];
|
|
||||||
then
|
|
||||||
LintUI
|
|
||||||
fi
|
|
||||||
|
|
||||||
RunWebpack
|
|
||||||
UploadUIArtifacts
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$PACKAGES" = "YES" ];
|
|
||||||
then
|
|
||||||
UpdateVersionNumber
|
|
||||||
|
|
||||||
if [[ -z "$RID" || -z "$FRAMEWORK" ]];
|
|
||||||
then
|
|
||||||
Package "$framework" "win-x64"
|
|
||||||
Package "$framework" "win-x86"
|
|
||||||
Package "$framework" "linux-x64"
|
|
||||||
Package "$framework" "linux-musl-x64"
|
|
||||||
Package "$framework" "linux-arm64"
|
|
||||||
Package "$framework" "linux-musl-arm64"
|
|
||||||
Package "$framework" "linux-arm"
|
|
||||||
Package "$framework" "osx-x64"
|
|
||||||
Package "$framework" "osx-arm64"
|
|
||||||
if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ];
|
|
||||||
then
|
|
||||||
Package "$framework" "freebsd-x64"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
Package "$FRAMEWORK" "$RID"
|
|
||||||
fi
|
|
||||||
|
|
||||||
UploadArtifacts "$framework"
|
|
||||||
fi
|
|
||||||
Regular → Executable
+103
-14
@@ -6,6 +6,8 @@
|
|||||||
### Version V1.0.1 2024-01-02 - StevieTV - remove UTF8-BOM
|
### Version V1.0.1 2024-01-02 - StevieTV - remove UTF8-BOM
|
||||||
### Version V1.0.2 2024-01-03 - markus101 - Get user input from /dev/tty
|
### Version V1.0.2 2024-01-03 - markus101 - Get user input from /dev/tty
|
||||||
### Version V1.0.3 2024-01-06 - StevieTV - exit script when it is ran from install directory
|
### Version V1.0.3 2024-01-06 - StevieTV - exit script when it is ran from install directory
|
||||||
|
### Version V1.0.4 2025-04-05 - kaecyra - Allow user/group to be supplied via CLI, add unattended mode
|
||||||
|
### Version V1.0.5 2025-07-08 - bparkin1283 - use systemctl instead of service for stopping app
|
||||||
|
|
||||||
### Boilerplate Warning
|
### Boilerplate Warning
|
||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
@@ -16,8 +18,8 @@
|
|||||||
#OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
#OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
#WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
#WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
scriptversion="1.0.3"
|
scriptversion="1.0.4"
|
||||||
scriptdate="2024-01-06"
|
scriptdate="2025-04-05"
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@@ -49,18 +51,106 @@ if [ "$installdir" == "$(dirname -- "$( readlink -f -- "$0"; )")" ] || [ "$bindi
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prompt User
|
show_help() {
|
||||||
read -r -p "What user should ${app^} run as? (Default: $app): " app_uid < /dev/tty
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [OPTIONS]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--user <name> What user will $app run under?
|
||||||
|
User will be created if it doesn't already exist.
|
||||||
|
|
||||||
|
--group <name> What group will $app run under?
|
||||||
|
Group will be created if it doesn't already exist.
|
||||||
|
|
||||||
|
-u Unattended mode
|
||||||
|
The installer will not prompt or pause, making it suitable for automated installations.
|
||||||
|
This option requires the use of --user and --group to supply those inputs for the script.
|
||||||
|
|
||||||
|
-h, --help Show this help message and exit
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Default values for command-line arguments
|
||||||
|
arg_user=""
|
||||||
|
arg_group=""
|
||||||
|
arg_unattended=false
|
||||||
|
|
||||||
|
# Parse command-line arguments
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--user=*)
|
||||||
|
arg_user="${1#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--user)
|
||||||
|
if [[ -n "$2" && "$2" != -* ]]; then
|
||||||
|
arg_user="$2"
|
||||||
|
shift 2
|
||||||
|
else
|
||||||
|
echo "Error: --user requires a value." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--group=*)
|
||||||
|
arg_group="${1#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--group)
|
||||||
|
if [[ -n "$2" && "$2" != -* ]]; then
|
||||||
|
arg_group="$2"
|
||||||
|
shift 2
|
||||||
|
else
|
||||||
|
echo "Error: --group requires a value." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
-u)
|
||||||
|
arg_unattended=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
show_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option: $1" >&2
|
||||||
|
echo "Use --help to see valid options." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# If unattended mode is requested, require user and group
|
||||||
|
if $arg_unattended; then
|
||||||
|
if [[ -z "$arg_user" || -z "$arg_group" ]]; then
|
||||||
|
echo "Error: --user and --group are required when using -u (unattended mode)." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prompt User if necessary
|
||||||
|
if [ -n "$arg_user" ]; then
|
||||||
|
app_uid="$arg_user"
|
||||||
|
else
|
||||||
|
read -r -p "What user should ${app^} run as? (Default: $app): " app_uid < /dev/tty
|
||||||
|
fi
|
||||||
app_uid=$(echo "$app_uid" | tr -d ' ')
|
app_uid=$(echo "$app_uid" | tr -d ' ')
|
||||||
app_uid=${app_uid:-$app}
|
app_uid=${app_uid:-$app}
|
||||||
# Prompt Group
|
|
||||||
read -r -p "What group should ${app^} run as? (Default: media): " app_guid < /dev/tty
|
# Prompt Group if necessary
|
||||||
|
if [ -n "$arg_group" ]; then
|
||||||
|
app_guid="$arg_group"
|
||||||
|
else
|
||||||
|
read -r -p "What group should ${app^} run as? (Default: media): " app_guid < /dev/tty
|
||||||
|
fi
|
||||||
app_guid=$(echo "$app_guid" | tr -d ' ')
|
app_guid=$(echo "$app_guid" | tr -d ' ')
|
||||||
app_guid=${app_guid:-media}
|
app_guid=${app_guid:-media}
|
||||||
|
|
||||||
echo "This will install [${app^}] to [$bindir] and use [$datadir] for the AppData Directory"
|
echo "This will install [${app^}] to [$bindir] and use [$datadir] for the AppData Directory"
|
||||||
echo "${app^} will run as the user [$app_uid] and group [$app_guid]. By continuing, you've confirmed that that user and group will have READ and WRITE access to your Media Library and Download Client Completed Download directories"
|
echo "${app^} will run as the user [$app_uid] and group [$app_guid]. By continuing, you've confirmed that the selected user and group will have READ and WRITE access to your Media Library and Download Client Completed Download directories"
|
||||||
read -n 1 -r -s -p $'Press enter to continue or ctrl+c to exit...\n' < /dev/tty
|
if ! $arg_unattended; then
|
||||||
|
read -n 1 -r -s -p $'Press enter to continue or ctrl+c to exit...\n' < /dev/tty
|
||||||
|
fi
|
||||||
|
|
||||||
# Create User / Group as needed
|
# Create User / Group as needed
|
||||||
if [ "$app_guid" != "$app_uid" ]; then
|
if [ "$app_guid" != "$app_uid" ]; then
|
||||||
@@ -78,11 +168,10 @@ if ! getent group "$app_guid" | grep -qw "$app_uid"; then
|
|||||||
echo "Added User [$app_uid] to Group [$app_guid]"
|
echo "Added User [$app_uid] to Group [$app_guid]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stop the App if running
|
# Stop and disable the App if running
|
||||||
if service --status-all | grep -Fq "$app"; then
|
if [ $(systemctl is-active "$app") = "active" ]; then
|
||||||
systemctl stop "$app"
|
systemctl disable --now -q "$app"
|
||||||
systemctl disable "$app".service
|
echo "Stopped and disabled existing $app"
|
||||||
echo "Stopped existing $app"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create Appdata Directory
|
# Create Appdata Directory
|
||||||
@@ -114,7 +203,7 @@ case "$ARCH" in
|
|||||||
esac
|
esac
|
||||||
echo ""
|
echo ""
|
||||||
echo "Removing previous tarballs"
|
echo "Removing previous tarballs"
|
||||||
# -f to Force so we fail if it doesnt exist
|
# -f to Force so we fail if it doesn't exist
|
||||||
rm -f "${app^}".*.tar.gz
|
rm -f "${app^}".*.tar.gz
|
||||||
echo ""
|
echo ""
|
||||||
echo "Downloading..."
|
echo "Downloading..."
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@REM SET SONARR_MAJOR_VERSION=4
|
@REM SET SONARR_MAJOR_VERSION=4
|
||||||
@REM SET SONARR_VERSION=4.0.0.5
|
@REM SET SONARR_VERSION=4.0.0.5
|
||||||
@REM SET BRANCH=develop
|
@REM SET BRANCH=develop
|
||||||
@REM SET FRAMEWORK=net6.0
|
@REM SET FRAMEWORK=net8.0
|
||||||
@REM SET RUNTIME=win-x64
|
@REM SET RUNTIME=win-x64
|
||||||
|
|
||||||
inno\ISCC.exe sonarr.iss
|
inno\ISCC.exe sonarr.iss
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ cd /data/test
|
|||||||
|
|
||||||
runTest()
|
runTest()
|
||||||
{
|
{
|
||||||
bash test.sh Linux $1
|
bash scripts/test.sh Linux $1
|
||||||
cp TestResult.xml /data/_tests_results/TestResult_$1.xml
|
cp TestResult.xml /data/_tests_results/TestResult_$1.xml
|
||||||
}
|
}
|
||||||
|
|
||||||
runTest Integration
|
runTest Integration
|
||||||
runTest Unit
|
runTest Unit
|
||||||
|
|||||||
+48
-6
@@ -210,7 +210,6 @@ module.exports = {
|
|||||||
'no-undef-init': 'off',
|
'no-undef-init': 'off',
|
||||||
'no-undefined': 'off',
|
'no-undefined': 'off',
|
||||||
'no-unused-vars': ['error', { args: 'none', ignoreRestSiblings: true }],
|
'no-unused-vars': ['error', { args: 'none', ignoreRestSiblings: true }],
|
||||||
'no-use-before-define': 'error',
|
|
||||||
|
|
||||||
// Node.js and CommonJS
|
// Node.js and CommonJS
|
||||||
|
|
||||||
@@ -359,11 +358,20 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
|
|
||||||
rules: Object.assign(typescriptEslintRecommended.rules, {
|
rules: Object.assign(typescriptEslintRecommended.rules, {
|
||||||
'no-shadow': 'off',
|
'@typescript-eslint/no-unused-vars': [
|
||||||
// These should be enabled after cleaning things up
|
'error',
|
||||||
'@typescript-eslint/no-unused-vars': 'warn',
|
{
|
||||||
|
args: 'after-used',
|
||||||
|
argsIgnorePattern: '^_',
|
||||||
|
caughtErrorsIgnorePattern: '^_',
|
||||||
|
destructuredArrayIgnorePattern: '^_',
|
||||||
|
varsIgnorePattern: '^_',
|
||||||
|
ignoreRestSiblings: true
|
||||||
|
|
||||||
|
}
|
||||||
|
],
|
||||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||||
'react/prop-types': 'off',
|
'no-shadow': 'off',
|
||||||
'prettier/prettier': 'error',
|
'prettier/prettier': 'error',
|
||||||
'simple-import-sort/imports': [
|
'simple-import-sort/imports': [
|
||||||
'error',
|
'error',
|
||||||
@@ -376,7 +384,41 @@ module.exports = {
|
|||||||
['^@?\\w', `^(${dirs})(/.*|$)`, '^\\.', '^\\..*css$']
|
['^@?\\w', `^(${dirs})(/.*|$)`, '^\\.', '^\\..*css$']
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
|
||||||
|
// React Hooks
|
||||||
|
'react-hooks/rules-of-hooks': 'error',
|
||||||
|
'react-hooks/exhaustive-deps': 'error',
|
||||||
|
|
||||||
|
// React
|
||||||
|
'react/function-component-definition': 'error',
|
||||||
|
'react/hook-use-state': 'error',
|
||||||
|
'react/jsx-boolean-value': ['error', 'always'],
|
||||||
|
'react/jsx-curly-brace-presence': [
|
||||||
|
'error',
|
||||||
|
{ props: 'never', children: 'never' }
|
||||||
|
],
|
||||||
|
'react/jsx-fragments': 'error',
|
||||||
|
'react/jsx-handler-names': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
eventHandlerPrefix: 'on',
|
||||||
|
eventHandlerPropPrefix: 'on'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'react/jsx-no-bind': ['error', { ignoreRefs: true }],
|
||||||
|
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
|
||||||
|
'react/jsx-pascal-case': ['error', { allowAllCaps: true }],
|
||||||
|
'react/jsx-sort-props': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
callbacksLast: true,
|
||||||
|
noSortAlphabetically: true,
|
||||||
|
reservedFirst: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'react/prop-types': 'off',
|
||||||
|
'react/self-closing-comp': 'error'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Vendored
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
"editor.formatOnSave": false,
|
"editor.formatOnSave": false,
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll": true
|
"source.fixAll": "explicit"
|
||||||
},
|
},
|
||||||
|
|
||||||
"typescript.preferences.quoteStyle": "single",
|
"typescript.preferences.quoteStyle": "single",
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ module.exports = (env) => {
|
|||||||
const srcFolder = path.join(frontendFolder, 'src');
|
const srcFolder = path.join(frontendFolder, 'src');
|
||||||
const isProduction = !!env.production;
|
const isProduction = !!env.production;
|
||||||
const isProfiling = isProduction && !!env.profile;
|
const isProfiling = isProduction && !!env.profile;
|
||||||
const inlineWebWorkers = 'no-fallback';
|
|
||||||
|
|
||||||
const distFolder = path.resolve(frontendFolder, '..', '_output', uiFolder);
|
const distFolder = path.resolve(frontendFolder, '..', '_output', uiFolder);
|
||||||
|
|
||||||
@@ -26,6 +25,7 @@ module.exports = (env) => {
|
|||||||
const config = {
|
const config = {
|
||||||
mode: isProduction ? 'production' : 'development',
|
mode: isProduction ? 'production' : 'development',
|
||||||
devtool: isProduction ? 'source-map' : 'eval-source-map',
|
devtool: isProduction ? 'source-map' : 'eval-source-map',
|
||||||
|
target: 'web',
|
||||||
|
|
||||||
stats: {
|
stats: {
|
||||||
children: false
|
children: false
|
||||||
@@ -51,8 +51,7 @@ module.exports = (env) => {
|
|||||||
'node_modules'
|
'node_modules'
|
||||||
],
|
],
|
||||||
alias: {
|
alias: {
|
||||||
jquery: 'jquery/dist/jquery.min',
|
jquery: 'jquery/dist/jquery.min'
|
||||||
'react-middle-truncate': 'react-middle-truncate/lib/react-middle-truncate'
|
|
||||||
},
|
},
|
||||||
fallback: {
|
fallback: {
|
||||||
buffer: false,
|
buffer: false,
|
||||||
@@ -66,8 +65,8 @@ module.exports = (env) => {
|
|||||||
|
|
||||||
output: {
|
output: {
|
||||||
path: distFolder,
|
path: distFolder,
|
||||||
publicPath: '/',
|
publicPath: 'auto',
|
||||||
filename: '[name]-[contenthash].js',
|
filename: isProduction ? '[name]-[contenthash].js' : '[name].js',
|
||||||
sourceMapFilename: '[file].map'
|
sourceMapFilename: '[file].map'
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -92,7 +91,7 @@ module.exports = (env) => {
|
|||||||
|
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: 'Content/styles.css',
|
filename: 'Content/styles.css',
|
||||||
chunkFilename: 'Content/[id]-[chunkhash].css'
|
chunkFilename: isProduction ? 'Content/[id]-[chunkhash].css' : 'Content/[id].css'
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
@@ -134,6 +133,12 @@ module.exports = (env) => {
|
|||||||
{
|
{
|
||||||
source: 'frontend/src/Content/robots.txt',
|
source: 'frontend/src/Content/robots.txt',
|
||||||
destination: path.join(distFolder, 'Content/robots.txt')
|
destination: path.join(distFolder, 'Content/robots.txt')
|
||||||
|
},
|
||||||
|
|
||||||
|
// manifest.json and browserconfig.xml
|
||||||
|
{
|
||||||
|
source: 'frontend/src/Content/*.(json|xml)',
|
||||||
|
destination: path.join(distFolder, 'Content')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -154,16 +159,6 @@ module.exports = (env) => {
|
|||||||
|
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
|
||||||
test: /\.worker\.js$/,
|
|
||||||
use: {
|
|
||||||
loader: 'worker-loader',
|
|
||||||
options: {
|
|
||||||
filename: '[name].js',
|
|
||||||
inline: inlineWebWorkers
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
test: [/\.jsx?$/, /\.tsx?$/],
|
test: [/\.jsx?$/, /\.tsx?$/],
|
||||||
exclude: /(node_modules|JsLibraries)/,
|
exclude: /(node_modules|JsLibraries)/,
|
||||||
@@ -181,7 +176,7 @@ module.exports = (env) => {
|
|||||||
loose: true,
|
loose: true,
|
||||||
debug: false,
|
debug: false,
|
||||||
useBuiltIns: 'entry',
|
useBuiltIns: 'entry',
|
||||||
corejs: 3
|
corejs: '3.42'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
@@ -202,7 +197,7 @@ module.exports = (env) => {
|
|||||||
options: {
|
options: {
|
||||||
importLoaders: 1,
|
importLoaders: 1,
|
||||||
modules: {
|
modules: {
|
||||||
localIdentName: '[name]/[local]/[hash:base64:5]'
|
localIdentName: isProduction ? '[name]/[local]/[hash:base64:5]' : '[name]/[local]'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const mixinsFiles = [
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: [
|
plugins: [
|
||||||
|
'autoprefixer',
|
||||||
['postcss-mixins', {
|
['postcss-mixins', {
|
||||||
mixinsFiles
|
mixinsFiles
|
||||||
}],
|
}],
|
||||||
|
|||||||
@@ -1,284 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import Alert from 'Components/Alert';
|
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
|
||||||
import FilterMenu from 'Components/Menu/FilterMenu';
|
|
||||||
import ConfirmModal from 'Components/Modal/ConfirmModal';
|
|
||||||
import PageContent from 'Components/Page/PageContent';
|
|
||||||
import PageContentBody from 'Components/Page/PageContentBody';
|
|
||||||
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
|
||||||
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
|
||||||
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
|
||||||
import Table from 'Components/Table/Table';
|
|
||||||
import TableBody from 'Components/Table/TableBody';
|
|
||||||
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
|
||||||
import TablePager from 'Components/Table/TablePager';
|
|
||||||
import { align, icons, kinds } from 'Helpers/Props';
|
|
||||||
import getRemovedItems from 'Utilities/Object/getRemovedItems';
|
|
||||||
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import getSelectedIds from 'Utilities/Table/getSelectedIds';
|
|
||||||
import removeOldSelectedState from 'Utilities/Table/removeOldSelectedState';
|
|
||||||
import selectAll from 'Utilities/Table/selectAll';
|
|
||||||
import toggleSelected from 'Utilities/Table/toggleSelected';
|
|
||||||
import BlocklistFilterModal from './BlocklistFilterModal';
|
|
||||||
import BlocklistRowConnector from './BlocklistRowConnector';
|
|
||||||
|
|
||||||
class Blocklist extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
allSelected: false,
|
|
||||||
allUnselected: false,
|
|
||||||
lastToggled: null,
|
|
||||||
selectedState: {},
|
|
||||||
isConfirmRemoveModalOpen: false,
|
|
||||||
isConfirmClearModalOpen: false,
|
|
||||||
items: props.items
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
const {
|
|
||||||
items
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
if (hasDifferentItems(prevProps.items, items)) {
|
|
||||||
this.setState((state) => {
|
|
||||||
return {
|
|
||||||
...removeOldSelectedState(state, getRemovedItems(prevProps.items, items)),
|
|
||||||
items
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Control
|
|
||||||
|
|
||||||
getSelectedIds = () => {
|
|
||||||
return getSelectedIds(this.state.selectedState);
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onSelectAllChange = ({ value }) => {
|
|
||||||
this.setState(selectAll(this.state.selectedState, value));
|
|
||||||
};
|
|
||||||
|
|
||||||
onSelectedChange = ({ id, value, shiftKey = false }) => {
|
|
||||||
this.setState((state) => {
|
|
||||||
return toggleSelected(state, this.props.items, id, value, shiftKey);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onRemoveSelectedPress = () => {
|
|
||||||
this.setState({ isConfirmRemoveModalOpen: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
onRemoveSelectedConfirmed = () => {
|
|
||||||
this.props.onRemoveSelected(this.getSelectedIds());
|
|
||||||
this.setState({ isConfirmRemoveModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
onConfirmRemoveModalClose = () => {
|
|
||||||
this.setState({ isConfirmRemoveModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
onClearBlocklistPress = () => {
|
|
||||||
this.setState({ isConfirmClearModalOpen: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
onClearBlocklistConfirmed = () => {
|
|
||||||
this.props.onClearBlocklistPress();
|
|
||||||
this.setState({ isConfirmClearModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
onConfirmClearModalClose = () => {
|
|
||||||
this.setState({ isConfirmClearModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
isFetching,
|
|
||||||
isPopulated,
|
|
||||||
error,
|
|
||||||
items,
|
|
||||||
columns,
|
|
||||||
selectedFilterKey,
|
|
||||||
filters,
|
|
||||||
customFilters,
|
|
||||||
totalRecords,
|
|
||||||
isRemoving,
|
|
||||||
isClearingBlocklistExecuting,
|
|
||||||
onFilterSelect,
|
|
||||||
...otherProps
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const {
|
|
||||||
allSelected,
|
|
||||||
allUnselected,
|
|
||||||
selectedState,
|
|
||||||
isConfirmRemoveModalOpen,
|
|
||||||
isConfirmClearModalOpen
|
|
||||||
} = this.state;
|
|
||||||
|
|
||||||
const selectedIds = this.getSelectedIds();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageContent title={translate('Blocklist')}>
|
|
||||||
<PageToolbar>
|
|
||||||
<PageToolbarSection>
|
|
||||||
<PageToolbarButton
|
|
||||||
label={translate('RemoveSelected')}
|
|
||||||
iconName={icons.REMOVE}
|
|
||||||
isDisabled={!selectedIds.length}
|
|
||||||
isSpinning={isRemoving}
|
|
||||||
onPress={this.onRemoveSelectedPress}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<PageToolbarButton
|
|
||||||
label={translate('Clear')}
|
|
||||||
iconName={icons.CLEAR}
|
|
||||||
isDisabled={!items.length}
|
|
||||||
isSpinning={isClearingBlocklistExecuting}
|
|
||||||
onPress={this.onClearBlocklistPress}
|
|
||||||
/>
|
|
||||||
</PageToolbarSection>
|
|
||||||
|
|
||||||
<PageToolbarSection alignContent={align.RIGHT}>
|
|
||||||
<TableOptionsModalWrapper
|
|
||||||
{...otherProps}
|
|
||||||
columns={columns}
|
|
||||||
>
|
|
||||||
<PageToolbarButton
|
|
||||||
label={translate('Options')}
|
|
||||||
iconName={icons.TABLE}
|
|
||||||
/>
|
|
||||||
</TableOptionsModalWrapper>
|
|
||||||
|
|
||||||
<FilterMenu
|
|
||||||
alignMenu={align.RIGHT}
|
|
||||||
selectedFilterKey={selectedFilterKey}
|
|
||||||
filters={filters}
|
|
||||||
customFilters={customFilters}
|
|
||||||
filterModalConnectorComponent={BlocklistFilterModal}
|
|
||||||
onFilterSelect={onFilterSelect}
|
|
||||||
/>
|
|
||||||
</PageToolbarSection>
|
|
||||||
</PageToolbar>
|
|
||||||
|
|
||||||
<PageContentBody>
|
|
||||||
{
|
|
||||||
isFetching && !isPopulated &&
|
|
||||||
<LoadingIndicator />
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!isFetching && !!error &&
|
|
||||||
<Alert kind={kinds.DANGER}>
|
|
||||||
{translate('BlocklistLoadError')}
|
|
||||||
</Alert>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
isPopulated && !error && !items.length &&
|
|
||||||
<Alert kind={kinds.INFO}>
|
|
||||||
{
|
|
||||||
selectedFilterKey === 'all' ?
|
|
||||||
translate('NoHistoryBlocklist') :
|
|
||||||
translate('BlocklistFilterHasNoItems')
|
|
||||||
}
|
|
||||||
</Alert>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
isPopulated && !error && !!items.length &&
|
|
||||||
<div>
|
|
||||||
<Table
|
|
||||||
selectAll={true}
|
|
||||||
allSelected={allSelected}
|
|
||||||
allUnselected={allUnselected}
|
|
||||||
columns={columns}
|
|
||||||
{...otherProps}
|
|
||||||
onSelectAllChange={this.onSelectAllChange}
|
|
||||||
>
|
|
||||||
<TableBody>
|
|
||||||
{
|
|
||||||
items.map((item) => {
|
|
||||||
return (
|
|
||||||
<BlocklistRowConnector
|
|
||||||
key={item.id}
|
|
||||||
isSelected={selectedState[item.id] || false}
|
|
||||||
columns={columns}
|
|
||||||
{...item}
|
|
||||||
onSelectedChange={this.onSelectedChange}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</TableBody>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
<TablePager
|
|
||||||
totalRecords={totalRecords}
|
|
||||||
isFetching={isFetching}
|
|
||||||
{...otherProps}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</PageContentBody>
|
|
||||||
|
|
||||||
<ConfirmModal
|
|
||||||
isOpen={isConfirmRemoveModalOpen}
|
|
||||||
kind={kinds.DANGER}
|
|
||||||
title={translate('RemoveSelected')}
|
|
||||||
message={translate('RemoveSelectedBlocklistMessageText')}
|
|
||||||
confirmLabel={translate('RemoveSelected')}
|
|
||||||
onConfirm={this.onRemoveSelectedConfirmed}
|
|
||||||
onCancel={this.onConfirmRemoveModalClose}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ConfirmModal
|
|
||||||
isOpen={isConfirmClearModalOpen}
|
|
||||||
kind={kinds.DANGER}
|
|
||||||
title={translate('ClearBlocklist')}
|
|
||||||
message={translate('ClearBlocklistMessageText')}
|
|
||||||
confirmLabel={translate('Clear')}
|
|
||||||
onConfirm={this.onClearBlocklistConfirmed}
|
|
||||||
onCancel={this.onConfirmClearModalClose}
|
|
||||||
/>
|
|
||||||
</PageContent>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Blocklist.propTypes = {
|
|
||||||
isFetching: PropTypes.bool.isRequired,
|
|
||||||
isPopulated: PropTypes.bool.isRequired,
|
|
||||||
error: PropTypes.object,
|
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
||||||
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
customFilters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
totalRecords: PropTypes.number,
|
|
||||||
isRemoving: PropTypes.bool.isRequired,
|
|
||||||
isClearingBlocklistExecuting: PropTypes.bool.isRequired,
|
|
||||||
onRemoveSelected: PropTypes.func.isRequired,
|
|
||||||
onClearBlocklistPress: PropTypes.func.isRequired,
|
|
||||||
onFilterSelect: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Blocklist;
|
|
||||||
@@ -0,0 +1,294 @@
|
|||||||
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import { setQueueOptions } from 'Activity/Queue/queueOptionsStore';
|
||||||
|
import { SelectProvider } from 'App/SelectContext';
|
||||||
|
import * as commandNames from 'Commands/commandNames';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
|
import FilterMenu from 'Components/Menu/FilterMenu';
|
||||||
|
import ConfirmModal from 'Components/Modal/ConfirmModal';
|
||||||
|
import PageContent from 'Components/Page/PageContent';
|
||||||
|
import PageContentBody from 'Components/Page/PageContentBody';
|
||||||
|
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
||||||
|
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
||||||
|
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
||||||
|
import Table from 'Components/Table/Table';
|
||||||
|
import TableBody from 'Components/Table/TableBody';
|
||||||
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
|
import TablePager from 'Components/Table/TablePager';
|
||||||
|
import useSelectState from 'Helpers/Hooks/useSelectState';
|
||||||
|
import { align, icons, kinds } from 'Helpers/Props';
|
||||||
|
import { executeCommand } from 'Store/Actions/commandActions';
|
||||||
|
import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector';
|
||||||
|
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
||||||
|
import { CheckInputChanged } from 'typings/inputs';
|
||||||
|
import { SelectStateInputProps } from 'typings/props';
|
||||||
|
import { TableOptionsChangePayload } from 'typings/Table';
|
||||||
|
import {
|
||||||
|
registerPagePopulator,
|
||||||
|
unregisterPagePopulator,
|
||||||
|
} from 'Utilities/pagePopulator';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import getSelectedIds from 'Utilities/Table/getSelectedIds';
|
||||||
|
import BlocklistFilterModal from './BlocklistFilterModal';
|
||||||
|
import {
|
||||||
|
setBlocklistOption,
|
||||||
|
useBlocklistOptions,
|
||||||
|
} from './blocklistOptionsStore';
|
||||||
|
import BlocklistRow from './BlocklistRow';
|
||||||
|
import useBlocklist, {
|
||||||
|
useFilters,
|
||||||
|
useRemoveBlocklistItems,
|
||||||
|
} from './useBlocklist';
|
||||||
|
|
||||||
|
function Blocklist() {
|
||||||
|
const {
|
||||||
|
records,
|
||||||
|
totalPages,
|
||||||
|
totalRecords,
|
||||||
|
isFetching,
|
||||||
|
isFetched,
|
||||||
|
isLoading,
|
||||||
|
error,
|
||||||
|
page,
|
||||||
|
goToPage,
|
||||||
|
refetch,
|
||||||
|
} = useBlocklist();
|
||||||
|
|
||||||
|
const { columns, pageSize, sortKey, sortDirection, selectedFilterKey } =
|
||||||
|
useBlocklistOptions();
|
||||||
|
|
||||||
|
const filters = useFilters();
|
||||||
|
const { isRemoving, removeBlocklistItems } = useRemoveBlocklistItems();
|
||||||
|
|
||||||
|
const customFilters = useSelector(createCustomFiltersSelector('blocklist'));
|
||||||
|
const isClearingBlocklistExecuting = useSelector(
|
||||||
|
createCommandExecutingSelector(commandNames.CLEAR_BLOCKLIST)
|
||||||
|
);
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const [isConfirmRemoveModalOpen, setIsConfirmRemoveModalOpen] =
|
||||||
|
useState(false);
|
||||||
|
const [isConfirmClearModalOpen, setIsConfirmClearModalOpen] = useState(false);
|
||||||
|
|
||||||
|
const [selectState, setSelectState] = useSelectState();
|
||||||
|
const { allSelected, allUnselected, selectedState } = selectState;
|
||||||
|
|
||||||
|
const selectedIds = useMemo(() => {
|
||||||
|
return getSelectedIds(selectedState);
|
||||||
|
}, [selectedState]);
|
||||||
|
|
||||||
|
const handleSelectAllChange = useCallback(
|
||||||
|
({ value }: CheckInputChanged) => {
|
||||||
|
setSelectState({
|
||||||
|
type: value ? 'selectAll' : 'unselectAll',
|
||||||
|
items: records,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[records, setSelectState]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleSelectedChange = useCallback(
|
||||||
|
({ id, value, shiftKey = false }: SelectStateInputProps) => {
|
||||||
|
setSelectState({
|
||||||
|
type: 'toggleSelected',
|
||||||
|
items: records,
|
||||||
|
id,
|
||||||
|
isSelected: value,
|
||||||
|
shiftKey,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[records, setSelectState]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleRemoveSelectedPress = useCallback(() => {
|
||||||
|
setIsConfirmRemoveModalOpen(true);
|
||||||
|
}, [setIsConfirmRemoveModalOpen]);
|
||||||
|
|
||||||
|
const handleRemoveSelectedConfirmed = useCallback(() => {
|
||||||
|
removeBlocklistItems({ ids: selectedIds });
|
||||||
|
setIsConfirmRemoveModalOpen(false);
|
||||||
|
}, [selectedIds, setIsConfirmRemoveModalOpen, removeBlocklistItems]);
|
||||||
|
|
||||||
|
const handleConfirmRemoveModalClose = useCallback(() => {
|
||||||
|
setIsConfirmRemoveModalOpen(false);
|
||||||
|
}, [setIsConfirmRemoveModalOpen]);
|
||||||
|
|
||||||
|
const handleClearBlocklistPress = useCallback(() => {
|
||||||
|
setIsConfirmClearModalOpen(true);
|
||||||
|
}, [setIsConfirmClearModalOpen]);
|
||||||
|
|
||||||
|
const handleClearBlocklistConfirmed = useCallback(() => {
|
||||||
|
dispatch(
|
||||||
|
executeCommand({
|
||||||
|
name: commandNames.CLEAR_BLOCKLIST,
|
||||||
|
commandFinished: () => {
|
||||||
|
goToPage(1);
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
setIsConfirmClearModalOpen(false);
|
||||||
|
}, [setIsConfirmClearModalOpen, goToPage, dispatch]);
|
||||||
|
|
||||||
|
const handleConfirmClearModalClose = useCallback(() => {
|
||||||
|
setIsConfirmClearModalOpen(false);
|
||||||
|
}, [setIsConfirmClearModalOpen]);
|
||||||
|
|
||||||
|
const handleFilterSelect = useCallback(
|
||||||
|
(selectedFilterKey: string | number) => {
|
||||||
|
setBlocklistOption('selectedFilterKey', selectedFilterKey);
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleSortPress = useCallback((sortKey: string) => {
|
||||||
|
setBlocklistOption('sortKey', sortKey);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleTableOptionChange = useCallback(
|
||||||
|
(payload: TableOptionsChangePayload) => {
|
||||||
|
setQueueOptions(payload);
|
||||||
|
|
||||||
|
if (payload.pageSize) {
|
||||||
|
goToPage(1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[goToPage]
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const repopulate = () => {
|
||||||
|
refetch();
|
||||||
|
};
|
||||||
|
|
||||||
|
registerPagePopulator(repopulate);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
unregisterPagePopulator(repopulate);
|
||||||
|
};
|
||||||
|
}, [refetch]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SelectProvider items={records}>
|
||||||
|
<PageContent title={translate('Blocklist')}>
|
||||||
|
<PageToolbar>
|
||||||
|
<PageToolbarSection>
|
||||||
|
<PageToolbarButton
|
||||||
|
label={translate('RemoveSelected')}
|
||||||
|
iconName={icons.REMOVE}
|
||||||
|
isDisabled={!selectedIds.length}
|
||||||
|
isSpinning={isRemoving}
|
||||||
|
onPress={handleRemoveSelectedPress}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<PageToolbarButton
|
||||||
|
label={translate('Clear')}
|
||||||
|
iconName={icons.CLEAR}
|
||||||
|
isDisabled={!records.length}
|
||||||
|
isSpinning={isClearingBlocklistExecuting}
|
||||||
|
onPress={handleClearBlocklistPress}
|
||||||
|
/>
|
||||||
|
</PageToolbarSection>
|
||||||
|
|
||||||
|
<PageToolbarSection alignContent={align.RIGHT}>
|
||||||
|
<TableOptionsModalWrapper
|
||||||
|
columns={columns}
|
||||||
|
pageSize={pageSize}
|
||||||
|
onTableOptionChange={handleTableOptionChange}
|
||||||
|
>
|
||||||
|
<PageToolbarButton
|
||||||
|
label={translate('Options')}
|
||||||
|
iconName={icons.TABLE}
|
||||||
|
/>
|
||||||
|
</TableOptionsModalWrapper>
|
||||||
|
|
||||||
|
<FilterMenu
|
||||||
|
alignMenu={align.RIGHT}
|
||||||
|
selectedFilterKey={selectedFilterKey}
|
||||||
|
filters={filters}
|
||||||
|
customFilters={customFilters}
|
||||||
|
filterModalConnectorComponent={BlocklistFilterModal}
|
||||||
|
onFilterSelect={handleFilterSelect}
|
||||||
|
/>
|
||||||
|
</PageToolbarSection>
|
||||||
|
</PageToolbar>
|
||||||
|
|
||||||
|
<PageContentBody>
|
||||||
|
{isLoading && !isFetched ? <LoadingIndicator /> : null}
|
||||||
|
|
||||||
|
{!isLoading && !!error ? (
|
||||||
|
<Alert kind={kinds.DANGER}>{translate('BlocklistLoadError')}</Alert>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{isFetched && !error && !records.length ? (
|
||||||
|
<Alert kind={kinds.INFO}>
|
||||||
|
{selectedFilterKey === 'all'
|
||||||
|
? translate('NoBlocklistItems')
|
||||||
|
: translate('BlocklistFilterHasNoItems')}
|
||||||
|
</Alert>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{isFetched && !error && !!records.length ? (
|
||||||
|
<div>
|
||||||
|
<Table
|
||||||
|
selectAll={true}
|
||||||
|
allSelected={allSelected}
|
||||||
|
allUnselected={allUnselected}
|
||||||
|
columns={columns}
|
||||||
|
pageSize={pageSize}
|
||||||
|
sortKey={sortKey}
|
||||||
|
sortDirection={sortDirection}
|
||||||
|
onTableOptionChange={handleTableOptionChange}
|
||||||
|
onSelectAllChange={handleSelectAllChange}
|
||||||
|
onSortPress={handleSortPress}
|
||||||
|
>
|
||||||
|
<TableBody>
|
||||||
|
{records.map((item) => {
|
||||||
|
return (
|
||||||
|
<BlocklistRow
|
||||||
|
key={item.id}
|
||||||
|
isSelected={selectedState[item.id] || false}
|
||||||
|
columns={columns}
|
||||||
|
{...item}
|
||||||
|
onSelectedChange={handleSelectedChange}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
<TablePager
|
||||||
|
page={page}
|
||||||
|
totalPages={totalPages}
|
||||||
|
totalRecords={totalRecords}
|
||||||
|
isFetching={isFetching}
|
||||||
|
onPageSelect={goToPage}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
</PageContentBody>
|
||||||
|
|
||||||
|
<ConfirmModal
|
||||||
|
isOpen={isConfirmRemoveModalOpen}
|
||||||
|
kind={kinds.DANGER}
|
||||||
|
title={translate('RemoveSelected')}
|
||||||
|
message={translate('RemoveSelectedBlocklistMessageText')}
|
||||||
|
confirmLabel={translate('RemoveSelected')}
|
||||||
|
onConfirm={handleRemoveSelectedConfirmed}
|
||||||
|
onCancel={handleConfirmRemoveModalClose}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ConfirmModal
|
||||||
|
isOpen={isConfirmClearModalOpen}
|
||||||
|
kind={kinds.DANGER}
|
||||||
|
title={translate('ClearBlocklist')}
|
||||||
|
message={translate('ClearBlocklistMessageText')}
|
||||||
|
confirmLabel={translate('Clear')}
|
||||||
|
onConfirm={handleClearBlocklistConfirmed}
|
||||||
|
onCancel={handleConfirmClearModalClose}
|
||||||
|
/>
|
||||||
|
</PageContent>
|
||||||
|
</SelectProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Blocklist;
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import * as commandNames from 'Commands/commandNames';
|
|
||||||
import withCurrentPage from 'Components/withCurrentPage';
|
|
||||||
import * as blocklistActions from 'Store/Actions/blocklistActions';
|
|
||||||
import { executeCommand } from 'Store/Actions/commandActions';
|
|
||||||
import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector';
|
|
||||||
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
|
||||||
import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator';
|
|
||||||
import Blocklist from './Blocklist';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.blocklist,
|
|
||||||
createCustomFiltersSelector('blocklist'),
|
|
||||||
createCommandExecutingSelector(commandNames.CLEAR_BLOCKLIST),
|
|
||||||
(blocklist, customFilters, isClearingBlocklistExecuting) => {
|
|
||||||
return {
|
|
||||||
isClearingBlocklistExecuting,
|
|
||||||
customFilters,
|
|
||||||
...blocklist
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
...blocklistActions,
|
|
||||||
executeCommand
|
|
||||||
};
|
|
||||||
|
|
||||||
class BlocklistConnector extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
const {
|
|
||||||
useCurrentPage,
|
|
||||||
fetchBlocklist,
|
|
||||||
gotoBlocklistFirstPage
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
registerPagePopulator(this.repopulate);
|
|
||||||
|
|
||||||
if (useCurrentPage) {
|
|
||||||
fetchBlocklist();
|
|
||||||
} else {
|
|
||||||
gotoBlocklistFirstPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
if (prevProps.isClearingBlocklistExecuting && !this.props.isClearingBlocklistExecuting) {
|
|
||||||
this.props.gotoBlocklistFirstPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
this.props.clearBlocklist();
|
|
||||||
unregisterPagePopulator(this.repopulate);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Control
|
|
||||||
|
|
||||||
repopulate = () => {
|
|
||||||
this.props.fetchBlocklist();
|
|
||||||
};
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onFirstPagePress = () => {
|
|
||||||
this.props.gotoBlocklistFirstPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
onPreviousPagePress = () => {
|
|
||||||
this.props.gotoBlocklistPreviousPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
onNextPagePress = () => {
|
|
||||||
this.props.gotoBlocklistNextPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
onLastPagePress = () => {
|
|
||||||
this.props.gotoBlocklistLastPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
onPageSelect = (page) => {
|
|
||||||
this.props.gotoBlocklistPage({ page });
|
|
||||||
};
|
|
||||||
|
|
||||||
onRemoveSelected = (ids) => {
|
|
||||||
this.props.removeBlocklistItems({ ids });
|
|
||||||
};
|
|
||||||
|
|
||||||
onSortPress = (sortKey) => {
|
|
||||||
this.props.setBlocklistSort({ sortKey });
|
|
||||||
};
|
|
||||||
|
|
||||||
onFilterSelect = (selectedFilterKey) => {
|
|
||||||
this.props.setBlocklistFilter({ selectedFilterKey });
|
|
||||||
};
|
|
||||||
|
|
||||||
onClearBlocklistPress = () => {
|
|
||||||
this.props.executeCommand({ name: commandNames.CLEAR_BLOCKLIST });
|
|
||||||
};
|
|
||||||
|
|
||||||
onTableOptionChange = (payload) => {
|
|
||||||
this.props.setBlocklistTableOption(payload);
|
|
||||||
|
|
||||||
if (payload.pageSize) {
|
|
||||||
this.props.gotoBlocklistFirstPage();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<Blocklist
|
|
||||||
onFirstPagePress={this.onFirstPagePress}
|
|
||||||
onPreviousPagePress={this.onPreviousPagePress}
|
|
||||||
onNextPagePress={this.onNextPagePress}
|
|
||||||
onLastPagePress={this.onLastPagePress}
|
|
||||||
onPageSelect={this.onPageSelect}
|
|
||||||
onRemoveSelected={this.onRemoveSelected}
|
|
||||||
onSortPress={this.onSortPress}
|
|
||||||
onFilterSelect={this.onFilterSelect}
|
|
||||||
onTableOptionChange={this.onTableOptionChange}
|
|
||||||
onClearBlocklistPress={this.onClearBlocklistPress}
|
|
||||||
{...this.props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BlocklistConnector.propTypes = {
|
|
||||||
useCurrentPage: PropTypes.bool.isRequired,
|
|
||||||
isClearingBlocklistExecuting: PropTypes.bool.isRequired,
|
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
fetchBlocklist: PropTypes.func.isRequired,
|
|
||||||
gotoBlocklistFirstPage: PropTypes.func.isRequired,
|
|
||||||
gotoBlocklistPreviousPage: PropTypes.func.isRequired,
|
|
||||||
gotoBlocklistNextPage: PropTypes.func.isRequired,
|
|
||||||
gotoBlocklistLastPage: PropTypes.func.isRequired,
|
|
||||||
gotoBlocklistPage: PropTypes.func.isRequired,
|
|
||||||
removeBlocklistItems: PropTypes.func.isRequired,
|
|
||||||
setBlocklistSort: PropTypes.func.isRequired,
|
|
||||||
setBlocklistFilter: PropTypes.func.isRequired,
|
|
||||||
setBlocklistTableOption: PropTypes.func.isRequired,
|
|
||||||
clearBlocklist: PropTypes.func.isRequired,
|
|
||||||
executeCommand: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default withCurrentPage(
|
|
||||||
connect(createMapStateToProps, mapDispatchToProps)(BlocklistConnector)
|
|
||||||
);
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import DescriptionList from 'Components/DescriptionList/DescriptionList';
|
|
||||||
import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem';
|
|
||||||
import Button from 'Components/Link/Button';
|
|
||||||
import Modal from 'Components/Modal/Modal';
|
|
||||||
import ModalBody from 'Components/Modal/ModalBody';
|
|
||||||
import ModalContent from 'Components/Modal/ModalContent';
|
|
||||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
|
||||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
|
|
||||||
class BlocklistDetailsModal extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
isOpen,
|
|
||||||
sourceTitle,
|
|
||||||
protocol,
|
|
||||||
indexer,
|
|
||||||
message,
|
|
||||||
onModalClose
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
isOpen={isOpen}
|
|
||||||
onModalClose={onModalClose}
|
|
||||||
>
|
|
||||||
<ModalContent
|
|
||||||
onModalClose={onModalClose}
|
|
||||||
>
|
|
||||||
<ModalHeader>
|
|
||||||
Details
|
|
||||||
</ModalHeader>
|
|
||||||
|
|
||||||
<ModalBody>
|
|
||||||
<DescriptionList>
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('Name')}
|
|
||||||
data={sourceTitle}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('Protocol')}
|
|
||||||
data={protocol}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{
|
|
||||||
!!message &&
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('Indexer')}
|
|
||||||
data={indexer}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!!message &&
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('Message')}
|
|
||||||
data={message}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
</DescriptionList>
|
|
||||||
</ModalBody>
|
|
||||||
|
|
||||||
<ModalFooter>
|
|
||||||
<Button onPress={onModalClose}>
|
|
||||||
{translate('Close')}
|
|
||||||
</Button>
|
|
||||||
</ModalFooter>
|
|
||||||
</ModalContent>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BlocklistDetailsModal.propTypes = {
|
|
||||||
isOpen: PropTypes.bool.isRequired,
|
|
||||||
sourceTitle: PropTypes.string.isRequired,
|
|
||||||
protocol: PropTypes.string.isRequired,
|
|
||||||
indexer: PropTypes.string,
|
|
||||||
message: PropTypes.string,
|
|
||||||
onModalClose: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default BlocklistDetailsModal;
|
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import DescriptionList from 'Components/DescriptionList/DescriptionList';
|
||||||
|
import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem';
|
||||||
|
import Button from 'Components/Link/Button';
|
||||||
|
import Modal from 'Components/Modal/Modal';
|
||||||
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import DownloadProtocol from 'DownloadClient/DownloadProtocol';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
|
interface BlocklistDetailsModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
sourceTitle: string;
|
||||||
|
protocol: DownloadProtocol;
|
||||||
|
indexer?: string;
|
||||||
|
message?: string;
|
||||||
|
source?: string;
|
||||||
|
onModalClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function BlocklistDetailsModal({
|
||||||
|
isOpen,
|
||||||
|
sourceTitle,
|
||||||
|
protocol,
|
||||||
|
indexer,
|
||||||
|
message,
|
||||||
|
source,
|
||||||
|
onModalClose,
|
||||||
|
}: BlocklistDetailsModalProps) {
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
|
<ModalContent onModalClose={onModalClose}>
|
||||||
|
<ModalHeader>Details</ModalHeader>
|
||||||
|
|
||||||
|
<ModalBody>
|
||||||
|
<DescriptionList>
|
||||||
|
<DescriptionListItem title={translate('Name')} data={sourceTitle} />
|
||||||
|
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('Protocol')}
|
||||||
|
data={protocol}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{message ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('Indexer')}
|
||||||
|
data={indexer}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{message ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('Message')}
|
||||||
|
data={message}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
{source ? (
|
||||||
|
<DescriptionListItem title={translate('Source')} data={source} />
|
||||||
|
) : null}
|
||||||
|
</DescriptionList>
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter>
|
||||||
|
<Button onPress={onModalClose}>{translate('Close')}</Button>
|
||||||
|
</ModalFooter>
|
||||||
|
</ModalContent>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BlocklistDetailsModal;
|
||||||
@@ -1,53 +1,26 @@
|
|||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import FilterModal, { FilterModalProps } from 'Components/Filter/FilterModal';
|
||||||
import { createSelector } from 'reselect';
|
import { setBlocklistOption } from './blocklistOptionsStore';
|
||||||
import AppState from 'App/State/AppState';
|
import useBlocklist, { FILTER_BUILDER } from './useBlocklist';
|
||||||
import FilterModal from 'Components/Filter/FilterModal';
|
|
||||||
import { setBlocklistFilter } from 'Store/Actions/blocklistActions';
|
|
||||||
|
|
||||||
function createBlocklistSelector() {
|
type BlocklistFilterModalProps = FilterModalProps<History>;
|
||||||
return createSelector(
|
|
||||||
(state: AppState) => state.blocklist.items,
|
|
||||||
(blocklistItems) => {
|
|
||||||
return blocklistItems;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createFilterBuilderPropsSelector() {
|
|
||||||
return createSelector(
|
|
||||||
(state: AppState) => state.blocklist.filterBuilderProps,
|
|
||||||
(filterBuilderProps) => {
|
|
||||||
return filterBuilderProps;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface BlocklistFilterModalProps {
|
|
||||||
isOpen: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function BlocklistFilterModal(props: BlocklistFilterModalProps) {
|
export default function BlocklistFilterModal(props: BlocklistFilterModalProps) {
|
||||||
const sectionItems = useSelector(createBlocklistSelector());
|
const { records } = useBlocklist();
|
||||||
const filterBuilderProps = useSelector(createFilterBuilderPropsSelector());
|
|
||||||
const customFilterType = 'blocklist';
|
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
|
||||||
|
|
||||||
const dispatchSetFilter = useCallback(
|
const dispatchSetFilter = useCallback(
|
||||||
(payload: unknown) => {
|
({ selectedFilterKey }: { selectedFilterKey: string | number }) => {
|
||||||
dispatch(setBlocklistFilter(payload));
|
setBlocklistOption('selectedFilterKey', selectedFilterKey);
|
||||||
},
|
},
|
||||||
[dispatch]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FilterModal
|
<FilterModal
|
||||||
// TODO: Don't spread all the props
|
|
||||||
{...props}
|
{...props}
|
||||||
sectionItems={sectionItems}
|
sectionItems={records}
|
||||||
filterBuilderProps={filterBuilderProps}
|
filterBuilderProps={FILTER_BUILDER}
|
||||||
customFilterType={customFilterType}
|
customFilterType="blocklist"
|
||||||
dispatchSetFilter={dispatchSetFilter}
|
dispatchSetFilter={dispatchSetFilter}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,212 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import IconButton from 'Components/Link/IconButton';
|
|
||||||
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
|
||||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
|
||||||
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
|
||||||
import TableRow from 'Components/Table/TableRow';
|
|
||||||
import EpisodeFormats from 'Episode/EpisodeFormats';
|
|
||||||
import EpisodeLanguages from 'Episode/EpisodeLanguages';
|
|
||||||
import EpisodeQuality from 'Episode/EpisodeQuality';
|
|
||||||
import { icons, kinds } from 'Helpers/Props';
|
|
||||||
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import BlocklistDetailsModal from './BlocklistDetailsModal';
|
|
||||||
import styles from './BlocklistRow.css';
|
|
||||||
|
|
||||||
class BlocklistRow extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
isDetailsModalOpen: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onDetailsPress = () => {
|
|
||||||
this.setState({ isDetailsModalOpen: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
onDetailsModalClose = () => {
|
|
||||||
this.setState({ isDetailsModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
id,
|
|
||||||
series,
|
|
||||||
sourceTitle,
|
|
||||||
languages,
|
|
||||||
quality,
|
|
||||||
customFormats,
|
|
||||||
date,
|
|
||||||
protocol,
|
|
||||||
indexer,
|
|
||||||
message,
|
|
||||||
isSelected,
|
|
||||||
columns,
|
|
||||||
onSelectedChange,
|
|
||||||
onRemovePress
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TableRow>
|
|
||||||
<TableSelectCell
|
|
||||||
id={id}
|
|
||||||
isSelected={isSelected}
|
|
||||||
onSelectedChange={onSelectedChange}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{
|
|
||||||
columns.map((column) => {
|
|
||||||
const {
|
|
||||||
name,
|
|
||||||
isVisible
|
|
||||||
} = column;
|
|
||||||
|
|
||||||
if (!isVisible) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'series.sortTitle') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
<SeriesTitleLink
|
|
||||||
titleSlug={series.titleSlug}
|
|
||||||
title={series.title}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'sourceTitle') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
{sourceTitle}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'languages') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
className={styles.languages}
|
|
||||||
>
|
|
||||||
<EpisodeLanguages
|
|
||||||
languages={languages}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'quality') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
className={styles.quality}
|
|
||||||
>
|
|
||||||
<EpisodeQuality
|
|
||||||
quality={quality}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'customFormats') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
<EpisodeFormats
|
|
||||||
formats={customFormats}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'date') {
|
|
||||||
return (
|
|
||||||
<RelativeDateCellConnector
|
|
||||||
key={name}
|
|
||||||
date={date}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'indexer') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
className={styles.indexer}
|
|
||||||
>
|
|
||||||
{indexer}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'actions') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
className={styles.actions}
|
|
||||||
>
|
|
||||||
<IconButton
|
|
||||||
name={icons.INFO}
|
|
||||||
onPress={this.onDetailsPress}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<IconButton
|
|
||||||
title={translate('RemoveFromBlocklist')}
|
|
||||||
name={icons.REMOVE}
|
|
||||||
kind={kinds.DANGER}
|
|
||||||
onPress={onRemovePress}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
<BlocklistDetailsModal
|
|
||||||
isOpen={this.state.isDetailsModalOpen}
|
|
||||||
sourceTitle={sourceTitle}
|
|
||||||
protocol={protocol}
|
|
||||||
indexer={indexer}
|
|
||||||
message={message}
|
|
||||||
onModalClose={this.onDetailsModalClose}
|
|
||||||
/>
|
|
||||||
</TableRow>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
BlocklistRow.propTypes = {
|
|
||||||
id: PropTypes.number.isRequired,
|
|
||||||
series: PropTypes.object.isRequired,
|
|
||||||
sourceTitle: PropTypes.string.isRequired,
|
|
||||||
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
quality: PropTypes.object.isRequired,
|
|
||||||
customFormats: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
date: PropTypes.string.isRequired,
|
|
||||||
protocol: PropTypes.string.isRequired,
|
|
||||||
indexer: PropTypes.string,
|
|
||||||
message: PropTypes.string,
|
|
||||||
isSelected: PropTypes.bool.isRequired,
|
|
||||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
onSelectedChange: PropTypes.func.isRequired,
|
|
||||||
onRemovePress: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default BlocklistRow;
|
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
import React, { useCallback, useState } from 'react';
|
||||||
|
import IconButton from 'Components/Link/IconButton';
|
||||||
|
import RelativeDateCell from 'Components/Table/Cells/RelativeDateCell';
|
||||||
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
|
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
||||||
|
import Column from 'Components/Table/Column';
|
||||||
|
import TableRow from 'Components/Table/TableRow';
|
||||||
|
import EpisodeFormats from 'Episode/EpisodeFormats';
|
||||||
|
import EpisodeLanguages from 'Episode/EpisodeLanguages';
|
||||||
|
import EpisodeQuality from 'Episode/EpisodeQuality';
|
||||||
|
import { icons, kinds } from 'Helpers/Props';
|
||||||
|
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
||||||
|
import useSeries from 'Series/useSeries';
|
||||||
|
import Blocklist from 'typings/Blocklist';
|
||||||
|
import { SelectStateInputProps } from 'typings/props';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import BlocklistDetailsModal from './BlocklistDetailsModal';
|
||||||
|
import { useRemoveBlocklistItem } from './useBlocklist';
|
||||||
|
import styles from './BlocklistRow.css';
|
||||||
|
|
||||||
|
interface BlocklistRowProps extends Blocklist {
|
||||||
|
isSelected: boolean;
|
||||||
|
columns: Column[];
|
||||||
|
onSelectedChange: (options: SelectStateInputProps) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function BlocklistRow({
|
||||||
|
id,
|
||||||
|
seriesId,
|
||||||
|
sourceTitle,
|
||||||
|
languages,
|
||||||
|
quality,
|
||||||
|
customFormats,
|
||||||
|
date,
|
||||||
|
protocol,
|
||||||
|
indexer,
|
||||||
|
message,
|
||||||
|
source,
|
||||||
|
isSelected,
|
||||||
|
columns,
|
||||||
|
onSelectedChange,
|
||||||
|
}: BlocklistRowProps) {
|
||||||
|
const series = useSeries(seriesId);
|
||||||
|
const { isRemoving, removeBlocklistItem } = useRemoveBlocklistItem(id);
|
||||||
|
const [isDetailsModalOpen, setIsDetailsModalOpen] = useState(false);
|
||||||
|
|
||||||
|
const handleDetailsPress = useCallback(() => {
|
||||||
|
setIsDetailsModalOpen(true);
|
||||||
|
}, [setIsDetailsModalOpen]);
|
||||||
|
|
||||||
|
const handleDetailsModalClose = useCallback(() => {
|
||||||
|
setIsDetailsModalOpen(false);
|
||||||
|
}, [setIsDetailsModalOpen]);
|
||||||
|
|
||||||
|
const handleRemovePress = useCallback(() => {
|
||||||
|
removeBlocklistItem();
|
||||||
|
}, [removeBlocklistItem]);
|
||||||
|
|
||||||
|
if (!series) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRow>
|
||||||
|
<TableSelectCell
|
||||||
|
id={id}
|
||||||
|
isSelected={isSelected}
|
||||||
|
onSelectedChange={onSelectedChange}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{columns.map((column) => {
|
||||||
|
const { name, isVisible } = column;
|
||||||
|
|
||||||
|
if (!isVisible) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'series.sortTitle') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<SeriesTitleLink
|
||||||
|
titleSlug={series.titleSlug}
|
||||||
|
title={series.title}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'sourceTitle') {
|
||||||
|
return <TableRowCell key={name}>{sourceTitle}</TableRowCell>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'languages') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name} className={styles.languages}>
|
||||||
|
<EpisodeLanguages languages={languages} />
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'quality') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name} className={styles.quality}>
|
||||||
|
<EpisodeQuality quality={quality} />
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'customFormats') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<EpisodeFormats formats={customFormats} />
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'date') {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore ts(2739)
|
||||||
|
return <RelativeDateCell key={name} date={date} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'indexer') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name} className={styles.indexer}>
|
||||||
|
{indexer}
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'actions') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name} className={styles.actions}>
|
||||||
|
<IconButton name={icons.INFO} onPress={handleDetailsPress} />
|
||||||
|
|
||||||
|
<IconButton
|
||||||
|
title={translate('RemoveFromBlocklist')}
|
||||||
|
name={icons.REMOVE}
|
||||||
|
kind={kinds.DANGER}
|
||||||
|
isSpinning={isRemoving}
|
||||||
|
onPress={handleRemovePress}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
})}
|
||||||
|
|
||||||
|
<BlocklistDetailsModal
|
||||||
|
isOpen={isDetailsModalOpen}
|
||||||
|
sourceTitle={sourceTitle}
|
||||||
|
protocol={protocol}
|
||||||
|
indexer={indexer}
|
||||||
|
message={message}
|
||||||
|
source={source}
|
||||||
|
onModalClose={handleDetailsModalClose}
|
||||||
|
/>
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BlocklistRow;
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import { removeBlocklistItem } from 'Store/Actions/blocklistActions';
|
|
||||||
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
|
||||||
import BlocklistRow from './BlocklistRow';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
createSeriesSelector(),
|
|
||||||
(series) => {
|
|
||||||
return {
|
|
||||||
series
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createMapDispatchToProps(dispatch, props) {
|
|
||||||
return {
|
|
||||||
onRemovePress() {
|
|
||||||
dispatch(removeBlocklistItem({ id: props.id }));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps, createMapDispatchToProps)(BlocklistRow);
|
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
import {
|
||||||
|
createOptionsStore,
|
||||||
|
PageableOptions,
|
||||||
|
} from 'Helpers/Hooks/useOptionsStore';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
|
export type BlocklistOptions = PageableOptions;
|
||||||
|
|
||||||
|
const { useOptions, useOption, setOptions, setOption } =
|
||||||
|
createOptionsStore<BlocklistOptions>('blocklist_options', () => {
|
||||||
|
return {
|
||||||
|
pageSize: 20,
|
||||||
|
selectedFilterKey: 'all',
|
||||||
|
sortKey: 'time',
|
||||||
|
sortDirection: 'descending',
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
name: 'series.sortTitle',
|
||||||
|
label: () => translate('SeriesTitle'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'sourceTitle',
|
||||||
|
label: () => translate('SourceTitle'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'languages',
|
||||||
|
label: () => translate('Languages'),
|
||||||
|
isVisible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'quality',
|
||||||
|
label: () => translate('Quality'),
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'customFormats',
|
||||||
|
label: () => translate('Formats'),
|
||||||
|
isSortable: false,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'date',
|
||||||
|
label: () => translate('Date'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'indexer',
|
||||||
|
label: () => translate('Indexer'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'actions',
|
||||||
|
label: '',
|
||||||
|
columnLabel: () => translate('Actions'),
|
||||||
|
isVisible: true,
|
||||||
|
isModifiable: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
export const useBlocklistOptions = useOptions;
|
||||||
|
export const setBlocklistOptions = setOptions;
|
||||||
|
export const useBlocklistOption = useOption;
|
||||||
|
export const setBlocklistOption = setOption;
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
import { keepPreviousData, useQueryClient } from '@tanstack/react-query';
|
||||||
|
import { useMemo } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import { CustomFilter, Filter, FilterBuilderProp } from 'App/State/AppState';
|
||||||
|
import useApiMutation from 'Helpers/Hooks/useApiMutation';
|
||||||
|
import usePage from 'Helpers/Hooks/usePage';
|
||||||
|
import usePagedApiQuery from 'Helpers/Hooks/usePagedApiQuery';
|
||||||
|
import { filterBuilderValueTypes } from 'Helpers/Props';
|
||||||
|
import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector';
|
||||||
|
import Blocklist from 'typings/Blocklist';
|
||||||
|
import findSelectedFilters from 'Utilities/Filter/findSelectedFilters';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import { useBlocklistOptions } from './blocklistOptionsStore';
|
||||||
|
|
||||||
|
interface BulkBlocklistData {
|
||||||
|
ids: number[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FILTERS: Filter[] = [
|
||||||
|
{
|
||||||
|
key: 'all',
|
||||||
|
label: () => translate('All'),
|
||||||
|
filters: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const FILTER_BUILDER: FilterBuilderProp<Blocklist>[] = [
|
||||||
|
{
|
||||||
|
name: 'seriesIds',
|
||||||
|
label: () => translate('Series'),
|
||||||
|
type: 'equal',
|
||||||
|
valueType: filterBuilderValueTypes.SERIES,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'protocols',
|
||||||
|
label: () => translate('Protocol'),
|
||||||
|
type: 'equal',
|
||||||
|
valueType: filterBuilderValueTypes.PROTOCOL,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const useBlocklist = () => {
|
||||||
|
const { page, goToPage } = usePage('blocklist');
|
||||||
|
const { pageSize, selectedFilterKey, sortKey, sortDirection } =
|
||||||
|
useBlocklistOptions();
|
||||||
|
const customFilters = useSelector(
|
||||||
|
createCustomFiltersSelector('blocklist')
|
||||||
|
) as CustomFilter[];
|
||||||
|
|
||||||
|
const filters = useMemo(() => {
|
||||||
|
return findSelectedFilters(selectedFilterKey, FILTERS, customFilters);
|
||||||
|
}, [selectedFilterKey, customFilters]);
|
||||||
|
|
||||||
|
const { refetch, ...query } = usePagedApiQuery<Blocklist>({
|
||||||
|
path: '/blocklist',
|
||||||
|
page,
|
||||||
|
pageSize,
|
||||||
|
filters,
|
||||||
|
sortKey,
|
||||||
|
sortDirection,
|
||||||
|
queryOptions: {
|
||||||
|
placeholderData: keepPreviousData,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
...query,
|
||||||
|
goToPage,
|
||||||
|
page,
|
||||||
|
refetch,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useBlocklist;
|
||||||
|
|
||||||
|
export const useFilters = () => {
|
||||||
|
return FILTERS;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useRemoveBlocklistItem = (id: number) => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
const { mutate, isPending } = useApiMutation<unknown, void>({
|
||||||
|
path: `/blocklist/${id}`,
|
||||||
|
method: 'DELETE',
|
||||||
|
mutationOptions: {
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: ['/blocklist'] });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
removeBlocklistItem: mutate,
|
||||||
|
isRemoving: isPending,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useRemoveBlocklistItems = () => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
const { mutate, isPending } = useApiMutation<unknown, BulkBlocklistData>({
|
||||||
|
path: `/blocklist/bulk`,
|
||||||
|
method: 'DELETE',
|
||||||
|
mutationOptions: {
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: ['/blocklist'] });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
removeBlocklistItems: mutate,
|
||||||
|
isRemoving: isPending,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -1,354 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import DescriptionList from 'Components/DescriptionList/DescriptionList';
|
|
||||||
import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem';
|
|
||||||
import DescriptionListItemDescription from 'Components/DescriptionList/DescriptionListItemDescription';
|
|
||||||
import DescriptionListItemTitle from 'Components/DescriptionList/DescriptionListItemTitle';
|
|
||||||
import Link from 'Components/Link/Link';
|
|
||||||
import formatDateTime from 'Utilities/Date/formatDateTime';
|
|
||||||
import formatAge from 'Utilities/Number/formatAge';
|
|
||||||
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import styles from './HistoryDetails.css';
|
|
||||||
|
|
||||||
function HistoryDetails(props) {
|
|
||||||
const {
|
|
||||||
eventType,
|
|
||||||
sourceTitle,
|
|
||||||
data,
|
|
||||||
downloadId,
|
|
||||||
shortDateFormat,
|
|
||||||
timeFormat
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
if (eventType === 'grabbed') {
|
|
||||||
const {
|
|
||||||
indexer,
|
|
||||||
releaseGroup,
|
|
||||||
seriesMatchType,
|
|
||||||
customFormatScore,
|
|
||||||
nzbInfoUrl,
|
|
||||||
downloadClient,
|
|
||||||
downloadClientName,
|
|
||||||
age,
|
|
||||||
ageHours,
|
|
||||||
ageMinutes,
|
|
||||||
publishedDate
|
|
||||||
} = data;
|
|
||||||
|
|
||||||
const downloadClientNameInfo = downloadClientName ?? downloadClient;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DescriptionList>
|
|
||||||
<DescriptionListItem
|
|
||||||
descriptionClassName={styles.description}
|
|
||||||
title={translate('Name')}
|
|
||||||
data={sourceTitle}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{
|
|
||||||
indexer ?
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('Indexer')}
|
|
||||||
data={indexer}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
releaseGroup ?
|
|
||||||
<DescriptionListItem
|
|
||||||
descriptionClassName={styles.description}
|
|
||||||
title={translate('ReleaseGroup')}
|
|
||||||
data={releaseGroup}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
customFormatScore && customFormatScore !== '0' ?
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('CustomFormatScore')}
|
|
||||||
data={formatCustomFormatScore(customFormatScore)}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
seriesMatchType ?
|
|
||||||
<DescriptionListItem
|
|
||||||
descriptionClassName={styles.description}
|
|
||||||
title={translate('SeriesMatchType')}
|
|
||||||
data={seriesMatchType}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
nzbInfoUrl ?
|
|
||||||
<span>
|
|
||||||
<DescriptionListItemTitle>
|
|
||||||
{translate('InfoUrl')}
|
|
||||||
</DescriptionListItemTitle>
|
|
||||||
|
|
||||||
<DescriptionListItemDescription>
|
|
||||||
<Link to={nzbInfoUrl}>{nzbInfoUrl}</Link>
|
|
||||||
</DescriptionListItemDescription>
|
|
||||||
</span> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
downloadClientNameInfo ?
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('DownloadClient')}
|
|
||||||
data={downloadClientNameInfo}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
downloadId ?
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('GrabId')}
|
|
||||||
data={downloadId}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
age || ageHours || ageMinutes ?
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('AgeWhenGrabbed')}
|
|
||||||
data={formatAge(age, ageHours, ageMinutes)}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
publishedDate ?
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('PublishedDate')}
|
|
||||||
data={formatDateTime(publishedDate, shortDateFormat, timeFormat, { includeSeconds: true })}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</DescriptionList>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventType === 'downloadFailed') {
|
|
||||||
const {
|
|
||||||
message
|
|
||||||
} = data;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DescriptionList>
|
|
||||||
<DescriptionListItem
|
|
||||||
descriptionClassName={styles.description}
|
|
||||||
title={translate('Name')}
|
|
||||||
data={sourceTitle}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{
|
|
||||||
downloadId ?
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('GrabId')}
|
|
||||||
data={downloadId}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
message ?
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('Message')}
|
|
||||||
data={message}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</DescriptionList>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventType === 'downloadFolderImported') {
|
|
||||||
const {
|
|
||||||
customFormatScore,
|
|
||||||
droppedPath,
|
|
||||||
importedPath
|
|
||||||
} = data;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DescriptionList>
|
|
||||||
<DescriptionListItem
|
|
||||||
descriptionClassName={styles.description}
|
|
||||||
title={translate('Name')}
|
|
||||||
data={sourceTitle}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{
|
|
||||||
droppedPath ?
|
|
||||||
<DescriptionListItem
|
|
||||||
descriptionClassName={styles.description}
|
|
||||||
title={translate('Source')}
|
|
||||||
data={droppedPath}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
importedPath ?
|
|
||||||
<DescriptionListItem
|
|
||||||
descriptionClassName={styles.description}
|
|
||||||
title={translate('ImportedTo')}
|
|
||||||
data={importedPath}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
customFormatScore && customFormatScore !== '0' ?
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('CustomFormatScore')}
|
|
||||||
data={formatCustomFormatScore(customFormatScore)}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</DescriptionList>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventType === 'episodeFileDeleted') {
|
|
||||||
const {
|
|
||||||
reason,
|
|
||||||
customFormatScore
|
|
||||||
} = data;
|
|
||||||
|
|
||||||
let reasonMessage = '';
|
|
||||||
|
|
||||||
switch (reason) {
|
|
||||||
case 'Manual':
|
|
||||||
reasonMessage = translate('DeletedReasonManual');
|
|
||||||
break;
|
|
||||||
case 'MissingFromDisk':
|
|
||||||
reasonMessage = translate('DeletedReasonEpisodeMissingFromDisk');
|
|
||||||
break;
|
|
||||||
case 'Upgrade':
|
|
||||||
reasonMessage = translate('DeletedReasonUpgrade');
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reasonMessage = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DescriptionList>
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('Name')}
|
|
||||||
data={sourceTitle}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('Reason')}
|
|
||||||
data={reasonMessage}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{
|
|
||||||
customFormatScore && customFormatScore !== '0' ?
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('CustomFormatScore')}
|
|
||||||
data={formatCustomFormatScore(customFormatScore)}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</DescriptionList>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventType === 'episodeFileRenamed') {
|
|
||||||
const {
|
|
||||||
sourcePath,
|
|
||||||
sourceRelativePath,
|
|
||||||
path,
|
|
||||||
relativePath
|
|
||||||
} = data;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DescriptionList>
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('SourcePath')}
|
|
||||||
data={sourcePath}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('SourceRelativePath')}
|
|
||||||
data={sourceRelativePath}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('DestinationPath')}
|
|
||||||
data={path}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('DestinationRelativePath')}
|
|
||||||
data={relativePath}
|
|
||||||
/>
|
|
||||||
</DescriptionList>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eventType === 'downloadIgnored') {
|
|
||||||
const {
|
|
||||||
message
|
|
||||||
} = data;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DescriptionList>
|
|
||||||
<DescriptionListItem
|
|
||||||
descriptionClassName={styles.description}
|
|
||||||
title={translate('Name')}
|
|
||||||
data={sourceTitle}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{
|
|
||||||
downloadId ?
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('GrabId')}
|
|
||||||
data={downloadId}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
message ?
|
|
||||||
<DescriptionListItem
|
|
||||||
title={translate('Message')}
|
|
||||||
data={message}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</DescriptionList>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DescriptionList>
|
|
||||||
<DescriptionListItem
|
|
||||||
descriptionClassName={styles.description}
|
|
||||||
title={translate('Name')}
|
|
||||||
data={sourceTitle}
|
|
||||||
/>
|
|
||||||
</DescriptionList>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
HistoryDetails.propTypes = {
|
|
||||||
eventType: PropTypes.string.isRequired,
|
|
||||||
sourceTitle: PropTypes.string.isRequired,
|
|
||||||
data: PropTypes.object.isRequired,
|
|
||||||
downloadId: PropTypes.string,
|
|
||||||
shortDateFormat: PropTypes.string.isRequired,
|
|
||||||
timeFormat: PropTypes.string.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default HistoryDetails;
|
|
||||||
@@ -0,0 +1,353 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import DescriptionList from 'Components/DescriptionList/DescriptionList';
|
||||||
|
import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem';
|
||||||
|
import DescriptionListItemDescription from 'Components/DescriptionList/DescriptionListItemDescription';
|
||||||
|
import DescriptionListItemTitle from 'Components/DescriptionList/DescriptionListItemTitle';
|
||||||
|
import Link from 'Components/Link/Link';
|
||||||
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
|
import {
|
||||||
|
DownloadFailedHistory,
|
||||||
|
DownloadFolderImportedHistory,
|
||||||
|
DownloadIgnoredHistory,
|
||||||
|
EpisodeFileDeletedHistory,
|
||||||
|
EpisodeFileRenamedHistory,
|
||||||
|
GrabbedHistoryData,
|
||||||
|
HistoryData,
|
||||||
|
HistoryEventType,
|
||||||
|
} from 'typings/History';
|
||||||
|
import formatDateTime from 'Utilities/Date/formatDateTime';
|
||||||
|
import formatAge from 'Utilities/Number/formatAge';
|
||||||
|
import formatBytes from 'Utilities/Number/formatBytes';
|
||||||
|
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import styles from './HistoryDetails.css';
|
||||||
|
|
||||||
|
interface HistoryDetailsProps {
|
||||||
|
eventType: HistoryEventType;
|
||||||
|
sourceTitle: string;
|
||||||
|
data: HistoryData;
|
||||||
|
downloadId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function HistoryDetails(props: HistoryDetailsProps) {
|
||||||
|
const { eventType, sourceTitle, data, downloadId } = props;
|
||||||
|
|
||||||
|
const { shortDateFormat, timeFormat } = useSelector(
|
||||||
|
createUISettingsSelector()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (eventType === 'grabbed') {
|
||||||
|
const {
|
||||||
|
indexer,
|
||||||
|
releaseGroup,
|
||||||
|
seriesMatchType,
|
||||||
|
releaseSource,
|
||||||
|
customFormatScore,
|
||||||
|
nzbInfoUrl,
|
||||||
|
downloadClient,
|
||||||
|
downloadClientName,
|
||||||
|
age,
|
||||||
|
ageHours,
|
||||||
|
ageMinutes,
|
||||||
|
publishedDate,
|
||||||
|
size,
|
||||||
|
} = data as GrabbedHistoryData;
|
||||||
|
|
||||||
|
const downloadClientNameInfo = downloadClientName ?? downloadClient;
|
||||||
|
|
||||||
|
let releaseSourceMessage = '';
|
||||||
|
|
||||||
|
switch (releaseSource) {
|
||||||
|
case 'Unknown':
|
||||||
|
releaseSourceMessage = translate('Unknown');
|
||||||
|
break;
|
||||||
|
case 'Rss':
|
||||||
|
releaseSourceMessage = translate('Rss');
|
||||||
|
break;
|
||||||
|
case 'Search':
|
||||||
|
releaseSourceMessage = translate('Search');
|
||||||
|
break;
|
||||||
|
case 'UserInvokedSearch':
|
||||||
|
releaseSourceMessage = translate('UserInvokedSearch');
|
||||||
|
break;
|
||||||
|
case 'InteractiveSearch':
|
||||||
|
releaseSourceMessage = translate('InteractiveSearch');
|
||||||
|
break;
|
||||||
|
case 'ReleasePush':
|
||||||
|
releaseSourceMessage = translate('ReleasePush');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
releaseSourceMessage = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DescriptionList>
|
||||||
|
<DescriptionListItem
|
||||||
|
descriptionClassName={styles.description}
|
||||||
|
title={translate('Name')}
|
||||||
|
data={sourceTitle}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{indexer ? (
|
||||||
|
<DescriptionListItem title={translate('Indexer')} data={indexer} />
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{releaseGroup ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
descriptionClassName={styles.description}
|
||||||
|
title={translate('ReleaseGroup')}
|
||||||
|
data={releaseGroup}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{customFormatScore && customFormatScore !== '0' ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('CustomFormatScore')}
|
||||||
|
data={formatCustomFormatScore(parseInt(customFormatScore))}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{seriesMatchType ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
descriptionClassName={styles.description}
|
||||||
|
title={translate('SeriesMatchType')}
|
||||||
|
data={seriesMatchType}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{releaseSource ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
descriptionClassName={styles.description}
|
||||||
|
title={translate('ReleaseSource')}
|
||||||
|
data={releaseSourceMessage}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{nzbInfoUrl ? (
|
||||||
|
<span>
|
||||||
|
<DescriptionListItemTitle>
|
||||||
|
{translate('InfoUrl')}
|
||||||
|
</DescriptionListItemTitle>
|
||||||
|
|
||||||
|
<DescriptionListItemDescription>
|
||||||
|
<Link to={nzbInfoUrl}>{nzbInfoUrl}</Link>
|
||||||
|
</DescriptionListItemDescription>
|
||||||
|
</span>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{downloadClientNameInfo ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('DownloadClient')}
|
||||||
|
data={downloadClientNameInfo}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{downloadId ? (
|
||||||
|
<DescriptionListItem title={translate('GrabId')} data={downloadId} />
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{age || ageHours || ageMinutes ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('AgeWhenGrabbed')}
|
||||||
|
data={formatAge(age, ageHours, ageMinutes)}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{publishedDate ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('PublishedDate')}
|
||||||
|
data={formatDateTime(publishedDate, shortDateFormat, timeFormat, {
|
||||||
|
includeSeconds: true,
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{size ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('Size')}
|
||||||
|
data={formatBytes(size)}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</DescriptionList>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eventType === 'downloadFailed') {
|
||||||
|
const { indexer, message, source } = data as DownloadFailedHistory;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DescriptionList>
|
||||||
|
<DescriptionListItem
|
||||||
|
descriptionClassName={styles.description}
|
||||||
|
title={translate('Name')}
|
||||||
|
data={sourceTitle}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{downloadId ? (
|
||||||
|
<DescriptionListItem title={translate('GrabId')} data={downloadId} />
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{indexer ? (
|
||||||
|
<DescriptionListItem title={translate('Indexer')} data={indexer} />
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{message ? (
|
||||||
|
<DescriptionListItem title={translate('Message')} data={message} />
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{source ? (
|
||||||
|
<DescriptionListItem title={translate('Source')} data={source} />
|
||||||
|
) : null}
|
||||||
|
</DescriptionList>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eventType === 'downloadFolderImported') {
|
||||||
|
const { customFormatScore, droppedPath, importedPath, size } =
|
||||||
|
data as DownloadFolderImportedHistory;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DescriptionList>
|
||||||
|
<DescriptionListItem
|
||||||
|
descriptionClassName={styles.description}
|
||||||
|
title={translate('Name')}
|
||||||
|
data={sourceTitle}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{droppedPath ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
descriptionClassName={styles.description}
|
||||||
|
title={translate('Source')}
|
||||||
|
data={droppedPath}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{importedPath ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
descriptionClassName={styles.description}
|
||||||
|
title={translate('ImportedTo')}
|
||||||
|
data={importedPath}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{customFormatScore && customFormatScore !== '0' ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('CustomFormatScore')}
|
||||||
|
data={formatCustomFormatScore(parseInt(customFormatScore))}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{size ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('FileSize')}
|
||||||
|
data={formatBytes(size)}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</DescriptionList>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eventType === 'episodeFileDeleted') {
|
||||||
|
const { reason, customFormatScore, size } =
|
||||||
|
data as EpisodeFileDeletedHistory;
|
||||||
|
|
||||||
|
let reasonMessage = '';
|
||||||
|
|
||||||
|
switch (reason) {
|
||||||
|
case 'Manual':
|
||||||
|
reasonMessage = translate('DeletedReasonManual');
|
||||||
|
break;
|
||||||
|
case 'MissingFromDisk':
|
||||||
|
reasonMessage = translate('DeletedReasonEpisodeMissingFromDisk');
|
||||||
|
break;
|
||||||
|
case 'Upgrade':
|
||||||
|
reasonMessage = translate('DeletedReasonUpgrade');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
reasonMessage = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DescriptionList>
|
||||||
|
<DescriptionListItem title={translate('Name')} data={sourceTitle} />
|
||||||
|
|
||||||
|
<DescriptionListItem title={translate('Reason')} data={reasonMessage} />
|
||||||
|
|
||||||
|
{customFormatScore && customFormatScore !== '0' ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('CustomFormatScore')}
|
||||||
|
data={formatCustomFormatScore(parseInt(customFormatScore))}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{size ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('FileSize')}
|
||||||
|
data={formatBytes(size)}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</DescriptionList>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eventType === 'episodeFileRenamed') {
|
||||||
|
const { sourcePath, sourceRelativePath, path, relativePath } =
|
||||||
|
data as EpisodeFileRenamedHistory;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DescriptionList>
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('SourcePath')}
|
||||||
|
data={sourcePath}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('SourceRelativePath')}
|
||||||
|
data={sourceRelativePath}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<DescriptionListItem title={translate('DestinationPath')} data={path} />
|
||||||
|
|
||||||
|
<DescriptionListItem
|
||||||
|
title={translate('DestinationRelativePath')}
|
||||||
|
data={relativePath}
|
||||||
|
/>
|
||||||
|
</DescriptionList>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eventType === 'downloadIgnored') {
|
||||||
|
const { message } = data as DownloadIgnoredHistory;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DescriptionList>
|
||||||
|
<DescriptionListItem
|
||||||
|
descriptionClassName={styles.description}
|
||||||
|
title={translate('Name')}
|
||||||
|
data={sourceTitle}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{downloadId ? (
|
||||||
|
<DescriptionListItem title={translate('GrabId')} data={downloadId} />
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{message ? (
|
||||||
|
<DescriptionListItem title={translate('Message')} data={message} />
|
||||||
|
) : null}
|
||||||
|
</DescriptionList>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DescriptionList>
|
||||||
|
<DescriptionListItem
|
||||||
|
descriptionClassName={styles.description}
|
||||||
|
title={translate('Name')}
|
||||||
|
data={sourceTitle}
|
||||||
|
/>
|
||||||
|
</DescriptionList>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HistoryDetails;
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import _ from 'lodash';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
||||||
import HistoryDetails from './HistoryDetails';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
createUISettingsSelector(),
|
|
||||||
(uiSettings) => {
|
|
||||||
return _.pick(uiSettings, [
|
|
||||||
'shortDateFormat',
|
|
||||||
'timeFormat'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps)(HistoryDetails);
|
|
||||||
+29
-49
@@ -1,4 +1,3 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Button from 'Components/Link/Button';
|
import Button from 'Components/Link/Button';
|
||||||
import SpinnerButton from 'Components/Link/SpinnerButton';
|
import SpinnerButton from 'Components/Link/SpinnerButton';
|
||||||
@@ -8,11 +7,12 @@ import ModalContent from 'Components/Modal/ModalContent';
|
|||||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
import { kinds } from 'Helpers/Props';
|
import { kinds } from 'Helpers/Props';
|
||||||
|
import { HistoryData, HistoryEventType } from 'typings/History';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import HistoryDetails from './HistoryDetails';
|
import HistoryDetails from './HistoryDetails';
|
||||||
import styles from './HistoryDetailsModal.css';
|
import styles from './HistoryDetailsModal.css';
|
||||||
|
|
||||||
function getHeaderTitle(eventType) {
|
function getHeaderTitle(eventType: HistoryEventType) {
|
||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
case 'grabbed':
|
case 'grabbed':
|
||||||
return translate('Grabbed');
|
return translate('Grabbed');
|
||||||
@@ -31,29 +31,33 @@ function getHeaderTitle(eventType) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function HistoryDetailsModal(props) {
|
interface HistoryDetailsModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
eventType: HistoryEventType;
|
||||||
|
sourceTitle: string;
|
||||||
|
data: HistoryData;
|
||||||
|
downloadId?: string;
|
||||||
|
isMarkingAsFailed: boolean;
|
||||||
|
onMarkAsFailedPress: () => void;
|
||||||
|
onModalClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function HistoryDetailsModal(props: HistoryDetailsModalProps) {
|
||||||
const {
|
const {
|
||||||
isOpen,
|
isOpen,
|
||||||
eventType,
|
eventType,
|
||||||
sourceTitle,
|
sourceTitle,
|
||||||
data,
|
data,
|
||||||
downloadId,
|
downloadId,
|
||||||
isMarkingAsFailed,
|
isMarkingAsFailed = false,
|
||||||
shortDateFormat,
|
|
||||||
timeFormat,
|
|
||||||
onMarkAsFailedPress,
|
onMarkAsFailedPress,
|
||||||
onModalClose
|
onModalClose,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
isOpen={isOpen}
|
|
||||||
onModalClose={onModalClose}
|
|
||||||
>
|
|
||||||
<ModalContent onModalClose={onModalClose}>
|
<ModalContent onModalClose={onModalClose}>
|
||||||
<ModalHeader>
|
<ModalHeader>{getHeaderTitle(eventType)}</ModalHeader>
|
||||||
{getHeaderTitle(eventType)}
|
|
||||||
</ModalHeader>
|
|
||||||
|
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<HistoryDetails
|
<HistoryDetails
|
||||||
@@ -61,50 +65,26 @@ function HistoryDetailsModal(props) {
|
|||||||
sourceTitle={sourceTitle}
|
sourceTitle={sourceTitle}
|
||||||
data={data}
|
data={data}
|
||||||
downloadId={downloadId}
|
downloadId={downloadId}
|
||||||
shortDateFormat={shortDateFormat}
|
|
||||||
timeFormat={timeFormat}
|
|
||||||
/>
|
/>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
{
|
{eventType === 'grabbed' && (
|
||||||
eventType === 'grabbed' &&
|
<SpinnerButton
|
||||||
<SpinnerButton
|
className={styles.markAsFailedButton}
|
||||||
className={styles.markAsFailedButton}
|
kind={kinds.DANGER}
|
||||||
kind={kinds.DANGER}
|
isSpinning={isMarkingAsFailed}
|
||||||
isSpinning={isMarkingAsFailed}
|
onPress={onMarkAsFailedPress}
|
||||||
onPress={onMarkAsFailedPress}
|
>
|
||||||
>
|
{translate('MarkAsFailed')}
|
||||||
{translate('MarkAsFailed')}
|
</SpinnerButton>
|
||||||
</SpinnerButton>
|
)}
|
||||||
}
|
|
||||||
|
|
||||||
<Button
|
<Button onPress={onModalClose}>{translate('Close')}</Button>
|
||||||
onPress={onModalClose}
|
|
||||||
>
|
|
||||||
{translate('Close')}
|
|
||||||
</Button>
|
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryDetailsModal.propTypes = {
|
|
||||||
isOpen: PropTypes.bool.isRequired,
|
|
||||||
eventType: PropTypes.string.isRequired,
|
|
||||||
sourceTitle: PropTypes.string.isRequired,
|
|
||||||
data: PropTypes.object.isRequired,
|
|
||||||
downloadId: PropTypes.string,
|
|
||||||
isMarkingAsFailed: PropTypes.bool.isRequired,
|
|
||||||
shortDateFormat: PropTypes.string.isRequired,
|
|
||||||
timeFormat: PropTypes.string.isRequired,
|
|
||||||
onMarkAsFailedPress: PropTypes.func.isRequired,
|
|
||||||
onModalClose: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
HistoryDetailsModal.defaultProps = {
|
|
||||||
isMarkingAsFailed: false
|
|
||||||
};
|
|
||||||
|
|
||||||
export default HistoryDetailsModal;
|
export default HistoryDetailsModal;
|
||||||
@@ -1,180 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import Alert from 'Components/Alert';
|
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
|
||||||
import FilterMenu from 'Components/Menu/FilterMenu';
|
|
||||||
import PageContent from 'Components/Page/PageContent';
|
|
||||||
import PageContentBody from 'Components/Page/PageContentBody';
|
|
||||||
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
|
||||||
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
|
||||||
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
|
||||||
import Table from 'Components/Table/Table';
|
|
||||||
import TableBody from 'Components/Table/TableBody';
|
|
||||||
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
|
||||||
import TablePager from 'Components/Table/TablePager';
|
|
||||||
import { align, icons, kinds } from 'Helpers/Props';
|
|
||||||
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import HistoryFilterModal from './HistoryFilterModal';
|
|
||||||
import HistoryRowConnector from './HistoryRowConnector';
|
|
||||||
|
|
||||||
class History extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps) {
|
|
||||||
// Don't update when fetching has completed if items have changed,
|
|
||||||
// before episodes start fetching or when episodes start fetching.
|
|
||||||
|
|
||||||
if (
|
|
||||||
(
|
|
||||||
this.props.isFetching &&
|
|
||||||
nextProps.isPopulated &&
|
|
||||||
hasDifferentItems(this.props.items, nextProps.items)
|
|
||||||
) ||
|
|
||||||
(!this.props.isEpisodesFetching && nextProps.isEpisodesFetching)
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
isFetching,
|
|
||||||
isPopulated,
|
|
||||||
error,
|
|
||||||
items,
|
|
||||||
columns,
|
|
||||||
selectedFilterKey,
|
|
||||||
filters,
|
|
||||||
customFilters,
|
|
||||||
totalRecords,
|
|
||||||
isEpisodesFetching,
|
|
||||||
isEpisodesPopulated,
|
|
||||||
episodesError,
|
|
||||||
onFilterSelect,
|
|
||||||
onFirstPagePress,
|
|
||||||
...otherProps
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const isFetchingAny = isFetching || isEpisodesFetching;
|
|
||||||
const isAllPopulated = isPopulated && (isEpisodesPopulated || !items.length);
|
|
||||||
const hasError = error || episodesError;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageContent title={translate('History')}>
|
|
||||||
<PageToolbar>
|
|
||||||
<PageToolbarSection>
|
|
||||||
<PageToolbarButton
|
|
||||||
label={translate('Refresh')}
|
|
||||||
iconName={icons.REFRESH}
|
|
||||||
isSpinning={isFetching}
|
|
||||||
onPress={onFirstPagePress}
|
|
||||||
/>
|
|
||||||
</PageToolbarSection>
|
|
||||||
|
|
||||||
<PageToolbarSection alignContent={align.RIGHT}>
|
|
||||||
<TableOptionsModalWrapper
|
|
||||||
{...otherProps}
|
|
||||||
columns={columns}
|
|
||||||
>
|
|
||||||
<PageToolbarButton
|
|
||||||
label={translate('Options')}
|
|
||||||
iconName={icons.TABLE}
|
|
||||||
/>
|
|
||||||
</TableOptionsModalWrapper>
|
|
||||||
|
|
||||||
<FilterMenu
|
|
||||||
alignMenu={align.RIGHT}
|
|
||||||
selectedFilterKey={selectedFilterKey}
|
|
||||||
filters={filters}
|
|
||||||
customFilters={customFilters}
|
|
||||||
filterModalConnectorComponent={HistoryFilterModal}
|
|
||||||
onFilterSelect={onFilterSelect}
|
|
||||||
/>
|
|
||||||
</PageToolbarSection>
|
|
||||||
</PageToolbar>
|
|
||||||
|
|
||||||
<PageContentBody>
|
|
||||||
{
|
|
||||||
isFetchingAny && !isAllPopulated &&
|
|
||||||
<LoadingIndicator />
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!isFetchingAny && hasError &&
|
|
||||||
<Alert kind={kinds.DANGER}>
|
|
||||||
{translate('HistoryLoadError')}
|
|
||||||
</Alert>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
// If history isPopulated and it's empty show no history found and don't
|
|
||||||
// wait for the episodes to populate because they are never coming.
|
|
||||||
|
|
||||||
isPopulated && !hasError && !items.length &&
|
|
||||||
<Alert kind={kinds.INFO}>
|
|
||||||
{translate('NoHistoryFound')}
|
|
||||||
</Alert>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
isAllPopulated && !hasError && !!items.length &&
|
|
||||||
<div>
|
|
||||||
<Table
|
|
||||||
columns={columns}
|
|
||||||
{...otherProps}
|
|
||||||
>
|
|
||||||
<TableBody>
|
|
||||||
{
|
|
||||||
items.map((item) => {
|
|
||||||
return (
|
|
||||||
<HistoryRowConnector
|
|
||||||
key={item.id}
|
|
||||||
columns={columns}
|
|
||||||
{...item}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</TableBody>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
<TablePager
|
|
||||||
totalRecords={totalRecords}
|
|
||||||
isFetching={isFetchingAny}
|
|
||||||
onFirstPagePress={onFirstPagePress}
|
|
||||||
{...otherProps}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</PageContentBody>
|
|
||||||
</PageContent>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
History.propTypes = {
|
|
||||||
isFetching: PropTypes.bool.isRequired,
|
|
||||||
isPopulated: PropTypes.bool.isRequired,
|
|
||||||
error: PropTypes.object,
|
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
||||||
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
customFilters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
totalRecords: PropTypes.number,
|
|
||||||
isEpisodesFetching: PropTypes.bool.isRequired,
|
|
||||||
isEpisodesPopulated: PropTypes.bool.isRequired,
|
|
||||||
episodesError: PropTypes.object,
|
|
||||||
onFilterSelect: PropTypes.func.isRequired,
|
|
||||||
onFirstPagePress: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default History;
|
|
||||||
@@ -0,0 +1,231 @@
|
|||||||
|
import React, { useCallback, useEffect } from 'react';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
|
import FilterMenu from 'Components/Menu/FilterMenu';
|
||||||
|
import PageContent from 'Components/Page/PageContent';
|
||||||
|
import PageContentBody from 'Components/Page/PageContentBody';
|
||||||
|
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
||||||
|
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
||||||
|
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
||||||
|
import Table from 'Components/Table/Table';
|
||||||
|
import TableBody from 'Components/Table/TableBody';
|
||||||
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
|
import TablePager from 'Components/Table/TablePager';
|
||||||
|
import usePaging from 'Components/Table/usePaging';
|
||||||
|
import createEpisodesFetchingSelector from 'Episode/createEpisodesFetchingSelector';
|
||||||
|
import useCurrentPage from 'Helpers/Hooks/useCurrentPage';
|
||||||
|
import { align, icons, kinds } from 'Helpers/Props';
|
||||||
|
import { clearEpisodes, fetchEpisodes } from 'Store/Actions/episodeActions';
|
||||||
|
import { clearEpisodeFiles } from 'Store/Actions/episodeFileActions';
|
||||||
|
import {
|
||||||
|
clearHistory,
|
||||||
|
fetchHistory,
|
||||||
|
gotoHistoryPage,
|
||||||
|
setHistoryFilter,
|
||||||
|
setHistorySort,
|
||||||
|
setHistoryTableOption,
|
||||||
|
} from 'Store/Actions/historyActions';
|
||||||
|
import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector';
|
||||||
|
import HistoryItem from 'typings/History';
|
||||||
|
import { TableOptionsChangePayload } from 'typings/Table';
|
||||||
|
import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
|
||||||
|
import {
|
||||||
|
registerPagePopulator,
|
||||||
|
unregisterPagePopulator,
|
||||||
|
} from 'Utilities/pagePopulator';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import HistoryFilterModal from './HistoryFilterModal';
|
||||||
|
import HistoryRow from './HistoryRow';
|
||||||
|
|
||||||
|
function History() {
|
||||||
|
const requestCurrentPage = useCurrentPage();
|
||||||
|
|
||||||
|
const {
|
||||||
|
isFetching,
|
||||||
|
isPopulated,
|
||||||
|
error,
|
||||||
|
items,
|
||||||
|
columns,
|
||||||
|
selectedFilterKey,
|
||||||
|
filters,
|
||||||
|
sortKey,
|
||||||
|
sortDirection,
|
||||||
|
page,
|
||||||
|
pageSize,
|
||||||
|
totalPages,
|
||||||
|
totalRecords,
|
||||||
|
} = useSelector((state: AppState) => state.history);
|
||||||
|
|
||||||
|
const { isEpisodesFetching, isEpisodesPopulated, episodesError } =
|
||||||
|
useSelector(createEpisodesFetchingSelector());
|
||||||
|
const customFilters = useSelector(createCustomFiltersSelector('history'));
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const isFetchingAny = isFetching || isEpisodesFetching;
|
||||||
|
const isAllPopulated = isPopulated && (isEpisodesPopulated || !items.length);
|
||||||
|
const hasError = error || episodesError;
|
||||||
|
|
||||||
|
const {
|
||||||
|
handleFirstPagePress,
|
||||||
|
handlePreviousPagePress,
|
||||||
|
handleNextPagePress,
|
||||||
|
handleLastPagePress,
|
||||||
|
handlePageSelect,
|
||||||
|
} = usePaging({
|
||||||
|
page,
|
||||||
|
totalPages,
|
||||||
|
gotoPage: gotoHistoryPage,
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleFilterSelect = useCallback(
|
||||||
|
(selectedFilterKey: string | number) => {
|
||||||
|
dispatch(setHistoryFilter({ selectedFilterKey }));
|
||||||
|
},
|
||||||
|
[dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleSortPress = useCallback(
|
||||||
|
(sortKey: string) => {
|
||||||
|
dispatch(setHistorySort({ sortKey }));
|
||||||
|
},
|
||||||
|
[dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleTableOptionChange = useCallback(
|
||||||
|
(payload: TableOptionsChangePayload) => {
|
||||||
|
dispatch(setHistoryTableOption(payload));
|
||||||
|
|
||||||
|
if (payload.pageSize) {
|
||||||
|
dispatch(gotoHistoryPage({ page: 1 }));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (requestCurrentPage) {
|
||||||
|
dispatch(fetchHistory());
|
||||||
|
} else {
|
||||||
|
dispatch(gotoHistoryPage({ page: 1 }));
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
dispatch(clearHistory());
|
||||||
|
dispatch(clearEpisodes());
|
||||||
|
dispatch(clearEpisodeFiles());
|
||||||
|
};
|
||||||
|
}, [requestCurrentPage, dispatch]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const episodeIds = selectUniqueIds<HistoryItem, number>(items, 'episodeId');
|
||||||
|
|
||||||
|
if (episodeIds.length) {
|
||||||
|
dispatch(fetchEpisodes({ episodeIds }));
|
||||||
|
} else {
|
||||||
|
dispatch(clearEpisodes());
|
||||||
|
}
|
||||||
|
}, [items, dispatch]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const repopulate = () => {
|
||||||
|
dispatch(fetchHistory());
|
||||||
|
};
|
||||||
|
|
||||||
|
registerPagePopulator(repopulate);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
unregisterPagePopulator(repopulate);
|
||||||
|
};
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageContent title={translate('History')}>
|
||||||
|
<PageToolbar>
|
||||||
|
<PageToolbarSection>
|
||||||
|
<PageToolbarButton
|
||||||
|
label={translate('Refresh')}
|
||||||
|
iconName={icons.REFRESH}
|
||||||
|
isSpinning={isFetching}
|
||||||
|
onPress={handleFirstPagePress}
|
||||||
|
/>
|
||||||
|
</PageToolbarSection>
|
||||||
|
|
||||||
|
<PageToolbarSection alignContent={align.RIGHT}>
|
||||||
|
<TableOptionsModalWrapper
|
||||||
|
columns={columns}
|
||||||
|
pageSize={pageSize}
|
||||||
|
onTableOptionChange={handleTableOptionChange}
|
||||||
|
>
|
||||||
|
<PageToolbarButton
|
||||||
|
label={translate('Options')}
|
||||||
|
iconName={icons.TABLE}
|
||||||
|
/>
|
||||||
|
</TableOptionsModalWrapper>
|
||||||
|
|
||||||
|
<FilterMenu
|
||||||
|
alignMenu={align.RIGHT}
|
||||||
|
selectedFilterKey={selectedFilterKey}
|
||||||
|
filters={filters}
|
||||||
|
customFilters={customFilters}
|
||||||
|
filterModalConnectorComponent={HistoryFilterModal}
|
||||||
|
onFilterSelect={handleFilterSelect}
|
||||||
|
/>
|
||||||
|
</PageToolbarSection>
|
||||||
|
</PageToolbar>
|
||||||
|
|
||||||
|
<PageContentBody>
|
||||||
|
{isFetchingAny && !isAllPopulated ? <LoadingIndicator /> : null}
|
||||||
|
|
||||||
|
{!isFetchingAny && hasError ? (
|
||||||
|
<Alert kind={kinds.DANGER}>{translate('HistoryLoadError')}</Alert>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{
|
||||||
|
// If history isPopulated and it's empty show no history found and don't
|
||||||
|
// wait for the episodes to populate because they are never coming.
|
||||||
|
|
||||||
|
isPopulated && !hasError && !items.length ? (
|
||||||
|
<Alert kind={kinds.INFO}>{translate('NoHistoryFound')}</Alert>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
|
||||||
|
{isAllPopulated && !hasError && items.length ? (
|
||||||
|
<div>
|
||||||
|
<Table
|
||||||
|
columns={columns}
|
||||||
|
pageSize={pageSize}
|
||||||
|
sortKey={sortKey}
|
||||||
|
sortDirection={sortDirection}
|
||||||
|
onTableOptionChange={handleTableOptionChange}
|
||||||
|
onSortPress={handleSortPress}
|
||||||
|
>
|
||||||
|
<TableBody>
|
||||||
|
{items.map((item) => {
|
||||||
|
return (
|
||||||
|
<HistoryRow key={item.id} columns={columns} {...item} />
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
|
||||||
|
<TablePager
|
||||||
|
page={page}
|
||||||
|
totalPages={totalPages}
|
||||||
|
totalRecords={totalRecords}
|
||||||
|
isFetching={isFetching}
|
||||||
|
onFirstPagePress={handleFirstPagePress}
|
||||||
|
onPreviousPagePress={handlePreviousPagePress}
|
||||||
|
onNextPagePress={handleNextPagePress}
|
||||||
|
onLastPagePress={handleLastPagePress}
|
||||||
|
onPageSelect={handlePageSelect}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
</PageContentBody>
|
||||||
|
</PageContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default History;
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import withCurrentPage from 'Components/withCurrentPage';
|
|
||||||
import { clearEpisodes, fetchEpisodes } from 'Store/Actions/episodeActions';
|
|
||||||
import { clearEpisodeFiles } from 'Store/Actions/episodeFileActions';
|
|
||||||
import * as historyActions from 'Store/Actions/historyActions';
|
|
||||||
import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector';
|
|
||||||
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
|
||||||
import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
|
|
||||||
import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator';
|
|
||||||
import History from './History';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.history,
|
|
||||||
(state) => state.episodes,
|
|
||||||
createCustomFiltersSelector('history'),
|
|
||||||
(history, episodes, customFilters) => {
|
|
||||||
return {
|
|
||||||
isEpisodesFetching: episodes.isFetching,
|
|
||||||
isEpisodesPopulated: episodes.isPopulated,
|
|
||||||
episodesError: episodes.error,
|
|
||||||
customFilters,
|
|
||||||
...history
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
...historyActions,
|
|
||||||
fetchEpisodes,
|
|
||||||
clearEpisodes,
|
|
||||||
clearEpisodeFiles
|
|
||||||
};
|
|
||||||
|
|
||||||
class HistoryConnector extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
const {
|
|
||||||
useCurrentPage,
|
|
||||||
fetchHistory,
|
|
||||||
gotoHistoryFirstPage
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
registerPagePopulator(this.repopulate);
|
|
||||||
|
|
||||||
if (useCurrentPage) {
|
|
||||||
fetchHistory();
|
|
||||||
} else {
|
|
||||||
gotoHistoryFirstPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
if (hasDifferentItems(prevProps.items, this.props.items)) {
|
|
||||||
const episodeIds = selectUniqueIds(this.props.items, 'episodeId');
|
|
||||||
|
|
||||||
if (episodeIds.length) {
|
|
||||||
this.props.fetchEpisodes({ episodeIds });
|
|
||||||
} else {
|
|
||||||
this.props.clearEpisodes();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
unregisterPagePopulator(this.repopulate);
|
|
||||||
this.props.clearHistory();
|
|
||||||
this.props.clearEpisodes();
|
|
||||||
this.props.clearEpisodeFiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Control
|
|
||||||
|
|
||||||
repopulate = () => {
|
|
||||||
this.props.fetchHistory();
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onFirstPagePress = () => {
|
|
||||||
this.props.gotoHistoryFirstPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
onPreviousPagePress = () => {
|
|
||||||
this.props.gotoHistoryPreviousPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
onNextPagePress = () => {
|
|
||||||
this.props.gotoHistoryNextPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
onLastPagePress = () => {
|
|
||||||
this.props.gotoHistoryLastPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
onPageSelect = (page) => {
|
|
||||||
this.props.gotoHistoryPage({ page });
|
|
||||||
};
|
|
||||||
|
|
||||||
onSortPress = (sortKey) => {
|
|
||||||
this.props.setHistorySort({ sortKey });
|
|
||||||
};
|
|
||||||
|
|
||||||
onFilterSelect = (selectedFilterKey) => {
|
|
||||||
this.props.setHistoryFilter({ selectedFilterKey });
|
|
||||||
};
|
|
||||||
|
|
||||||
onTableOptionChange = (payload) => {
|
|
||||||
this.props.setHistoryTableOption(payload);
|
|
||||||
|
|
||||||
if (payload.pageSize) {
|
|
||||||
this.props.gotoHistoryFirstPage();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<History
|
|
||||||
onFirstPagePress={this.onFirstPagePress}
|
|
||||||
onPreviousPagePress={this.onPreviousPagePress}
|
|
||||||
onNextPagePress={this.onNextPagePress}
|
|
||||||
onLastPagePress={this.onLastPagePress}
|
|
||||||
onPageSelect={this.onPageSelect}
|
|
||||||
onSortPress={this.onSortPress}
|
|
||||||
onFilterSelect={this.onFilterSelect}
|
|
||||||
onTableOptionChange={this.onTableOptionChange}
|
|
||||||
{...this.props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HistoryConnector.propTypes = {
|
|
||||||
useCurrentPage: PropTypes.bool.isRequired,
|
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
fetchHistory: PropTypes.func.isRequired,
|
|
||||||
gotoHistoryFirstPage: PropTypes.func.isRequired,
|
|
||||||
gotoHistoryPreviousPage: PropTypes.func.isRequired,
|
|
||||||
gotoHistoryNextPage: PropTypes.func.isRequired,
|
|
||||||
gotoHistoryLastPage: PropTypes.func.isRequired,
|
|
||||||
gotoHistoryPage: PropTypes.func.isRequired,
|
|
||||||
setHistorySort: PropTypes.func.isRequired,
|
|
||||||
setHistoryFilter: PropTypes.func.isRequired,
|
|
||||||
setHistoryTableOption: PropTypes.func.isRequired,
|
|
||||||
clearHistory: PropTypes.func.isRequired,
|
|
||||||
fetchEpisodes: PropTypes.func.isRequired,
|
|
||||||
clearEpisodes: PropTypes.func.isRequired,
|
|
||||||
clearEpisodeFiles: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default withCurrentPage(
|
|
||||||
connect(createMapStateToProps, mapDispatchToProps)(HistoryConnector)
|
|
||||||
);
|
|
||||||
+27
-25
@@ -1,12 +1,17 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Icon from 'Components/Icon';
|
import Icon from 'Components/Icon';
|
||||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
import { icons, kinds } from 'Helpers/Props';
|
import { icons, kinds } from 'Helpers/Props';
|
||||||
|
import {
|
||||||
|
EpisodeFileDeletedHistory,
|
||||||
|
GrabbedHistoryData,
|
||||||
|
HistoryData,
|
||||||
|
HistoryEventType,
|
||||||
|
} from 'typings/History';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import styles from './HistoryEventTypeCell.css';
|
import styles from './HistoryEventTypeCell.css';
|
||||||
|
|
||||||
function getIconName(eventType, data) {
|
function getIconName(eventType: HistoryEventType, data: HistoryData) {
|
||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
case 'grabbed':
|
case 'grabbed':
|
||||||
return icons.DOWNLOADING;
|
return icons.DOWNLOADING;
|
||||||
@@ -17,7 +22,9 @@ function getIconName(eventType, data) {
|
|||||||
case 'downloadFailed':
|
case 'downloadFailed':
|
||||||
return icons.DOWNLOADING;
|
return icons.DOWNLOADING;
|
||||||
case 'episodeFileDeleted':
|
case 'episodeFileDeleted':
|
||||||
return data.reason === 'MissingFromDisk' ? icons.FILE_MISSING : icons.DELETE;
|
return (data as EpisodeFileDeletedHistory).reason === 'MissingFromDisk'
|
||||||
|
? icons.FILE_MISSING
|
||||||
|
: icons.DELETE;
|
||||||
case 'episodeFileRenamed':
|
case 'episodeFileRenamed':
|
||||||
return icons.ORGANIZE;
|
return icons.ORGANIZE;
|
||||||
case 'downloadIgnored':
|
case 'downloadIgnored':
|
||||||
@@ -27,7 +34,7 @@ function getIconName(eventType, data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIconKind(eventType) {
|
function getIconKind(eventType: HistoryEventType) {
|
||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
case 'downloadFailed':
|
case 'downloadFailed':
|
||||||
return kinds.DANGER;
|
return kinds.DANGER;
|
||||||
@@ -36,10 +43,13 @@ function getIconKind(eventType) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTooltip(eventType, data) {
|
function getTooltip(eventType: HistoryEventType, data: HistoryData) {
|
||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
case 'grabbed':
|
case 'grabbed':
|
||||||
return translate('EpisodeGrabbedTooltip', { indexer: data.indexer, downloadClient: data.downloadClient });
|
return translate('EpisodeGrabbedTooltip', {
|
||||||
|
indexer: (data as GrabbedHistoryData).indexer,
|
||||||
|
downloadClient: (data as GrabbedHistoryData).downloadClient,
|
||||||
|
});
|
||||||
case 'seriesFolderImported':
|
case 'seriesFolderImported':
|
||||||
return translate('SeriesFolderImportedTooltip');
|
return translate('SeriesFolderImportedTooltip');
|
||||||
case 'downloadFolderImported':
|
case 'downloadFolderImported':
|
||||||
@@ -47,7 +57,9 @@ function getTooltip(eventType, data) {
|
|||||||
case 'downloadFailed':
|
case 'downloadFailed':
|
||||||
return translate('DownloadFailedEpisodeTooltip');
|
return translate('DownloadFailedEpisodeTooltip');
|
||||||
case 'episodeFileDeleted':
|
case 'episodeFileDeleted':
|
||||||
return data.reason === 'MissingFromDisk' ? translate('EpisodeFileMissingTooltip') : translate('EpisodeFileDeletedTooltip');
|
return (data as EpisodeFileDeletedHistory).reason === 'MissingFromDisk'
|
||||||
|
? translate('EpisodeFileMissingTooltip')
|
||||||
|
: translate('EpisodeFileDeletedTooltip');
|
||||||
case 'episodeFileRenamed':
|
case 'episodeFileRenamed':
|
||||||
return translate('EpisodeFileRenamedTooltip');
|
return translate('EpisodeFileRenamedTooltip');
|
||||||
case 'downloadIgnored':
|
case 'downloadIgnored':
|
||||||
@@ -57,31 +69,21 @@ function getTooltip(eventType, data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function HistoryEventTypeCell({ eventType, data }) {
|
interface HistoryEventTypeCellProps {
|
||||||
|
eventType: HistoryEventType;
|
||||||
|
data: HistoryData;
|
||||||
|
}
|
||||||
|
|
||||||
|
function HistoryEventTypeCell({ eventType, data }: HistoryEventTypeCellProps) {
|
||||||
const iconName = getIconName(eventType, data);
|
const iconName = getIconName(eventType, data);
|
||||||
const iconKind = getIconKind(eventType);
|
const iconKind = getIconKind(eventType);
|
||||||
const tooltip = getTooltip(eventType, data);
|
const tooltip = getTooltip(eventType, data);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRowCell
|
<TableRowCell className={styles.cell} title={tooltip}>
|
||||||
className={styles.cell}
|
<Icon name={iconName} kind={iconKind} />
|
||||||
title={tooltip}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
name={iconName}
|
|
||||||
kind={iconKind}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
</TableRowCell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryEventTypeCell.propTypes = {
|
|
||||||
eventType: PropTypes.string.isRequired,
|
|
||||||
data: PropTypes.object
|
|
||||||
};
|
|
||||||
|
|
||||||
HistoryEventTypeCell.defaultProps = {
|
|
||||||
data: {}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default HistoryEventTypeCell;
|
export default HistoryEventTypeCell;
|
||||||
@@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
|
|||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import AppState from 'App/State/AppState';
|
import AppState from 'App/State/AppState';
|
||||||
import FilterModal from 'Components/Filter/FilterModal';
|
import FilterModal, { FilterModalProps } from 'Components/Filter/FilterModal';
|
||||||
import { setHistoryFilter } from 'Store/Actions/historyActions';
|
import { setHistoryFilter } from 'Store/Actions/historyActions';
|
||||||
|
|
||||||
function createHistorySelector() {
|
function createHistorySelector() {
|
||||||
@@ -23,19 +23,16 @@ function createFilterBuilderPropsSelector() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface HistoryFilterModalProps {
|
type HistoryFilterModalProps = FilterModalProps<History>;
|
||||||
isOpen: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function HistoryFilterModal(props: HistoryFilterModalProps) {
|
export default function HistoryFilterModal(props: HistoryFilterModalProps) {
|
||||||
const sectionItems = useSelector(createHistorySelector());
|
const sectionItems = useSelector(createHistorySelector());
|
||||||
const filterBuilderProps = useSelector(createFilterBuilderPropsSelector());
|
const filterBuilderProps = useSelector(createFilterBuilderPropsSelector());
|
||||||
const customFilterType = 'history';
|
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const dispatchSetFilter = useCallback(
|
const dispatchSetFilter = useCallback(
|
||||||
(payload: unknown) => {
|
(payload: { selectedFilterKey: string | number }) => {
|
||||||
dispatch(setHistoryFilter(payload));
|
dispatch(setHistoryFilter(payload));
|
||||||
},
|
},
|
||||||
[dispatch]
|
[dispatch]
|
||||||
@@ -43,11 +40,10 @@ export default function HistoryFilterModal(props: HistoryFilterModalProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<FilterModal
|
<FilterModal
|
||||||
// TODO: Don't spread all the props
|
|
||||||
{...props}
|
{...props}
|
||||||
sectionItems={sectionItems}
|
sectionItems={sectionItems}
|
||||||
filterBuilderProps={filterBuilderProps}
|
filterBuilderProps={filterBuilderProps}
|
||||||
customFilterType={customFilterType}
|
customFilterType="history"
|
||||||
dispatchSetFilter={dispatchSetFilter}
|
dispatchSetFilter={dispatchSetFilter}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,312 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import IconButton from 'Components/Link/IconButton';
|
|
||||||
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
|
||||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
|
||||||
import TableRow from 'Components/Table/TableRow';
|
|
||||||
import Tooltip from 'Components/Tooltip/Tooltip';
|
|
||||||
import episodeEntities from 'Episode/episodeEntities';
|
|
||||||
import EpisodeFormats from 'Episode/EpisodeFormats';
|
|
||||||
import EpisodeLanguages from 'Episode/EpisodeLanguages';
|
|
||||||
import EpisodeQuality from 'Episode/EpisodeQuality';
|
|
||||||
import EpisodeTitleLink from 'Episode/EpisodeTitleLink';
|
|
||||||
import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber';
|
|
||||||
import { icons, tooltipPositions } from 'Helpers/Props';
|
|
||||||
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
|
||||||
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
|
||||||
import HistoryDetailsModal from './Details/HistoryDetailsModal';
|
|
||||||
import HistoryEventTypeCell from './HistoryEventTypeCell';
|
|
||||||
import styles from './HistoryRow.css';
|
|
||||||
|
|
||||||
class HistoryRow extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
isDetailsModalOpen: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
if (
|
|
||||||
prevProps.isMarkingAsFailed &&
|
|
||||||
!this.props.isMarkingAsFailed &&
|
|
||||||
!this.props.markAsFailedError
|
|
||||||
) {
|
|
||||||
this.setState({ isDetailsModalOpen: false });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onDetailsPress = () => {
|
|
||||||
this.setState({ isDetailsModalOpen: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
onDetailsModalClose = () => {
|
|
||||||
this.setState({ isDetailsModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
episodeId,
|
|
||||||
series,
|
|
||||||
episode,
|
|
||||||
languages,
|
|
||||||
quality,
|
|
||||||
customFormats,
|
|
||||||
customFormatScore,
|
|
||||||
qualityCutoffNotMet,
|
|
||||||
eventType,
|
|
||||||
sourceTitle,
|
|
||||||
date,
|
|
||||||
data,
|
|
||||||
downloadId,
|
|
||||||
isMarkingAsFailed,
|
|
||||||
columns,
|
|
||||||
shortDateFormat,
|
|
||||||
timeFormat,
|
|
||||||
onMarkAsFailedPress
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
if (!episode) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TableRow>
|
|
||||||
{
|
|
||||||
columns.map((column) => {
|
|
||||||
const {
|
|
||||||
name,
|
|
||||||
isVisible
|
|
||||||
} = column;
|
|
||||||
|
|
||||||
if (!isVisible) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'eventType') {
|
|
||||||
return (
|
|
||||||
<HistoryEventTypeCell
|
|
||||||
key={name}
|
|
||||||
eventType={eventType}
|
|
||||||
data={data}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'series.sortTitle') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
<SeriesTitleLink
|
|
||||||
titleSlug={series.titleSlug}
|
|
||||||
title={series.title}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'episode') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
<SeasonEpisodeNumber
|
|
||||||
seasonNumber={episode.seasonNumber}
|
|
||||||
episodeNumber={episode.episodeNumber}
|
|
||||||
absoluteEpisodeNumber={episode.absoluteEpisodeNumber}
|
|
||||||
seriesType={series.seriesType}
|
|
||||||
alternateTitles={series.alternateTitles}
|
|
||||||
sceneSeasonNumber={episode.sceneSeasonNumber}
|
|
||||||
sceneEpisodeNumber={episode.sceneEpisodeNumber}
|
|
||||||
sceneAbsoluteEpisodeNumber={episode.sceneAbsoluteEpisodeNumber}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'episodes.title') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
<EpisodeTitleLink
|
|
||||||
episodeId={episodeId}
|
|
||||||
episodeEntity={episodeEntities.EPISODES}
|
|
||||||
seriesId={series.id}
|
|
||||||
episodeTitle={episode.title}
|
|
||||||
showOpenSeriesButton={true}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'languages') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
<EpisodeLanguages languages={languages} />
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'quality') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
<EpisodeQuality
|
|
||||||
quality={quality}
|
|
||||||
isCutoffMet={qualityCutoffNotMet}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'customFormats') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
<EpisodeFormats
|
|
||||||
formats={customFormats}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'date') {
|
|
||||||
return (
|
|
||||||
<RelativeDateCellConnector
|
|
||||||
key={name}
|
|
||||||
date={date}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'downloadClient') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
className={styles.downloadClient}
|
|
||||||
>
|
|
||||||
{data.downloadClient}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'indexer') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
className={styles.indexer}
|
|
||||||
>
|
|
||||||
{data.indexer}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'customFormatScore') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
className={styles.customFormatScore}
|
|
||||||
>
|
|
||||||
<Tooltip
|
|
||||||
anchor={formatCustomFormatScore(
|
|
||||||
customFormatScore,
|
|
||||||
customFormats.length
|
|
||||||
)}
|
|
||||||
tooltip={<EpisodeFormats formats={customFormats} />}
|
|
||||||
position={tooltipPositions.BOTTOM}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'releaseGroup') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
className={styles.releaseGroup}
|
|
||||||
>
|
|
||||||
{data.releaseGroup}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'sourceTitle') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
>
|
|
||||||
{sourceTitle}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'details') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
className={styles.details}
|
|
||||||
>
|
|
||||||
<div className={styles.actionContents}>
|
|
||||||
<IconButton
|
|
||||||
name={icons.INFO}
|
|
||||||
onPress={this.onDetailsPress}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
<HistoryDetailsModal
|
|
||||||
isOpen={this.state.isDetailsModalOpen}
|
|
||||||
eventType={eventType}
|
|
||||||
sourceTitle={sourceTitle}
|
|
||||||
data={data}
|
|
||||||
downloadId={downloadId}
|
|
||||||
isMarkingAsFailed={isMarkingAsFailed}
|
|
||||||
shortDateFormat={shortDateFormat}
|
|
||||||
timeFormat={timeFormat}
|
|
||||||
onMarkAsFailedPress={onMarkAsFailedPress}
|
|
||||||
onModalClose={this.onDetailsModalClose}
|
|
||||||
/>
|
|
||||||
</TableRow>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
HistoryRow.propTypes = {
|
|
||||||
episodeId: PropTypes.number,
|
|
||||||
series: PropTypes.object.isRequired,
|
|
||||||
episode: PropTypes.object,
|
|
||||||
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
quality: PropTypes.object.isRequired,
|
|
||||||
customFormats: PropTypes.arrayOf(PropTypes.object),
|
|
||||||
customFormatScore: PropTypes.number.isRequired,
|
|
||||||
qualityCutoffNotMet: PropTypes.bool.isRequired,
|
|
||||||
eventType: PropTypes.string.isRequired,
|
|
||||||
sourceTitle: PropTypes.string.isRequired,
|
|
||||||
date: PropTypes.string.isRequired,
|
|
||||||
data: PropTypes.object.isRequired,
|
|
||||||
downloadId: PropTypes.string,
|
|
||||||
isMarkingAsFailed: PropTypes.bool,
|
|
||||||
markAsFailedError: PropTypes.object,
|
|
||||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
shortDateFormat: PropTypes.string.isRequired,
|
|
||||||
timeFormat: PropTypes.string.isRequired,
|
|
||||||
onMarkAsFailedPress: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
HistoryRow.defaultProps = {
|
|
||||||
customFormats: []
|
|
||||||
};
|
|
||||||
|
|
||||||
export default HistoryRow;
|
|
||||||
@@ -0,0 +1,270 @@
|
|||||||
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import IconButton from 'Components/Link/IconButton';
|
||||||
|
import RelativeDateCell from 'Components/Table/Cells/RelativeDateCell';
|
||||||
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
|
import Column from 'Components/Table/Column';
|
||||||
|
import TableRow from 'Components/Table/TableRow';
|
||||||
|
import Tooltip from 'Components/Tooltip/Tooltip';
|
||||||
|
import episodeEntities from 'Episode/episodeEntities';
|
||||||
|
import EpisodeFormats from 'Episode/EpisodeFormats';
|
||||||
|
import EpisodeLanguages from 'Episode/EpisodeLanguages';
|
||||||
|
import EpisodeQuality from 'Episode/EpisodeQuality';
|
||||||
|
import EpisodeTitleLink from 'Episode/EpisodeTitleLink';
|
||||||
|
import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber';
|
||||||
|
import useEpisode from 'Episode/useEpisode';
|
||||||
|
import usePrevious from 'Helpers/Hooks/usePrevious';
|
||||||
|
import { icons, tooltipPositions } from 'Helpers/Props';
|
||||||
|
import Language from 'Language/Language';
|
||||||
|
import { QualityModel } from 'Quality/Quality';
|
||||||
|
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
||||||
|
import useSeries from 'Series/useSeries';
|
||||||
|
import { fetchHistory, markAsFailed } from 'Store/Actions/historyActions';
|
||||||
|
import CustomFormat from 'typings/CustomFormat';
|
||||||
|
import { HistoryData, HistoryEventType } from 'typings/History';
|
||||||
|
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
||||||
|
import HistoryDetailsModal from './Details/HistoryDetailsModal';
|
||||||
|
import HistoryEventTypeCell from './HistoryEventTypeCell';
|
||||||
|
import styles from './HistoryRow.css';
|
||||||
|
|
||||||
|
interface HistoryRowProps {
|
||||||
|
id: number;
|
||||||
|
episodeId: number;
|
||||||
|
seriesId: number;
|
||||||
|
languages: Language[];
|
||||||
|
quality: QualityModel;
|
||||||
|
customFormats?: CustomFormat[];
|
||||||
|
customFormatScore: number;
|
||||||
|
qualityCutoffNotMet: boolean;
|
||||||
|
eventType: HistoryEventType;
|
||||||
|
sourceTitle: string;
|
||||||
|
date: string;
|
||||||
|
data: HistoryData;
|
||||||
|
downloadId?: string;
|
||||||
|
isMarkingAsFailed?: boolean;
|
||||||
|
markAsFailedError?: object;
|
||||||
|
columns: Column[];
|
||||||
|
}
|
||||||
|
|
||||||
|
function HistoryRow(props: HistoryRowProps) {
|
||||||
|
const {
|
||||||
|
id,
|
||||||
|
episodeId,
|
||||||
|
seriesId,
|
||||||
|
languages,
|
||||||
|
quality,
|
||||||
|
customFormats = [],
|
||||||
|
customFormatScore,
|
||||||
|
qualityCutoffNotMet,
|
||||||
|
eventType,
|
||||||
|
sourceTitle,
|
||||||
|
date,
|
||||||
|
data,
|
||||||
|
downloadId,
|
||||||
|
isMarkingAsFailed = false,
|
||||||
|
markAsFailedError,
|
||||||
|
columns,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const wasMarkingAsFailed = usePrevious(isMarkingAsFailed);
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const series = useSeries(seriesId);
|
||||||
|
const episode = useEpisode(episodeId, 'episodes');
|
||||||
|
|
||||||
|
const [isDetailsModalOpen, setIsDetailsModalOpen] = useState(false);
|
||||||
|
|
||||||
|
const handleDetailsPress = useCallback(() => {
|
||||||
|
setIsDetailsModalOpen(true);
|
||||||
|
}, [setIsDetailsModalOpen]);
|
||||||
|
|
||||||
|
const handleDetailsModalClose = useCallback(() => {
|
||||||
|
setIsDetailsModalOpen(false);
|
||||||
|
}, [setIsDetailsModalOpen]);
|
||||||
|
|
||||||
|
const handleMarkAsFailedPress = useCallback(() => {
|
||||||
|
dispatch(markAsFailed({ id }));
|
||||||
|
}, [id, dispatch]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (wasMarkingAsFailed && !isMarkingAsFailed && !markAsFailedError) {
|
||||||
|
setIsDetailsModalOpen(false);
|
||||||
|
dispatch(fetchHistory());
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
wasMarkingAsFailed,
|
||||||
|
isMarkingAsFailed,
|
||||||
|
markAsFailedError,
|
||||||
|
setIsDetailsModalOpen,
|
||||||
|
dispatch,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!series || !episode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRow>
|
||||||
|
{columns.map((column) => {
|
||||||
|
const { name, isVisible } = column;
|
||||||
|
|
||||||
|
if (!isVisible) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'eventType') {
|
||||||
|
return (
|
||||||
|
<HistoryEventTypeCell
|
||||||
|
key={name}
|
||||||
|
eventType={eventType}
|
||||||
|
data={data}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'series.sortTitle') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<SeriesTitleLink
|
||||||
|
titleSlug={series.titleSlug}
|
||||||
|
title={series.title}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'episode') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<SeasonEpisodeNumber
|
||||||
|
seasonNumber={episode.seasonNumber}
|
||||||
|
episodeNumber={episode.episodeNumber}
|
||||||
|
absoluteEpisodeNumber={episode.absoluteEpisodeNumber}
|
||||||
|
seriesType={series.seriesType}
|
||||||
|
alternateTitles={series.alternateTitles}
|
||||||
|
sceneSeasonNumber={episode.sceneSeasonNumber}
|
||||||
|
sceneEpisodeNumber={episode.sceneEpisodeNumber}
|
||||||
|
sceneAbsoluteEpisodeNumber={episode.sceneAbsoluteEpisodeNumber}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'episodes.title') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<EpisodeTitleLink
|
||||||
|
episodeId={episodeId}
|
||||||
|
episodeEntity={episodeEntities.EPISODES}
|
||||||
|
seriesId={series.id}
|
||||||
|
episodeTitle={episode.title}
|
||||||
|
showOpenSeriesButton={true}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'languages') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<EpisodeLanguages languages={languages} />
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'quality') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<EpisodeQuality
|
||||||
|
quality={quality}
|
||||||
|
isCutoffNotMet={qualityCutoffNotMet}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'customFormats') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<EpisodeFormats formats={customFormats} />
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'date') {
|
||||||
|
return <RelativeDateCell key={name} date={date} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'downloadClient') {
|
||||||
|
const downloadClientName =
|
||||||
|
'downloadClientName' in data ? data.downloadClientName : null;
|
||||||
|
const downloadClient =
|
||||||
|
'downloadClient' in data ? data.downloadClient : null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name} className={styles.downloadClient}>
|
||||||
|
{downloadClientName ?? downloadClient ?? ''}
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'indexer') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name} className={styles.indexer}>
|
||||||
|
{'indexer' in data ? data.indexer : ''}
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'customFormatScore') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name} className={styles.customFormatScore}>
|
||||||
|
<Tooltip
|
||||||
|
anchor={formatCustomFormatScore(
|
||||||
|
customFormatScore,
|
||||||
|
customFormats.length
|
||||||
|
)}
|
||||||
|
tooltip={<EpisodeFormats formats={customFormats} />}
|
||||||
|
position={tooltipPositions.BOTTOM}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'releaseGroup') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name} className={styles.releaseGroup}>
|
||||||
|
{'releaseGroup' in data ? data.releaseGroup : ''}
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'sourceTitle') {
|
||||||
|
return <TableRowCell key={name}>{sourceTitle}</TableRowCell>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'details') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name} className={styles.details}>
|
||||||
|
<IconButton name={icons.INFO} onPress={handleDetailsPress} />
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
})}
|
||||||
|
|
||||||
|
<HistoryDetailsModal
|
||||||
|
isOpen={isDetailsModalOpen}
|
||||||
|
eventType={eventType}
|
||||||
|
sourceTitle={sourceTitle}
|
||||||
|
data={data}
|
||||||
|
downloadId={downloadId}
|
||||||
|
isMarkingAsFailed={isMarkingAsFailed}
|
||||||
|
onMarkAsFailedPress={handleMarkAsFailedPress}
|
||||||
|
onModalClose={handleDetailsModalClose}
|
||||||
|
/>
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HistoryRow;
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import { fetchHistory, markAsFailed } from 'Store/Actions/historyActions';
|
|
||||||
import createEpisodeSelector from 'Store/Selectors/createEpisodeSelector';
|
|
||||||
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
||||||
import HistoryRow from './HistoryRow';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
createSeriesSelector(),
|
|
||||||
createEpisodeSelector(),
|
|
||||||
createUISettingsSelector(),
|
|
||||||
(series, episode, uiSettings) => {
|
|
||||||
return {
|
|
||||||
series,
|
|
||||||
episode,
|
|
||||||
shortDateFormat: uiSettings.shortDateFormat,
|
|
||||||
timeFormat: uiSettings.timeFormat
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
fetchHistory,
|
|
||||||
markAsFailed
|
|
||||||
};
|
|
||||||
|
|
||||||
class HistoryRowConnector extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
if (
|
|
||||||
prevProps.isMarkingAsFailed &&
|
|
||||||
!this.props.isMarkingAsFailed &&
|
|
||||||
!this.props.markAsFailedError
|
|
||||||
) {
|
|
||||||
this.props.fetchHistory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onMarkAsFailedPress = () => {
|
|
||||||
this.props.markAsFailed({ id: this.props.id });
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<HistoryRow
|
|
||||||
{...this.props}
|
|
||||||
onMarkAsFailedPress={this.onMarkAsFailedPress}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
HistoryRowConnector.propTypes = {
|
|
||||||
id: PropTypes.number.isRequired,
|
|
||||||
isMarkingAsFailed: PropTypes.bool,
|
|
||||||
markAsFailedError: PropTypes.object,
|
|
||||||
fetchHistory: PropTypes.func.isRequired,
|
|
||||||
markAsFailed: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(HistoryRowConnector);
|
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
import React, { createContext, ReactNode, useContext, useMemo } from 'react';
|
||||||
|
import useApiQuery from 'Helpers/Hooks/useApiQuery';
|
||||||
|
import Queue from 'typings/Queue';
|
||||||
|
|
||||||
|
interface EpisodeDetails {
|
||||||
|
episodeIds: number[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SeriesDetails {
|
||||||
|
seriesId: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AllDetails {
|
||||||
|
all: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
type QueueDetailsFilter = AllDetails | EpisodeDetails | SeriesDetails;
|
||||||
|
|
||||||
|
interface QueueDetailsProps {
|
||||||
|
children: ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QueueDetailsContext = createContext<Queue[] | undefined>(undefined);
|
||||||
|
|
||||||
|
export default function QueueDetailsProvider({
|
||||||
|
children,
|
||||||
|
...filter
|
||||||
|
}: QueueDetailsProps & QueueDetailsFilter) {
|
||||||
|
const { data } = useApiQuery<Queue[]>({
|
||||||
|
path: '/queue/details',
|
||||||
|
queryParams: { ...filter },
|
||||||
|
queryOptions: {
|
||||||
|
enabled: Object.keys(filter).length > 0,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<QueueDetailsContext.Provider value={data}>
|
||||||
|
{children}
|
||||||
|
</QueueDetailsContext.Provider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useQueueItemForEpisode(episodeId: number) {
|
||||||
|
const queue = useContext(QueueDetailsContext);
|
||||||
|
|
||||||
|
return useMemo(() => {
|
||||||
|
return queue?.find((item) => item.episodeIds.includes(episodeId));
|
||||||
|
}, [episodeId, queue]);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useIsDownloadingEpisodes(episodeIds: number[]) {
|
||||||
|
const queue = useContext(QueueDetailsContext);
|
||||||
|
|
||||||
|
return useMemo(() => {
|
||||||
|
if (!queue) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return queue.some((item) =>
|
||||||
|
item.episodeIds?.some((e) => episodeIds.includes(e))
|
||||||
|
);
|
||||||
|
}, [episodeIds, queue]);
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SeriesQueueDetails {
|
||||||
|
count: number;
|
||||||
|
episodesWithFiles: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useQueueDetailsForSeries(
|
||||||
|
seriesId: number,
|
||||||
|
seasonNumber?: number
|
||||||
|
) {
|
||||||
|
const queue = useContext(QueueDetailsContext);
|
||||||
|
|
||||||
|
return useMemo<SeriesQueueDetails>(() => {
|
||||||
|
if (!queue) {
|
||||||
|
return { count: 0, episodesWithFiles: 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
return queue.reduce<SeriesQueueDetails>(
|
||||||
|
(acc: SeriesQueueDetails, item) => {
|
||||||
|
if (
|
||||||
|
item.trackedDownloadState === 'imported' ||
|
||||||
|
item.seriesId !== seriesId
|
||||||
|
) {
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seasonNumber != null && item.seasonNumber !== seasonNumber) {
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
|
|
||||||
|
acc.count++;
|
||||||
|
|
||||||
|
if (item.episodeHasFile) {
|
||||||
|
acc.episodesWithFiles++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
count: 0,
|
||||||
|
episodesWithFiles: 0,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}, [seriesId, seasonNumber, queue]);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useQueueDetails = () => {
|
||||||
|
return useContext(QueueDetailsContext) ?? [];
|
||||||
|
};
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Episode from 'Episode/Episode';
|
||||||
|
import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber';
|
||||||
|
import Series from 'Series/Series';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
|
interface EpisodeCellContentProps {
|
||||||
|
episodes: Episode[];
|
||||||
|
isFullSeason: boolean;
|
||||||
|
seasonNumber?: number;
|
||||||
|
series?: Series;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function EpisodeCellContent({
|
||||||
|
episodes,
|
||||||
|
isFullSeason,
|
||||||
|
seasonNumber,
|
||||||
|
series,
|
||||||
|
}: EpisodeCellContentProps) {
|
||||||
|
if (episodes.length === 0) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFullSeason && seasonNumber != null) {
|
||||||
|
return translate('SeasonNumberToken', { seasonNumber });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (episodes.length === 1) {
|
||||||
|
const episode = episodes[0];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SeasonEpisodeNumber
|
||||||
|
seasonNumber={episode.seasonNumber}
|
||||||
|
episodeNumber={episode.episodeNumber}
|
||||||
|
absoluteEpisodeNumber={episode.absoluteEpisodeNumber}
|
||||||
|
seriesType={series?.seriesType}
|
||||||
|
alternateTitles={series?.alternateTitles}
|
||||||
|
sceneSeasonNumber={episode.sceneSeasonNumber}
|
||||||
|
sceneEpisodeNumber={episode.sceneEpisodeNumber}
|
||||||
|
sceneAbsoluteEpisodeNumber={episode.sceneAbsoluteEpisodeNumber}
|
||||||
|
unverifiedSceneNumbering={episode.unverifiedSceneNumbering}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const firstEpisode = episodes[0];
|
||||||
|
const lastEpisode = episodes[episodes.length - 1];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<SeasonEpisodeNumber
|
||||||
|
seasonNumber={firstEpisode.seasonNumber}
|
||||||
|
episodeNumber={firstEpisode.episodeNumber}
|
||||||
|
absoluteEpisodeNumber={firstEpisode.absoluteEpisodeNumber}
|
||||||
|
seriesType={series?.seriesType}
|
||||||
|
alternateTitles={series?.alternateTitles}
|
||||||
|
sceneSeasonNumber={firstEpisode.sceneSeasonNumber}
|
||||||
|
sceneEpisodeNumber={firstEpisode.sceneEpisodeNumber}
|
||||||
|
sceneAbsoluteEpisodeNumber={firstEpisode.sceneAbsoluteEpisodeNumber}
|
||||||
|
unverifiedSceneNumbering={firstEpisode.unverifiedSceneNumbering}
|
||||||
|
/>
|
||||||
|
{' - '}
|
||||||
|
<SeasonEpisodeNumber
|
||||||
|
seasonNumber={lastEpisode.seasonNumber}
|
||||||
|
episodeNumber={lastEpisode.episodeNumber}
|
||||||
|
absoluteEpisodeNumber={lastEpisode.absoluteEpisodeNumber}
|
||||||
|
seriesType={series?.seriesType}
|
||||||
|
alternateTitles={series?.alternateTitles}
|
||||||
|
sceneSeasonNumber={lastEpisode.sceneSeasonNumber}
|
||||||
|
sceneEpisodeNumber={lastEpisode.sceneEpisodeNumber}
|
||||||
|
sceneAbsoluteEpisodeNumber={lastEpisode.sceneAbsoluteEpisodeNumber}
|
||||||
|
unverifiedSceneNumbering={lastEpisode.unverifiedSceneNumbering}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
.multiple {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.episodeNumber {
|
||||||
|
margin-right: 8px;
|
||||||
|
font-weight: bold;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
// This file is automatically generated.
|
// This file is automatically generated.
|
||||||
// Please do not change this file!
|
// Please do not change this file!
|
||||||
interface CssExports {
|
interface CssExports {
|
||||||
'format': string;
|
'episodeNumber': string;
|
||||||
'selectedValue': string;
|
'multiple': string;
|
||||||
'value': string;
|
'row': string;
|
||||||
}
|
}
|
||||||
export const cssExports: CssExports;
|
export const cssExports: CssExports;
|
||||||
export default cssExports;
|
export default cssExports;
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Popover from 'Components/Tooltip/Popover';
|
||||||
|
import Episode from 'Episode/Episode';
|
||||||
|
import EpisodeTitleLink from 'Episode/EpisodeTitleLink';
|
||||||
|
import Series from 'Series/Series';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import styles from './EpisodeTitleCellContent.css';
|
||||||
|
|
||||||
|
interface EpisodeTitleCellContentProps {
|
||||||
|
episodes: Episode[];
|
||||||
|
series?: Series;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function EpisodeTitleCellContent({
|
||||||
|
episodes,
|
||||||
|
series,
|
||||||
|
}: EpisodeTitleCellContentProps) {
|
||||||
|
if (episodes.length === 0 || !series) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (episodes.length === 1) {
|
||||||
|
const episode = episodes[0];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<EpisodeTitleLink
|
||||||
|
episodeId={episode.id}
|
||||||
|
seriesId={series.id}
|
||||||
|
episodeTitle={episode.title}
|
||||||
|
episodeEntity="episodes"
|
||||||
|
showOpenSeriesButton={true}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Popover
|
||||||
|
anchor={
|
||||||
|
<span className={styles.multiple}>{translate('MultipleEpisodes')}</span>
|
||||||
|
}
|
||||||
|
title={translate('EpisodeTitles')}
|
||||||
|
body={
|
||||||
|
<>
|
||||||
|
{episodes.map((episode) => {
|
||||||
|
return (
|
||||||
|
<div key={episode.id} className={styles.row}>
|
||||||
|
<div className={styles.episodeNumber}>
|
||||||
|
{episode.episodeNumber}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<EpisodeTitleLink
|
||||||
|
episodeId={episode.id}
|
||||||
|
seriesId={series.id}
|
||||||
|
episodeTitle={episode.title}
|
||||||
|
episodeEntity="episodes"
|
||||||
|
showOpenSeriesButton={true}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
position="right"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -11,3 +11,7 @@
|
|||||||
border-color: var(--usenetColor);
|
border-color: var(--usenetColor);
|
||||||
background-color: var(--usenetColor);
|
background-color: var(--usenetColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unknown {
|
||||||
|
composes: label from '~Components/Label.css';
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// Please do not change this file!
|
// Please do not change this file!
|
||||||
interface CssExports {
|
interface CssExports {
|
||||||
'torrent': string;
|
'torrent': string;
|
||||||
|
'unknown': string;
|
||||||
'usenet': string;
|
'usenet': string;
|
||||||
}
|
}
|
||||||
export const cssExports: CssExports;
|
export const cssExports: CssExports;
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import Label from 'Components/Label';
|
|
||||||
import styles from './ProtocolLabel.css';
|
|
||||||
|
|
||||||
function ProtocolLabel({ protocol }) {
|
|
||||||
const protocolName = protocol === 'usenet' ? 'nzb' : protocol;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Label className={styles[protocol]}>
|
|
||||||
{protocolName}
|
|
||||||
</Label>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProtocolLabel.propTypes = {
|
|
||||||
protocol: PropTypes.string.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ProtocolLabel;
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Label from 'Components/Label';
|
||||||
|
import DownloadProtocol from 'DownloadClient/DownloadProtocol';
|
||||||
|
import styles from './ProtocolLabel.css';
|
||||||
|
|
||||||
|
interface ProtocolLabelProps {
|
||||||
|
protocol: DownloadProtocol;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ProtocolLabel({ protocol }: ProtocolLabelProps) {
|
||||||
|
const protocolName = protocol === 'usenet' ? 'nzb' : protocol;
|
||||||
|
|
||||||
|
return <Label className={styles[protocol]}>{protocolName}</Label>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ProtocolLabel;
|
||||||
@@ -1,371 +0,0 @@
|
|||||||
import _ from 'lodash';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import Alert from 'Components/Alert';
|
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
|
||||||
import FilterMenu from 'Components/Menu/FilterMenu';
|
|
||||||
import PageContent from 'Components/Page/PageContent';
|
|
||||||
import PageContentBody from 'Components/Page/PageContentBody';
|
|
||||||
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
|
||||||
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
|
||||||
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
|
||||||
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
|
||||||
import Table from 'Components/Table/Table';
|
|
||||||
import TableBody from 'Components/Table/TableBody';
|
|
||||||
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
|
||||||
import TablePager from 'Components/Table/TablePager';
|
|
||||||
import { align, icons, kinds } from 'Helpers/Props';
|
|
||||||
import getRemovedItems from 'Utilities/Object/getRemovedItems';
|
|
||||||
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import getSelectedIds from 'Utilities/Table/getSelectedIds';
|
|
||||||
import removeOldSelectedState from 'Utilities/Table/removeOldSelectedState';
|
|
||||||
import selectAll from 'Utilities/Table/selectAll';
|
|
||||||
import toggleSelected from 'Utilities/Table/toggleSelected';
|
|
||||||
import QueueFilterModal from './QueueFilterModal';
|
|
||||||
import QueueOptionsConnector from './QueueOptionsConnector';
|
|
||||||
import QueueRowConnector from './QueueRowConnector';
|
|
||||||
import RemoveQueueItemModal from './RemoveQueueItemModal';
|
|
||||||
|
|
||||||
class Queue extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this._shouldBlockRefresh = false;
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
allSelected: false,
|
|
||||||
allUnselected: false,
|
|
||||||
lastToggled: null,
|
|
||||||
selectedState: {},
|
|
||||||
isPendingSelected: false,
|
|
||||||
isConfirmRemoveModalOpen: false,
|
|
||||||
items: props.items
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
shouldComponentUpdate() {
|
|
||||||
if (this._shouldBlockRefresh) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
const {
|
|
||||||
items,
|
|
||||||
isEpisodesFetching
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
if (
|
|
||||||
(!isEpisodesFetching && prevProps.isEpisodesFetching) ||
|
|
||||||
(hasDifferentItems(prevProps.items, items) && !items.some((e) => e.episodeId))
|
|
||||||
) {
|
|
||||||
this.setState((state) => {
|
|
||||||
return {
|
|
||||||
...removeOldSelectedState(state, getRemovedItems(prevProps.items, items)),
|
|
||||||
items
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nextState = {};
|
|
||||||
|
|
||||||
if (prevProps.items !== items) {
|
|
||||||
nextState.items = items;
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectedIds = this.getSelectedIds();
|
|
||||||
const isPendingSelected = _.some(this.props.items, (item) => {
|
|
||||||
return selectedIds.indexOf(item.id) > -1 && item.status === 'delay';
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isPendingSelected !== this.state.isPendingSelected) {
|
|
||||||
nextState.isPendingSelected = isPendingSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_.isEmpty(nextState)) {
|
|
||||||
this.setState(nextState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Control
|
|
||||||
|
|
||||||
getSelectedIds = () => {
|
|
||||||
return getSelectedIds(this.state.selectedState);
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onQueueRowModalOpenOrClose = (isOpen) => {
|
|
||||||
this._shouldBlockRefresh = isOpen;
|
|
||||||
};
|
|
||||||
|
|
||||||
onSelectAllChange = ({ value }) => {
|
|
||||||
this.setState(selectAll(this.state.selectedState, value));
|
|
||||||
};
|
|
||||||
|
|
||||||
onSelectedChange = ({ id, value, shiftKey = false }) => {
|
|
||||||
this.setState((state) => {
|
|
||||||
return toggleSelected(state, this.props.items, id, value, shiftKey);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onGrabSelectedPress = () => {
|
|
||||||
this.props.onGrabSelectedPress(this.getSelectedIds());
|
|
||||||
};
|
|
||||||
|
|
||||||
onRemoveSelectedPress = () => {
|
|
||||||
this.setState({ isConfirmRemoveModalOpen: true }, () => {
|
|
||||||
this._shouldBlockRefresh = true;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onRemoveSelectedConfirmed = (payload) => {
|
|
||||||
this._shouldBlockRefresh = false;
|
|
||||||
this.props.onRemoveSelectedPress({ ids: this.getSelectedIds(), ...payload });
|
|
||||||
this.setState({ isConfirmRemoveModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
onConfirmRemoveModalClose = () => {
|
|
||||||
this._shouldBlockRefresh = false;
|
|
||||||
this.setState({ isConfirmRemoveModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
isFetching,
|
|
||||||
isPopulated,
|
|
||||||
error,
|
|
||||||
isEpisodesFetching,
|
|
||||||
isEpisodesPopulated,
|
|
||||||
episodesError,
|
|
||||||
columns,
|
|
||||||
selectedFilterKey,
|
|
||||||
filters,
|
|
||||||
customFilters,
|
|
||||||
count,
|
|
||||||
totalRecords,
|
|
||||||
isGrabbing,
|
|
||||||
isRemoving,
|
|
||||||
isRefreshMonitoredDownloadsExecuting,
|
|
||||||
onRefreshPress,
|
|
||||||
onFilterSelect,
|
|
||||||
...otherProps
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const {
|
|
||||||
allSelected,
|
|
||||||
allUnselected,
|
|
||||||
selectedState,
|
|
||||||
isConfirmRemoveModalOpen,
|
|
||||||
isPendingSelected,
|
|
||||||
items
|
|
||||||
} = this.state;
|
|
||||||
|
|
||||||
const isRefreshing = isFetching || isEpisodesFetching || isRefreshMonitoredDownloadsExecuting;
|
|
||||||
const isAllPopulated = isPopulated && (isEpisodesPopulated || !items.length || items.every((e) => !e.episodeId));
|
|
||||||
const hasError = error || episodesError;
|
|
||||||
const selectedIds = this.getSelectedIds();
|
|
||||||
const selectedCount = selectedIds.length;
|
|
||||||
const disableSelectedActions = selectedCount === 0;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageContent title={translate('Queue')}>
|
|
||||||
<PageToolbar>
|
|
||||||
<PageToolbarSection>
|
|
||||||
<PageToolbarButton
|
|
||||||
label="Refresh"
|
|
||||||
iconName={icons.REFRESH}
|
|
||||||
isSpinning={isRefreshing}
|
|
||||||
onPress={onRefreshPress}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<PageToolbarSeparator />
|
|
||||||
|
|
||||||
<PageToolbarButton
|
|
||||||
label={translate('GrabSelected')}
|
|
||||||
iconName={icons.DOWNLOAD}
|
|
||||||
isDisabled={disableSelectedActions || !isPendingSelected}
|
|
||||||
isSpinning={isGrabbing}
|
|
||||||
onPress={this.onGrabSelectedPress}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<PageToolbarButton
|
|
||||||
label={translate('RemoveSelected')}
|
|
||||||
iconName={icons.REMOVE}
|
|
||||||
isDisabled={disableSelectedActions}
|
|
||||||
isSpinning={isRemoving}
|
|
||||||
onPress={this.onRemoveSelectedPress}
|
|
||||||
/>
|
|
||||||
</PageToolbarSection>
|
|
||||||
|
|
||||||
<PageToolbarSection
|
|
||||||
alignContent={align.RIGHT}
|
|
||||||
>
|
|
||||||
<TableOptionsModalWrapper
|
|
||||||
columns={columns}
|
|
||||||
{...otherProps}
|
|
||||||
optionsComponent={QueueOptionsConnector}
|
|
||||||
>
|
|
||||||
<PageToolbarButton
|
|
||||||
label={translate('Options')}
|
|
||||||
iconName={icons.TABLE}
|
|
||||||
/>
|
|
||||||
</TableOptionsModalWrapper>
|
|
||||||
|
|
||||||
<FilterMenu
|
|
||||||
alignMenu={align.RIGHT}
|
|
||||||
selectedFilterKey={selectedFilterKey}
|
|
||||||
filters={filters}
|
|
||||||
customFilters={customFilters}
|
|
||||||
filterModalConnectorComponent={QueueFilterModal}
|
|
||||||
onFilterSelect={onFilterSelect}
|
|
||||||
/>
|
|
||||||
</PageToolbarSection>
|
|
||||||
</PageToolbar>
|
|
||||||
|
|
||||||
<PageContentBody>
|
|
||||||
{
|
|
||||||
isRefreshing && !isAllPopulated ?
|
|
||||||
<LoadingIndicator /> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!isRefreshing && hasError ?
|
|
||||||
<Alert kind={kinds.DANGER}>
|
|
||||||
{translate('QueueLoadError')}
|
|
||||||
</Alert> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
isAllPopulated && !hasError && !items.length ?
|
|
||||||
<Alert kind={kinds.INFO}>
|
|
||||||
{
|
|
||||||
selectedFilterKey !== 'all' && count > 0 ?
|
|
||||||
translate('QueueFilterHasNoItems') :
|
|
||||||
translate('QueueIsEmpty')
|
|
||||||
}
|
|
||||||
</Alert> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
isAllPopulated && !hasError && !!items.length ?
|
|
||||||
<div>
|
|
||||||
<Table
|
|
||||||
columns={columns}
|
|
||||||
selectAll={true}
|
|
||||||
allSelected={allSelected}
|
|
||||||
allUnselected={allUnselected}
|
|
||||||
{...otherProps}
|
|
||||||
optionsComponent={QueueOptionsConnector}
|
|
||||||
onSelectAllChange={this.onSelectAllChange}
|
|
||||||
>
|
|
||||||
<TableBody>
|
|
||||||
{
|
|
||||||
items.map((item) => {
|
|
||||||
return (
|
|
||||||
<QueueRowConnector
|
|
||||||
key={item.id}
|
|
||||||
episodeId={item.episodeId}
|
|
||||||
isSelected={selectedState[item.id]}
|
|
||||||
columns={columns}
|
|
||||||
{...item}
|
|
||||||
onSelectedChange={this.onSelectedChange}
|
|
||||||
onQueueRowModalOpenOrClose={this.onQueueRowModalOpenOrClose}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</TableBody>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
<TablePager
|
|
||||||
totalRecords={totalRecords}
|
|
||||||
isFetching={isRefreshing}
|
|
||||||
{...otherProps}
|
|
||||||
/>
|
|
||||||
</div> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</PageContentBody>
|
|
||||||
|
|
||||||
<RemoveQueueItemModal
|
|
||||||
isOpen={isConfirmRemoveModalOpen}
|
|
||||||
selectedCount={selectedCount}
|
|
||||||
canChangeCategory={isConfirmRemoveModalOpen && (
|
|
||||||
selectedIds.every((id) => {
|
|
||||||
const item = items.find((i) => i.id === id);
|
|
||||||
|
|
||||||
return !!(item && item.downloadClientHasPostImportCategory);
|
|
||||||
})
|
|
||||||
)}
|
|
||||||
canIgnore={isConfirmRemoveModalOpen && (
|
|
||||||
selectedIds.every((id) => {
|
|
||||||
const item = items.find((i) => i.id === id);
|
|
||||||
|
|
||||||
return !!(item && item.seriesId && item.episodeId);
|
|
||||||
})
|
|
||||||
)}
|
|
||||||
pending={isConfirmRemoveModalOpen && (
|
|
||||||
selectedIds.every((id) => {
|
|
||||||
const item = items.find((i) => i.id === id);
|
|
||||||
|
|
||||||
if (!item) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return item.status === 'delay' || item.status === 'downloadClientUnavailable';
|
|
||||||
})
|
|
||||||
)}
|
|
||||||
onRemovePress={this.onRemoveSelectedConfirmed}
|
|
||||||
onModalClose={this.onConfirmRemoveModalClose}
|
|
||||||
/>
|
|
||||||
</PageContent>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Queue.propTypes = {
|
|
||||||
isFetching: PropTypes.bool.isRequired,
|
|
||||||
isPopulated: PropTypes.bool.isRequired,
|
|
||||||
error: PropTypes.object,
|
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
isEpisodesFetching: PropTypes.bool.isRequired,
|
|
||||||
isEpisodesPopulated: PropTypes.bool.isRequired,
|
|
||||||
episodesError: PropTypes.object,
|
|
||||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
||||||
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
customFilters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
count: PropTypes.number.isRequired,
|
|
||||||
totalRecords: PropTypes.number,
|
|
||||||
isGrabbing: PropTypes.bool.isRequired,
|
|
||||||
isRemoving: PropTypes.bool.isRequired,
|
|
||||||
isRefreshMonitoredDownloadsExecuting: PropTypes.bool.isRequired,
|
|
||||||
onRefreshPress: PropTypes.func.isRequired,
|
|
||||||
onGrabSelectedPress: PropTypes.func.isRequired,
|
|
||||||
onRemoveSelectedPress: PropTypes.func.isRequired,
|
|
||||||
onFilterSelect: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
Queue.defaultProps = {
|
|
||||||
count: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Queue;
|
|
||||||
@@ -0,0 +1,380 @@
|
|||||||
|
import React, {
|
||||||
|
ReactElement,
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useRef,
|
||||||
|
useState,
|
||||||
|
} from 'react';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import * as commandNames from 'Commands/commandNames';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
|
import FilterMenu from 'Components/Menu/FilterMenu';
|
||||||
|
import PageContent from 'Components/Page/PageContent';
|
||||||
|
import PageContentBody from 'Components/Page/PageContentBody';
|
||||||
|
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
||||||
|
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
||||||
|
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
||||||
|
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
||||||
|
import Table from 'Components/Table/Table';
|
||||||
|
import TableBody from 'Components/Table/TableBody';
|
||||||
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
||||||
|
import TablePager from 'Components/Table/TablePager';
|
||||||
|
import createEpisodesFetchingSelector from 'Episode/createEpisodesFetchingSelector';
|
||||||
|
import useSelectState from 'Helpers/Hooks/useSelectState';
|
||||||
|
import { align, icons, kinds } from 'Helpers/Props';
|
||||||
|
import { executeCommand } from 'Store/Actions/commandActions';
|
||||||
|
import { clearEpisodes, fetchEpisodes } from 'Store/Actions/episodeActions';
|
||||||
|
import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector';
|
||||||
|
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
||||||
|
import { CheckInputChanged } from 'typings/inputs';
|
||||||
|
import { SelectStateInputProps } from 'typings/props';
|
||||||
|
import { TableOptionsChangePayload } from 'typings/Table';
|
||||||
|
import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
|
||||||
|
import {
|
||||||
|
registerPagePopulator,
|
||||||
|
unregisterPagePopulator,
|
||||||
|
} from 'Utilities/pagePopulator';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import getSelectedIds from 'Utilities/Table/getSelectedIds';
|
||||||
|
import QueueFilterModal from './QueueFilterModal';
|
||||||
|
import QueueOptions from './QueueOptions';
|
||||||
|
import {
|
||||||
|
setQueueOption,
|
||||||
|
setQueueOptions,
|
||||||
|
useQueueOptions,
|
||||||
|
} from './queueOptionsStore';
|
||||||
|
import QueueRow from './QueueRow';
|
||||||
|
import RemoveQueueItemModal from './RemoveQueueItemModal';
|
||||||
|
import useQueueStatus from './Status/useQueueStatus';
|
||||||
|
import useQueue, {
|
||||||
|
useFilters,
|
||||||
|
useGrabQueueItems,
|
||||||
|
useRemoveQueueItems,
|
||||||
|
} from './useQueue';
|
||||||
|
|
||||||
|
function Queue() {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const {
|
||||||
|
records,
|
||||||
|
totalPages,
|
||||||
|
totalRecords,
|
||||||
|
error,
|
||||||
|
isFetching,
|
||||||
|
isFetched,
|
||||||
|
isLoading,
|
||||||
|
page,
|
||||||
|
goToPage,
|
||||||
|
refetch,
|
||||||
|
} = useQueue();
|
||||||
|
|
||||||
|
const { columns, pageSize, sortKey, sortDirection, selectedFilterKey } =
|
||||||
|
useQueueOptions();
|
||||||
|
|
||||||
|
const filters = useFilters();
|
||||||
|
|
||||||
|
const { isRemoving, removeQueueItems } = useRemoveQueueItems();
|
||||||
|
const { isGrabbing, grabQueueItems } = useGrabQueueItems();
|
||||||
|
|
||||||
|
const { count } = useQueueStatus();
|
||||||
|
const { isEpisodesFetching, isEpisodesPopulated, episodesError } =
|
||||||
|
useSelector(createEpisodesFetchingSelector());
|
||||||
|
const customFilters = useSelector(createCustomFiltersSelector('queue'));
|
||||||
|
|
||||||
|
const isRefreshMonitoredDownloadsExecuting = useSelector(
|
||||||
|
createCommandExecutingSelector(commandNames.REFRESH_MONITORED_DOWNLOADS)
|
||||||
|
);
|
||||||
|
|
||||||
|
const shouldBlockRefresh = useRef(false);
|
||||||
|
const currentQueue = useRef<ReactElement | null>(null);
|
||||||
|
|
||||||
|
const [selectState, setSelectState] = useSelectState();
|
||||||
|
const { allSelected, allUnselected, selectedState } = selectState;
|
||||||
|
|
||||||
|
const selectedIds = useMemo(() => {
|
||||||
|
return getSelectedIds(selectedState);
|
||||||
|
}, [selectedState]);
|
||||||
|
|
||||||
|
const isPendingSelected = useMemo(() => {
|
||||||
|
return records.some((item) => {
|
||||||
|
return selectedIds.indexOf(item.id) > -1 && item.status === 'delay';
|
||||||
|
});
|
||||||
|
}, [records, selectedIds]);
|
||||||
|
|
||||||
|
const [isConfirmRemoveModalOpen, setIsConfirmRemoveModalOpen] =
|
||||||
|
useState(false);
|
||||||
|
|
||||||
|
const isRefreshing =
|
||||||
|
isLoading || isEpisodesFetching || isRefreshMonitoredDownloadsExecuting;
|
||||||
|
const isAllPopulated =
|
||||||
|
isFetched &&
|
||||||
|
(isEpisodesPopulated ||
|
||||||
|
!records.length ||
|
||||||
|
records.every((e) => !e.episodeIds?.length));
|
||||||
|
const hasError = error || episodesError;
|
||||||
|
const selectedCount = selectedIds.length;
|
||||||
|
const disableSelectedActions = selectedCount === 0;
|
||||||
|
|
||||||
|
const handleSelectAllChange = useCallback(
|
||||||
|
({ value }: CheckInputChanged) => {
|
||||||
|
setSelectState({
|
||||||
|
type: value ? 'selectAll' : 'unselectAll',
|
||||||
|
items: records,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[records, setSelectState]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleSelectedChange = useCallback(
|
||||||
|
({ id, value, shiftKey = false }: SelectStateInputProps) => {
|
||||||
|
setSelectState({
|
||||||
|
type: 'toggleSelected',
|
||||||
|
items: records,
|
||||||
|
id,
|
||||||
|
isSelected: value,
|
||||||
|
shiftKey,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[records, setSelectState]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleRefreshPress = useCallback(() => {
|
||||||
|
dispatch(
|
||||||
|
executeCommand({
|
||||||
|
name: commandNames.REFRESH_MONITORED_DOWNLOADS,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
|
const handleQueueRowModalOpenOrClose = useCallback((isOpen: boolean) => {
|
||||||
|
shouldBlockRefresh.current = isOpen;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleGrabSelectedPress = useCallback(() => {
|
||||||
|
grabQueueItems({ ids: selectedIds });
|
||||||
|
}, [selectedIds, grabQueueItems]);
|
||||||
|
|
||||||
|
const handleRemoveSelectedPress = useCallback(() => {
|
||||||
|
shouldBlockRefresh.current = true;
|
||||||
|
setIsConfirmRemoveModalOpen(true);
|
||||||
|
}, [setIsConfirmRemoveModalOpen]);
|
||||||
|
|
||||||
|
const handleRemoveSelectedConfirmed = useCallback(() => {
|
||||||
|
shouldBlockRefresh.current = false;
|
||||||
|
removeQueueItems({ ids: selectedIds });
|
||||||
|
setIsConfirmRemoveModalOpen(false);
|
||||||
|
}, [selectedIds, setIsConfirmRemoveModalOpen, removeQueueItems]);
|
||||||
|
|
||||||
|
const handleConfirmRemoveModalClose = useCallback(() => {
|
||||||
|
shouldBlockRefresh.current = false;
|
||||||
|
setIsConfirmRemoveModalOpen(false);
|
||||||
|
}, [setIsConfirmRemoveModalOpen]);
|
||||||
|
|
||||||
|
const handleFilterSelect = useCallback(
|
||||||
|
(selectedFilterKey: string | number) => {
|
||||||
|
setQueueOption('selectedFilterKey', selectedFilterKey);
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleSortPress = useCallback((sortKey: string) => {
|
||||||
|
setQueueOption('sortKey', sortKey);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleTableOptionChange = useCallback(
|
||||||
|
(payload: TableOptionsChangePayload) => {
|
||||||
|
setQueueOptions(payload);
|
||||||
|
|
||||||
|
if (payload.pageSize) {
|
||||||
|
goToPage(1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[goToPage]
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const episodeIds = selectUniqueIds(records, 'episodeIds');
|
||||||
|
|
||||||
|
if (episodeIds.length) {
|
||||||
|
dispatch(fetchEpisodes({ episodeIds }));
|
||||||
|
} else {
|
||||||
|
dispatch(clearEpisodes());
|
||||||
|
}
|
||||||
|
}, [records, dispatch]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const repopulate = () => {
|
||||||
|
refetch();
|
||||||
|
};
|
||||||
|
|
||||||
|
registerPagePopulator(repopulate);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
unregisterPagePopulator(repopulate);
|
||||||
|
};
|
||||||
|
}, [refetch]);
|
||||||
|
|
||||||
|
if (!shouldBlockRefresh.current) {
|
||||||
|
currentQueue.current = (
|
||||||
|
<PageContentBody>
|
||||||
|
{isRefreshing && !isAllPopulated ? <LoadingIndicator /> : null}
|
||||||
|
|
||||||
|
{!isRefreshing && hasError ? (
|
||||||
|
<Alert kind={kinds.DANGER}>{translate('QueueLoadError')}</Alert>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{isAllPopulated && !hasError && !records.length ? (
|
||||||
|
<Alert kind={kinds.INFO}>
|
||||||
|
{selectedFilterKey !== 'all' && count > 0
|
||||||
|
? translate('QueueFilterHasNoItems')
|
||||||
|
: translate('QueueIsEmpty')}
|
||||||
|
</Alert>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{isAllPopulated && !hasError && !!records.length ? (
|
||||||
|
<div>
|
||||||
|
<Table
|
||||||
|
selectAll={true}
|
||||||
|
allSelected={allSelected}
|
||||||
|
allUnselected={allUnselected}
|
||||||
|
columns={columns}
|
||||||
|
pageSize={pageSize}
|
||||||
|
sortKey={sortKey}
|
||||||
|
sortDirection={sortDirection}
|
||||||
|
optionsComponent={QueueOptions}
|
||||||
|
onTableOptionChange={handleTableOptionChange}
|
||||||
|
onSelectAllChange={handleSelectAllChange}
|
||||||
|
onSortPress={handleSortPress}
|
||||||
|
>
|
||||||
|
<TableBody>
|
||||||
|
{records.map((item) => {
|
||||||
|
return (
|
||||||
|
<QueueRow
|
||||||
|
key={item.id}
|
||||||
|
isSelected={selectedState[item.id]}
|
||||||
|
columns={columns}
|
||||||
|
{...item}
|
||||||
|
onSelectedChange={handleSelectedChange}
|
||||||
|
onQueueRowModalOpenOrClose={
|
||||||
|
handleQueueRowModalOpenOrClose
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
|
||||||
|
<TablePager
|
||||||
|
page={page}
|
||||||
|
totalPages={totalPages}
|
||||||
|
totalRecords={totalRecords}
|
||||||
|
isFetching={isFetching}
|
||||||
|
onPageSelect={goToPage}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
</PageContentBody>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageContent title={translate('Queue')}>
|
||||||
|
<PageToolbar>
|
||||||
|
<PageToolbarSection>
|
||||||
|
<PageToolbarButton
|
||||||
|
label="Refresh"
|
||||||
|
iconName={icons.REFRESH}
|
||||||
|
isSpinning={isRefreshing}
|
||||||
|
onPress={handleRefreshPress}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<PageToolbarSeparator />
|
||||||
|
|
||||||
|
<PageToolbarButton
|
||||||
|
label={translate('GrabSelected')}
|
||||||
|
iconName={icons.DOWNLOAD}
|
||||||
|
isDisabled={disableSelectedActions || !isPendingSelected}
|
||||||
|
isSpinning={isGrabbing}
|
||||||
|
onPress={handleGrabSelectedPress}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<PageToolbarButton
|
||||||
|
label={translate('RemoveSelected')}
|
||||||
|
iconName={icons.REMOVE}
|
||||||
|
isDisabled={disableSelectedActions}
|
||||||
|
isSpinning={isRemoving}
|
||||||
|
onPress={handleRemoveSelectedPress}
|
||||||
|
/>
|
||||||
|
</PageToolbarSection>
|
||||||
|
|
||||||
|
<PageToolbarSection alignContent={align.RIGHT}>
|
||||||
|
<TableOptionsModalWrapper
|
||||||
|
columns={columns}
|
||||||
|
pageSize={pageSize}
|
||||||
|
maxPageSize={200}
|
||||||
|
optionsComponent={QueueOptions}
|
||||||
|
onTableOptionChange={handleTableOptionChange}
|
||||||
|
>
|
||||||
|
<PageToolbarButton
|
||||||
|
label={translate('Options')}
|
||||||
|
iconName={icons.TABLE}
|
||||||
|
/>
|
||||||
|
</TableOptionsModalWrapper>
|
||||||
|
|
||||||
|
<FilterMenu
|
||||||
|
alignMenu={align.RIGHT}
|
||||||
|
selectedFilterKey={selectedFilterKey}
|
||||||
|
filters={filters}
|
||||||
|
customFilters={customFilters}
|
||||||
|
filterModalConnectorComponent={QueueFilterModal}
|
||||||
|
onFilterSelect={handleFilterSelect}
|
||||||
|
/>
|
||||||
|
</PageToolbarSection>
|
||||||
|
</PageToolbar>
|
||||||
|
|
||||||
|
{currentQueue.current}
|
||||||
|
|
||||||
|
<RemoveQueueItemModal
|
||||||
|
isOpen={isConfirmRemoveModalOpen}
|
||||||
|
selectedCount={selectedCount}
|
||||||
|
canChangeCategory={
|
||||||
|
isConfirmRemoveModalOpen &&
|
||||||
|
selectedIds.every((id) => {
|
||||||
|
const item = records.find((i) => i.id === id);
|
||||||
|
|
||||||
|
return !!(item && item.downloadClientHasPostImportCategory);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
canIgnore={
|
||||||
|
isConfirmRemoveModalOpen &&
|
||||||
|
selectedIds.every((id) => {
|
||||||
|
const item = records.find((i) => i.id === id);
|
||||||
|
|
||||||
|
return !!(item && item.seriesId && item.episodeId);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isPending={
|
||||||
|
isConfirmRemoveModalOpen &&
|
||||||
|
selectedIds.every((id) => {
|
||||||
|
const item = records.find((i) => i.id === id);
|
||||||
|
|
||||||
|
if (!item) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
item.status === 'delay' ||
|
||||||
|
item.status === 'downloadClientUnavailable'
|
||||||
|
);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onRemovePress={handleRemoveSelectedConfirmed}
|
||||||
|
onModalClose={handleConfirmRemoveModalClose}
|
||||||
|
/>
|
||||||
|
</PageContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Queue;
|
||||||
@@ -1,203 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import * as commandNames from 'Commands/commandNames';
|
|
||||||
import withCurrentPage from 'Components/withCurrentPage';
|
|
||||||
import { executeCommand } from 'Store/Actions/commandActions';
|
|
||||||
import { clearEpisodes, fetchEpisodes } from 'Store/Actions/episodeActions';
|
|
||||||
import * as queueActions from 'Store/Actions/queueActions';
|
|
||||||
import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector';
|
|
||||||
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
|
||||||
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
|
||||||
import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
|
|
||||||
import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator';
|
|
||||||
import Queue from './Queue';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.episodes,
|
|
||||||
(state) => state.queue.options,
|
|
||||||
(state) => state.queue.paged,
|
|
||||||
(state) => state.queue.status.item,
|
|
||||||
createCustomFiltersSelector('queue'),
|
|
||||||
createCommandExecutingSelector(commandNames.REFRESH_MONITORED_DOWNLOADS),
|
|
||||||
(episodes, options, queue, status, customFilters, isRefreshMonitoredDownloadsExecuting) => {
|
|
||||||
return {
|
|
||||||
count: options.includeUnknownSeriesItems ? status.totalCount : status.count,
|
|
||||||
isEpisodesFetching: episodes.isFetching,
|
|
||||||
isEpisodesPopulated: episodes.isPopulated,
|
|
||||||
episodesError: episodes.error,
|
|
||||||
customFilters,
|
|
||||||
isRefreshMonitoredDownloadsExecuting,
|
|
||||||
...options,
|
|
||||||
...queue
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
...queueActions,
|
|
||||||
fetchEpisodes,
|
|
||||||
clearEpisodes,
|
|
||||||
executeCommand
|
|
||||||
};
|
|
||||||
|
|
||||||
class QueueConnector extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
const {
|
|
||||||
useCurrentPage,
|
|
||||||
fetchQueue,
|
|
||||||
fetchQueueStatus,
|
|
||||||
gotoQueueFirstPage
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
registerPagePopulator(this.repopulate);
|
|
||||||
|
|
||||||
if (useCurrentPage) {
|
|
||||||
fetchQueue();
|
|
||||||
} else {
|
|
||||||
gotoQueueFirstPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchQueueStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
if (hasDifferentItems(prevProps.items, this.props.items)) {
|
|
||||||
const episodeIds = selectUniqueIds(this.props.items, 'episodeId');
|
|
||||||
|
|
||||||
if (episodeIds.length) {
|
|
||||||
this.props.fetchEpisodes({ episodeIds });
|
|
||||||
} else {
|
|
||||||
this.props.clearEpisodes();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
this.props.includeUnknownSeriesItems !==
|
|
||||||
prevProps.includeUnknownSeriesItems
|
|
||||||
) {
|
|
||||||
this.repopulate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
unregisterPagePopulator(this.repopulate);
|
|
||||||
this.props.clearQueue();
|
|
||||||
this.props.clearEpisodes();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Control
|
|
||||||
|
|
||||||
repopulate = () => {
|
|
||||||
this.props.fetchQueue();
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onFirstPagePress = () => {
|
|
||||||
this.props.gotoQueueFirstPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
onPreviousPagePress = () => {
|
|
||||||
this.props.gotoQueuePreviousPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
onNextPagePress = () => {
|
|
||||||
this.props.gotoQueueNextPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
onLastPagePress = () => {
|
|
||||||
this.props.gotoQueueLastPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
onPageSelect = (page) => {
|
|
||||||
this.props.gotoQueuePage({ page });
|
|
||||||
};
|
|
||||||
|
|
||||||
onSortPress = (sortKey) => {
|
|
||||||
this.props.setQueueSort({ sortKey });
|
|
||||||
};
|
|
||||||
|
|
||||||
onFilterSelect = (selectedFilterKey) => {
|
|
||||||
this.props.setQueueFilter({ selectedFilterKey });
|
|
||||||
};
|
|
||||||
|
|
||||||
onTableOptionChange = (payload) => {
|
|
||||||
this.props.setQueueTableOption(payload);
|
|
||||||
|
|
||||||
if (payload.pageSize) {
|
|
||||||
this.props.gotoQueueFirstPage();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
onRefreshPress = () => {
|
|
||||||
this.props.executeCommand({
|
|
||||||
name: commandNames.REFRESH_MONITORED_DOWNLOADS
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onGrabSelectedPress = (ids) => {
|
|
||||||
this.props.grabQueueItems({ ids });
|
|
||||||
};
|
|
||||||
|
|
||||||
onRemoveSelectedPress = (payload) => {
|
|
||||||
this.props.removeQueueItems(payload);
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<Queue
|
|
||||||
onFirstPagePress={this.onFirstPagePress}
|
|
||||||
onPreviousPagePress={this.onPreviousPagePress}
|
|
||||||
onNextPagePress={this.onNextPagePress}
|
|
||||||
onLastPagePress={this.onLastPagePress}
|
|
||||||
onPageSelect={this.onPageSelect}
|
|
||||||
onSortPress={this.onSortPress}
|
|
||||||
onFilterSelect={this.onFilterSelect}
|
|
||||||
onTableOptionChange={this.onTableOptionChange}
|
|
||||||
onRefreshPress={this.onRefreshPress}
|
|
||||||
onGrabSelectedPress={this.onGrabSelectedPress}
|
|
||||||
onRemoveSelectedPress={this.onRemoveSelectedPress}
|
|
||||||
{...this.props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QueueConnector.propTypes = {
|
|
||||||
includeUnknownSeriesItems: PropTypes.bool.isRequired,
|
|
||||||
useCurrentPage: PropTypes.bool.isRequired,
|
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
fetchQueue: PropTypes.func.isRequired,
|
|
||||||
fetchQueueStatus: PropTypes.func.isRequired,
|
|
||||||
gotoQueueFirstPage: PropTypes.func.isRequired,
|
|
||||||
gotoQueuePreviousPage: PropTypes.func.isRequired,
|
|
||||||
gotoQueueNextPage: PropTypes.func.isRequired,
|
|
||||||
gotoQueueLastPage: PropTypes.func.isRequired,
|
|
||||||
gotoQueuePage: PropTypes.func.isRequired,
|
|
||||||
setQueueSort: PropTypes.func.isRequired,
|
|
||||||
setQueueFilter: PropTypes.func.isRequired,
|
|
||||||
setQueueTableOption: PropTypes.func.isRequired,
|
|
||||||
clearQueue: PropTypes.func.isRequired,
|
|
||||||
grabQueueItems: PropTypes.func.isRequired,
|
|
||||||
removeQueueItems: PropTypes.func.isRequired,
|
|
||||||
fetchEpisodes: PropTypes.func.isRequired,
|
|
||||||
clearEpisodes: PropTypes.func.isRequired,
|
|
||||||
executeCommand: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default withCurrentPage(
|
|
||||||
connect(createMapStateToProps, mapDispatchToProps)(QueueConnector)
|
|
||||||
);
|
|
||||||
+28
-35
@@ -1,36 +1,49 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Icon from 'Components/Icon';
|
import Icon from 'Components/Icon';
|
||||||
import Popover from 'Components/Tooltip/Popover';
|
import Popover from 'Components/Tooltip/Popover';
|
||||||
import { icons, tooltipPositions } from 'Helpers/Props';
|
import { icons, tooltipPositions } from 'Helpers/Props';
|
||||||
|
import {
|
||||||
|
QueueTrackedDownloadState,
|
||||||
|
QueueTrackedDownloadStatus,
|
||||||
|
StatusMessage,
|
||||||
|
} from 'typings/Queue';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import QueueStatus from './QueueStatus';
|
import QueueStatus from './QueueStatus';
|
||||||
import styles from './QueueDetails.css';
|
import styles from './QueueDetails.css';
|
||||||
|
|
||||||
function QueueDetails(props) {
|
interface QueueDetailsProps {
|
||||||
|
title: string;
|
||||||
|
size: number;
|
||||||
|
sizeLeft: number;
|
||||||
|
estimatedCompletionTime?: string;
|
||||||
|
status: string;
|
||||||
|
trackedDownloadState?: QueueTrackedDownloadState;
|
||||||
|
trackedDownloadStatus?: QueueTrackedDownloadStatus;
|
||||||
|
statusMessages?: StatusMessage[];
|
||||||
|
errorMessage?: string;
|
||||||
|
progressBar: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
function QueueDetails(props: QueueDetailsProps) {
|
||||||
const {
|
const {
|
||||||
title,
|
title,
|
||||||
size,
|
size,
|
||||||
sizeleft,
|
sizeLeft,
|
||||||
status,
|
status,
|
||||||
trackedDownloadState,
|
trackedDownloadState = 'downloading',
|
||||||
trackedDownloadStatus,
|
trackedDownloadStatus = 'ok',
|
||||||
statusMessages,
|
statusMessages,
|
||||||
errorMessage,
|
errorMessage,
|
||||||
progressBar
|
progressBar,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const progress = (100 - sizeleft / size * 100);
|
const progress = 100 - (sizeLeft / size) * 100;
|
||||||
const isDownloading = status === 'downloading';
|
const isDownloading = status === 'downloading';
|
||||||
const isPaused = status === 'paused';
|
const isPaused = status === 'paused';
|
||||||
const hasWarning = trackedDownloadStatus === 'warning';
|
const hasWarning = trackedDownloadStatus === 'warning';
|
||||||
const hasError = trackedDownloadStatus === 'error';
|
const hasError = trackedDownloadStatus === 'error';
|
||||||
|
|
||||||
if (
|
if ((isDownloading || isPaused) && !hasWarning && !hasError) {
|
||||||
(isDownloading || isPaused) &&
|
|
||||||
!hasWarning &&
|
|
||||||
!hasError
|
|
||||||
) {
|
|
||||||
const state = isPaused ? translate('Paused') : translate('Downloading');
|
const state = isPaused ? translate('Paused') : translate('Downloading');
|
||||||
|
|
||||||
if (progress < 5) {
|
if (progress < 5) {
|
||||||
@@ -45,12 +58,10 @@ function QueueDetails(props) {
|
|||||||
return (
|
return (
|
||||||
<Popover
|
<Popover
|
||||||
className={styles.progressBarContainer}
|
className={styles.progressBarContainer}
|
||||||
anchor={progressBar}
|
anchor={progressBar!}
|
||||||
title={`${state} - ${progress.toFixed(1)}%`}
|
title={`${state} - ${progress.toFixed(1)}%`}
|
||||||
body={
|
body={<div>{title}</div>}
|
||||||
<div>{title}</div>
|
position="bottom-start"
|
||||||
}
|
|
||||||
position={tooltipPositions.LEFT}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -68,22 +79,4 @@ function QueueDetails(props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueDetails.propTypes = {
|
|
||||||
title: PropTypes.string.isRequired,
|
|
||||||
size: PropTypes.number.isRequired,
|
|
||||||
sizeleft: PropTypes.number.isRequired,
|
|
||||||
estimatedCompletionTime: PropTypes.string,
|
|
||||||
status: PropTypes.string.isRequired,
|
|
||||||
trackedDownloadState: PropTypes.string.isRequired,
|
|
||||||
trackedDownloadStatus: PropTypes.string.isRequired,
|
|
||||||
statusMessages: PropTypes.arrayOf(PropTypes.object),
|
|
||||||
errorMessage: PropTypes.string,
|
|
||||||
progressBar: PropTypes.node.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
QueueDetails.defaultProps = {
|
|
||||||
trackedDownloadStatus: 'ok',
|
|
||||||
trackedDownloadState: 'downloading'
|
|
||||||
};
|
|
||||||
|
|
||||||
export default QueueDetails;
|
export default QueueDetails;
|
||||||
@@ -1,53 +1,26 @@
|
|||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import FilterModal, { FilterModalProps } from 'Components/Filter/FilterModal';
|
||||||
import { createSelector } from 'reselect';
|
import { setQueueOption } from './queueOptionsStore';
|
||||||
import AppState from 'App/State/AppState';
|
import useQueue, { FILTER_BUILDER } from './useQueue';
|
||||||
import FilterModal from 'Components/Filter/FilterModal';
|
|
||||||
import { setQueueFilter } from 'Store/Actions/queueActions';
|
|
||||||
|
|
||||||
function createQueueSelector() {
|
type QueueFilterModalProps = FilterModalProps<History>;
|
||||||
return createSelector(
|
|
||||||
(state: AppState) => state.queue.paged.items,
|
|
||||||
(queueItems) => {
|
|
||||||
return queueItems;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createFilterBuilderPropsSelector() {
|
|
||||||
return createSelector(
|
|
||||||
(state: AppState) => state.queue.paged.filterBuilderProps,
|
|
||||||
(filterBuilderProps) => {
|
|
||||||
return filterBuilderProps;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface QueueFilterModalProps {
|
|
||||||
isOpen: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function QueueFilterModal(props: QueueFilterModalProps) {
|
export default function QueueFilterModal(props: QueueFilterModalProps) {
|
||||||
const sectionItems = useSelector(createQueueSelector());
|
const { records } = useQueue();
|
||||||
const filterBuilderProps = useSelector(createFilterBuilderPropsSelector());
|
|
||||||
const customFilterType = 'queue';
|
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
|
||||||
|
|
||||||
const dispatchSetFilter = useCallback(
|
const dispatchSetFilter = useCallback(
|
||||||
(payload: unknown) => {
|
({ selectedFilterKey }: { selectedFilterKey: string | number }) => {
|
||||||
dispatch(setQueueFilter(payload));
|
setQueueOption('selectedFilterKey', selectedFilterKey);
|
||||||
},
|
},
|
||||||
[dispatch]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FilterModal
|
<FilterModal
|
||||||
// TODO: Don't spread all the props
|
|
||||||
{...props}
|
{...props}
|
||||||
sectionItems={sectionItems}
|
sectionItems={records}
|
||||||
filterBuilderProps={filterBuilderProps}
|
filterBuilderProps={FILTER_BUILDER}
|
||||||
customFilterType={customFilterType}
|
customFilterType="queue"
|
||||||
dispatchSetFilter={dispatchSetFilter}
|
dispatchSetFilter={dispatchSetFilter}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component, Fragment } from 'react';
|
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
|
||||||
import FormLabel from 'Components/Form/FormLabel';
|
|
||||||
import { inputTypes } from 'Helpers/Props';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
|
|
||||||
class QueueOptions extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
includeUnknownSeriesItems: props.includeUnknownSeriesItems
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
const {
|
|
||||||
includeUnknownSeriesItems
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
if (includeUnknownSeriesItems !== prevProps.includeUnknownSeriesItems) {
|
|
||||||
this.setState({
|
|
||||||
includeUnknownSeriesItems
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onOptionChange = ({ name, value }) => {
|
|
||||||
this.setState({
|
|
||||||
[name]: value
|
|
||||||
}, () => {
|
|
||||||
this.props.onOptionChange({
|
|
||||||
[name]: value
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
includeUnknownSeriesItems
|
|
||||||
} = this.state;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Fragment>
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('ShowUnknownSeriesItems')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="includeUnknownSeriesItems"
|
|
||||||
value={includeUnknownSeriesItems}
|
|
||||||
helpText={translate('ShowUnknownSeriesItemsHelpText')}
|
|
||||||
onChange={this.onOptionChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
</Fragment>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QueueOptions.propTypes = {
|
|
||||||
includeUnknownSeriesItems: PropTypes.bool.isRequired,
|
|
||||||
onOptionChange: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default QueueOptions;
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import React, { useCallback } from 'react';
|
||||||
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
|
import { OptionChanged } from 'Helpers/Hooks/useOptionsStore';
|
||||||
|
import { inputTypes } from 'Helpers/Props';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import {
|
||||||
|
QueueOptions as QueueOptionsType,
|
||||||
|
setQueueOption,
|
||||||
|
useQueueOption,
|
||||||
|
} from './queueOptionsStore';
|
||||||
|
import useQueue from './useQueue';
|
||||||
|
|
||||||
|
function QueueOptions() {
|
||||||
|
const includeUnknownSeriesItems = useQueueOption('includeUnknownSeriesItems');
|
||||||
|
const { goToPage } = useQueue();
|
||||||
|
|
||||||
|
const handleOptionChange = useCallback(
|
||||||
|
({ name, value }: OptionChanged<QueueOptionsType>) => {
|
||||||
|
setQueueOption(name, value);
|
||||||
|
|
||||||
|
if (name === 'includeUnknownSeriesItems') {
|
||||||
|
goToPage(1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[goToPage]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('ShowUnknownSeriesItems')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="includeUnknownSeriesItems"
|
||||||
|
value={includeUnknownSeriesItems}
|
||||||
|
helpText={translate('ShowUnknownSeriesItemsHelpText')}
|
||||||
|
// @ts-expect-error - The typing for inputs needs more work
|
||||||
|
onChange={handleOptionChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default QueueOptions;
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import { setQueueOption } from 'Store/Actions/queueActions';
|
|
||||||
import QueueOptions from './QueueOptions';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.queue.options,
|
|
||||||
(options) => {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
onOptionChange: setQueueOption
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(QueueOptions);
|
|
||||||
@@ -26,4 +26,5 @@
|
|||||||
composes: cell from '~Components/Table/Cells/TableRowCell.css';
|
composes: cell from '~Components/Table/Cells/TableRowCell.css';
|
||||||
|
|
||||||
width: 70px;
|
width: 70px;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,481 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import ProtocolLabel from 'Activity/Queue/ProtocolLabel';
|
|
||||||
import IconButton from 'Components/Link/IconButton';
|
|
||||||
import SpinnerIconButton from 'Components/Link/SpinnerIconButton';
|
|
||||||
import ProgressBar from 'Components/ProgressBar';
|
|
||||||
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
|
||||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
|
||||||
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
|
||||||
import TableRow from 'Components/Table/TableRow';
|
|
||||||
import Tooltip from 'Components/Tooltip/Tooltip';
|
|
||||||
import EpisodeFormats from 'Episode/EpisodeFormats';
|
|
||||||
import EpisodeLanguages from 'Episode/EpisodeLanguages';
|
|
||||||
import EpisodeQuality from 'Episode/EpisodeQuality';
|
|
||||||
import EpisodeTitleLink from 'Episode/EpisodeTitleLink';
|
|
||||||
import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber';
|
|
||||||
import { icons, kinds, tooltipPositions } from 'Helpers/Props';
|
|
||||||
import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal';
|
|
||||||
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
|
||||||
import formatBytes from 'Utilities/Number/formatBytes';
|
|
||||||
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import QueueStatusCell from './QueueStatusCell';
|
|
||||||
import RemoveQueueItemModal from './RemoveQueueItemModal';
|
|
||||||
import TimeleftCell from './TimeleftCell';
|
|
||||||
import styles from './QueueRow.css';
|
|
||||||
|
|
||||||
class QueueRow extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
isRemoveQueueItemModalOpen: false,
|
|
||||||
isInteractiveImportModalOpen: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onRemoveQueueItemPress = () => {
|
|
||||||
this.setState({ isRemoveQueueItemModalOpen: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
onRemoveQueueItemModalConfirmed = (blocklist, skipRedownload) => {
|
|
||||||
const {
|
|
||||||
onRemoveQueueItemPress,
|
|
||||||
onQueueRowModalOpenOrClose
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
onQueueRowModalOpenOrClose(false);
|
|
||||||
onRemoveQueueItemPress(blocklist, skipRedownload);
|
|
||||||
|
|
||||||
this.setState({ isRemoveQueueItemModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
onRemoveQueueItemModalClose = () => {
|
|
||||||
this.props.onQueueRowModalOpenOrClose(false);
|
|
||||||
|
|
||||||
this.setState({ isRemoveQueueItemModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
onInteractiveImportPress = () => {
|
|
||||||
this.props.onQueueRowModalOpenOrClose(true);
|
|
||||||
|
|
||||||
this.setState({ isInteractiveImportModalOpen: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
onInteractiveImportModalClose = () => {
|
|
||||||
this.props.onQueueRowModalOpenOrClose(false);
|
|
||||||
|
|
||||||
this.setState({ isInteractiveImportModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
id,
|
|
||||||
downloadId,
|
|
||||||
title,
|
|
||||||
status,
|
|
||||||
trackedDownloadStatus,
|
|
||||||
trackedDownloadState,
|
|
||||||
statusMessages,
|
|
||||||
errorMessage,
|
|
||||||
series,
|
|
||||||
episode,
|
|
||||||
languages,
|
|
||||||
quality,
|
|
||||||
customFormats,
|
|
||||||
customFormatScore,
|
|
||||||
protocol,
|
|
||||||
indexer,
|
|
||||||
outputPath,
|
|
||||||
downloadClient,
|
|
||||||
downloadClientHasPostImportCategory,
|
|
||||||
estimatedCompletionTime,
|
|
||||||
added,
|
|
||||||
timeleft,
|
|
||||||
size,
|
|
||||||
sizeleft,
|
|
||||||
showRelativeDates,
|
|
||||||
shortDateFormat,
|
|
||||||
timeFormat,
|
|
||||||
isGrabbing,
|
|
||||||
grabError,
|
|
||||||
isRemoving,
|
|
||||||
isSelected,
|
|
||||||
columns,
|
|
||||||
onSelectedChange,
|
|
||||||
onGrabPress
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const {
|
|
||||||
isRemoveQueueItemModalOpen,
|
|
||||||
isInteractiveImportModalOpen
|
|
||||||
} = this.state;
|
|
||||||
|
|
||||||
const progress = 100 - (sizeleft / size * 100);
|
|
||||||
const showInteractiveImport = status === 'completed' && trackedDownloadStatus === 'warning';
|
|
||||||
const isPending = status === 'delay' || status === 'downloadClientUnavailable';
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TableRow>
|
|
||||||
<TableSelectCell
|
|
||||||
id={id}
|
|
||||||
isSelected={isSelected}
|
|
||||||
onSelectedChange={onSelectedChange}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{
|
|
||||||
columns.map((column) => {
|
|
||||||
const {
|
|
||||||
name,
|
|
||||||
isVisible
|
|
||||||
} = column;
|
|
||||||
|
|
||||||
if (!isVisible) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'status') {
|
|
||||||
return (
|
|
||||||
<QueueStatusCell
|
|
||||||
key={name}
|
|
||||||
sourceTitle={title}
|
|
||||||
status={status}
|
|
||||||
trackedDownloadStatus={trackedDownloadStatus}
|
|
||||||
trackedDownloadState={trackedDownloadState}
|
|
||||||
statusMessages={statusMessages}
|
|
||||||
errorMessage={errorMessage}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'series.sortTitle') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
{
|
|
||||||
series ?
|
|
||||||
<SeriesTitleLink
|
|
||||||
titleSlug={series.titleSlug}
|
|
||||||
title={series.title}
|
|
||||||
/> :
|
|
||||||
title
|
|
||||||
}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'episode') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
{
|
|
||||||
episode ?
|
|
||||||
<SeasonEpisodeNumber
|
|
||||||
seasonNumber={episode.seasonNumber}
|
|
||||||
episodeNumber={episode.episodeNumber}
|
|
||||||
absoluteEpisodeNumber={episode.absoluteEpisodeNumber}
|
|
||||||
seriesType={series.seriesType}
|
|
||||||
alternateTitles={series.alternateTitles}
|
|
||||||
sceneSeasonNumber={episode.sceneSeasonNumber}
|
|
||||||
sceneEpisodeNumber={episode.sceneEpisodeNumber}
|
|
||||||
sceneAbsoluteEpisodeNumber={episode.sceneAbsoluteEpisodeNumber}
|
|
||||||
unverifiedSceneNumbering={episode.unverifiedSceneNumbering}
|
|
||||||
/> :
|
|
||||||
'-'
|
|
||||||
}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'episodes.title') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
{
|
|
||||||
episode ?
|
|
||||||
<EpisodeTitleLink
|
|
||||||
episodeId={episode.id}
|
|
||||||
seriesId={series.id}
|
|
||||||
episodeFileId={episode.episodeFileId}
|
|
||||||
episodeTitle={episode.title}
|
|
||||||
showOpenSeriesButton={true}
|
|
||||||
/> :
|
|
||||||
'-'
|
|
||||||
}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'episodes.airDateUtc') {
|
|
||||||
if (episode) {
|
|
||||||
return (
|
|
||||||
<RelativeDateCellConnector
|
|
||||||
key={name}
|
|
||||||
date={episode.airDateUtc}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
-
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'languages') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
<EpisodeLanguages
|
|
||||||
languages={languages}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'quality') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
{
|
|
||||||
quality ?
|
|
||||||
<EpisodeQuality
|
|
||||||
quality={quality}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'customFormats') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
<EpisodeFormats
|
|
||||||
formats={customFormats}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'customFormatScore') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
className={styles.customFormatScore}
|
|
||||||
>
|
|
||||||
<Tooltip
|
|
||||||
anchor={formatCustomFormatScore(
|
|
||||||
customFormatScore,
|
|
||||||
customFormats.length
|
|
||||||
)}
|
|
||||||
tooltip={<EpisodeFormats formats={customFormats} />}
|
|
||||||
position={tooltipPositions.BOTTOM}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'protocol') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
<ProtocolLabel
|
|
||||||
protocol={protocol}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'indexer') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
{indexer}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'downloadClient') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
{downloadClient}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'title') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
{title}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'size') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>{formatBytes(size)}</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'outputPath') {
|
|
||||||
return (
|
|
||||||
<TableRowCell key={name}>
|
|
||||||
{outputPath}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'estimatedCompletionTime') {
|
|
||||||
return (
|
|
||||||
<TimeleftCell
|
|
||||||
key={name}
|
|
||||||
status={status}
|
|
||||||
estimatedCompletionTime={estimatedCompletionTime}
|
|
||||||
timeleft={timeleft}
|
|
||||||
size={size}
|
|
||||||
sizeleft={sizeleft}
|
|
||||||
showRelativeDates={showRelativeDates}
|
|
||||||
shortDateFormat={shortDateFormat}
|
|
||||||
timeFormat={timeFormat}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'progress') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
className={styles.progress}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
!!progress &&
|
|
||||||
<ProgressBar
|
|
||||||
progress={progress}
|
|
||||||
title={`${progress.toFixed(1)}%`}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'added') {
|
|
||||||
return (
|
|
||||||
<RelativeDateCellConnector
|
|
||||||
key={name}
|
|
||||||
date={added}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'actions') {
|
|
||||||
return (
|
|
||||||
<TableRowCell
|
|
||||||
key={name}
|
|
||||||
className={styles.actions}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
showInteractiveImport &&
|
|
||||||
<IconButton
|
|
||||||
name={icons.INTERACTIVE}
|
|
||||||
onPress={this.onInteractiveImportPress}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
isPending &&
|
|
||||||
<SpinnerIconButton
|
|
||||||
name={icons.DOWNLOAD}
|
|
||||||
kind={grabError ? kinds.DANGER : kinds.DEFAULT}
|
|
||||||
isSpinning={isGrabbing}
|
|
||||||
onPress={onGrabPress}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
<SpinnerIconButton
|
|
||||||
title={translate('RemoveFromQueue')}
|
|
||||||
name={icons.REMOVE}
|
|
||||||
isSpinning={isRemoving}
|
|
||||||
onPress={this.onRemoveQueueItemPress}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
<InteractiveImportModal
|
|
||||||
isOpen={isInteractiveImportModalOpen}
|
|
||||||
downloadId={downloadId}
|
|
||||||
title={title}
|
|
||||||
onModalClose={this.onInteractiveImportModalClose}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<RemoveQueueItemModal
|
|
||||||
isOpen={isRemoveQueueItemModalOpen}
|
|
||||||
sourceTitle={title}
|
|
||||||
canChangeCategory={!!downloadClientHasPostImportCategory}
|
|
||||||
canIgnore={!!series}
|
|
||||||
isPending={isPending}
|
|
||||||
onRemovePress={this.onRemoveQueueItemModalConfirmed}
|
|
||||||
onModalClose={this.onRemoveQueueItemModalClose}
|
|
||||||
/>
|
|
||||||
</TableRow>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QueueRow.propTypes = {
|
|
||||||
id: PropTypes.number.isRequired,
|
|
||||||
downloadId: PropTypes.string,
|
|
||||||
title: PropTypes.string.isRequired,
|
|
||||||
status: PropTypes.string.isRequired,
|
|
||||||
trackedDownloadStatus: PropTypes.string,
|
|
||||||
trackedDownloadState: PropTypes.string,
|
|
||||||
statusMessages: PropTypes.arrayOf(PropTypes.object),
|
|
||||||
errorMessage: PropTypes.string,
|
|
||||||
series: PropTypes.object,
|
|
||||||
episode: PropTypes.object,
|
|
||||||
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
quality: PropTypes.object.isRequired,
|
|
||||||
customFormats: PropTypes.arrayOf(PropTypes.object),
|
|
||||||
customFormatScore: PropTypes.number.isRequired,
|
|
||||||
protocol: PropTypes.string.isRequired,
|
|
||||||
indexer: PropTypes.string,
|
|
||||||
outputPath: PropTypes.string,
|
|
||||||
downloadClient: PropTypes.string,
|
|
||||||
downloadClientHasPostImportCategory: PropTypes.bool,
|
|
||||||
estimatedCompletionTime: PropTypes.string,
|
|
||||||
added: PropTypes.string,
|
|
||||||
timeleft: PropTypes.string,
|
|
||||||
size: PropTypes.number,
|
|
||||||
sizeleft: PropTypes.number,
|
|
||||||
showRelativeDates: PropTypes.bool.isRequired,
|
|
||||||
shortDateFormat: PropTypes.string.isRequired,
|
|
||||||
timeFormat: PropTypes.string.isRequired,
|
|
||||||
isGrabbing: PropTypes.bool.isRequired,
|
|
||||||
grabError: PropTypes.object,
|
|
||||||
isRemoving: PropTypes.bool.isRequired,
|
|
||||||
isSelected: PropTypes.bool,
|
|
||||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
onSelectedChange: PropTypes.func.isRequired,
|
|
||||||
onGrabPress: PropTypes.func.isRequired,
|
|
||||||
onRemoveQueueItemPress: PropTypes.func.isRequired,
|
|
||||||
onQueueRowModalOpenOrClose: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
QueueRow.defaultProps = {
|
|
||||||
customFormats: [],
|
|
||||||
isGrabbing: false,
|
|
||||||
isRemoving: false
|
|
||||||
};
|
|
||||||
|
|
||||||
export default QueueRow;
|
|
||||||
@@ -0,0 +1,410 @@
|
|||||||
|
import React, { useCallback, useState } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import ProtocolLabel from 'Activity/Queue/ProtocolLabel';
|
||||||
|
import IconButton from 'Components/Link/IconButton';
|
||||||
|
import SpinnerIconButton from 'Components/Link/SpinnerIconButton';
|
||||||
|
import ProgressBar from 'Components/ProgressBar';
|
||||||
|
import RelativeDateCell from 'Components/Table/Cells/RelativeDateCell';
|
||||||
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
|
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
||||||
|
import Column from 'Components/Table/Column';
|
||||||
|
import TableRow from 'Components/Table/TableRow';
|
||||||
|
import Tooltip from 'Components/Tooltip/Tooltip';
|
||||||
|
import DownloadProtocol from 'DownloadClient/DownloadProtocol';
|
||||||
|
import EpisodeFormats from 'Episode/EpisodeFormats';
|
||||||
|
import EpisodeLanguages from 'Episode/EpisodeLanguages';
|
||||||
|
import EpisodeQuality from 'Episode/EpisodeQuality';
|
||||||
|
import useEpisodes from 'Episode/useEpisodes';
|
||||||
|
import { icons, kinds, tooltipPositions } from 'Helpers/Props';
|
||||||
|
import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal';
|
||||||
|
import Language from 'Language/Language';
|
||||||
|
import { QualityModel } from 'Quality/Quality';
|
||||||
|
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
||||||
|
import useSeries from 'Series/useSeries';
|
||||||
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
|
import CustomFormat from 'typings/CustomFormat';
|
||||||
|
import { SelectStateInputProps } from 'typings/props';
|
||||||
|
import {
|
||||||
|
QueueTrackedDownloadState,
|
||||||
|
QueueTrackedDownloadStatus,
|
||||||
|
StatusMessage,
|
||||||
|
} from 'typings/Queue';
|
||||||
|
import formatBytes from 'Utilities/Number/formatBytes';
|
||||||
|
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import EpisodeCellContent from './EpisodeCellContent';
|
||||||
|
import EpisodeTitleCellContent from './EpisodeTitleCellContent';
|
||||||
|
import QueueStatusCell from './QueueStatusCell';
|
||||||
|
import RemoveQueueItemModal from './RemoveQueueItemModal';
|
||||||
|
import TimeLeftCell from './TimeLeftCell';
|
||||||
|
import { useGrabQueueItem, useRemoveQueueItem } from './useQueue';
|
||||||
|
import styles from './QueueRow.css';
|
||||||
|
|
||||||
|
interface QueueRowProps {
|
||||||
|
id: number;
|
||||||
|
seriesId?: number;
|
||||||
|
episodeIds: number[];
|
||||||
|
downloadId?: string;
|
||||||
|
title: string;
|
||||||
|
status: string;
|
||||||
|
trackedDownloadStatus?: QueueTrackedDownloadStatus;
|
||||||
|
trackedDownloadState?: QueueTrackedDownloadState;
|
||||||
|
statusMessages?: StatusMessage[];
|
||||||
|
errorMessage?: string;
|
||||||
|
languages: Language[];
|
||||||
|
quality: QualityModel;
|
||||||
|
customFormats?: CustomFormat[];
|
||||||
|
customFormatScore: number;
|
||||||
|
protocol: DownloadProtocol;
|
||||||
|
indexer?: string;
|
||||||
|
isFullSeason: boolean;
|
||||||
|
seasonNumbers: number[];
|
||||||
|
outputPath?: string;
|
||||||
|
downloadClient?: string;
|
||||||
|
downloadClientHasPostImportCategory?: boolean;
|
||||||
|
estimatedCompletionTime?: string;
|
||||||
|
added?: string;
|
||||||
|
timeLeft?: string;
|
||||||
|
size: number;
|
||||||
|
sizeLeft: number;
|
||||||
|
isRemoving?: boolean;
|
||||||
|
isSelected?: boolean;
|
||||||
|
columns: Column[];
|
||||||
|
onSelectedChange: (options: SelectStateInputProps) => void;
|
||||||
|
onQueueRowModalOpenOrClose: (isOpen: boolean) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function QueueRow(props: QueueRowProps) {
|
||||||
|
const {
|
||||||
|
id,
|
||||||
|
seriesId,
|
||||||
|
episodeIds,
|
||||||
|
downloadId,
|
||||||
|
title,
|
||||||
|
status,
|
||||||
|
trackedDownloadStatus,
|
||||||
|
trackedDownloadState,
|
||||||
|
statusMessages,
|
||||||
|
errorMessage,
|
||||||
|
languages,
|
||||||
|
quality,
|
||||||
|
customFormats = [],
|
||||||
|
customFormatScore,
|
||||||
|
protocol,
|
||||||
|
indexer,
|
||||||
|
outputPath,
|
||||||
|
downloadClient,
|
||||||
|
downloadClientHasPostImportCategory,
|
||||||
|
estimatedCompletionTime,
|
||||||
|
isFullSeason,
|
||||||
|
seasonNumbers,
|
||||||
|
added,
|
||||||
|
timeLeft,
|
||||||
|
size,
|
||||||
|
sizeLeft,
|
||||||
|
isSelected,
|
||||||
|
columns,
|
||||||
|
onSelectedChange,
|
||||||
|
onQueueRowModalOpenOrClose,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const series = useSeries(seriesId);
|
||||||
|
const episodes = useEpisodes(episodeIds, 'episodes');
|
||||||
|
const { showRelativeDates, shortDateFormat, timeFormat } = useSelector(
|
||||||
|
createUISettingsSelector()
|
||||||
|
);
|
||||||
|
const { removeQueueItem, isRemoving } = useRemoveQueueItem(id);
|
||||||
|
const { grabQueueItem, isGrabbing, grabError } = useGrabQueueItem(id);
|
||||||
|
|
||||||
|
const [isRemoveQueueItemModalOpen, setIsRemoveQueueItemModalOpen] =
|
||||||
|
useState(false);
|
||||||
|
|
||||||
|
const [isInteractiveImportModalOpen, setIsInteractiveImportModalOpen] =
|
||||||
|
useState(false);
|
||||||
|
|
||||||
|
const handleGrabPress = useCallback(() => {
|
||||||
|
grabQueueItem();
|
||||||
|
}, [grabQueueItem]);
|
||||||
|
|
||||||
|
const handleInteractiveImportPress = useCallback(() => {
|
||||||
|
onQueueRowModalOpenOrClose(true);
|
||||||
|
setIsInteractiveImportModalOpen(true);
|
||||||
|
}, [setIsInteractiveImportModalOpen, onQueueRowModalOpenOrClose]);
|
||||||
|
|
||||||
|
const handleInteractiveImportModalClose = useCallback(() => {
|
||||||
|
onQueueRowModalOpenOrClose(false);
|
||||||
|
setIsInteractiveImportModalOpen(false);
|
||||||
|
}, [setIsInteractiveImportModalOpen, onQueueRowModalOpenOrClose]);
|
||||||
|
|
||||||
|
const handleRemoveQueueItemPress = useCallback(() => {
|
||||||
|
onQueueRowModalOpenOrClose(true);
|
||||||
|
setIsRemoveQueueItemModalOpen(true);
|
||||||
|
}, [setIsRemoveQueueItemModalOpen, onQueueRowModalOpenOrClose]);
|
||||||
|
|
||||||
|
const handleRemoveQueueItemModalConfirmed = useCallback(() => {
|
||||||
|
onQueueRowModalOpenOrClose(false);
|
||||||
|
removeQueueItem();
|
||||||
|
setIsRemoveQueueItemModalOpen(false);
|
||||||
|
}, [
|
||||||
|
setIsRemoveQueueItemModalOpen,
|
||||||
|
removeQueueItem,
|
||||||
|
onQueueRowModalOpenOrClose,
|
||||||
|
]);
|
||||||
|
|
||||||
|
const handleRemoveQueueItemModalClose = useCallback(() => {
|
||||||
|
onQueueRowModalOpenOrClose(false);
|
||||||
|
setIsRemoveQueueItemModalOpen(false);
|
||||||
|
}, [setIsRemoveQueueItemModalOpen, onQueueRowModalOpenOrClose]);
|
||||||
|
|
||||||
|
const progress = 100 - (sizeLeft / size) * 100;
|
||||||
|
const showInteractiveImport =
|
||||||
|
status === 'completed' && trackedDownloadStatus === 'warning';
|
||||||
|
const isPending =
|
||||||
|
status === 'delay' || status === 'downloadClientUnavailable';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRow>
|
||||||
|
<TableSelectCell
|
||||||
|
id={id}
|
||||||
|
isSelected={isSelected}
|
||||||
|
onSelectedChange={onSelectedChange}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{columns.map((column) => {
|
||||||
|
const { name, isVisible } = column;
|
||||||
|
|
||||||
|
if (!isVisible) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'status') {
|
||||||
|
return (
|
||||||
|
<QueueStatusCell
|
||||||
|
key={name}
|
||||||
|
sourceTitle={title}
|
||||||
|
status={status}
|
||||||
|
trackedDownloadStatus={trackedDownloadStatus}
|
||||||
|
trackedDownloadState={trackedDownloadState}
|
||||||
|
statusMessages={statusMessages}
|
||||||
|
errorMessage={errorMessage}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'series.sortTitle') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
{series ? (
|
||||||
|
<SeriesTitleLink
|
||||||
|
titleSlug={series.titleSlug}
|
||||||
|
title={series.title}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
title
|
||||||
|
)}
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'episode') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<EpisodeCellContent
|
||||||
|
episodes={episodes}
|
||||||
|
isFullSeason={isFullSeason}
|
||||||
|
seasonNumber={seasonNumbers[0]}
|
||||||
|
series={series}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'episodes.title') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<EpisodeTitleCellContent episodes={episodes} series={series} />
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'episodes.airDateUtc') {
|
||||||
|
if (episodes.length === 0) {
|
||||||
|
return <TableRowCell key={name}>-</TableRowCell>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (episodes.length === 1) {
|
||||||
|
return (
|
||||||
|
<RelativeDateCell key={name} date={episodes[0].airDateUtc} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<RelativeDateCell
|
||||||
|
key={name}
|
||||||
|
component="span"
|
||||||
|
date={episodes[0].airDateUtc}
|
||||||
|
/>
|
||||||
|
{' - '}
|
||||||
|
<RelativeDateCell
|
||||||
|
key={name}
|
||||||
|
component="span"
|
||||||
|
date={episodes[episodes.length - 1].airDateUtc}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'languages') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<EpisodeLanguages languages={languages} />
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'quality') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
{quality ? <EpisodeQuality quality={quality} /> : null}
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'customFormats') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<EpisodeFormats formats={customFormats} />
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'customFormatScore') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name} className={styles.customFormatScore}>
|
||||||
|
<Tooltip
|
||||||
|
anchor={formatCustomFormatScore(
|
||||||
|
customFormatScore,
|
||||||
|
customFormats.length
|
||||||
|
)}
|
||||||
|
tooltip={<EpisodeFormats formats={customFormats} />}
|
||||||
|
position={tooltipPositions.BOTTOM}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'protocol') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name}>
|
||||||
|
<ProtocolLabel protocol={protocol} />
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'indexer') {
|
||||||
|
return <TableRowCell key={name}>{indexer}</TableRowCell>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'downloadClient') {
|
||||||
|
return <TableRowCell key={name}>{downloadClient}</TableRowCell>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'title') {
|
||||||
|
return <TableRowCell key={name}>{title}</TableRowCell>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'size') {
|
||||||
|
return <TableRowCell key={name}>{formatBytes(size)}</TableRowCell>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'outputPath') {
|
||||||
|
return <TableRowCell key={name}>{outputPath}</TableRowCell>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'estimatedCompletionTime') {
|
||||||
|
return (
|
||||||
|
<TimeLeftCell
|
||||||
|
key={name}
|
||||||
|
status={status}
|
||||||
|
estimatedCompletionTime={estimatedCompletionTime}
|
||||||
|
timeLeft={timeLeft}
|
||||||
|
size={size}
|
||||||
|
sizeLeft={sizeLeft}
|
||||||
|
showRelativeDates={showRelativeDates}
|
||||||
|
shortDateFormat={shortDateFormat}
|
||||||
|
timeFormat={timeFormat}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'progress') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name} className={styles.progress}>
|
||||||
|
{!!progress && (
|
||||||
|
<ProgressBar
|
||||||
|
progress={progress}
|
||||||
|
title={`${progress.toFixed(1)}%`}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'added') {
|
||||||
|
return <RelativeDateCell key={name} date={added} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === 'actions') {
|
||||||
|
return (
|
||||||
|
<TableRowCell key={name} className={styles.actions}>
|
||||||
|
{showInteractiveImport ? (
|
||||||
|
<IconButton
|
||||||
|
name={icons.INTERACTIVE}
|
||||||
|
onPress={handleInteractiveImportPress}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{isPending ? (
|
||||||
|
<SpinnerIconButton
|
||||||
|
name={icons.DOWNLOAD}
|
||||||
|
kind={grabError ? kinds.DANGER : kinds.DEFAULT}
|
||||||
|
isSpinning={isGrabbing}
|
||||||
|
onPress={handleGrabPress}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<SpinnerIconButton
|
||||||
|
title={translate('RemoveFromQueue')}
|
||||||
|
name={icons.REMOVE}
|
||||||
|
isSpinning={isRemoving}
|
||||||
|
onPress={handleRemoveQueueItemPress}
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
})}
|
||||||
|
|
||||||
|
<InteractiveImportModal
|
||||||
|
isOpen={isInteractiveImportModalOpen}
|
||||||
|
downloadId={downloadId}
|
||||||
|
modalTitle={title}
|
||||||
|
onModalClose={handleInteractiveImportModalClose}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<RemoveQueueItemModal
|
||||||
|
isOpen={isRemoveQueueItemModalOpen}
|
||||||
|
sourceTitle={title}
|
||||||
|
canChangeCategory={!!downloadClientHasPostImportCategory}
|
||||||
|
canIgnore={!!series}
|
||||||
|
isPending={isPending}
|
||||||
|
onRemovePress={handleRemoveQueueItemModalConfirmed}
|
||||||
|
onModalClose={handleRemoveQueueItemModalClose}
|
||||||
|
/>
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default QueueRow;
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import { grabQueueItem, removeQueueItem } from 'Store/Actions/queueActions';
|
|
||||||
import createEpisodeSelector from 'Store/Selectors/createEpisodeSelector';
|
|
||||||
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
||||||
import QueueRow from './QueueRow';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
createSeriesSelector(),
|
|
||||||
createEpisodeSelector(),
|
|
||||||
createUISettingsSelector(),
|
|
||||||
(series, episode, uiSettings) => {
|
|
||||||
const result = {
|
|
||||||
showRelativeDates: uiSettings.showRelativeDates,
|
|
||||||
shortDateFormat: uiSettings.shortDateFormat,
|
|
||||||
timeFormat: uiSettings.timeFormat
|
|
||||||
};
|
|
||||||
|
|
||||||
result.series = series;
|
|
||||||
result.episode = episode;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
grabQueueItem,
|
|
||||||
removeQueueItem
|
|
||||||
};
|
|
||||||
|
|
||||||
class QueueRowConnector extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onGrabPress = () => {
|
|
||||||
this.props.grabQueueItem({ id: this.props.id });
|
|
||||||
};
|
|
||||||
|
|
||||||
onRemoveQueueItemPress = (payload) => {
|
|
||||||
this.props.removeQueueItem({ id: this.props.id, ...payload });
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<QueueRow
|
|
||||||
{...this.props}
|
|
||||||
onGrabPress={this.onGrabPress}
|
|
||||||
onRemoveQueueItemPress={this.onRemoveQueueItemPress}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QueueRowConnector.propTypes = {
|
|
||||||
id: PropTypes.number.isRequired,
|
|
||||||
episode: PropTypes.object,
|
|
||||||
grabQueueItem: PropTypes.func.isRequired,
|
|
||||||
removeQueueItem: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(QueueRowConnector);
|
|
||||||
+55
-59
@@ -1,51 +1,59 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Icon from 'Components/Icon';
|
import Icon, { IconKind } from 'Components/Icon';
|
||||||
import Popover from 'Components/Tooltip/Popover';
|
import Popover from 'Components/Tooltip/Popover';
|
||||||
import { icons, kinds, tooltipPositions } from 'Helpers/Props';
|
import { icons, kinds } from 'Helpers/Props';
|
||||||
|
import { TooltipPosition } from 'Helpers/Props/tooltipPositions';
|
||||||
|
import {
|
||||||
|
QueueTrackedDownloadState,
|
||||||
|
QueueTrackedDownloadStatus,
|
||||||
|
StatusMessage,
|
||||||
|
} from 'typings/Queue';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import styles from './QueueStatus.css';
|
import styles from './QueueStatus.css';
|
||||||
|
|
||||||
function getDetailedPopoverBody(statusMessages) {
|
function getDetailedPopoverBody(statusMessages: StatusMessage[]) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{
|
{statusMessages.map(({ title, messages }) => {
|
||||||
statusMessages.map(({ title, messages }) => {
|
return (
|
||||||
return (
|
<div
|
||||||
<div
|
key={title}
|
||||||
key={title}
|
className={messages.length ? undefined : styles.noMessages}
|
||||||
className={messages.length ? undefined: styles.noMessages}
|
>
|
||||||
>
|
{title}
|
||||||
{title}
|
<ul>
|
||||||
<ul>
|
{messages.map((message) => {
|
||||||
{
|
return <li key={message}>{message}</li>;
|
||||||
messages.map((message) => {
|
})}
|
||||||
return (
|
</ul>
|
||||||
<li key={message}>
|
</div>
|
||||||
{message}
|
);
|
||||||
</li>
|
})}
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function QueueStatus(props) {
|
interface QueueStatusProps {
|
||||||
|
sourceTitle: string;
|
||||||
|
status: string;
|
||||||
|
trackedDownloadStatus?: QueueTrackedDownloadStatus;
|
||||||
|
trackedDownloadState?: QueueTrackedDownloadState;
|
||||||
|
statusMessages?: StatusMessage[];
|
||||||
|
errorMessage?: string;
|
||||||
|
position: TooltipPosition;
|
||||||
|
canFlip?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
function QueueStatus(props: QueueStatusProps) {
|
||||||
const {
|
const {
|
||||||
sourceTitle,
|
sourceTitle,
|
||||||
status,
|
status,
|
||||||
trackedDownloadStatus,
|
trackedDownloadStatus = 'ok',
|
||||||
trackedDownloadState,
|
trackedDownloadState = 'downloading',
|
||||||
statusMessages,
|
statusMessages = [],
|
||||||
errorMessage,
|
errorMessage,
|
||||||
position,
|
position,
|
||||||
canFlip
|
canFlip = false,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const hasWarning = trackedDownloadStatus === 'warning';
|
const hasWarning = trackedDownloadStatus === 'warning';
|
||||||
@@ -53,7 +61,7 @@ function QueueStatus(props) {
|
|||||||
|
|
||||||
// status === 'downloading'
|
// status === 'downloading'
|
||||||
let iconName = icons.DOWNLOADING;
|
let iconName = icons.DOWNLOADING;
|
||||||
let iconKind = kinds.DEFAULT;
|
let iconKind: IconKind = kinds.DEFAULT;
|
||||||
let title = translate('Downloading');
|
let title = translate('Downloading');
|
||||||
|
|
||||||
if (status === 'paused') {
|
if (status === 'paused') {
|
||||||
@@ -70,6 +78,11 @@ function QueueStatus(props) {
|
|||||||
iconName = icons.DOWNLOADED;
|
iconName = icons.DOWNLOADED;
|
||||||
title = translate('Downloaded');
|
title = translate('Downloaded');
|
||||||
|
|
||||||
|
if (trackedDownloadState === 'importBlocked') {
|
||||||
|
title += ` - ${translate('UnableToImportAutomatically')}`;
|
||||||
|
iconKind = kinds.WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
if (trackedDownloadState === 'importPending') {
|
if (trackedDownloadState === 'importPending') {
|
||||||
title += ` - ${translate('WaitingToImport')}`;
|
title += ` - ${translate('WaitingToImport')}`;
|
||||||
iconKind = kinds.PURPLE;
|
iconKind = kinds.PURPLE;
|
||||||
@@ -77,7 +90,7 @@ function QueueStatus(props) {
|
|||||||
|
|
||||||
if (trackedDownloadState === 'importing') {
|
if (trackedDownloadState === 'importing') {
|
||||||
title += ` - ${translate('Importing')}`;
|
title += ` - ${translate('Importing')}`;
|
||||||
iconKind = kinds.PURPLE;
|
iconKind = kinds.PRIMARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trackedDownloadState === 'failedPending') {
|
if (trackedDownloadState === 'failedPending') {
|
||||||
@@ -110,7 +123,8 @@ function QueueStatus(props) {
|
|||||||
if (status === 'warning') {
|
if (status === 'warning') {
|
||||||
iconName = icons.DOWNLOADING;
|
iconName = icons.DOWNLOADING;
|
||||||
iconKind = kinds.WARNING;
|
iconKind = kinds.WARNING;
|
||||||
const warningMessage = errorMessage || translate('CheckDownloadClientForDetails');
|
const warningMessage =
|
||||||
|
errorMessage || translate('CheckDownloadClientForDetails');
|
||||||
title = translate('DownloadWarning', { warningMessage });
|
title = translate('DownloadWarning', { warningMessage });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,35 +142,17 @@ function QueueStatus(props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover
|
<Popover
|
||||||
anchor={
|
anchor={<Icon name={iconName} kind={iconKind} />}
|
||||||
<Icon
|
|
||||||
name={iconName}
|
|
||||||
kind={iconKind}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
title={title}
|
title={title}
|
||||||
body={hasWarning || hasError ? getDetailedPopoverBody(statusMessages) : sourceTitle}
|
body={
|
||||||
|
hasWarning || hasError
|
||||||
|
? getDetailedPopoverBody(statusMessages)
|
||||||
|
: sourceTitle
|
||||||
|
}
|
||||||
position={position}
|
position={position}
|
||||||
canFlip={canFlip}
|
canFlip={canFlip}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueStatus.propTypes = {
|
|
||||||
sourceTitle: PropTypes.string.isRequired,
|
|
||||||
status: PropTypes.string.isRequired,
|
|
||||||
trackedDownloadStatus: PropTypes.string.isRequired,
|
|
||||||
trackedDownloadState: PropTypes.string.isRequired,
|
|
||||||
statusMessages: PropTypes.arrayOf(PropTypes.object),
|
|
||||||
errorMessage: PropTypes.string,
|
|
||||||
position: PropTypes.oneOf(tooltipPositions.all).isRequired,
|
|
||||||
canFlip: PropTypes.bool.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
QueueStatus.defaultProps = {
|
|
||||||
trackedDownloadStatus: 'ok',
|
|
||||||
trackedDownloadState: 'downloading',
|
|
||||||
canFlip: false
|
|
||||||
};
|
|
||||||
|
|
||||||
export default QueueStatus;
|
export default QueueStatus;
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
|
||||||
import { tooltipPositions } from 'Helpers/Props';
|
|
||||||
import QueueStatus from './QueueStatus';
|
|
||||||
import styles from './QueueStatusCell.css';
|
|
||||||
|
|
||||||
function QueueStatusCell(props) {
|
|
||||||
const {
|
|
||||||
sourceTitle,
|
|
||||||
status,
|
|
||||||
trackedDownloadStatus,
|
|
||||||
trackedDownloadState,
|
|
||||||
statusMessages,
|
|
||||||
errorMessage
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TableRowCell className={styles.status}>
|
|
||||||
<QueueStatus
|
|
||||||
sourceTitle={sourceTitle}
|
|
||||||
status={status}
|
|
||||||
trackedDownloadStatus={trackedDownloadStatus}
|
|
||||||
trackedDownloadState={trackedDownloadState}
|
|
||||||
statusMessages={statusMessages}
|
|
||||||
errorMessage={errorMessage}
|
|
||||||
position={tooltipPositions.RIGHT}
|
|
||||||
/>
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
QueueStatusCell.propTypes = {
|
|
||||||
sourceTitle: PropTypes.string.isRequired,
|
|
||||||
status: PropTypes.string.isRequired,
|
|
||||||
trackedDownloadStatus: PropTypes.string.isRequired,
|
|
||||||
trackedDownloadState: PropTypes.string.isRequired,
|
|
||||||
statusMessages: PropTypes.arrayOf(PropTypes.object),
|
|
||||||
errorMessage: PropTypes.string
|
|
||||||
};
|
|
||||||
|
|
||||||
QueueStatusCell.defaultProps = {
|
|
||||||
trackedDownloadStatus: 'ok',
|
|
||||||
trackedDownloadState: 'downloading'
|
|
||||||
};
|
|
||||||
|
|
||||||
export default QueueStatusCell;
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
|
import {
|
||||||
|
QueueTrackedDownloadState,
|
||||||
|
QueueTrackedDownloadStatus,
|
||||||
|
StatusMessage,
|
||||||
|
} from 'typings/Queue';
|
||||||
|
import QueueStatus from './QueueStatus';
|
||||||
|
import styles from './QueueStatusCell.css';
|
||||||
|
|
||||||
|
interface QueueStatusCellProps {
|
||||||
|
sourceTitle: string;
|
||||||
|
status: string;
|
||||||
|
trackedDownloadStatus?: QueueTrackedDownloadStatus;
|
||||||
|
trackedDownloadState?: QueueTrackedDownloadState;
|
||||||
|
statusMessages?: StatusMessage[];
|
||||||
|
errorMessage?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function QueueStatusCell(props: QueueStatusCellProps) {
|
||||||
|
const {
|
||||||
|
sourceTitle,
|
||||||
|
status,
|
||||||
|
trackedDownloadStatus = 'ok',
|
||||||
|
trackedDownloadState = 'downloading',
|
||||||
|
statusMessages,
|
||||||
|
errorMessage,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableRowCell className={styles.status}>
|
||||||
|
<QueueStatus
|
||||||
|
sourceTitle={sourceTitle}
|
||||||
|
status={status}
|
||||||
|
trackedDownloadStatus={trackedDownloadStatus}
|
||||||
|
trackedDownloadState={trackedDownloadState}
|
||||||
|
statusMessages={statusMessages}
|
||||||
|
errorMessage={errorMessage}
|
||||||
|
position="right"
|
||||||
|
/>
|
||||||
|
</TableRowCell>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default QueueStatusCell;
|
||||||
@@ -1,45 +1,39 @@
|
|||||||
import React, { useCallback, useMemo, useState } from 'react';
|
import React, { useCallback, useMemo } from 'react';
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
import FormLabel from 'Components/Form/FormLabel';
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
|
import { EnhancedSelectInputValue } from 'Components/Form/Select/EnhancedSelectInput';
|
||||||
import Button from 'Components/Link/Button';
|
import Button from 'Components/Link/Button';
|
||||||
import Modal from 'Components/Modal/Modal';
|
import Modal from 'Components/Modal/Modal';
|
||||||
import ModalBody from 'Components/Modal/ModalBody';
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
import ModalContent from 'Components/Modal/ModalContent';
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import { OptionChanged } from 'Helpers/Hooks/useOptionsStore';
|
||||||
import { inputTypes, kinds, sizes } from 'Helpers/Props';
|
import { inputTypes, kinds, sizes } from 'Helpers/Props';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
|
import {
|
||||||
|
QueueOptions,
|
||||||
|
setQueueOption,
|
||||||
|
useQueueOption,
|
||||||
|
} from './queueOptionsStore';
|
||||||
import styles from './RemoveQueueItemModal.css';
|
import styles from './RemoveQueueItemModal.css';
|
||||||
|
|
||||||
interface RemovePressProps {
|
|
||||||
remove: boolean;
|
|
||||||
changeCategory: boolean;
|
|
||||||
blocklist: boolean;
|
|
||||||
skipRedownload: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RemoveQueueItemModalProps {
|
interface RemoveQueueItemModalProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
sourceTitle: string;
|
sourceTitle?: string;
|
||||||
canChangeCategory: boolean;
|
canChangeCategory: boolean;
|
||||||
canIgnore: boolean;
|
canIgnore: boolean;
|
||||||
isPending: boolean;
|
isPending: boolean;
|
||||||
selectedCount?: number;
|
selectedCount?: number;
|
||||||
onRemovePress(props: RemovePressProps): void;
|
onRemovePress(): void;
|
||||||
onModalClose: () => void;
|
onModalClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
type RemovalMethod = 'removeFromClient' | 'changeCategory' | 'ignore';
|
|
||||||
type BlocklistMethod =
|
|
||||||
| 'doNotBlocklist'
|
|
||||||
| 'blocklistAndSearch'
|
|
||||||
| 'blocklistOnly';
|
|
||||||
|
|
||||||
function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
|
function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
|
||||||
const {
|
const {
|
||||||
isOpen,
|
isOpen,
|
||||||
sourceTitle,
|
sourceTitle = '',
|
||||||
canIgnore,
|
canIgnore,
|
||||||
canChangeCategory,
|
canChangeCategory,
|
||||||
isPending,
|
isPending,
|
||||||
@@ -49,11 +43,7 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
|
|||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const multipleSelected = selectedCount && selectedCount > 1;
|
const multipleSelected = selectedCount && selectedCount > 1;
|
||||||
|
const { removalMethod, blocklistMethod } = useQueueOption('removalOptions');
|
||||||
const [removalMethod, setRemovalMethod] =
|
|
||||||
useState<RemovalMethod>('removeFromClient');
|
|
||||||
const [blocklistMethod, setBlocklistMethod] =
|
|
||||||
useState<BlocklistMethod>('doNotBlocklist');
|
|
||||||
|
|
||||||
const { title, message } = useMemo(() => {
|
const { title, message } = useMemo(() => {
|
||||||
if (!selectedCount) {
|
if (!selectedCount) {
|
||||||
@@ -79,7 +69,7 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
|
|||||||
}, [sourceTitle, selectedCount]);
|
}, [sourceTitle, selectedCount]);
|
||||||
|
|
||||||
const removalMethodOptions = useMemo(() => {
|
const removalMethodOptions = useMemo(() => {
|
||||||
return [
|
const options: EnhancedSelectInputValue<string>[] = [
|
||||||
{
|
{
|
||||||
key: 'removeFromClient',
|
key: 'removeFromClient',
|
||||||
value: translate('RemoveFromDownloadClient'),
|
value: translate('RemoveFromDownloadClient'),
|
||||||
@@ -106,10 +96,12 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
|
|||||||
: translate('IgnoreDownloadHint'),
|
: translate('IgnoreDownloadHint'),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
return options;
|
||||||
}, [canChangeCategory, canIgnore, multipleSelected]);
|
}, [canChangeCategory, canIgnore, multipleSelected]);
|
||||||
|
|
||||||
const blocklistMethodOptions = useMemo(() => {
|
const blocklistMethodOptions = useMemo(() => {
|
||||||
return [
|
const options: EnhancedSelectInputValue<string>[] = [
|
||||||
{
|
{
|
||||||
key: 'doNotBlocklist',
|
key: 'doNotBlocklist',
|
||||||
value: translate('DoNotBlocklist'),
|
value: translate('DoNotBlocklist'),
|
||||||
@@ -118,6 +110,7 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
|
|||||||
{
|
{
|
||||||
key: 'blocklistAndSearch',
|
key: 'blocklistAndSearch',
|
||||||
value: translate('BlocklistAndSearch'),
|
value: translate('BlocklistAndSearch'),
|
||||||
|
isDisabled: isPending,
|
||||||
hint: multipleSelected
|
hint: multipleSelected
|
||||||
? translate('BlocklistAndSearchMultipleHint')
|
? translate('BlocklistAndSearchMultipleHint')
|
||||||
: translate('BlocklistAndSearchHint'),
|
: translate('BlocklistAndSearchHint'),
|
||||||
@@ -130,46 +123,28 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
|
|||||||
: translate('BlocklistOnlyHint'),
|
: translate('BlocklistOnlyHint'),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}, [multipleSelected]);
|
|
||||||
|
|
||||||
const handleRemovalMethodChange = useCallback(
|
return options;
|
||||||
({ value }: { value: RemovalMethod }) => {
|
}, [isPending, multipleSelected]);
|
||||||
setRemovalMethod(value);
|
|
||||||
},
|
|
||||||
[setRemovalMethod]
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleBlocklistMethodChange = useCallback(
|
const handleRemovalOptionInputChange = useCallback(
|
||||||
({ value }: { value: BlocklistMethod }) => {
|
({ name, value }: OptionChanged<QueueOptions['removalOptions']>) => {
|
||||||
setBlocklistMethod(value);
|
setQueueOption('removalOptions', {
|
||||||
|
removalMethod,
|
||||||
|
blocklistMethod,
|
||||||
|
[name]: value,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
[setBlocklistMethod]
|
[removalMethod, blocklistMethod]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleConfirmRemove = useCallback(() => {
|
const handleConfirmRemove = useCallback(() => {
|
||||||
onRemovePress({
|
onRemovePress();
|
||||||
remove: removalMethod === 'removeFromClient',
|
}, [onRemovePress]);
|
||||||
changeCategory: removalMethod === 'changeCategory',
|
|
||||||
blocklist: blocklistMethod !== 'doNotBlocklist',
|
|
||||||
skipRedownload: blocklistMethod === 'blocklistOnly',
|
|
||||||
});
|
|
||||||
|
|
||||||
setRemovalMethod('removeFromClient');
|
|
||||||
setBlocklistMethod('doNotBlocklist');
|
|
||||||
}, [
|
|
||||||
removalMethod,
|
|
||||||
blocklistMethod,
|
|
||||||
setRemovalMethod,
|
|
||||||
setBlocklistMethod,
|
|
||||||
onRemovePress,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const handleModalClose = useCallback(() => {
|
const handleModalClose = useCallback(() => {
|
||||||
setRemovalMethod('removeFromClient');
|
|
||||||
setBlocklistMethod('doNotBlocklist');
|
|
||||||
|
|
||||||
onModalClose();
|
onModalClose();
|
||||||
}, [setRemovalMethod, setBlocklistMethod, onModalClose]);
|
}, [onModalClose]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal isOpen={isOpen} size={sizes.MEDIUM} onModalClose={handleModalClose}>
|
<Modal isOpen={isOpen} size={sizes.MEDIUM} onModalClose={handleModalClose}>
|
||||||
@@ -192,7 +167,8 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
|
|||||||
helpTextWarning={translate(
|
helpTextWarning={translate(
|
||||||
'RemoveQueueItemRemovalMethodHelpTextWarning'
|
'RemoveQueueItemRemovalMethodHelpTextWarning'
|
||||||
)}
|
)}
|
||||||
onChange={handleRemovalMethodChange}
|
// @ts-expect-error - The typing for inputs needs more work
|
||||||
|
onChange={handleRemovalOptionInputChange}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
@@ -210,7 +186,8 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
|
|||||||
value={blocklistMethod}
|
value={blocklistMethod}
|
||||||
values={blocklistMethodOptions}
|
values={blocklistMethodOptions}
|
||||||
helpText={translate('BlocklistReleaseHelpText')}
|
helpText={translate('BlocklistReleaseHelpText')}
|
||||||
onChange={handleBlocklistMethodChange}
|
// @ts-expect-error - The typing for inputs needs more work
|
||||||
|
onChange={handleRemovalOptionInputChange}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PageSidebarStatus from 'Components/Page/Sidebar/PageSidebarStatus';
|
||||||
|
import useQueueStatus from './useQueueStatus';
|
||||||
|
|
||||||
|
function QueueStatus() {
|
||||||
|
const { errors, warnings, count } = useQueueStatus();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageSidebarStatus count={count} errors={errors} warnings={warnings} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default QueueStatus;
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import PageSidebarStatus from 'Components/Page/Sidebar/PageSidebarStatus';
|
|
||||||
import { fetchQueueStatus } from 'Store/Actions/queueActions';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.app,
|
|
||||||
(state) => state.queue.status,
|
|
||||||
(state) => state.queue.options.includeUnknownSeriesItems,
|
|
||||||
(app, status, includeUnknownSeriesItems) => {
|
|
||||||
const {
|
|
||||||
errors,
|
|
||||||
warnings,
|
|
||||||
unknownErrors,
|
|
||||||
unknownWarnings,
|
|
||||||
count,
|
|
||||||
totalCount
|
|
||||||
} = status.item;
|
|
||||||
|
|
||||||
return {
|
|
||||||
isConnected: app.isConnected,
|
|
||||||
isReconnecting: app.isReconnecting,
|
|
||||||
isPopulated: status.isPopulated,
|
|
||||||
...status.item,
|
|
||||||
count: includeUnknownSeriesItems ? totalCount : count,
|
|
||||||
errors: includeUnknownSeriesItems ? errors || unknownErrors : errors,
|
|
||||||
warnings: includeUnknownSeriesItems ? warnings || unknownWarnings : warnings
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
fetchQueueStatus
|
|
||||||
};
|
|
||||||
|
|
||||||
class QueueStatusConnector extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
if (!this.props.isPopulated) {
|
|
||||||
this.props.fetchQueueStatus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
if (this.props.isConnected && prevProps.isReconnecting) {
|
|
||||||
this.props.fetchQueueStatus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<PageSidebarStatus
|
|
||||||
{...this.props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QueueStatusConnector.propTypes = {
|
|
||||||
isConnected: PropTypes.bool.isRequired,
|
|
||||||
isReconnecting: PropTypes.bool.isRequired,
|
|
||||||
isPopulated: PropTypes.bool.isRequired,
|
|
||||||
fetchQueueStatus: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(QueueStatusConnector);
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import useApiQuery from 'Helpers/Hooks/useApiQuery';
|
||||||
|
import { useQueueOption } from '../queueOptionsStore';
|
||||||
|
|
||||||
|
export interface QueueStatus {
|
||||||
|
totalCount: number;
|
||||||
|
count: number;
|
||||||
|
unknownCount: number;
|
||||||
|
errors: boolean;
|
||||||
|
warnings: boolean;
|
||||||
|
unknownErrors: boolean;
|
||||||
|
unknownWarnings: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function useQueueStatus() {
|
||||||
|
const includeUnknownSeriesItems = useQueueOption('includeUnknownSeriesItems');
|
||||||
|
|
||||||
|
const { data } = useApiQuery<QueueStatus>({
|
||||||
|
path: '/queue/status',
|
||||||
|
queryParams: {
|
||||||
|
includeUnknownSeriesItems,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
return {
|
||||||
|
count: 0,
|
||||||
|
errors: false,
|
||||||
|
warnings: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
errors,
|
||||||
|
warnings,
|
||||||
|
unknownErrors,
|
||||||
|
unknownWarnings,
|
||||||
|
count,
|
||||||
|
totalCount,
|
||||||
|
} = data;
|
||||||
|
|
||||||
|
if (includeUnknownSeriesItems) {
|
||||||
|
return {
|
||||||
|
count: totalCount,
|
||||||
|
errors: errors || unknownErrors,
|
||||||
|
warnings: warnings || unknownWarnings,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
count,
|
||||||
|
errors,
|
||||||
|
warnings,
|
||||||
|
};
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
.timeleft {
|
.timeLeft {
|
||||||
composes: cell from '~Components/Table/Cells/TableRowCell.css';
|
composes: cell from '~Components/Table/Cells/TableRowCell.css';
|
||||||
|
|
||||||
width: 100px;
|
width: 100px;
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
// This file is automatically generated.
|
// This file is automatically generated.
|
||||||
// Please do not change this file!
|
// Please do not change this file!
|
||||||
interface CssExports {
|
interface CssExports {
|
||||||
'timeleft': string;
|
'timeLeft': string;
|
||||||
}
|
}
|
||||||
export const cssExports: CssExports;
|
export const cssExports: CssExports;
|
||||||
export default cssExports;
|
export default cssExports;
|
||||||
+32
-33
@@ -1,4 +1,3 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Icon from 'Components/Icon';
|
import Icon from 'Components/Icon';
|
||||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
@@ -9,30 +8,43 @@ import formatTimeSpan from 'Utilities/Date/formatTimeSpan';
|
|||||||
import getRelativeDate from 'Utilities/Date/getRelativeDate';
|
import getRelativeDate from 'Utilities/Date/getRelativeDate';
|
||||||
import formatBytes from 'Utilities/Number/formatBytes';
|
import formatBytes from 'Utilities/Number/formatBytes';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import styles from './TimeleftCell.css';
|
import styles from './TimeLeftCell.css';
|
||||||
|
|
||||||
function TimeleftCell(props) {
|
interface TimeLeftCellProps {
|
||||||
|
estimatedCompletionTime?: string;
|
||||||
|
timeLeft?: string;
|
||||||
|
status: string;
|
||||||
|
size: number;
|
||||||
|
sizeLeft: number;
|
||||||
|
showRelativeDates: boolean;
|
||||||
|
shortDateFormat: string;
|
||||||
|
timeFormat: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function TimeLeftCell(props: TimeLeftCellProps) {
|
||||||
const {
|
const {
|
||||||
estimatedCompletionTime,
|
estimatedCompletionTime,
|
||||||
timeleft,
|
timeLeft,
|
||||||
status,
|
status,
|
||||||
size,
|
size,
|
||||||
sizeleft,
|
sizeLeft,
|
||||||
showRelativeDates,
|
showRelativeDates,
|
||||||
shortDateFormat,
|
shortDateFormat,
|
||||||
timeFormat
|
timeFormat,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
if (status === 'delay') {
|
if (status === 'delay') {
|
||||||
const date = getRelativeDate({
|
const date = getRelativeDate({
|
||||||
date: estimatedCompletionTime,
|
date: estimatedCompletionTime,
|
||||||
shortDateFormat,
|
shortDateFormat,
|
||||||
showRelativeDates
|
showRelativeDates,
|
||||||
|
});
|
||||||
|
const time = formatTime(estimatedCompletionTime, timeFormat, {
|
||||||
|
includeMinuteZero: true,
|
||||||
});
|
});
|
||||||
const time = formatTime(estimatedCompletionTime, timeFormat, { includeMinuteZero: true });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRowCell className={styles.timeleft}>
|
<TableRowCell className={styles.timeLeft}>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
anchor={<Icon name={icons.INFO} />}
|
anchor={<Icon name={icons.INFO} />}
|
||||||
tooltip={translate('DelayingDownloadUntil', { date, time })}
|
tooltip={translate('DelayingDownloadUntil', { date, time })}
|
||||||
@@ -47,12 +59,14 @@ function TimeleftCell(props) {
|
|||||||
const date = getRelativeDate({
|
const date = getRelativeDate({
|
||||||
date: estimatedCompletionTime,
|
date: estimatedCompletionTime,
|
||||||
shortDateFormat,
|
shortDateFormat,
|
||||||
showRelativeDates
|
showRelativeDates,
|
||||||
|
});
|
||||||
|
const time = formatTime(estimatedCompletionTime, timeFormat, {
|
||||||
|
includeMinuteZero: true,
|
||||||
});
|
});
|
||||||
const time = formatTime(estimatedCompletionTime, timeFormat, { includeMinuteZero: true });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRowCell className={styles.timeleft}>
|
<TableRowCell className={styles.timeLeft}>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
anchor={<Icon name={icons.INFO} />}
|
anchor={<Icon name={icons.INFO} />}
|
||||||
tooltip={translate('RetryingDownloadOn', { date, time })}
|
tooltip={translate('RetryingDownloadOn', { date, time })}
|
||||||
@@ -63,36 +77,21 @@ function TimeleftCell(props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!timeleft || status === 'completed' || status === 'failed') {
|
if (!timeLeft || status === 'completed' || status === 'failed') {
|
||||||
return (
|
return <TableRowCell className={styles.timeLeft}>-</TableRowCell>;
|
||||||
<TableRowCell className={styles.timeleft}>
|
|
||||||
-
|
|
||||||
</TableRowCell>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const totalSize = formatBytes(size);
|
const totalSize = formatBytes(size);
|
||||||
const remainingSize = formatBytes(sizeleft);
|
const remainingSize = formatBytes(sizeLeft);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRowCell
|
<TableRowCell
|
||||||
className={styles.timeleft}
|
className={styles.timeLeft}
|
||||||
title={`${remainingSize} / ${totalSize}`}
|
title={`${remainingSize} / ${totalSize}`}
|
||||||
>
|
>
|
||||||
{formatTimeSpan(timeleft)}
|
{formatTimeSpan(timeLeft)}
|
||||||
</TableRowCell>
|
</TableRowCell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeleftCell.propTypes = {
|
export default TimeLeftCell;
|
||||||
estimatedCompletionTime: PropTypes.string,
|
|
||||||
timeleft: PropTypes.string,
|
|
||||||
status: PropTypes.string.isRequired,
|
|
||||||
size: PropTypes.number.isRequired,
|
|
||||||
sizeleft: PropTypes.number.isRequired,
|
|
||||||
showRelativeDates: PropTypes.bool.isRequired,
|
|
||||||
shortDateFormat: PropTypes.string.isRequired,
|
|
||||||
timeFormat: PropTypes.string.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default TimeleftCell;
|
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Icon from 'Components/Icon';
|
||||||
|
import {
|
||||||
|
createOptionsStore,
|
||||||
|
PageableOptions,
|
||||||
|
} from 'Helpers/Hooks/useOptionsStore';
|
||||||
|
import { icons } from 'Helpers/Props';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
|
interface QueueRemovalOptions {
|
||||||
|
removalMethod: 'changeCategory' | 'ignore' | 'removeFromClient';
|
||||||
|
blocklistMethod: 'blocklistAndSearch' | 'blocklistOnly' | 'doNotBlocklist';
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QueueOptions extends PageableOptions {
|
||||||
|
includeUnknownSeriesItems: boolean;
|
||||||
|
removalOptions: QueueRemovalOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { useOptions, useOption, setOptions, setOption } =
|
||||||
|
createOptionsStore<QueueOptions>('queue_options', () => {
|
||||||
|
return {
|
||||||
|
includeUnknownSeriesItems: true,
|
||||||
|
pageSize: 20,
|
||||||
|
selectedFilterKey: 'all',
|
||||||
|
sortKey: 'time',
|
||||||
|
sortDirection: 'descending',
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
name: 'status',
|
||||||
|
label: '',
|
||||||
|
columnLabel: () => translate('Status'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
isModifiable: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'series.sortTitle',
|
||||||
|
label: () => translate('Series'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'episode',
|
||||||
|
label: () => translate('EpisodeMaybePlural'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'episodes.title',
|
||||||
|
label: () => translate('EpisodeTitleMaybePlural'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'episodes.airDateUtc',
|
||||||
|
label: () => translate('EpisodeAirDate'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'languages',
|
||||||
|
label: () => translate('Languages'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'quality',
|
||||||
|
label: () => translate('Quality'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'customFormats',
|
||||||
|
label: () => translate('Formats'),
|
||||||
|
isSortable: false,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'customFormatScore',
|
||||||
|
columnLabel: () => translate('CustomFormatScore'),
|
||||||
|
label: React.createElement(Icon, {
|
||||||
|
name: icons.SCORE,
|
||||||
|
title: () => translate('CustomFormatScore'),
|
||||||
|
}),
|
||||||
|
isVisible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'protocol',
|
||||||
|
label: () => translate('Protocol'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'indexer',
|
||||||
|
label: () => translate('Indexer'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'downloadClient',
|
||||||
|
label: () => translate('DownloadClient'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'title',
|
||||||
|
label: () => translate('ReleaseTitle'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'size',
|
||||||
|
label: () => translate('Size'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'outputPath',
|
||||||
|
label: () => translate('OutputPath'),
|
||||||
|
isSortable: false,
|
||||||
|
isVisible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'estimatedCompletionTime',
|
||||||
|
label: () => translate('TimeLeft'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'added',
|
||||||
|
label: () => translate('Added'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'progress',
|
||||||
|
label: () => translate('Progress'),
|
||||||
|
isSortable: true,
|
||||||
|
isVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'actions',
|
||||||
|
label: '',
|
||||||
|
columnLabel: () => translate('Actions'),
|
||||||
|
isVisible: true,
|
||||||
|
isModifiable: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
removalOptions: {
|
||||||
|
removalMethod: 'removeFromClient',
|
||||||
|
blocklistMethod: 'doNotBlocklist',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
export const useQueueOptions = useOptions;
|
||||||
|
export const setQueueOptions = setOptions;
|
||||||
|
export const useQueueOption = useOption;
|
||||||
|
export const setQueueOption = setOption;
|
||||||
@@ -0,0 +1,203 @@
|
|||||||
|
import { keepPreviousData, useQueryClient } from '@tanstack/react-query';
|
||||||
|
import { useMemo, useState } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import { CustomFilter, Filter, FilterBuilderProp } from 'App/State/AppState';
|
||||||
|
import useApiMutation from 'Helpers/Hooks/useApiMutation';
|
||||||
|
import usePage from 'Helpers/Hooks/usePage';
|
||||||
|
import usePagedApiQuery from 'Helpers/Hooks/usePagedApiQuery';
|
||||||
|
import { filterBuilderValueTypes } from 'Helpers/Props';
|
||||||
|
import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector';
|
||||||
|
import Queue from 'typings/Queue';
|
||||||
|
import getQueryString from 'Utilities/Fetch/getQueryString';
|
||||||
|
import findSelectedFilters from 'Utilities/Filter/findSelectedFilters';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import { useQueueOptions } from './queueOptionsStore';
|
||||||
|
|
||||||
|
interface BulkQueueData {
|
||||||
|
ids: number[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FILTERS: Filter[] = [
|
||||||
|
{
|
||||||
|
key: 'all',
|
||||||
|
label: () => translate('All'),
|
||||||
|
filters: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const FILTER_BUILDER: FilterBuilderProp<Queue>[] = [
|
||||||
|
{
|
||||||
|
name: 'seriesIds',
|
||||||
|
label: () => translate('Series'),
|
||||||
|
type: 'equal',
|
||||||
|
valueType: filterBuilderValueTypes.SERIES,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'quality',
|
||||||
|
label: () => translate('Quality'),
|
||||||
|
type: 'equal',
|
||||||
|
valueType: filterBuilderValueTypes.QUALITY,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'languages',
|
||||||
|
label: () => translate('Languages'),
|
||||||
|
type: 'contains',
|
||||||
|
valueType: filterBuilderValueTypes.LANGUAGE,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'protocol',
|
||||||
|
label: () => translate('Protocol'),
|
||||||
|
type: 'equal',
|
||||||
|
valueType: filterBuilderValueTypes.PROTOCOL,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'status',
|
||||||
|
label: () => translate('Status'),
|
||||||
|
type: 'equal',
|
||||||
|
valueType: filterBuilderValueTypes.QUEUE_STATUS,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const useQueue = () => {
|
||||||
|
const { page, goToPage } = usePage('queue');
|
||||||
|
const {
|
||||||
|
includeUnknownSeriesItems,
|
||||||
|
pageSize,
|
||||||
|
selectedFilterKey,
|
||||||
|
sortKey,
|
||||||
|
sortDirection,
|
||||||
|
} = useQueueOptions();
|
||||||
|
const customFilters = useSelector(
|
||||||
|
createCustomFiltersSelector('queue')
|
||||||
|
) as CustomFilter[];
|
||||||
|
|
||||||
|
const filters = useMemo(() => {
|
||||||
|
return findSelectedFilters(selectedFilterKey, FILTERS, customFilters);
|
||||||
|
}, [selectedFilterKey, customFilters]);
|
||||||
|
|
||||||
|
const { refetch, ...query } = usePagedApiQuery<Queue>({
|
||||||
|
path: '/queue',
|
||||||
|
page,
|
||||||
|
pageSize,
|
||||||
|
filters,
|
||||||
|
queryParams: {
|
||||||
|
includeUnknownSeriesItems,
|
||||||
|
},
|
||||||
|
sortKey,
|
||||||
|
sortDirection,
|
||||||
|
queryOptions: {
|
||||||
|
placeholderData: keepPreviousData,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
...query,
|
||||||
|
goToPage,
|
||||||
|
page,
|
||||||
|
refetch,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useQueue;
|
||||||
|
|
||||||
|
export const useFilters = () => {
|
||||||
|
return FILTERS;
|
||||||
|
};
|
||||||
|
|
||||||
|
const useRemovalOptions = () => {
|
||||||
|
const { removalOptions } = useQueueOptions();
|
||||||
|
|
||||||
|
return {
|
||||||
|
remove: removalOptions.removalMethod === 'removeFromClient',
|
||||||
|
changeCategory: removalOptions.removalMethod === 'changeCategory',
|
||||||
|
blocklist: removalOptions.blocklistMethod !== 'doNotBlocklist',
|
||||||
|
skipRedownload: removalOptions.blocklistMethod === 'blocklistOnly',
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useRemoveQueueItem = (id: number) => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
const removalOptions = useRemovalOptions();
|
||||||
|
|
||||||
|
const { mutate, isPending } = useApiMutation<unknown, void>({
|
||||||
|
path: `/queue/${id}${getQueryString(removalOptions)}`,
|
||||||
|
method: 'DELETE',
|
||||||
|
mutationOptions: {
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: ['/queue'] });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
removeQueueItem: mutate,
|
||||||
|
isRemoving: isPending,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useRemoveQueueItems = () => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
const removalOptions = useRemovalOptions();
|
||||||
|
|
||||||
|
const { mutate, isPending } = useApiMutation<unknown, BulkQueueData>({
|
||||||
|
path: `/queue/bulk${getQueryString(removalOptions)}`,
|
||||||
|
method: 'DELETE',
|
||||||
|
mutationOptions: {
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: ['/queue'] });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
removeQueueItems: mutate,
|
||||||
|
isRemoving: isPending,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useGrabQueueItem = (id: number) => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
const [grabError, setGrabError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const { mutate, isPending } = useApiMutation<unknown, void>({
|
||||||
|
path: `/queue/grab/${id}`,
|
||||||
|
method: 'POST',
|
||||||
|
mutationOptions: {
|
||||||
|
onMutate: () => {
|
||||||
|
setGrabError(null);
|
||||||
|
},
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: ['/queue'] });
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
setGrabError('Error grabbing queue item');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
grabQueueItem: mutate,
|
||||||
|
isGrabbing: isPending,
|
||||||
|
grabError,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useGrabQueueItems = () => {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
// Explicitly define the types for the mutation so we can pass in no arguments to mutate as expected.
|
||||||
|
const { mutate, isPending } = useApiMutation<unknown, BulkQueueData>({
|
||||||
|
path: '/queue/grab/bulk',
|
||||||
|
method: 'POST',
|
||||||
|
mutationOptions: {
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.invalidateQueries({ queryKey: ['/queue'] });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
grabQueueItems: mutate,
|
||||||
|
isGrabbing: isPending,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import TextInput from 'Components/Form/TextInput';
|
|
||||||
import Icon from 'Components/Icon';
|
|
||||||
import Button from 'Components/Link/Button';
|
|
||||||
import Link from 'Components/Link/Link';
|
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
|
||||||
import PageContent from 'Components/Page/PageContent';
|
|
||||||
import PageContentBody from 'Components/Page/PageContentBody';
|
|
||||||
import { icons, kinds } from 'Helpers/Props';
|
|
||||||
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import AddNewSeriesSearchResultConnector from './AddNewSeriesSearchResultConnector';
|
|
||||||
import styles from './AddNewSeries.css';
|
|
||||||
|
|
||||||
class AddNewSeries extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
term: props.term || '',
|
|
||||||
isFetching: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
const term = this.state.term;
|
|
||||||
|
|
||||||
if (term) {
|
|
||||||
this.props.onSeriesLookupChange(term);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
const {
|
|
||||||
term,
|
|
||||||
isFetching
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
if (term && term !== prevProps.term) {
|
|
||||||
this.setState({
|
|
||||||
term,
|
|
||||||
isFetching: true
|
|
||||||
});
|
|
||||||
this.props.onSeriesLookupChange(term);
|
|
||||||
} else if (isFetching !== prevProps.isFetching) {
|
|
||||||
this.setState({
|
|
||||||
isFetching
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onSearchInputChange = ({ value }) => {
|
|
||||||
const hasValue = !!value.trim();
|
|
||||||
|
|
||||||
this.setState({ term: value, isFetching: hasValue }, () => {
|
|
||||||
if (hasValue) {
|
|
||||||
this.props.onSeriesLookupChange(value);
|
|
||||||
} else {
|
|
||||||
this.props.onClearSeriesLookup();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onClearSeriesLookupPress = () => {
|
|
||||||
this.setState({ term: '' });
|
|
||||||
this.props.onClearSeriesLookup();
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
error,
|
|
||||||
items,
|
|
||||||
hasExistingSeries
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const term = this.state.term;
|
|
||||||
const isFetching = this.state.isFetching;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageContent title={translate('AddNewSeries')}>
|
|
||||||
<PageContentBody>
|
|
||||||
<div className={styles.searchContainer}>
|
|
||||||
<div className={styles.searchIconContainer}>
|
|
||||||
<Icon
|
|
||||||
name={icons.SEARCH}
|
|
||||||
size={20}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<TextInput
|
|
||||||
className={styles.searchInput}
|
|
||||||
name="seriesLookup"
|
|
||||||
value={term}
|
|
||||||
placeholder="eg. Breaking Bad, tvdb:####"
|
|
||||||
autoFocus={true}
|
|
||||||
onChange={this.onSearchInputChange}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
className={styles.clearLookupButton}
|
|
||||||
onPress={this.onClearSeriesLookupPress}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
name={icons.REMOVE}
|
|
||||||
size={20}
|
|
||||||
/>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{
|
|
||||||
isFetching &&
|
|
||||||
<LoadingIndicator />
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!isFetching && !!error ?
|
|
||||||
<div className={styles.message}>
|
|
||||||
<div className={styles.helpText}>
|
|
||||||
{translate('AddNewSeriesError')}
|
|
||||||
</div>
|
|
||||||
<div>{getErrorMessage(error)}</div>
|
|
||||||
</div> : null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!isFetching && !error && !!items.length &&
|
|
||||||
<div className={styles.searchResults}>
|
|
||||||
{
|
|
||||||
items.map((item) => {
|
|
||||||
return (
|
|
||||||
<AddNewSeriesSearchResultConnector
|
|
||||||
key={item.tvdbId}
|
|
||||||
{...item}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!isFetching && !error && !items.length && !!term &&
|
|
||||||
<div className={styles.message}>
|
|
||||||
<div className={styles.noResults}>{translate('CouldNotFindResults', { term })}</div>
|
|
||||||
<div>{translate('SearchByTvdbId')}</div>
|
|
||||||
<div>
|
|
||||||
<Link to="https://wiki.servarr.com/sonarr/faq#why-cant-i-add-a-new-series-when-i-know-the-tvdb-id">
|
|
||||||
{translate('WhyCantIFindMyShow')}
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
term ?
|
|
||||||
null :
|
|
||||||
<div className={styles.message}>
|
|
||||||
<div className={styles.helpText}>
|
|
||||||
{translate('AddNewSeriesHelpText')}
|
|
||||||
</div>
|
|
||||||
<div>{translate('SearchByTvdbId')}</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!term && !hasExistingSeries ?
|
|
||||||
<div className={styles.message}>
|
|
||||||
<div className={styles.noSeriesText}>
|
|
||||||
{translate('NoSeriesHaveBeenAdded')}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<Button
|
|
||||||
to="/add/import"
|
|
||||||
kind={kinds.PRIMARY}
|
|
||||||
>
|
|
||||||
{translate('ImportExistingSeries')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
<div />
|
|
||||||
</PageContentBody>
|
|
||||||
</PageContent>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AddNewSeries.propTypes = {
|
|
||||||
term: PropTypes.string,
|
|
||||||
isFetching: PropTypes.bool.isRequired,
|
|
||||||
error: PropTypes.object,
|
|
||||||
isAdding: PropTypes.bool.isRequired,
|
|
||||||
addError: PropTypes.object,
|
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
hasExistingSeries: PropTypes.bool.isRequired,
|
|
||||||
onSeriesLookupChange: PropTypes.func.isRequired,
|
|
||||||
onClearSeriesLookup: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AddNewSeries;
|
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
|
import TextInput from 'Components/Form/TextInput';
|
||||||
|
import Icon from 'Components/Icon';
|
||||||
|
import Button from 'Components/Link/Button';
|
||||||
|
import Link from 'Components/Link/Link';
|
||||||
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
|
import PageContent from 'Components/Page/PageContent';
|
||||||
|
import PageContentBody from 'Components/Page/PageContentBody';
|
||||||
|
import useDebounce from 'Helpers/Hooks/useDebounce';
|
||||||
|
import useQueryParams from 'Helpers/Hooks/useQueryParams';
|
||||||
|
import { icons, kinds } from 'Helpers/Props';
|
||||||
|
import { InputChanged } from 'typings/inputs';
|
||||||
|
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import AddNewSeriesSearchResult from './AddNewSeriesSearchResult';
|
||||||
|
import { useLookupSeries } from './useAddSeries';
|
||||||
|
import styles from './AddNewSeries.css';
|
||||||
|
|
||||||
|
function AddNewSeries() {
|
||||||
|
const { term: initialTerm = '' } = useQueryParams<{ term: string }>();
|
||||||
|
|
||||||
|
const seriesCount = useSelector(
|
||||||
|
(state: AppState) => state.series.items.length
|
||||||
|
);
|
||||||
|
|
||||||
|
const [term, setTerm] = useState(initialTerm);
|
||||||
|
const [isFetching, setIsFetching] = useState(false);
|
||||||
|
const query = useDebounce(term, term ? 300 : 0);
|
||||||
|
|
||||||
|
const handleSearchInputChange = useCallback(
|
||||||
|
({ value }: InputChanged<string>) => {
|
||||||
|
setTerm(value);
|
||||||
|
setIsFetching(!!value.trim());
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleClearSeriesLookupPress = useCallback(() => {
|
||||||
|
setTerm('');
|
||||||
|
setIsFetching(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const {
|
||||||
|
isFetching: isFetchingApi,
|
||||||
|
error,
|
||||||
|
data = [],
|
||||||
|
} = useLookupSeries(query);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setIsFetching(isFetchingApi);
|
||||||
|
}, [isFetchingApi]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setTerm(initialTerm);
|
||||||
|
}, [initialTerm]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageContent title={translate('AddNewSeries')}>
|
||||||
|
<PageContentBody>
|
||||||
|
<div className={styles.searchContainer}>
|
||||||
|
<div className={styles.searchIconContainer}>
|
||||||
|
<Icon name={icons.SEARCH} size={20} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<TextInput
|
||||||
|
className={styles.searchInput}
|
||||||
|
name="seriesLookup"
|
||||||
|
value={term}
|
||||||
|
placeholder="eg. Breaking Bad, tvdb:####"
|
||||||
|
autoFocus={true}
|
||||||
|
onChange={handleSearchInputChange}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
className={styles.clearLookupButton}
|
||||||
|
onPress={handleClearSeriesLookupPress}
|
||||||
|
>
|
||||||
|
<Icon name={icons.REMOVE} size={20} />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{isFetching ? <LoadingIndicator /> : null}
|
||||||
|
|
||||||
|
{!isFetching && !!error ? (
|
||||||
|
<div className={styles.message}>
|
||||||
|
<div className={styles.helpText}>
|
||||||
|
{translate('AddNewSeriesError')}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Alert kind={kinds.DANGER}>{getErrorMessage(error)}</Alert>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{!isFetching && !error && !!data.length ? (
|
||||||
|
<div className={styles.searchResults}>
|
||||||
|
{data.map((item) => {
|
||||||
|
return (
|
||||||
|
<AddNewSeriesSearchResult key={item.tvdbId} series={item} />
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{!isFetching && !error && !data.length && term ? (
|
||||||
|
<div className={styles.message}>
|
||||||
|
<div className={styles.noResults}>
|
||||||
|
{translate('CouldNotFindResults', { term })}
|
||||||
|
</div>
|
||||||
|
<div>{translate('SearchByTvdbId')}</div>
|
||||||
|
<div>
|
||||||
|
<Link to="https://wiki.servarr.com/sonarr/faq#why-cant-i-add-a-new-series-when-i-know-the-tvdb-id">
|
||||||
|
{translate('WhyCantIFindMyShow')}
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{term ? null : (
|
||||||
|
<div className={styles.message}>
|
||||||
|
<div className={styles.helpText}>
|
||||||
|
{translate('AddNewSeriesHelpText')}
|
||||||
|
</div>
|
||||||
|
<div>{translate('SearchByTvdbId')}</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!term && !seriesCount ? (
|
||||||
|
<div className={styles.message}>
|
||||||
|
<div className={styles.noSeriesText}>
|
||||||
|
{translate('NoSeriesHaveBeenAdded')}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Button to="/add/import" kind={kinds.PRIMARY}>
|
||||||
|
{translate('ImportExistingSeries')}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<div />
|
||||||
|
</PageContentBody>
|
||||||
|
</PageContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AddNewSeries;
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import { clearAddSeries, lookupSeries } from 'Store/Actions/addSeriesActions';
|
|
||||||
import { fetchRootFolders } from 'Store/Actions/rootFolderActions';
|
|
||||||
import parseUrl from 'Utilities/String/parseUrl';
|
|
||||||
import AddNewSeries from './AddNewSeries';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.addSeries,
|
|
||||||
(state) => state.series.items.length,
|
|
||||||
(state) => state.router.location,
|
|
||||||
(addSeries, existingSeriesCount, location) => {
|
|
||||||
const { params } = parseUrl(location.search);
|
|
||||||
|
|
||||||
return {
|
|
||||||
...addSeries,
|
|
||||||
term: params.term,
|
|
||||||
hasExistingSeries: existingSeriesCount > 0
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
lookupSeries,
|
|
||||||
clearAddSeries,
|
|
||||||
fetchRootFolders
|
|
||||||
};
|
|
||||||
|
|
||||||
class AddNewSeriesConnector extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this._seriesLookupTimeout = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
this.props.fetchRootFolders();
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
if (this._seriesLookupTimeout) {
|
|
||||||
clearTimeout(this._seriesLookupTimeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.props.clearAddSeries();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onSeriesLookupChange = (term) => {
|
|
||||||
if (this._seriesLookupTimeout) {
|
|
||||||
clearTimeout(this._seriesLookupTimeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (term.trim() === '') {
|
|
||||||
this.props.clearAddSeries();
|
|
||||||
} else {
|
|
||||||
this._seriesLookupTimeout = setTimeout(() => {
|
|
||||||
this.props.lookupSeries({ term });
|
|
||||||
}, 300);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
onClearSeriesLookup = () => {
|
|
||||||
this.props.clearAddSeries();
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
term,
|
|
||||||
...otherProps
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<AddNewSeries
|
|
||||||
term={term}
|
|
||||||
{...otherProps}
|
|
||||||
onSeriesLookupChange={this.onSeriesLookupChange}
|
|
||||||
onClearSeriesLookup={this.onClearSeriesLookup}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AddNewSeriesConnector.propTypes = {
|
|
||||||
term: PropTypes.string,
|
|
||||||
lookupSeries: PropTypes.func.isRequired,
|
|
||||||
clearAddSeries: PropTypes.func.isRequired,
|
|
||||||
fetchRootFolders: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(AddNewSeriesConnector);
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import Modal from 'Components/Modal/Modal';
|
|
||||||
import AddNewSeriesModalContentConnector from './AddNewSeriesModalContentConnector';
|
|
||||||
|
|
||||||
function AddNewSeriesModal(props) {
|
|
||||||
const {
|
|
||||||
isOpen,
|
|
||||||
onModalClose,
|
|
||||||
...otherProps
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
isOpen={isOpen}
|
|
||||||
onModalClose={onModalClose}
|
|
||||||
>
|
|
||||||
<AddNewSeriesModalContentConnector
|
|
||||||
{...otherProps}
|
|
||||||
onModalClose={onModalClose}
|
|
||||||
/>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
AddNewSeriesModal.propTypes = {
|
|
||||||
isOpen: PropTypes.bool.isRequired,
|
|
||||||
onModalClose: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AddNewSeriesModal;
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Modal from 'Components/Modal/Modal';
|
||||||
|
import AddNewSeriesModalContent, {
|
||||||
|
AddNewSeriesModalContentProps,
|
||||||
|
} from './AddNewSeriesModalContent';
|
||||||
|
|
||||||
|
interface AddNewSeriesModalProps extends AddNewSeriesModalContentProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddNewSeriesModal({
|
||||||
|
isOpen,
|
||||||
|
onModalClose,
|
||||||
|
...otherProps
|
||||||
|
}: AddNewSeriesModalProps) {
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
|
<AddNewSeriesModalContent {...otherProps} onModalClose={onModalClose} />
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AddNewSeriesModal;
|
||||||
@@ -1,300 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import SeriesMonitoringOptionsPopoverContent from 'AddSeries/SeriesMonitoringOptionsPopoverContent';
|
|
||||||
import SeriesTypePopoverContent from 'AddSeries/SeriesTypePopoverContent';
|
|
||||||
import CheckInput from 'Components/Form/CheckInput';
|
|
||||||
import Form from 'Components/Form/Form';
|
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
|
||||||
import FormLabel from 'Components/Form/FormLabel';
|
|
||||||
import Icon from 'Components/Icon';
|
|
||||||
import SpinnerButton from 'Components/Link/SpinnerButton';
|
|
||||||
import ModalBody from 'Components/Modal/ModalBody';
|
|
||||||
import ModalContent from 'Components/Modal/ModalContent';
|
|
||||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
|
||||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
|
||||||
import Popover from 'Components/Tooltip/Popover';
|
|
||||||
import { icons, inputTypes, kinds, tooltipPositions } from 'Helpers/Props';
|
|
||||||
import SeriesPoster from 'Series/SeriesPoster';
|
|
||||||
import * as seriesTypes from 'Utilities/Series/seriesTypes';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import styles from './AddNewSeriesModalContent.css';
|
|
||||||
|
|
||||||
class AddNewSeriesModalContent extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
seriesType: props.initialSeriesType === seriesTypes.STANDARD ?
|
|
||||||
props.seriesType.value :
|
|
||||||
props.initialSeriesType
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
if (this.props.seriesType.value !== prevProps.seriesType.value) {
|
|
||||||
this.setState({ seriesType: this.props.seriesType.value });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onQualityProfileIdChange = ({ value }) => {
|
|
||||||
this.props.onInputChange({ name: 'qualityProfileId', value: parseInt(value) });
|
|
||||||
};
|
|
||||||
|
|
||||||
onAddSeriesPress = () => {
|
|
||||||
const {
|
|
||||||
seriesType
|
|
||||||
} = this.state;
|
|
||||||
|
|
||||||
this.props.onAddSeriesPress(
|
|
||||||
seriesType
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
title,
|
|
||||||
year,
|
|
||||||
overview,
|
|
||||||
images,
|
|
||||||
isAdding,
|
|
||||||
rootFolderPath,
|
|
||||||
monitor,
|
|
||||||
qualityProfileId,
|
|
||||||
seriesType,
|
|
||||||
seasonFolder,
|
|
||||||
searchForMissingEpisodes,
|
|
||||||
searchForCutoffUnmetEpisodes,
|
|
||||||
folder,
|
|
||||||
tags,
|
|
||||||
isSmallScreen,
|
|
||||||
isWindows,
|
|
||||||
onModalClose,
|
|
||||||
onInputChange,
|
|
||||||
...otherProps
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ModalContent onModalClose={onModalClose}>
|
|
||||||
<ModalHeader>
|
|
||||||
{title}
|
|
||||||
|
|
||||||
{
|
|
||||||
!title.contains(year) && !!year &&
|
|
||||||
<span className={styles.year}>({year})</span>
|
|
||||||
}
|
|
||||||
</ModalHeader>
|
|
||||||
|
|
||||||
<ModalBody>
|
|
||||||
<div className={styles.container}>
|
|
||||||
{
|
|
||||||
isSmallScreen ?
|
|
||||||
null :
|
|
||||||
<div className={styles.poster}>
|
|
||||||
<SeriesPoster
|
|
||||||
className={styles.poster}
|
|
||||||
images={images}
|
|
||||||
size={250}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<div className={styles.info}>
|
|
||||||
{
|
|
||||||
overview ?
|
|
||||||
<div className={styles.overview}>
|
|
||||||
{overview}
|
|
||||||
</div> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
<Form {...otherProps}>
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('RootFolder')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.ROOT_FOLDER_SELECT}
|
|
||||||
name="rootFolderPath"
|
|
||||||
valueOptions={{
|
|
||||||
seriesFolder: folder,
|
|
||||||
isWindows
|
|
||||||
}}
|
|
||||||
selectedValueOptions={{
|
|
||||||
seriesFolder: folder,
|
|
||||||
isWindows
|
|
||||||
}}
|
|
||||||
helpText={translate('AddNewSeriesRootFolderHelpText', { folder })}
|
|
||||||
onChange={onInputChange}
|
|
||||||
{...rootFolderPath}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>
|
|
||||||
{translate('Monitor')}
|
|
||||||
|
|
||||||
<Popover
|
|
||||||
anchor={
|
|
||||||
<Icon
|
|
||||||
className={styles.labelIcon}
|
|
||||||
name={icons.INFO}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
title={translate('MonitoringOptions')}
|
|
||||||
body={<SeriesMonitoringOptionsPopoverContent />}
|
|
||||||
position={tooltipPositions.RIGHT}
|
|
||||||
/>
|
|
||||||
</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.MONITOR_EPISODES_SELECT}
|
|
||||||
name="monitor"
|
|
||||||
onChange={onInputChange}
|
|
||||||
{...monitor}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('QualityProfile')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.QUALITY_PROFILE_SELECT}
|
|
||||||
name="qualityProfileId"
|
|
||||||
onChange={this.onQualityProfileIdChange}
|
|
||||||
{...qualityProfileId}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>
|
|
||||||
{translate('SeriesType')}
|
|
||||||
|
|
||||||
<Popover
|
|
||||||
anchor={
|
|
||||||
<Icon
|
|
||||||
className={styles.labelIcon}
|
|
||||||
name={icons.INFO}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
title={translate('SeriesTypes')}
|
|
||||||
body={<SeriesTypePopoverContent />}
|
|
||||||
position={tooltipPositions.RIGHT}
|
|
||||||
/>
|
|
||||||
</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.SERIES_TYPE_SELECT}
|
|
||||||
name="seriesType"
|
|
||||||
onChange={onInputChange}
|
|
||||||
{...seriesType}
|
|
||||||
value={this.state.seriesType}
|
|
||||||
helpText={translate('SeriesTypesHelpText')}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('SeasonFolder')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="seasonFolder"
|
|
||||||
onChange={onInputChange}
|
|
||||||
{...seasonFolder}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('Tags')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.TAG}
|
|
||||||
name="tags"
|
|
||||||
onChange={onInputChange}
|
|
||||||
{...tags}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
</Form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</ModalBody>
|
|
||||||
|
|
||||||
<ModalFooter className={styles.modalFooter}>
|
|
||||||
<div>
|
|
||||||
<label className={styles.searchLabelContainer}>
|
|
||||||
<span className={styles.searchLabel}>
|
|
||||||
{translate('AddNewSeriesSearchForMissingEpisodes')}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<CheckInput
|
|
||||||
containerClassName={styles.searchInputContainer}
|
|
||||||
className={styles.searchInput}
|
|
||||||
name="searchForMissingEpisodes"
|
|
||||||
onChange={onInputChange}
|
|
||||||
{...searchForMissingEpisodes}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label className={styles.searchLabelContainer}>
|
|
||||||
<span className={styles.searchLabel}>
|
|
||||||
{translate('AddNewSeriesSearchForCutoffUnmetEpisodes')}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<CheckInput
|
|
||||||
containerClassName={styles.searchInputContainer}
|
|
||||||
className={styles.searchInput}
|
|
||||||
name="searchForCutoffUnmetEpisodes"
|
|
||||||
onChange={onInputChange}
|
|
||||||
{...searchForCutoffUnmetEpisodes}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<SpinnerButton
|
|
||||||
className={styles.addButton}
|
|
||||||
kind={kinds.SUCCESS}
|
|
||||||
isSpinning={isAdding}
|
|
||||||
onPress={this.onAddSeriesPress}
|
|
||||||
>
|
|
||||||
{translate('AddSeriesWithTitle', { title })}
|
|
||||||
</SpinnerButton>
|
|
||||||
</ModalFooter>
|
|
||||||
</ModalContent>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AddNewSeriesModalContent.propTypes = {
|
|
||||||
title: PropTypes.string.isRequired,
|
|
||||||
year: PropTypes.number.isRequired,
|
|
||||||
overview: PropTypes.string,
|
|
||||||
initialSeriesType: PropTypes.string.isRequired,
|
|
||||||
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
isAdding: PropTypes.bool.isRequired,
|
|
||||||
addError: PropTypes.object,
|
|
||||||
rootFolderPath: PropTypes.object,
|
|
||||||
monitor: PropTypes.object.isRequired,
|
|
||||||
qualityProfileId: PropTypes.object,
|
|
||||||
seriesType: PropTypes.object.isRequired,
|
|
||||||
seasonFolder: PropTypes.object.isRequired,
|
|
||||||
searchForMissingEpisodes: PropTypes.object.isRequired,
|
|
||||||
searchForCutoffUnmetEpisodes: PropTypes.object.isRequired,
|
|
||||||
folder: PropTypes.string.isRequired,
|
|
||||||
tags: PropTypes.object.isRequired,
|
|
||||||
isSmallScreen: PropTypes.bool.isRequired,
|
|
||||||
isWindows: PropTypes.bool.isRequired,
|
|
||||||
onModalClose: PropTypes.func.isRequired,
|
|
||||||
onInputChange: PropTypes.func.isRequired,
|
|
||||||
onAddSeriesPress: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AddNewSeriesModalContent;
|
|
||||||
@@ -0,0 +1,296 @@
|
|||||||
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import AddSeries from 'AddSeries/AddSeries';
|
||||||
|
import {
|
||||||
|
AddSeriesOptions,
|
||||||
|
setAddSeriesOption,
|
||||||
|
useAddSeriesOptions,
|
||||||
|
} from 'AddSeries/addSeriesOptionsStore';
|
||||||
|
import SeriesMonitoringOptionsPopoverContent from 'AddSeries/SeriesMonitoringOptionsPopoverContent';
|
||||||
|
import SeriesTypePopoverContent from 'AddSeries/SeriesTypePopoverContent';
|
||||||
|
import CheckInput from 'Components/Form/CheckInput';
|
||||||
|
import Form from 'Components/Form/Form';
|
||||||
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
|
import Icon from 'Components/Icon';
|
||||||
|
import SpinnerButton from 'Components/Link/SpinnerButton';
|
||||||
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import Popover from 'Components/Tooltip/Popover';
|
||||||
|
import { icons, inputTypes, kinds, tooltipPositions } from 'Helpers/Props';
|
||||||
|
import { SeriesType } from 'Series/Series';
|
||||||
|
import SeriesPoster from 'Series/SeriesPoster';
|
||||||
|
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
||||||
|
import selectSettings from 'Store/Selectors/selectSettings';
|
||||||
|
import useIsWindows from 'System/useIsWindows';
|
||||||
|
import { InputChanged } from 'typings/inputs';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import { useAddSeries } from './useAddSeries';
|
||||||
|
import styles from './AddNewSeriesModalContent.css';
|
||||||
|
|
||||||
|
export interface AddNewSeriesModalContentProps {
|
||||||
|
series: AddSeries;
|
||||||
|
initialSeriesType: SeriesType;
|
||||||
|
onModalClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddNewSeriesModalContent({
|
||||||
|
series,
|
||||||
|
initialSeriesType,
|
||||||
|
onModalClose,
|
||||||
|
}: AddNewSeriesModalContentProps) {
|
||||||
|
const { title, year, overview, images, folder } = series;
|
||||||
|
const options = useAddSeriesOptions();
|
||||||
|
const { isSmallScreen } = useSelector(createDimensionsSelector());
|
||||||
|
const isWindows = useIsWindows();
|
||||||
|
|
||||||
|
const { isAdding, addError, addSeries } = useAddSeries();
|
||||||
|
|
||||||
|
const { settings, validationErrors, validationWarnings } = useMemo(() => {
|
||||||
|
return selectSettings(options, {}, addError);
|
||||||
|
}, [options, addError]);
|
||||||
|
|
||||||
|
const [seriesType, setSeriesType] = useState<SeriesType>(
|
||||||
|
initialSeriesType === 'standard'
|
||||||
|
? settings.seriesType.value
|
||||||
|
: initialSeriesType
|
||||||
|
);
|
||||||
|
|
||||||
|
const {
|
||||||
|
monitor,
|
||||||
|
qualityProfileId,
|
||||||
|
rootFolderPath,
|
||||||
|
searchForCutoffUnmetEpisodes,
|
||||||
|
searchForMissingEpisodes,
|
||||||
|
seasonFolder,
|
||||||
|
seriesType: seriesTypeSetting,
|
||||||
|
tags,
|
||||||
|
} = settings;
|
||||||
|
|
||||||
|
const handleInputChange = useCallback(
|
||||||
|
({ name, value }: InputChanged<string | number | boolean | number[]>) => {
|
||||||
|
setAddSeriesOption(name as keyof AddSeriesOptions, value);
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleQualityProfileIdChange = useCallback(
|
||||||
|
({ value }: InputChanged<string | number>) => {
|
||||||
|
setAddSeriesOption('qualityProfileId', value as number);
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleAddSeriesPress = useCallback(() => {
|
||||||
|
addSeries({
|
||||||
|
...series,
|
||||||
|
rootFolderPath: rootFolderPath.value,
|
||||||
|
monitor: monitor.value,
|
||||||
|
qualityProfileId: qualityProfileId.value,
|
||||||
|
seriesType,
|
||||||
|
seasonFolder: seasonFolder.value,
|
||||||
|
searchForMissingEpisodes: searchForMissingEpisodes.value,
|
||||||
|
searchForCutoffUnmetEpisodes: searchForCutoffUnmetEpisodes.value,
|
||||||
|
tags: tags.value,
|
||||||
|
});
|
||||||
|
}, [
|
||||||
|
series,
|
||||||
|
seriesType,
|
||||||
|
rootFolderPath,
|
||||||
|
monitor,
|
||||||
|
qualityProfileId,
|
||||||
|
seasonFolder,
|
||||||
|
searchForMissingEpisodes,
|
||||||
|
searchForCutoffUnmetEpisodes,
|
||||||
|
tags,
|
||||||
|
addSeries,
|
||||||
|
]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSeriesType(seriesTypeSetting.value);
|
||||||
|
}, [seriesTypeSetting]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalContent onModalClose={onModalClose}>
|
||||||
|
<ModalHeader>
|
||||||
|
{title}
|
||||||
|
|
||||||
|
{!title.includes(String(year)) && year ? (
|
||||||
|
<span className={styles.year}>({year})</span>
|
||||||
|
) : null}
|
||||||
|
</ModalHeader>
|
||||||
|
|
||||||
|
<ModalBody>
|
||||||
|
<div className={styles.container}>
|
||||||
|
{isSmallScreen ? null : (
|
||||||
|
<div className={styles.poster}>
|
||||||
|
<SeriesPoster
|
||||||
|
className={styles.poster}
|
||||||
|
images={images}
|
||||||
|
size={250}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className={styles.info}>
|
||||||
|
{overview ? (
|
||||||
|
<div className={styles.overview}>{overview}</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<Form
|
||||||
|
validationErrors={validationErrors}
|
||||||
|
validationWarnings={validationWarnings}
|
||||||
|
>
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('RootFolder')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.ROOT_FOLDER_SELECT}
|
||||||
|
name="rootFolderPath"
|
||||||
|
valueOptions={{
|
||||||
|
seriesFolder: folder,
|
||||||
|
isWindows,
|
||||||
|
}}
|
||||||
|
selectedValueOptions={{
|
||||||
|
seriesFolder: folder,
|
||||||
|
isWindows,
|
||||||
|
}}
|
||||||
|
helpText={translate('AddNewSeriesRootFolderHelpText', {
|
||||||
|
folder,
|
||||||
|
})}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
{...rootFolderPath}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>
|
||||||
|
{translate('Monitor')}
|
||||||
|
|
||||||
|
<Popover
|
||||||
|
anchor={
|
||||||
|
<Icon className={styles.labelIcon} name={icons.INFO} />
|
||||||
|
}
|
||||||
|
title={translate('MonitoringOptions')}
|
||||||
|
body={<SeriesMonitoringOptionsPopoverContent />}
|
||||||
|
position={tooltipPositions.RIGHT}
|
||||||
|
/>
|
||||||
|
</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.MONITOR_EPISODES_SELECT}
|
||||||
|
name="monitor"
|
||||||
|
onChange={handleInputChange}
|
||||||
|
{...monitor}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('QualityProfile')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.QUALITY_PROFILE_SELECT}
|
||||||
|
name="qualityProfileId"
|
||||||
|
onChange={handleQualityProfileIdChange}
|
||||||
|
{...qualityProfileId}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>
|
||||||
|
{translate('SeriesType')}
|
||||||
|
|
||||||
|
<Popover
|
||||||
|
anchor={
|
||||||
|
<Icon className={styles.labelIcon} name={icons.INFO} />
|
||||||
|
}
|
||||||
|
title={translate('SeriesTypes')}
|
||||||
|
body={<SeriesTypePopoverContent />}
|
||||||
|
position={tooltipPositions.RIGHT}
|
||||||
|
/>
|
||||||
|
</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SERIES_TYPE_SELECT}
|
||||||
|
name="seriesType"
|
||||||
|
onChange={handleInputChange}
|
||||||
|
{...seriesTypeSetting}
|
||||||
|
value={seriesType}
|
||||||
|
helpText={translate('SeriesTypesHelpText')}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('SeasonFolder')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="seasonFolder"
|
||||||
|
onChange={handleInputChange}
|
||||||
|
{...seasonFolder}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('Tags')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.TAG}
|
||||||
|
name="tags"
|
||||||
|
onChange={handleInputChange}
|
||||||
|
{...tags}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter className={styles.modalFooter}>
|
||||||
|
<div>
|
||||||
|
<label className={styles.searchLabelContainer}>
|
||||||
|
<span className={styles.searchLabel}>
|
||||||
|
{translate('AddNewSeriesSearchForMissingEpisodes')}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<CheckInput
|
||||||
|
containerClassName={styles.searchInputContainer}
|
||||||
|
className={styles.searchInput}
|
||||||
|
name="searchForMissingEpisodes"
|
||||||
|
onChange={handleInputChange}
|
||||||
|
{...searchForMissingEpisodes}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label className={styles.searchLabelContainer}>
|
||||||
|
<span className={styles.searchLabel}>
|
||||||
|
{translate('AddNewSeriesSearchForCutoffUnmetEpisodes')}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<CheckInput
|
||||||
|
containerClassName={styles.searchInputContainer}
|
||||||
|
className={styles.searchInput}
|
||||||
|
name="searchForCutoffUnmetEpisodes"
|
||||||
|
onChange={handleInputChange}
|
||||||
|
{...searchForCutoffUnmetEpisodes}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<SpinnerButton
|
||||||
|
className={styles.addButton}
|
||||||
|
kind={kinds.SUCCESS}
|
||||||
|
isSpinning={isAdding}
|
||||||
|
onPress={handleAddSeriesPress}
|
||||||
|
>
|
||||||
|
{translate('AddSeriesWithTitle', { title })}
|
||||||
|
</SpinnerButton>
|
||||||
|
</ModalFooter>
|
||||||
|
</ModalContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AddNewSeriesModalContent;
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import { addSeries, setAddSeriesDefault } from 'Store/Actions/addSeriesActions';
|
|
||||||
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
|
||||||
import createSystemStatusSelector from 'Store/Selectors/createSystemStatusSelector';
|
|
||||||
import selectSettings from 'Store/Selectors/selectSettings';
|
|
||||||
import AddNewSeriesModalContent from './AddNewSeriesModalContent';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.addSeries,
|
|
||||||
createDimensionsSelector(),
|
|
||||||
createSystemStatusSelector(),
|
|
||||||
(addSeriesState, dimensions, systemStatus) => {
|
|
||||||
const {
|
|
||||||
isAdding,
|
|
||||||
addError,
|
|
||||||
defaults
|
|
||||||
} = addSeriesState;
|
|
||||||
|
|
||||||
const {
|
|
||||||
settings,
|
|
||||||
validationErrors,
|
|
||||||
validationWarnings
|
|
||||||
} = selectSettings(defaults, {}, addError);
|
|
||||||
|
|
||||||
return {
|
|
||||||
isAdding,
|
|
||||||
addError,
|
|
||||||
isSmallScreen: dimensions.isSmallScreen,
|
|
||||||
validationErrors,
|
|
||||||
validationWarnings,
|
|
||||||
isWindows: systemStatus.isWindows,
|
|
||||||
...settings
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
setAddSeriesDefault,
|
|
||||||
addSeries
|
|
||||||
};
|
|
||||||
|
|
||||||
class AddNewSeriesModalContentConnector extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onInputChange = ({ name, value }) => {
|
|
||||||
this.props.setAddSeriesDefault({ [name]: value });
|
|
||||||
};
|
|
||||||
|
|
||||||
onAddSeriesPress = (seriesType) => {
|
|
||||||
const {
|
|
||||||
tvdbId,
|
|
||||||
rootFolderPath,
|
|
||||||
monitor,
|
|
||||||
qualityProfileId,
|
|
||||||
seasonFolder,
|
|
||||||
searchForMissingEpisodes,
|
|
||||||
searchForCutoffUnmetEpisodes,
|
|
||||||
tags
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
this.props.addSeries({
|
|
||||||
tvdbId,
|
|
||||||
rootFolderPath: rootFolderPath.value,
|
|
||||||
monitor: monitor.value,
|
|
||||||
qualityProfileId: qualityProfileId.value,
|
|
||||||
seriesType,
|
|
||||||
seasonFolder: seasonFolder.value,
|
|
||||||
searchForMissingEpisodes: searchForMissingEpisodes.value,
|
|
||||||
searchForCutoffUnmetEpisodes: searchForCutoffUnmetEpisodes.value,
|
|
||||||
tags: tags.value
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<AddNewSeriesModalContent
|
|
||||||
{...this.props}
|
|
||||||
onInputChange={this.onInputChange}
|
|
||||||
onAddSeriesPress={this.onAddSeriesPress}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AddNewSeriesModalContentConnector.propTypes = {
|
|
||||||
tvdbId: PropTypes.number.isRequired,
|
|
||||||
rootFolderPath: PropTypes.object,
|
|
||||||
monitor: PropTypes.object.isRequired,
|
|
||||||
qualityProfileId: PropTypes.object,
|
|
||||||
seriesType: PropTypes.object.isRequired,
|
|
||||||
seasonFolder: PropTypes.object.isRequired,
|
|
||||||
searchForMissingEpisodes: PropTypes.object.isRequired,
|
|
||||||
searchForCutoffUnmetEpisodes: PropTypes.object.isRequired,
|
|
||||||
tags: PropTypes.object.isRequired,
|
|
||||||
onModalClose: PropTypes.func.isRequired,
|
|
||||||
setAddSeriesDefault: PropTypes.func.isRequired,
|
|
||||||
addSeries: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(AddNewSeriesModalContentConnector);
|
|
||||||
@@ -69,6 +69,16 @@
|
|||||||
height: 55px;
|
height: 55px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.originalLanguageName,
|
||||||
|
.network,
|
||||||
|
.genres {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.genres {
|
||||||
|
pointer-events: all;
|
||||||
|
}
|
||||||
|
|
||||||
.tvdbLink {
|
.tvdbLink {
|
||||||
composes: link from '~Components/Link/Link.css';
|
composes: link from '~Components/Link/Link.css';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,10 @@
|
|||||||
interface CssExports {
|
interface CssExports {
|
||||||
'alreadyExistsIcon': string;
|
'alreadyExistsIcon': string;
|
||||||
'content': string;
|
'content': string;
|
||||||
|
'genres': string;
|
||||||
'icons': string;
|
'icons': string;
|
||||||
|
'network': string;
|
||||||
|
'originalLanguageName': string;
|
||||||
'overlay': string;
|
'overlay': string;
|
||||||
'overview': string;
|
'overview': string;
|
||||||
'poster': string;
|
'poster': string;
|
||||||
|
|||||||
@@ -1,232 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import HeartRating from 'Components/HeartRating';
|
|
||||||
import Icon from 'Components/Icon';
|
|
||||||
import Label from 'Components/Label';
|
|
||||||
import Link from 'Components/Link/Link';
|
|
||||||
import MetadataAttribution from 'Components/MetadataAttribution';
|
|
||||||
import { icons, kinds, sizes } from 'Helpers/Props';
|
|
||||||
import SeriesPoster from 'Series/SeriesPoster';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import AddNewSeriesModal from './AddNewSeriesModal';
|
|
||||||
import styles from './AddNewSeriesSearchResult.css';
|
|
||||||
|
|
||||||
class AddNewSeriesSearchResult extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
isNewAddSeriesModalOpen: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
if (!prevProps.isExistingSeries && this.props.isExistingSeries) {
|
|
||||||
this.onAddSeriesModalClose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onPress = () => {
|
|
||||||
this.setState({ isNewAddSeriesModalOpen: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
onAddSeriesModalClose = () => {
|
|
||||||
this.setState({ isNewAddSeriesModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
onTVDBLinkPress = (event) => {
|
|
||||||
event.stopPropagation();
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
tvdbId,
|
|
||||||
title,
|
|
||||||
titleSlug,
|
|
||||||
year,
|
|
||||||
network,
|
|
||||||
status,
|
|
||||||
overview,
|
|
||||||
statistics,
|
|
||||||
ratings,
|
|
||||||
folder,
|
|
||||||
seriesType,
|
|
||||||
images,
|
|
||||||
isExistingSeries,
|
|
||||||
isSmallScreen
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const seasonCount = statistics.seasonCount;
|
|
||||||
|
|
||||||
const {
|
|
||||||
isNewAddSeriesModalOpen
|
|
||||||
} = this.state;
|
|
||||||
|
|
||||||
const linkProps = isExistingSeries ? { to: `/series/${titleSlug}` } : { onPress: this.onPress };
|
|
||||||
let seasons = translate('OneSeason');
|
|
||||||
|
|
||||||
if (seasonCount > 1) {
|
|
||||||
seasons = translate('CountSeasons', { count: seasonCount });
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={styles.searchResult}>
|
|
||||||
<Link
|
|
||||||
className={styles.underlay}
|
|
||||||
{...linkProps}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div className={styles.overlay}>
|
|
||||||
{
|
|
||||||
isSmallScreen ?
|
|
||||||
null :
|
|
||||||
<SeriesPoster
|
|
||||||
className={styles.poster}
|
|
||||||
images={images}
|
|
||||||
size={250}
|
|
||||||
overflow={true}
|
|
||||||
lazy={false}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
<div className={styles.content}>
|
|
||||||
<div className={styles.titleRow}>
|
|
||||||
<div className={styles.titleContainer}>
|
|
||||||
<div className={styles.title}>
|
|
||||||
{title}
|
|
||||||
|
|
||||||
{
|
|
||||||
!title.contains(year) && year ?
|
|
||||||
<span className={styles.year}>
|
|
||||||
({year})
|
|
||||||
</span> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={styles.icons}>
|
|
||||||
{
|
|
||||||
isExistingSeries ?
|
|
||||||
<Icon
|
|
||||||
className={styles.alreadyExistsIcon}
|
|
||||||
name={icons.CHECK_CIRCLE}
|
|
||||||
size={36}
|
|
||||||
title={translate('AlreadyInYourLibrary')}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
<Link
|
|
||||||
className={styles.tvdbLink}
|
|
||||||
to={`https://www.thetvdb.com/?tab=series&id=${tvdbId}`}
|
|
||||||
onPress={this.onTVDBLinkPress}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
className={styles.tvdbLinkIcon}
|
|
||||||
name={icons.EXTERNAL_LINK}
|
|
||||||
size={28}
|
|
||||||
/>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<Label size={sizes.LARGE}>
|
|
||||||
<HeartRating
|
|
||||||
rating={ratings.value}
|
|
||||||
iconSize={13}
|
|
||||||
/>
|
|
||||||
</Label>
|
|
||||||
|
|
||||||
{
|
|
||||||
network ?
|
|
||||||
<Label size={sizes.LARGE}>
|
|
||||||
{network}
|
|
||||||
</Label> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
seasonCount ?
|
|
||||||
<Label size={sizes.LARGE}>
|
|
||||||
{seasons}
|
|
||||||
</Label> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
status === 'ended' ?
|
|
||||||
<Label
|
|
||||||
kind={kinds.DANGER}
|
|
||||||
size={sizes.LARGE}
|
|
||||||
>
|
|
||||||
{translate('Ended')}
|
|
||||||
</Label> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
status === 'upcoming' ?
|
|
||||||
<Label
|
|
||||||
kind={kinds.INFO}
|
|
||||||
size={sizes.LARGE}
|
|
||||||
>
|
|
||||||
{translate('Upcoming')}
|
|
||||||
</Label> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={styles.overview}>
|
|
||||||
{overview}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<MetadataAttribution />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<AddNewSeriesModal
|
|
||||||
isOpen={isNewAddSeriesModalOpen && !isExistingSeries}
|
|
||||||
tvdbId={tvdbId}
|
|
||||||
title={title}
|
|
||||||
year={year}
|
|
||||||
overview={overview}
|
|
||||||
folder={folder}
|
|
||||||
initialSeriesType={seriesType}
|
|
||||||
images={images}
|
|
||||||
onModalClose={this.onAddSeriesModalClose}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AddNewSeriesSearchResult.propTypes = {
|
|
||||||
tvdbId: PropTypes.number.isRequired,
|
|
||||||
title: PropTypes.string.isRequired,
|
|
||||||
titleSlug: PropTypes.string.isRequired,
|
|
||||||
year: PropTypes.number.isRequired,
|
|
||||||
network: PropTypes.string,
|
|
||||||
status: PropTypes.string.isRequired,
|
|
||||||
overview: PropTypes.string,
|
|
||||||
statistics: PropTypes.object.isRequired,
|
|
||||||
ratings: PropTypes.object.isRequired,
|
|
||||||
folder: PropTypes.string.isRequired,
|
|
||||||
seriesType: PropTypes.string.isRequired,
|
|
||||||
images: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
isExistingSeries: PropTypes.bool.isRequired,
|
|
||||||
isSmallScreen: PropTypes.bool.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AddNewSeriesSearchResult;
|
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
import React, { useCallback, useState } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import AddSeries from 'AddSeries/AddSeries';
|
||||||
|
import HeartRating from 'Components/HeartRating';
|
||||||
|
import Icon from 'Components/Icon';
|
||||||
|
import Label from 'Components/Label';
|
||||||
|
import Link from 'Components/Link/Link';
|
||||||
|
import MetadataAttribution from 'Components/MetadataAttribution';
|
||||||
|
import { icons, kinds, sizes } from 'Helpers/Props';
|
||||||
|
import { Statistics } from 'Series/Series';
|
||||||
|
import SeriesGenres from 'Series/SeriesGenres';
|
||||||
|
import SeriesPoster from 'Series/SeriesPoster';
|
||||||
|
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
||||||
|
import createExistingSeriesSelector from 'Store/Selectors/createExistingSeriesSelector';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import AddNewSeriesModal from './AddNewSeriesModal';
|
||||||
|
import styles from './AddNewSeriesSearchResult.css';
|
||||||
|
|
||||||
|
interface AddNewSeriesSearchResultProps {
|
||||||
|
series: AddSeries;
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddNewSeriesSearchResult({ series }: AddNewSeriesSearchResultProps) {
|
||||||
|
const {
|
||||||
|
tvdbId,
|
||||||
|
titleSlug,
|
||||||
|
title,
|
||||||
|
year,
|
||||||
|
network,
|
||||||
|
originalLanguage,
|
||||||
|
genres = [],
|
||||||
|
status,
|
||||||
|
statistics = {} as Statistics,
|
||||||
|
ratings,
|
||||||
|
overview,
|
||||||
|
seriesType,
|
||||||
|
images,
|
||||||
|
} = series;
|
||||||
|
|
||||||
|
const isExistingSeries = useSelector(createExistingSeriesSelector(tvdbId));
|
||||||
|
const { isSmallScreen } = useSelector(createDimensionsSelector());
|
||||||
|
const [isNewAddSeriesModalOpen, setIsNewAddSeriesModalOpen] = useState(false);
|
||||||
|
|
||||||
|
const seasonCount = statistics.seasonCount;
|
||||||
|
const handlePress = useCallback(() => {
|
||||||
|
setIsNewAddSeriesModalOpen(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleAddSeriesModalClose = useCallback(() => {
|
||||||
|
setIsNewAddSeriesModalOpen(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleTvdbLinkPress = useCallback((event: React.SyntheticEvent) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const linkProps = isExistingSeries
|
||||||
|
? { to: `/series/${titleSlug}` }
|
||||||
|
: { onPress: handlePress };
|
||||||
|
let seasons = translate('OneSeason');
|
||||||
|
|
||||||
|
if (seasonCount > 1) {
|
||||||
|
seasons = translate('CountSeasons', { count: seasonCount });
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.searchResult}>
|
||||||
|
<Link className={styles.underlay} {...linkProps} />
|
||||||
|
|
||||||
|
<div className={styles.overlay}>
|
||||||
|
{isSmallScreen ? null : (
|
||||||
|
<SeriesPoster
|
||||||
|
className={styles.poster}
|
||||||
|
images={images}
|
||||||
|
size={250}
|
||||||
|
overflow={true}
|
||||||
|
lazy={false}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className={styles.content}>
|
||||||
|
<div className={styles.titleRow}>
|
||||||
|
<div className={styles.titleContainer}>
|
||||||
|
<div className={styles.title}>
|
||||||
|
{title}
|
||||||
|
|
||||||
|
{!title.includes(String(year)) && year ? (
|
||||||
|
<span className={styles.year}>({year})</span>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.icons}>
|
||||||
|
{isExistingSeries ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.alreadyExistsIcon}
|
||||||
|
name={icons.CHECK_CIRCLE}
|
||||||
|
size={36}
|
||||||
|
title={translate('AlreadyInYourLibrary')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<Link
|
||||||
|
className={styles.tvdbLink}
|
||||||
|
to={`https://www.thetvdb.com/?tab=series&id=${tvdbId}`}
|
||||||
|
onPress={handleTvdbLinkPress}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
className={styles.tvdbLinkIcon}
|
||||||
|
name={icons.EXTERNAL_LINK}
|
||||||
|
size={28}
|
||||||
|
/>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<Label size={sizes.LARGE}>
|
||||||
|
<HeartRating
|
||||||
|
rating={ratings.value}
|
||||||
|
votes={ratings.votes}
|
||||||
|
iconSize={13}
|
||||||
|
/>
|
||||||
|
</Label>
|
||||||
|
|
||||||
|
{originalLanguage?.name ? (
|
||||||
|
<Label size={sizes.LARGE}>
|
||||||
|
<Icon name={icons.LANGUAGE} size={13} />
|
||||||
|
|
||||||
|
<span className={styles.originalLanguageName}>
|
||||||
|
{originalLanguage.name}
|
||||||
|
</span>
|
||||||
|
</Label>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{network ? (
|
||||||
|
<Label size={sizes.LARGE}>
|
||||||
|
<Icon name={icons.NETWORK} size={13} />
|
||||||
|
|
||||||
|
<span className={styles.network}>{network}</span>
|
||||||
|
</Label>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{genres.length > 0 ? (
|
||||||
|
<Label size={sizes.LARGE}>
|
||||||
|
<Icon name={icons.GENRE} size={13} />
|
||||||
|
<SeriesGenres className={styles.genres} genres={genres} />
|
||||||
|
</Label>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{seasonCount ? <Label size={sizes.LARGE}>{seasons}</Label> : null}
|
||||||
|
|
||||||
|
{status === 'ended' ? (
|
||||||
|
<Label kind={kinds.DANGER} size={sizes.LARGE}>
|
||||||
|
{translate('Ended')}
|
||||||
|
</Label>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{status === 'upcoming' ? (
|
||||||
|
<Label kind={kinds.INFO} size={sizes.LARGE}>
|
||||||
|
{translate('Upcoming')}
|
||||||
|
</Label>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.overview}>{overview}</div>
|
||||||
|
|
||||||
|
<MetadataAttribution />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<AddNewSeriesModal
|
||||||
|
isOpen={isNewAddSeriesModalOpen && !isExistingSeries}
|
||||||
|
series={series}
|
||||||
|
initialSeriesType={seriesType}
|
||||||
|
onModalClose={handleAddSeriesModalClose}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AddNewSeriesSearchResult;
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
|
||||||
import createExistingSeriesSelector from 'Store/Selectors/createExistingSeriesSelector';
|
|
||||||
import AddNewSeriesSearchResult from './AddNewSeriesSearchResult';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
createExistingSeriesSelector(),
|
|
||||||
createDimensionsSelector(),
|
|
||||||
(isExistingSeries, dimensions) => {
|
|
||||||
return {
|
|
||||||
isExistingSeries,
|
|
||||||
isSmallScreen: dimensions.isSmallScreen
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps)(AddNewSeriesSearchResult);
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import { useCallback } from 'react';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import AddSeries from 'AddSeries/AddSeries';
|
||||||
|
import { AddSeriesOptions } from 'AddSeries/addSeriesOptionsStore';
|
||||||
|
import useApiMutation from 'Helpers/Hooks/useApiMutation';
|
||||||
|
import useApiQuery from 'Helpers/Hooks/useApiQuery';
|
||||||
|
import Series from 'Series/Series';
|
||||||
|
import { updateItem } from 'Store/Actions/baseActions';
|
||||||
|
|
||||||
|
type AddSeriesPayload = AddSeries & AddSeriesOptions;
|
||||||
|
|
||||||
|
export const useLookupSeries = (query: string) => {
|
||||||
|
return useApiQuery<AddSeries[]>({
|
||||||
|
path: '/series/lookup',
|
||||||
|
queryParams: {
|
||||||
|
term: query,
|
||||||
|
},
|
||||||
|
queryOptions: {
|
||||||
|
enabled: !!query,
|
||||||
|
// Disable refetch on window focus to prevent refetching when the user switch tabs
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useAddSeries = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const onAddSuccess = useCallback(
|
||||||
|
(data: Series) => {
|
||||||
|
dispatch(updateItem({ section: 'series', ...data }));
|
||||||
|
},
|
||||||
|
[dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const { isPending, error, mutate } = useApiMutation<Series, AddSeriesPayload>(
|
||||||
|
{
|
||||||
|
path: '/series',
|
||||||
|
method: 'POST',
|
||||||
|
mutationOptions: {
|
||||||
|
onSuccess: onAddSuccess,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
isAdding: isPending,
|
||||||
|
addError: error,
|
||||||
|
addSeries: mutate,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import Series from 'Series/Series';
|
||||||
|
|
||||||
|
interface AddSeries extends Series {
|
||||||
|
folder: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AddSeries;
|
||||||
@@ -1,179 +0,0 @@
|
|||||||
import { reduce } from 'lodash';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import Alert from 'Components/Alert';
|
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
|
||||||
import PageContent from 'Components/Page/PageContent';
|
|
||||||
import PageContentBody from 'Components/Page/PageContentBody';
|
|
||||||
import { kinds } from 'Helpers/Props';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import selectAll from 'Utilities/Table/selectAll';
|
|
||||||
import toggleSelected from 'Utilities/Table/toggleSelected';
|
|
||||||
import ImportSeriesFooterConnector from './ImportSeriesFooterConnector';
|
|
||||||
import ImportSeriesTableConnector from './ImportSeriesTableConnector';
|
|
||||||
|
|
||||||
class ImportSeries extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.scrollerRef = React.createRef();
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
allSelected: false,
|
|
||||||
allUnselected: false,
|
|
||||||
lastToggled: null,
|
|
||||||
selectedState: {}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
getSelectedIds = () => {
|
|
||||||
return reduce(
|
|
||||||
this.state.selectedState,
|
|
||||||
(result, value, id) => {
|
|
||||||
if (value) {
|
|
||||||
result.push(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
onSelectAllChange = ({ value }) => {
|
|
||||||
// Only select non-dupes
|
|
||||||
this.setState(selectAll(this.state.selectedState, value));
|
|
||||||
};
|
|
||||||
|
|
||||||
onSelectedChange = ({ id, value, shiftKey = false }) => {
|
|
||||||
this.setState((state) => {
|
|
||||||
return toggleSelected(state, this.props.items, id, value, shiftKey);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onRemoveSelectedStateItem = (id) => {
|
|
||||||
this.setState((state) => {
|
|
||||||
const selectedState = Object.assign({}, state.selectedState);
|
|
||||||
delete selectedState[id];
|
|
||||||
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
selectedState
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onInputChange = ({ name, value }) => {
|
|
||||||
this.props.onInputChange(this.getSelectedIds(), name, value);
|
|
||||||
};
|
|
||||||
|
|
||||||
onImportPress = () => {
|
|
||||||
this.props.onImportPress(this.getSelectedIds());
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
rootFolderId,
|
|
||||||
path,
|
|
||||||
rootFoldersFetching,
|
|
||||||
rootFoldersPopulated,
|
|
||||||
rootFoldersError,
|
|
||||||
unmappedFolders
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const {
|
|
||||||
allSelected,
|
|
||||||
allUnselected,
|
|
||||||
selectedState
|
|
||||||
} = this.state;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageContent title={translate('ImportSeries')}>
|
|
||||||
<PageContentBody ref={this.scrollerRef} >
|
|
||||||
{
|
|
||||||
rootFoldersFetching ? <LoadingIndicator /> : null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!rootFoldersFetching && !!rootFoldersError ?
|
|
||||||
<Alert kind={kinds.DANGER}>
|
|
||||||
{translate('RootFoldersLoadError')}
|
|
||||||
</Alert> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!rootFoldersError &&
|
|
||||||
!rootFoldersFetching &&
|
|
||||||
rootFoldersPopulated &&
|
|
||||||
!unmappedFolders.length ?
|
|
||||||
<Alert kind={kinds.INFO}>
|
|
||||||
{translate('AllSeriesInRootFolderHaveBeenImported', { path })}
|
|
||||||
</Alert> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!rootFoldersError &&
|
|
||||||
!rootFoldersFetching &&
|
|
||||||
rootFoldersPopulated &&
|
|
||||||
!!unmappedFolders.length &&
|
|
||||||
this.scrollerRef.current ?
|
|
||||||
<ImportSeriesTableConnector
|
|
||||||
rootFolderId={rootFolderId}
|
|
||||||
unmappedFolders={unmappedFolders}
|
|
||||||
allSelected={allSelected}
|
|
||||||
allUnselected={allUnselected}
|
|
||||||
selectedState={selectedState}
|
|
||||||
scroller={this.scrollerRef.current}
|
|
||||||
onSelectAllChange={this.onSelectAllChange}
|
|
||||||
onSelectedChange={this.onSelectedChange}
|
|
||||||
onRemoveSelectedStateItem={this.onRemoveSelectedStateItem}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</PageContentBody>
|
|
||||||
|
|
||||||
{
|
|
||||||
!rootFoldersError &&
|
|
||||||
!rootFoldersFetching &&
|
|
||||||
!!unmappedFolders.length ?
|
|
||||||
<ImportSeriesFooterConnector
|
|
||||||
selectedIds={this.getSelectedIds()}
|
|
||||||
onInputChange={this.onInputChange}
|
|
||||||
onImportPress={this.onImportPress}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</PageContent>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImportSeries.propTypes = {
|
|
||||||
rootFolderId: PropTypes.number.isRequired,
|
|
||||||
path: PropTypes.string,
|
|
||||||
rootFoldersFetching: PropTypes.bool.isRequired,
|
|
||||||
rootFoldersPopulated: PropTypes.bool.isRequired,
|
|
||||||
rootFoldersError: PropTypes.object,
|
|
||||||
unmappedFolders: PropTypes.arrayOf(PropTypes.object),
|
|
||||||
items: PropTypes.arrayOf(PropTypes.object),
|
|
||||||
onInputChange: PropTypes.func.isRequired,
|
|
||||||
onImportPress: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
ImportSeries.defaultProps = {
|
|
||||||
unmappedFolders: []
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ImportSeries;
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user