mirror of
https://github.com/cachethq/cachet.git
synced 2026-03-06 09:17:01 +00:00
Compare commits
711 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5d92f5a3d | ||
|
|
247c1565a4 | ||
|
|
8f5afff4a2 | ||
|
|
b045028c7b | ||
|
|
16189da222 | ||
|
|
7596966e6c | ||
|
|
dcea947973 | ||
|
|
d8ea3c59e3 | ||
|
|
a2f8f4540e | ||
|
|
4031c42958 | ||
|
|
8348f48692 | ||
|
|
6c22c52e3a | ||
|
|
faf91470aa | ||
|
|
58039634bd | ||
|
|
ecfa9b1f01 | ||
|
|
915ea0d0bd | ||
|
|
380048dd53 | ||
|
|
ac57936b62 | ||
|
|
962b008fb2 | ||
|
|
5b1dd8ad00 | ||
|
|
c1d8203602 | ||
|
|
dc73f62803 | ||
|
|
a019d82010 | ||
|
|
0f029702d4 | ||
|
|
fdbde63143 | ||
|
|
9a9ec833eb | ||
|
|
136cce2d6d | ||
|
|
880a2d9cd9 | ||
|
|
71b5d446ba | ||
|
|
aea18a51c2 | ||
|
|
84bedf5c60 | ||
|
|
309a3f96ef | ||
|
|
6246f20506 | ||
|
|
9dcc5d6896 | ||
|
|
acd1ac496d | ||
|
|
8c273b8579 | ||
|
|
b30a774bed | ||
|
|
3ea1428c23 | ||
|
|
d6ab5efd14 | ||
|
|
235e3281b0 | ||
|
|
a94be2efca | ||
|
|
04b96e7dec | ||
|
|
e15af44449 | ||
|
|
ef9f7d23a0 | ||
|
|
ef694b027a | ||
|
|
f53e466500 | ||
|
|
1e24138d7a | ||
|
|
9120dba237 | ||
|
|
7f261a218a | ||
|
|
5b5db06ce3 | ||
|
|
b6635d30ee | ||
|
|
5ae23b64d2 | ||
|
|
0d90f0459b | ||
|
|
f8505a866d | ||
|
|
27235abab2 | ||
|
|
f70bc7a42f | ||
|
|
6cf622ae21 | ||
|
|
bcbbee22d9 | ||
|
|
9750191bff | ||
|
|
52c4901a78 | ||
|
|
587555c2d4 | ||
|
|
b4c7fb2ab0 | ||
|
|
e61d24f685 | ||
|
|
88e85d2dfb | ||
|
|
5b72f2febc | ||
|
|
dd1a14a438 | ||
|
|
387818dbb2 | ||
|
|
5d70d244ce | ||
|
|
ddc846d959 | ||
|
|
6fb6641499 | ||
|
|
d5eb087eca | ||
|
|
fd25edb2f0 | ||
|
|
7583fedaec | ||
|
|
eecd78496c | ||
|
|
4703aeadb2 | ||
|
|
5879a2cb1a | ||
|
|
48dc39122f | ||
|
|
3aacfb7849 | ||
|
|
ef304950bb | ||
|
|
2101b829bb | ||
|
|
ad8f098ec1 | ||
|
|
df5b9b89e6 | ||
|
|
2551a1a038 | ||
|
|
3874b533be | ||
|
|
85c0e94408 | ||
|
|
1793f5588a | ||
|
|
46ff13c7fb | ||
|
|
da8c8fae74 | ||
|
|
ff9eb123c6 | ||
|
|
895d1ea1b6 | ||
|
|
503252c3a2 | ||
|
|
ec0f0768f0 | ||
|
|
68cc6eb93c | ||
|
|
fdfebc18fb | ||
|
|
0cd3ea0e92 | ||
|
|
47a5569f02 | ||
|
|
ca4a72c518 | ||
|
|
6e45b5ae88 | ||
|
|
0f10522e9c | ||
|
|
3913ab65ac | ||
|
|
2048e0899c | ||
|
|
83e1013771 | ||
|
|
99dbc2cd6c | ||
|
|
7d4bab478f | ||
|
|
2f2ed53b58 | ||
|
|
7e1ead91ed | ||
|
|
28578474b9 | ||
|
|
18d7af2b35 | ||
|
|
e3cfb47d66 | ||
|
|
d4e332bf55 | ||
|
|
13f0f67a7b | ||
|
|
716d357738 | ||
|
|
cee336fd7c | ||
|
|
b3497820f9 | ||
|
|
67152806d7 | ||
|
|
5298ad241a | ||
|
|
709cac9332 | ||
|
|
e17196d4c9 | ||
|
|
e2da8ee1fa | ||
|
|
b6c22c1029 | ||
|
|
5c54830b0f | ||
|
|
80be140c1f | ||
|
|
4f9af8bca0 | ||
|
|
af3b7836ff | ||
|
|
cc4a960ea6 | ||
|
|
467d29ca11 | ||
|
|
ac1355771c | ||
|
|
c41adc1019 | ||
|
|
5b74b2d625 | ||
|
|
d7835f68ed | ||
|
|
a1f1a2b969 | ||
|
|
77394995e4 | ||
|
|
9953557497 | ||
|
|
4dc175b2be | ||
|
|
4a2fe00c89 | ||
|
|
db55283b85 | ||
|
|
5c6440e890 | ||
|
|
6b299b0a90 | ||
|
|
9b5d4aa7c4 | ||
|
|
1fdda03199 | ||
|
|
7c846d06ff | ||
|
|
e34e4381d4 | ||
|
|
b255f71958 | ||
|
|
9560b2a0dc | ||
|
|
1a6c22a8a9 | ||
|
|
f8491ceead | ||
|
|
823fe6e9e2 | ||
|
|
b7e9c07a05 | ||
|
|
a9d83e1337 | ||
|
|
86cfcb501a | ||
|
|
8f68b2a347 | ||
|
|
690290449e | ||
|
|
cb5badefcc | ||
|
|
1423a9bbd0 | ||
|
|
39d302175c | ||
|
|
fffb4d964c | ||
|
|
7ba12960dd | ||
|
|
440f45ed4a | ||
|
|
549eaa3382 | ||
|
|
5305f71c2b | ||
|
|
bf749c54ee | ||
|
|
f1e2c1ef68 | ||
|
|
4ab9807cbe | ||
|
|
9f9c9a10c5 | ||
|
|
a5ed3c40a9 | ||
|
|
1fe4789760 | ||
|
|
9c1e94c550 | ||
|
|
958c9eadc7 | ||
|
|
ca3f516457 | ||
|
|
e326381604 | ||
|
|
c25437871a | ||
|
|
04215fc37a | ||
|
|
8d90357f40 | ||
|
|
46add8d841 | ||
|
|
1e695d51b5 | ||
|
|
65f864d743 | ||
|
|
bc51aac622 | ||
|
|
3c39ccd5df | ||
|
|
cd4a96983e | ||
|
|
c0d3602a91 | ||
|
|
08175b89e9 | ||
|
|
ece696d7db | ||
|
|
e7052f5aff | ||
|
|
ff97327803 | ||
|
|
8dda99c499 | ||
|
|
947aa27e40 | ||
|
|
1425c15ee8 | ||
|
|
cdbd2db8e9 | ||
|
|
ef02d77439 | ||
|
|
662fff9edf | ||
|
|
e96088fc0f | ||
|
|
7472657812 | ||
|
|
88ce241785 | ||
|
|
6becaf2acd | ||
|
|
c5c21cd8db | ||
|
|
b64dd1e87e | ||
|
|
a0b9856d61 | ||
|
|
d6552982a3 | ||
|
|
42eac92737 | ||
|
|
a2cee97f33 | ||
|
|
0541a662ff | ||
|
|
b960146512 | ||
|
|
6c9b7a6fde | ||
|
|
ff9a2802f8 | ||
|
|
06ca0ffb21 | ||
|
|
80e5655be9 | ||
|
|
0b7ca97e53 | ||
|
|
812160839f | ||
|
|
27e46d77e6 | ||
|
|
a10d12e589 | ||
|
|
ac7652f3aa | ||
|
|
c63fedefe9 | ||
|
|
3b6fb9f64e | ||
|
|
acfb32bf1d | ||
|
|
c17ef87651 | ||
|
|
846f77b054 | ||
|
|
d5c29a6c4b | ||
|
|
31861f020f | ||
|
|
abf83361e8 | ||
|
|
3e8801d8d4 | ||
|
|
bbc9eb1f81 | ||
|
|
c8b602d349 | ||
|
|
715eb02844 | ||
|
|
c8f7e92124 | ||
|
|
eae44ee6cb | ||
|
|
3fde593a86 | ||
|
|
1527ec8ddc | ||
|
|
f9946928c1 | ||
|
|
5176fca8f0 | ||
|
|
4852f5558a | ||
|
|
c90584bda5 | ||
|
|
aea3b40c54 | ||
|
|
d394e108bd | ||
|
|
0df9f01ffe | ||
|
|
9745bb7543 | ||
|
|
cab030237b | ||
|
|
439ac9fe44 | ||
|
|
7eef9467aa | ||
|
|
15387b1da8 | ||
|
|
c33d297fa4 | ||
|
|
c8af103498 | ||
|
|
0e2610eee0 | ||
|
|
e201a6ed06 | ||
|
|
1e4d616b88 | ||
|
|
2de01671e9 | ||
|
|
dd26a3af34 | ||
|
|
4b41395144 | ||
|
|
2dacc71e8a | ||
|
|
4869c7ee21 | ||
|
|
9293dcf0df | ||
|
|
150057ef50 | ||
|
|
c81f18c3bc | ||
|
|
42aa437ac2 | ||
|
|
6a780314fb | ||
|
|
ffae9cf3d4 | ||
|
|
091f59c241 | ||
|
|
288fa6180b | ||
|
|
7ecb546a86 | ||
|
|
f7c8dd6254 | ||
|
|
2adc9d032a | ||
|
|
f53075ec4f | ||
|
|
0190813012 | ||
|
|
b0c75a2319 | ||
|
|
73d7303b6e | ||
|
|
2d8f2cbd63 | ||
|
|
cb2ce8f67f | ||
|
|
d6d103cf15 | ||
|
|
20d187d642 | ||
|
|
91bd9288f5 | ||
|
|
24df32e9a9 | ||
|
|
fb75ad6902 | ||
|
|
aa87274378 | ||
|
|
696a1126c7 | ||
|
|
7c4787a1a7 | ||
|
|
74d24b6809 | ||
|
|
22226c666f | ||
|
|
b3244a4639 | ||
|
|
6cf3c4c109 | ||
|
|
8f47bd4a4f | ||
|
|
c03f01ca44 | ||
|
|
7f36783582 | ||
|
|
ab0ed775e1 | ||
|
|
5a600c0e17 | ||
|
|
601a863fc4 | ||
|
|
366eab9cae | ||
|
|
021c2890d2 | ||
|
|
ed851c232a | ||
|
|
2eff325a23 | ||
|
|
d7e70c1870 | ||
|
|
0311d59e78 | ||
|
|
6a6c8d866e | ||
|
|
11d82a22c3 | ||
|
|
dcfe55e881 | ||
|
|
494d1a021c | ||
|
|
d95557d683 | ||
|
|
48ccc02799 | ||
|
|
f3440389be | ||
|
|
bad9b1d550 | ||
|
|
920a3ef6a9 | ||
|
|
15816c56bb | ||
|
|
e1d07fdc99 | ||
|
|
e69395a5ad | ||
|
|
1c10cba5fc | ||
|
|
3a1042e6ae | ||
|
|
a2a008b108 | ||
|
|
11f8ba81fd | ||
|
|
e8d216b671 | ||
|
|
167d076edc | ||
|
|
5c5634d355 | ||
|
|
1eea34e832 | ||
|
|
3873fd90ba | ||
|
|
38a659b08c | ||
|
|
55b6961a4b | ||
|
|
2b87629dca | ||
|
|
48c4240c38 | ||
|
|
f84793bfab | ||
|
|
0200ac848f | ||
|
|
787bb74b3b | ||
|
|
8f58cdd182 | ||
|
|
8f0691f3bd | ||
|
|
a81ce21721 | ||
|
|
1e0992be6c | ||
|
|
00706ad744 | ||
|
|
31d47cfb35 | ||
|
|
7e29f7d363 | ||
|
|
e5e4b04151 | ||
|
|
283d343dd6 | ||
|
|
71a1ab091f | ||
|
|
9e020e5d59 | ||
|
|
5e10f1c777 | ||
|
|
a2aa116204 | ||
|
|
ac65cc56bb | ||
|
|
9e3f07742b | ||
|
|
aa85c8708e | ||
|
|
b120c37cbc | ||
|
|
f93506fed9 | ||
|
|
b92f9d30fc | ||
|
|
3673e57c6f | ||
|
|
9fb6ae4fc0 | ||
|
|
6211e7a1f8 | ||
|
|
5d23f83db6 | ||
|
|
a2ea9bf10b | ||
|
|
d6495dec96 | ||
|
|
583601644c | ||
|
|
5cbe3ba708 | ||
|
|
375d2330de | ||
|
|
e39a3cde16 | ||
|
|
13d0ff320a | ||
|
|
72577a04b7 | ||
|
|
0bf2039e60 | ||
|
|
414efb0ce7 | ||
|
|
0500d63654 | ||
|
|
3a86862e4f | ||
|
|
8df65b2dc3 | ||
|
|
c3bc8fdd2d | ||
|
|
200cd62dc9 | ||
|
|
527e5872df | ||
|
|
ebaf4e9395 | ||
|
|
d0afcbffe4 | ||
|
|
2e9d56d053 | ||
|
|
90419e70cf | ||
|
|
0566133c12 | ||
|
|
8e824eb5e0 | ||
|
|
5534cdbdde | ||
|
|
2db0b011e6 | ||
|
|
962b40f0e9 | ||
|
|
96450c476c | ||
|
|
ba09b3f7cd | ||
|
|
053e3e9477 | ||
|
|
ff939e356e | ||
|
|
e4d5c53d69 | ||
|
|
4549c51959 | ||
|
|
20e4ae5ff8 | ||
|
|
77f455651d | ||
|
|
7a3c231f68 | ||
|
|
0ec77d7652 | ||
|
|
4f886e15ed | ||
|
|
d3454d8126 | ||
|
|
ccc0ebb7d5 | ||
|
|
f6bfb10500 | ||
|
|
e241f38dd7 | ||
|
|
fb0dd82fe2 | ||
|
|
6997e0c451 | ||
|
|
2e73d071c9 | ||
|
|
f86f6bbc08 | ||
|
|
6c872e60fc | ||
|
|
23f77a7e72 | ||
|
|
25dd45f47c | ||
|
|
2680bafd69 | ||
|
|
08c1f105c2 | ||
|
|
c152892610 | ||
|
|
d54ead2868 | ||
|
|
81ae63b2c0 | ||
|
|
9f17c34f50 | ||
|
|
5ea816ce2b | ||
|
|
541d410e41 | ||
|
|
03348b8ff2 | ||
|
|
d0be61ad96 | ||
|
|
89f99ef663 | ||
|
|
9f4270f4a5 | ||
|
|
bda3484cac | ||
|
|
aec2ef0198 | ||
|
|
651edcc7c5 | ||
|
|
d975cd8ca1 | ||
|
|
c315d04d5d | ||
|
|
e77562d469 | ||
|
|
088fd6631d | ||
|
|
cc102847f9 | ||
|
|
b88a102629 | ||
|
|
452eb653a5 | ||
|
|
1584883f39 | ||
|
|
595a720d8b | ||
|
|
2a0decc7c6 | ||
|
|
d10386821e | ||
|
|
8da8e83e48 | ||
|
|
80bb601813 | ||
|
|
21b60e0708 | ||
|
|
0fd88a6ba7 | ||
|
|
8da7bde2a5 | ||
|
|
ceb119b226 | ||
|
|
6790d85a87 | ||
|
|
873f61fde6 | ||
|
|
f716c7fd1d | ||
|
|
50ac69b234 | ||
|
|
712b1078f2 | ||
|
|
893e61e319 | ||
|
|
bfd0ccd652 | ||
|
|
3feb93c074 | ||
|
|
a5ce958b92 | ||
|
|
47e1dff5c5 | ||
|
|
9ddf9e3e1a | ||
|
|
9747cb9204 | ||
|
|
bd35db8d87 | ||
|
|
23ff795809 | ||
|
|
48d2721605 | ||
|
|
9d78092121 | ||
|
|
a0b1501b2a | ||
|
|
2e8743eb6b | ||
|
|
c4e724e0e6 | ||
|
|
792a8f6a07 | ||
|
|
684b480338 | ||
|
|
f1b61c7ef1 | ||
|
|
05bb91d2d9 | ||
|
|
5abd25c408 | ||
|
|
e1a8e2220d | ||
|
|
9d9d3b2e6c | ||
|
|
f79fadab80 | ||
|
|
e3dc7594e5 | ||
|
|
200771cdab | ||
|
|
56760c7445 | ||
|
|
66ff1cca65 | ||
|
|
64ff9b7d40 | ||
|
|
446aed6b9a | ||
|
|
0281c44933 | ||
|
|
df373e93ef | ||
|
|
65ebfde315 | ||
|
|
4f7c50f7f4 | ||
|
|
de232ab2b5 | ||
|
|
067018cf47 | ||
|
|
97e5fa07fa | ||
|
|
dec48a92f3 | ||
|
|
0672fe046e | ||
|
|
b78009bee4 | ||
|
|
5907f54201 | ||
|
|
555865d761 | ||
|
|
c0561ad8c0 | ||
|
|
28e7af7107 | ||
|
|
f9bc46b460 | ||
|
|
3730ca8811 | ||
|
|
69716730ac | ||
|
|
ef8049c21d | ||
|
|
cf80bf31f3 | ||
|
|
28bf01396c | ||
|
|
cf900e1390 | ||
|
|
df31b4d20e | ||
|
|
a9185b7876 | ||
|
|
f383d50f16 | ||
|
|
369073e636 | ||
|
|
eb6a638a59 | ||
|
|
9a743ab425 | ||
|
|
36d89a9ad8 | ||
|
|
7dfe1b6fab | ||
|
|
ebc6525b65 | ||
|
|
c5ae146683 | ||
|
|
70daa9d3fa | ||
|
|
95d3d427a4 | ||
|
|
8de387a92d | ||
|
|
5e6055c9bd | ||
|
|
c4338aaaeb | ||
|
|
ca06352bda | ||
|
|
edf78d7248 | ||
|
|
d0d40c93d3 | ||
|
|
11730ed932 | ||
|
|
0c4737aca1 | ||
|
|
159390f989 | ||
|
|
5de8521ac8 | ||
|
|
d957474618 | ||
|
|
7c56785fcc | ||
|
|
debc187874 | ||
|
|
6ccac55e1d | ||
|
|
ed77a6753c | ||
|
|
6e7df6e1f7 | ||
|
|
4f867dabe6 | ||
|
|
106a917dbc | ||
|
|
2cf5b9710a | ||
|
|
c60e7e906d | ||
|
|
7521678e5f | ||
|
|
d828e961bd | ||
|
|
fef84f8559 | ||
|
|
39b112dacc | ||
|
|
6054a6509c | ||
|
|
6f3a38d708 | ||
|
|
8e0fa710ee | ||
|
|
309c6d345b | ||
|
|
6a466d2c9c | ||
|
|
7a81d3b6ef | ||
|
|
b0a4820e80 | ||
|
|
fe569a6fbc | ||
|
|
b556eac851 | ||
|
|
84aea0e869 | ||
|
|
841e102971 | ||
|
|
7f65e1e48c | ||
|
|
99a5a85248 | ||
|
|
6cc1eb2c0f | ||
|
|
3d77a7a2cd | ||
|
|
53dd12e339 | ||
|
|
0c3d388f5a | ||
|
|
f73788fab3 | ||
|
|
b5bac7690e | ||
|
|
1438783c07 | ||
|
|
bca7c5340a | ||
|
|
794d3733c1 | ||
|
|
f63f63bb43 | ||
|
|
10c821c466 | ||
|
|
85094805f2 | ||
|
|
adab5487fd | ||
|
|
263933c589 | ||
|
|
120fcf3b37 | ||
|
|
d5542f7555 | ||
|
|
82e4411b45 | ||
|
|
62bba0ffa6 | ||
|
|
f5e45ce938 | ||
|
|
d342cdb6ad | ||
|
|
9b69ed417e | ||
|
|
e689f206cb | ||
|
|
8f80498c2e | ||
|
|
4d07d2c8b1 | ||
|
|
ac31067333 | ||
|
|
c293c39118 | ||
|
|
b8d148e79d | ||
|
|
b29cc6824c | ||
|
|
7d73bc8b23 | ||
|
|
22dbf290b4 | ||
|
|
dcec1e2e95 | ||
|
|
a64b5c1046 | ||
|
|
a5b0b2a1b5 | ||
|
|
6643d417b7 | ||
|
|
9ad20d013b | ||
|
|
37c8e5924f | ||
|
|
ea62a22998 | ||
|
|
fa744b1b97 | ||
|
|
15907a6112 | ||
|
|
b58b6d8375 | ||
|
|
ffa1fdbf1a | ||
|
|
5b646f9618 | ||
|
|
cbff8d50fa | ||
|
|
cc37fcfa78 | ||
|
|
71d6e692eb | ||
|
|
045667dce8 | ||
|
|
93dcf5b68a | ||
|
|
1b383e1d57 | ||
|
|
83c03cc3c7 | ||
|
|
419fa31d6e | ||
|
|
17bb3f66e8 | ||
|
|
97ba43a898 | ||
|
|
51bbcc2a7d | ||
|
|
8e8a78ca10 | ||
|
|
dd062c673f | ||
|
|
4cb57c5f1e | ||
|
|
bf1ef04ce2 | ||
|
|
4a86604bcc | ||
|
|
6610c1a50c | ||
|
|
957d7e5722 | ||
|
|
9844d0cff4 | ||
|
|
141ffeb474 | ||
|
|
31614d0c4d | ||
|
|
3817fc2cc6 | ||
|
|
3a278c1f5b | ||
|
|
6c8a6b2822 | ||
|
|
0d4c7a7e28 | ||
|
|
97b23cd002 | ||
|
|
97ec85ba2a | ||
|
|
cdfaadf986 | ||
|
|
9919853d07 | ||
|
|
a0477b03e3 | ||
|
|
d4d31efeb7 | ||
|
|
5fd3f379fc | ||
|
|
b2fca4c55a | ||
|
|
1a7b97b8b2 | ||
|
|
247016b61d | ||
|
|
13f1e6a713 | ||
|
|
f9e332cac7 | ||
|
|
0b3483fb8a | ||
|
|
9379ab131c | ||
|
|
5fa698f5b7 | ||
|
|
83991c132a | ||
|
|
6e7190b6bd | ||
|
|
9791118581 | ||
|
|
186ea7e8c3 | ||
|
|
3184df7d6c | ||
|
|
06284ecd13 | ||
|
|
4150f8c032 | ||
|
|
8051186de3 | ||
|
|
d9c97d3ef5 | ||
|
|
73d59e082d | ||
|
|
57273dd96f | ||
|
|
b4e023b7ce | ||
|
|
924e74d3c8 | ||
|
|
335d326a73 | ||
|
|
d572a67855 | ||
|
|
328608dfff | ||
|
|
be78216ff3 | ||
|
|
24a29f2251 | ||
|
|
d4655112ca | ||
|
|
f30710c5a8 | ||
|
|
eee94086db | ||
|
|
ca152ecbc0 | ||
|
|
fce4823d2c | ||
|
|
a20b95b87c | ||
|
|
640571a6bc | ||
|
|
2ad0085370 | ||
|
|
053d3191c8 | ||
|
|
6b6f5ee09d | ||
|
|
481296ad21 | ||
|
|
55d4a639d9 | ||
|
|
b19c9fc885 | ||
|
|
a2abd43fd2 | ||
|
|
1ab9d95b9c | ||
|
|
08b490a3cc | ||
|
|
919c7127e7 | ||
|
|
98550c31c9 | ||
|
|
4deff42aff | ||
|
|
e8cbd81ad0 | ||
|
|
54a8fbd185 | ||
|
|
49c6a7806b | ||
|
|
251e90433e | ||
|
|
3f7d1f588b | ||
|
|
9a3b073fc6 | ||
|
|
f92761437d | ||
|
|
f186907d8b | ||
|
|
718bd99c24 | ||
|
|
5c0f39759e | ||
|
|
bc9607a735 | ||
|
|
01e40c4684 | ||
|
|
69fe2d7b3a | ||
|
|
363dd5358f | ||
|
|
3487194415 | ||
|
|
08dc9e0be9 | ||
|
|
781b2238c6 | ||
|
|
e51504b3ec | ||
|
|
af0e578a44 | ||
|
|
140970ac37 | ||
|
|
0b78332a20 | ||
|
|
c9f08a3e6e | ||
|
|
52a1f42426 | ||
|
|
7bbba6e897 | ||
|
|
0f5008f301 | ||
|
|
dc1022e6f3 | ||
|
|
63eaaa325e | ||
|
|
819738cc77 | ||
|
|
d096e603d4 | ||
|
|
0d614fe0c3 | ||
|
|
d8ed965282 | ||
|
|
39092ff18e | ||
|
|
7d297a5c96 | ||
|
|
785fdea56d | ||
|
|
b8198c0d4f | ||
|
|
58f755d136 | ||
|
|
8d1c244e02 | ||
|
|
37898bee60 | ||
|
|
7b05d1d1b6 | ||
|
|
625b7d9a81 | ||
|
|
cb08443b27 | ||
|
|
207361d227 | ||
|
|
de5b5bdda5 | ||
|
|
e25472fc18 | ||
|
|
026d296d8f | ||
|
|
537017925f | ||
|
|
37af01483a | ||
|
|
726f5e851d | ||
|
|
1ddd868449 | ||
|
|
4a6e47c86b | ||
|
|
02b893cc89 | ||
|
|
b8f89e97cd | ||
|
|
42c8ee8adf | ||
|
|
9d0a49b2be | ||
|
|
5de5a5cd91 | ||
|
|
73fa0951f7 | ||
|
|
4e3879a949 | ||
|
|
7f55829035 | ||
|
|
63dd826377 | ||
|
|
2565774fea | ||
|
|
c72974de27 | ||
|
|
676e7be9fb | ||
|
|
cfca0434ba | ||
|
|
8264f72a5a | ||
|
|
3cb6ba237c | ||
|
|
e8e8dc2828 | ||
|
|
8a5b07f8d2 | ||
|
|
98f0d7ed31 | ||
|
|
dc45f7625a |
4
.bowerrc
4
.bowerrc
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"directory": "vendor/bower_components",
|
||||
"interactive": false
|
||||
}
|
||||
@@ -9,10 +9,11 @@ DB_DATABASE=cachet
|
||||
DB_USERNAME=homestead
|
||||
DB_PASSWORD=secret
|
||||
DB_PORT=null
|
||||
DB_PREFIX=null
|
||||
|
||||
CACHE_DRIVER=file
|
||||
SESSION_DRIVER=file
|
||||
QUEUE_DRIVER=database
|
||||
QUEUE_DRIVER=sync
|
||||
CACHET_EMOJI=false
|
||||
|
||||
MAIL_DRIVER=smtp
|
||||
|
||||
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1,3 +1,5 @@
|
||||
* text=auto
|
||||
*.css linguist-vendored
|
||||
*.scss linguist-vendored
|
||||
/.github export-ignore
|
||||
/tests export-ignore
|
||||
|
||||
20
.github/ISSUE_TEMPLATE
vendored
Normal file
20
.github/ISSUE_TEMPLATE
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Before submitting your issue, please make sure that you've checked the checkboxes below.
|
||||
|
||||
- [ ] I am running the [latest release](https://github.com/CachetHQ/Cachet/releases/latest) version of Cachet.
|
||||
- [ ] I am running at least PHP 5.6.4. *You can check this by running `php -v`.*
|
||||
- [ ] I have ran `rm -rf bootstrap/cache/*`.
|
||||
|
||||
### Expected behaviour
|
||||
|
||||
*Please describe what you're expecting to see happen.*
|
||||
|
||||
### Actual behaviour
|
||||
|
||||
*Please describe what you're actually seeing happen.*
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
*If your issue requires any specific steps to reproduce, please outline them here.*
|
||||
|
||||
1. First step
|
||||
2. Second step
|
||||
13
.travis.yml
13
.travis.yml
@@ -1,21 +1,12 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.5.9
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- hhvm
|
||||
|
||||
sudo: false
|
||||
|
||||
install:
|
||||
- travis_retry composer install --no-interaction --no-scripts --prefer-source
|
||||
install: travis_retry composer install --no-interaction --no-scripts --prefer-source
|
||||
|
||||
script:
|
||||
- if [ "$TRAVIS_PHP_VERSION" != "5.6" ] || [ "$TRAVIS_PULL_REQUEST" != false ]; then vendor/bin/phpunit; fi
|
||||
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ] && [ "$TRAVIS_PULL_REQUEST" == false ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi
|
||||
|
||||
after_script:
|
||||
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ] && [ "$TRAVIS_PULL_REQUEST" == false ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
|
||||
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ] && [ "$TRAVIS_PULL_REQUEST" == false ]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi
|
||||
script: vendor/bin/phpunit
|
||||
|
||||
64
README.md
64
README.md
@@ -1,13 +1,19 @@
|
||||
# Cachet
|
||||
|
||||
[](https://styleci.io/repos/26730195/)
|
||||
[](https://travis-ci.org/CachetHQ/Cachet)
|
||||
[](https://scrutinizer-ci.com/g/CachetHQ/Cachet)
|
||||
[](https://travis-ci.org/CachetHQ/Cachet)
|
||||
[](LICENSE)
|
||||
[](http://translate.cachethq.io/project/cachet)
|
||||
[](http://translate.cachethq.io/project/cachet)
|
||||
[](https://packagist.org/packages/cachethq/cachet)
|
||||
|
||||

|
||||
|
||||
Cachet is a beautiful and powerful open source status page system, a free replacement to services such as StatusPage.io, Status.io and others.
|
||||
|
||||
## Show your support
|
||||
|
||||
Cachet is a BSD-3-licensed open source project. If you'd like to support future development, check out the [Patreon campaign](https://patreon.com/jbrooksuk).
|
||||
|
||||
## Features
|
||||
|
||||
- List your services components
|
||||
@@ -23,20 +29,49 @@
|
||||
|
||||
## Usage in production
|
||||
|
||||
The `master` branch of this repository is a development branch and **should not** be used in production. Instead, please check out the latest tag release.
|
||||
Use of `master` in a production environment is not recommended as it may change at any time.
|
||||
|
||||
## Requirements
|
||||
|
||||
- PHP 5.5.9+ or newer
|
||||
- PHP 5.6.4+ or newer
|
||||
- Apache or Nginx server
|
||||
- [Composer](https://getcomposer.org)
|
||||
|
||||
### Development Requirements
|
||||
## How to contribute
|
||||
|
||||
These extra dependencies are required to develop Cachet:
|
||||
We're always looking for contributions that improve Cachet. It's easy to get started and you don't even need to know how to write a single line of code!
|
||||
|
||||
### Contributing as a non-developer/non-designer
|
||||
|
||||
We're always looking for new [translations](#translations).
|
||||
|
||||
Of course bug reports, feature requests and [documentation](https://docs.cachethq.io) are always appreciated.
|
||||
|
||||
### Contributing as a designer
|
||||
|
||||
As Cachet gains new features, the design and ideas that were once a perfect fit need updating and in some cases designing from scratch. This is where you come in! Fancy giving Cachet a lick of paint? Sweet!
|
||||
|
||||
You'll need to install Node.js, Bower and Gulp.
|
||||
|
||||
To get started you can do the following:
|
||||
|
||||
1. Install Node.js and our dev dependencies.
|
||||
2. Make your changes to the SCSS files in `./resources/assets/sass/`
|
||||
3. Run `gulp`
|
||||
|
||||
If you're making a lot of changes, you'll find that running `gulp watch` will make life easier for you!
|
||||
|
||||
### Contributing as a developer
|
||||
|
||||
Built using [Laravel](https://laravel.com).
|
||||
|
||||
We use these extra dependencies to develop Cachet:
|
||||
|
||||
- Node.js
|
||||
- Bower
|
||||
- Gulp
|
||||
- Git
|
||||
|
||||
Once cloned to your local machine, you'll need some demo data! Run `php artisan cachet:seed` to get the demo installation on the go.
|
||||
|
||||
## Installation, Upgrades and Documentation
|
||||
|
||||
@@ -44,7 +79,6 @@ You can now find our documentation at [https://docs.cachethq.io](https://docs.ca
|
||||
|
||||
- [Installing Cachet](https://docs.cachethq.io/docs/installing-cachet)
|
||||
- [Getting started with Docker](https://docs.cachethq.io/docs/get-started-with-docker)
|
||||
- [Getting started with Vagrant](https://docs.cachethq.io/docs/get-started-with-vagrant)
|
||||
|
||||
### Demo Account
|
||||
|
||||
@@ -55,10 +89,20 @@ To test out the demo, you may login to the [Dashboard](https://demo.cachethq.io/
|
||||
|
||||
The demo is reset every half hour.
|
||||
|
||||
### Release Notes
|
||||
|
||||
We list releases on the [Releases page](https://github.com/CachetHQ/Cachet/releases) of the [Cachet GitHub repository](https://github.com/CachetHQ/Cachet). On the Releases page, you can also find the release notes for each release.
|
||||
|
||||
## Translations
|
||||
|
||||
A special thank you to our [translators](https://crowdin.com/project/cachet/activity_stream), who have allowed us to share Cachet with the world. If you'd like to contribute translations, please check out our [CrowdIn project](https://crowdin.com/project/cachet).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Cachet, please send an e-mail to us at support@alt-three.com. All security vulnerabilities will be promptly addressed.
|
||||
If you discover a security vulnerability within Cachet, please send an e-mail to us at support@alt-three.com. We handle all security vulnerabilities on a case-by-case basis.
|
||||
|
||||
## Installations
|
||||
|
||||
We offer a paid installation service, which starts at $99 but is subject to change, dependant on your setup and infrastructure.
|
||||
|
||||
To find out more, email us at support@alt-three.com
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\ComponentGroup;
|
||||
|
||||
/**
|
||||
* This is the add component group command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class AddComponentGroupCommand
|
||||
{
|
||||
/**
|
||||
@@ -30,7 +35,7 @@ final class AddComponentGroupCommand
|
||||
/**
|
||||
* Is the component group collapsed?
|
||||
*
|
||||
* @var bool
|
||||
* @var int
|
||||
*/
|
||||
public $collapsed;
|
||||
|
||||
@@ -42,7 +47,7 @@ final class AddComponentGroupCommand
|
||||
public $rules = [
|
||||
'name' => 'required|string',
|
||||
'order' => 'int',
|
||||
'collapsed' => 'bool',
|
||||
'collapsed' => 'int|between:0,3',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -50,7 +55,7 @@ final class AddComponentGroupCommand
|
||||
*
|
||||
* @param string $name
|
||||
* @param int $order
|
||||
* @param bool $collapsed
|
||||
* @param int $collapsed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,11 @@ namespace CachetHQ\Cachet\Bus\Commands\ComponentGroup;
|
||||
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
|
||||
/**
|
||||
* This is the update component group command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class UpdateComponentGroupCommand
|
||||
{
|
||||
/**
|
||||
@@ -39,7 +44,7 @@ final class UpdateComponentGroupCommand
|
||||
/**
|
||||
* Is the component group collapsed?
|
||||
*
|
||||
* @var bool
|
||||
* @var int
|
||||
*/
|
||||
public $collapsed;
|
||||
|
||||
@@ -51,7 +56,7 @@ final class UpdateComponentGroupCommand
|
||||
public $rules = [
|
||||
'name' => 'string',
|
||||
'order' => 'int',
|
||||
'collapsed' => 'bool',
|
||||
'collapsed' => 'int|between:0,3',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -60,7 +65,7 @@ final class UpdateComponentGroupCommand
|
||||
* @param \CachetHQ\Cachet\Models\ComponentGroup $group
|
||||
* @param string $name
|
||||
* @param int $order
|
||||
* @param bool $collapsed
|
||||
* @param int $collapsed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
61
app/Bus/Commands/ComponentTag/AddComponentTagCommand.php
Normal file
61
app/Bus/Commands/ComponentTag/AddComponentTagCommand.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\ComponentTag;
|
||||
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Tag;
|
||||
|
||||
/**
|
||||
* This is the add component tag command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class AddComponentTagCommand
|
||||
{
|
||||
/**
|
||||
* The component to add the tag to.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
public $component;
|
||||
|
||||
/**
|
||||
* The tag to add to the component.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Tag
|
||||
*/
|
||||
public $tag;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'component' => 'required',
|
||||
'tag' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a add component tag command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Component $component
|
||||
* @param \CachetHQ\Cachet\Models\Tag $tag
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Component $component, Tag $tag)
|
||||
{
|
||||
$this->component = $component;
|
||||
$this->tag = $tag;
|
||||
}
|
||||
}
|
||||
61
app/Bus/Commands/ComponentTag/DeleteComponentTagCommand.php
Normal file
61
app/Bus/Commands/ComponentTag/DeleteComponentTagCommand.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\ComponentTag;
|
||||
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Tag;
|
||||
|
||||
/**
|
||||
* This is the delete component tag command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class DeleteComponentTagCommand
|
||||
{
|
||||
/**
|
||||
* The component to delete the tag from.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
public $component;
|
||||
|
||||
/**
|
||||
* The tag to delete.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Tag
|
||||
*/
|
||||
public $tag;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'component' => 'required',
|
||||
'tag' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a delete component tag command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Component $component
|
||||
* @param \CachetHQ\Cachet\Models\Tag $tag
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Component $component, Tag $tag)
|
||||
{
|
||||
$this->component = $component;
|
||||
$this->tag = $tag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\IncidentUpdate;
|
||||
|
||||
use CachetHQ\Cachet\Models\IncidentUpdate;
|
||||
|
||||
/**
|
||||
* This is the remove incident update command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class RemoveIncidentUpdateCommand
|
||||
{
|
||||
/**
|
||||
* The incident update to remove.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\IncidentUpdate
|
||||
*/
|
||||
public $incidentUpdate;
|
||||
|
||||
/**
|
||||
* Create a new remove incident update command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $incidentUpdate
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(IncidentUpdate $incidentUpdate)
|
||||
{
|
||||
$this->incidentUpdate = $incidentUpdate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\IncidentUpdate;
|
||||
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
|
||||
/**
|
||||
* This is the report incident update command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class ReportIncidentUpdateCommand
|
||||
{
|
||||
/**
|
||||
* The incident.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Incident
|
||||
*/
|
||||
public $incident;
|
||||
|
||||
/**
|
||||
* The incident status.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* The incident message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* The user.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\User
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'incident' => 'required',
|
||||
'status' => 'required|int|min:1|max:4',
|
||||
'message' => 'required|string',
|
||||
'user' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new report incident update command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
* @param string $status
|
||||
* @param string $message
|
||||
* @param \CachetHQ\Cachet\Models\User $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Incident $incident, $status, $message, User $user)
|
||||
{
|
||||
$this->incident = $incident;
|
||||
$this->status = $status;
|
||||
$this->message = $message;
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\IncidentUpdate;
|
||||
|
||||
use CachetHQ\Cachet\Models\IncidentUpdate;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
|
||||
/**
|
||||
* This is the update incident update command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class UpdateIncidentUpdateCommand
|
||||
{
|
||||
/**
|
||||
* The incident update.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\IncidentUpdate
|
||||
*/
|
||||
public $update;
|
||||
|
||||
/**
|
||||
* The incident status.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* The incident message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* The user.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\User
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'update' => 'required',
|
||||
'status' => 'int|min:1|max:4',
|
||||
'message' => 'string',
|
||||
'user' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new update incident update command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
|
||||
* @param string $status
|
||||
* @param string $message
|
||||
* @param \CachetHQ\Cachet\Models\User $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(IncidentUpdate $update, $status, $message, User $user)
|
||||
{
|
||||
$this->update = $update;
|
||||
$this->status = $status;
|
||||
$this->message = $message;
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,20 @@ final class AddMetricCommand
|
||||
*/
|
||||
public $default_view;
|
||||
|
||||
/**
|
||||
* The threshold to buffer the metric points in.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $threshold;
|
||||
|
||||
/**
|
||||
* The order of which to place the metric in.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $order;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
@@ -84,6 +98,8 @@ final class AddMetricCommand
|
||||
'display_chart' => 'int',
|
||||
'places' => 'int|between:0,4',
|
||||
'default_view' => 'int|between:0,3',
|
||||
'threshold' => 'numeric|between:0,10',
|
||||
'order' => 'int',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -97,10 +113,12 @@ final class AddMetricCommand
|
||||
* @param int $display_chart
|
||||
* @param int $places
|
||||
* @param int $default_view
|
||||
* @param int $threshold
|
||||
* @param int $order
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($name, $suffix, $description, $default_value, $calc_type, $display_chart, $places, $default_view)
|
||||
public function __construct($name, $suffix, $description, $default_value, $calc_type, $display_chart, $places, $default_view, $threshold, $order = 0)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->suffix = $suffix;
|
||||
@@ -110,5 +128,7 @@ final class AddMetricCommand
|
||||
$this->display_chart = $display_chart;
|
||||
$this->places = $places;
|
||||
$this->default_view = $default_view;
|
||||
$this->threshold = $threshold;
|
||||
$this->order = $order;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ final class AddMetricPointCommand
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'value' => 'int',
|
||||
'value' => 'numeric',
|
||||
'created_at' => 'string',
|
||||
];
|
||||
|
||||
|
||||
@@ -78,6 +78,20 @@ final class UpdateMetricCommand
|
||||
*/
|
||||
public $default_view;
|
||||
|
||||
/**
|
||||
* The threshold to buffer the metric points in.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $threshold;
|
||||
|
||||
/**
|
||||
* The order of which to place the metric in.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $order;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
@@ -93,6 +107,8 @@ final class UpdateMetricCommand
|
||||
'display_chart' => 'int',
|
||||
'places' => 'numeric|between:0,4',
|
||||
'default_view' => 'numeric|between:0,4',
|
||||
'threshold' => 'numeric|between:0,10',
|
||||
'order' => 'int',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -107,10 +123,12 @@ final class UpdateMetricCommand
|
||||
* @param int $display_chart
|
||||
* @param int $places
|
||||
* @param int $default_view
|
||||
* @param int $threshold
|
||||
* @param int|null $order
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Metric $metric, $name, $suffix, $description, $default_value, $calc_type, $display_chart, $places, $default_view)
|
||||
public function __construct(Metric $metric, $name, $suffix, $description, $default_value, $calc_type, $display_chart, $places, $default_view, $threshold, $order = null)
|
||||
{
|
||||
$this->metric = $metric;
|
||||
$this->name = $name;
|
||||
@@ -121,5 +139,7 @@ final class UpdateMetricCommand
|
||||
$this->display_chart = $display_chart;
|
||||
$this->places = $places;
|
||||
$this->default_view = $default_view;
|
||||
$this->threshold = $threshold;
|
||||
$this->order = $order;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,11 @@ namespace CachetHQ\Cachet\Bus\Commands\Metric;
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
|
||||
/**
|
||||
* This is the update metric point command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class UpdateMetricPointCommand
|
||||
{
|
||||
/**
|
||||
@@ -33,7 +38,7 @@ final class UpdateMetricPointCommand
|
||||
/**
|
||||
* The metric point value.
|
||||
*
|
||||
* @var int
|
||||
* @var float
|
||||
*/
|
||||
public $value;
|
||||
|
||||
@@ -50,7 +55,7 @@ final class UpdateMetricPointCommand
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'value' => 'int',
|
||||
'value' => 'numeric',
|
||||
'created_at' => 'string',
|
||||
];
|
||||
|
||||
@@ -59,7 +64,7 @@ final class UpdateMetricPointCommand
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\MetricPoint $point
|
||||
* @param \CachetHQ\Cachet\Models\Metric $metric
|
||||
* @param int $value
|
||||
* @param float $value
|
||||
* @param string $created_at
|
||||
*
|
||||
* @return void
|
||||
|
||||
@@ -33,7 +33,7 @@ final class SubscribeSubscriberCommand
|
||||
public $verified;
|
||||
|
||||
/**
|
||||
* The subscriptions that we want to add.
|
||||
* The list of subscriptions to set the subscriber up with.
|
||||
*
|
||||
* @var array|null
|
||||
*/
|
||||
@@ -53,7 +53,7 @@ final class SubscribeSubscriberCommand
|
||||
*
|
||||
* @param string $email
|
||||
* @param bool $verified
|
||||
* @param null|array $subscriptions
|
||||
* @param array|null $subscriptions
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\Subscriber;
|
||||
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
|
||||
/**
|
||||
* This is the subscribe subscriber command.
|
||||
*
|
||||
* @author Joseph Cohen <joe@alt-three.com>
|
||||
*/
|
||||
final class UpdateSubscriberSubscriptionCommand
|
||||
{
|
||||
/**
|
||||
* The subscriber email.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Subscriber
|
||||
*/
|
||||
public $subscriber;
|
||||
|
||||
/**
|
||||
* The subscriptions that we want to add.
|
||||
*
|
||||
* @var array|null
|
||||
*/
|
||||
public $subscriptions;
|
||||
|
||||
/**
|
||||
* Create a new subscribe subscriber command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
|
||||
* @param null|array $subscriptions
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($subscriber, $subscriptions = null)
|
||||
{
|
||||
$this->subscriber = $subscriber;
|
||||
$this->subscriptions = $subscriptions;
|
||||
}
|
||||
}
|
||||
58
app/Bus/Commands/Tag/CreateTagCommand.php
Normal file
58
app/Bus/Commands/Tag/CreateTagCommand.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\Tag;
|
||||
|
||||
/**
|
||||
* This is the create tag command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class CreateTagCommand
|
||||
{
|
||||
/**
|
||||
* The name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The slug.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $slug;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'required|string',
|
||||
'slug' => 'sometimes|string',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new create tag command instance.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $slug
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($name, $slug)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->slug = $slug;
|
||||
}
|
||||
}
|
||||
50
app/Bus/Commands/Tag/DeleteTagCommand.php
Normal file
50
app/Bus/Commands/Tag/DeleteTagCommand.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\Tag;
|
||||
|
||||
use CachetHQ\Cachet\Models\Tag;
|
||||
|
||||
/**
|
||||
* This is the delete tag command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class DeleteTagCommand
|
||||
{
|
||||
/**
|
||||
* The tag.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Tag
|
||||
*/
|
||||
public $tag;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $rules = [
|
||||
'tag' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new delete tag command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Tag $tag
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Tag $tag)
|
||||
{
|
||||
$this->tag = $tag;
|
||||
}
|
||||
}
|
||||
70
app/Bus/Commands/Tag/UpdateTagCommand.php
Normal file
70
app/Bus/Commands/Tag/UpdateTagCommand.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\Tag;
|
||||
|
||||
use CachetHQ\Cachet\Models\Tag;
|
||||
|
||||
/**
|
||||
* This is the update tag command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class UpdateTagCommand
|
||||
{
|
||||
/**
|
||||
* The tag.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Tag
|
||||
*/
|
||||
public $tag;
|
||||
|
||||
/**
|
||||
* The name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The slug.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $slug;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $rules = [
|
||||
'tag' => 'required',
|
||||
'name' => 'sometimes|string',
|
||||
'slug' => 'sometimes|string',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new update tag command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Tag $tag
|
||||
* @param string $name
|
||||
* @param string $slug
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Tag $tag, $name, $slug)
|
||||
{
|
||||
$this->tag = $tag;
|
||||
$this->name = $name;
|
||||
$this->slug = $slug;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,12 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\User;
|
||||
|
||||
final class AddTeamMemberCommand
|
||||
/**
|
||||
* This is the add user command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class AddUserCommand
|
||||
{
|
||||
/**
|
||||
* The user username.
|
||||
@@ -48,8 +53,9 @@ final class AddTeamMemberCommand
|
||||
*/
|
||||
public $rules = [
|
||||
'name' => 'required|string',
|
||||
'password' => 'string',
|
||||
'level' => 'int',
|
||||
'email' => 'required|email',
|
||||
'password' => 'required|string',
|
||||
'level' => 'int|min:1|max:2',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -11,7 +11,12 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\User;
|
||||
|
||||
final class InviteTeamMemberCommand
|
||||
/**
|
||||
* This is the invite user command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class InviteUserCommand
|
||||
{
|
||||
/**
|
||||
* The invite emails.
|
||||
@@ -30,7 +35,7 @@ final class InviteTeamMemberCommand
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new invite team member command instance.
|
||||
* Create a new invite user command instance.
|
||||
*
|
||||
* @param string[] $emails
|
||||
*
|
||||
90
app/Bus/Commands/User/UpdateTeamMemberCommand.php
Normal file
90
app/Bus/Commands/User/UpdateTeamMemberCommand.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Commands\User;
|
||||
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
|
||||
/**
|
||||
* This is the update team member command.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class UpdateTeamMemberCommand
|
||||
{
|
||||
/**
|
||||
* The user to update.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\User
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* The user username.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $username;
|
||||
|
||||
/**
|
||||
* The user password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $password;
|
||||
|
||||
/**
|
||||
* The user email.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* The user level.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $level;
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'user' => 'required',
|
||||
'name' => 'required|string',
|
||||
'email' => 'required|email',
|
||||
'password' => 'required|string',
|
||||
'level' => 'int|min:1|max:2',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new add team member command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\User $user
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param string $email
|
||||
* @param int $level
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $user, $username, $password, $email, $level)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
$this->email = $email;
|
||||
$this->level = $level;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Events\EventInterface;
|
||||
|
||||
/**
|
||||
* This is the incident update event interface.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
interface IncidentUpdateEventInterface extends EventInterface
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;
|
||||
|
||||
use CachetHQ\Cachet\Models\IncidentUpdate;
|
||||
|
||||
/**
|
||||
* This is the incident update was removed event.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class IncidentUpdateWasRemovedEvent implements IncidentUpdateEventInterface
|
||||
{
|
||||
/**
|
||||
* The incident update that has been removed.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\IncidentUpdate
|
||||
*/
|
||||
public $update;
|
||||
|
||||
/**
|
||||
* Create a new incident update was removed event instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(IncidentUpdate $update)
|
||||
{
|
||||
$this->update = $update;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;
|
||||
|
||||
use CachetHQ\Cachet\Models\IncidentUpdate;
|
||||
|
||||
/**
|
||||
* This is the incident update was reported event.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class IncidentUpdateWasReportedEvent implements IncidentUpdateEventInterface
|
||||
{
|
||||
/**
|
||||
* The incident update that has been reported.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\IncidentUpdate
|
||||
*/
|
||||
public $update;
|
||||
|
||||
/**
|
||||
* Create a new incident update was reported event instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(IncidentUpdate $update)
|
||||
{
|
||||
$this->update = $update;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Events\IncidentUpdate;
|
||||
|
||||
use CachetHQ\Cachet\Models\IncidentUpdate;
|
||||
|
||||
/**
|
||||
* This is the incident update was updated event.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class IncidentUpdateWasUpdatedEvent implements IncidentUpdateEventInterface
|
||||
{
|
||||
/**
|
||||
* The incident update that has been updated.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\IncidentUpdate
|
||||
*/
|
||||
public $update;
|
||||
|
||||
/**
|
||||
* Create a new incident update was updated event instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(IncidentUpdate $update)
|
||||
{
|
||||
$this->update = $update;
|
||||
}
|
||||
}
|
||||
41
app/Bus/Events/User/UserWasUpdatedEvent.php
Normal file
41
app/Bus/Events/User/UserWasUpdatedEvent.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Events\User;
|
||||
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
|
||||
/**
|
||||
* This is the user was updated event.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
final class UserWasUpdatedEvent implements UserEventInterface
|
||||
{
|
||||
/**
|
||||
* The user that has been updated.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\User
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Create a new user was updated event instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\User $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Exceptions\Tag;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* This is the tag does not exist on component exception class.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class TagDoesNotExistOnComponentException extends Exception implements TagExceptionInterface
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -9,18 +9,16 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Exceptions\Subscriber;
|
||||
namespace CachetHQ\Cachet\Bus\Exceptions\Tag;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Exceptions\ExceptionInterface;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* This is the already subscribed exception class.
|
||||
* This is the tag exception interface.
|
||||
*
|
||||
* @author Graham Campbell <graham@alt-three.com>
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class AlreadySubscribedException extends Exception implements ExceptionInterface
|
||||
interface TagExceptionInterface extends ExceptionInterface
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\ComponentTag;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\ComponentTag\AddComponentTagCommand;
|
||||
use CachetHQ\Cachet\Models\ComponentTag;
|
||||
|
||||
/**
|
||||
* This is the add component tag command handler.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class AddComponentTagCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the add component tag command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\ComponentTag\AddComponentTagCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\ComponentTag
|
||||
*/
|
||||
public function handle(AddComponentTagCommand $command)
|
||||
{
|
||||
$tag = ComponentTag::create([
|
||||
'component_id' => $command->component->id,
|
||||
'tag_id' => $command->tag->id,
|
||||
]);
|
||||
|
||||
return $tag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\ComponentTag;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\ComponentTag\DeleteComponentTagCommand;
|
||||
use CachetHQ\Cachet\Bus\Exceptions\Tag\TagDoesNotExistOnComponentException;
|
||||
use CachetHQ\Cachet\Models\ComponentTag;
|
||||
|
||||
/**
|
||||
* This is the delete component tag command handler.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class DeleteComponentTagCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the add component tag command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\ComponentTag\DeleteComponentTagCommand $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(DeleteComponentTagCommand $command)
|
||||
{
|
||||
// If the tag does not exist on the component, throw an exception.
|
||||
if (!($componentTag = ComponentTag::tagForComponent($command->tag->id, $command->component->id))) {
|
||||
throw new TagDoesNotExistOnComponentException('The given tag <'.$command->tag->id.'> does not exist on this component <'.$command->componnet->id.'>');
|
||||
}
|
||||
|
||||
$componentTag->delete();
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,13 @@ use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\IncidentTemplate;
|
||||
use Twig_Loader_String;
|
||||
use TwigBridge\Facade\Twig;
|
||||
use TwigBridge\Bridge;
|
||||
|
||||
/**
|
||||
* This is the report incident command handler.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class ReportIncidentCommandHandler
|
||||
{
|
||||
/**
|
||||
@@ -29,16 +34,25 @@ class ReportIncidentCommandHandler
|
||||
*/
|
||||
protected $dates;
|
||||
|
||||
/**
|
||||
* The twig bridge instance.
|
||||
*
|
||||
* @var \TwigBridge\Bridge
|
||||
*/
|
||||
protected $twig;
|
||||
|
||||
/**
|
||||
* Create a new report incident command handler instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Dates\DateFactory $dates
|
||||
* @param \TwigBridge\Bridge $twig
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(DateFactory $dates)
|
||||
public function __construct(DateFactory $dates, Bridge $twig)
|
||||
{
|
||||
$this->dates = $dates;
|
||||
$this->twig = $twig;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,7 +83,7 @@ class ReportIncidentCommandHandler
|
||||
|
||||
// The incident occurred at a different time.
|
||||
if ($command->incident_date) {
|
||||
$incidentDate = $this->dates->createNormalized('d/m/Y H:i', $command->incident_date);
|
||||
$incidentDate = $this->dates->create('d/m/Y H:i', $command->incident_date);
|
||||
|
||||
$data['created_at'] = $incidentDate;
|
||||
$data['updated_at'] = $incidentDate;
|
||||
@@ -106,9 +120,9 @@ class ReportIncidentCommandHandler
|
||||
$vars = [];
|
||||
}
|
||||
|
||||
Twig::setLoader(new Twig_Loader_String());
|
||||
$this->twig->setLoader(new Twig_Loader_String());
|
||||
$template = IncidentTemplate::forSlug($templateSlug)->first();
|
||||
|
||||
return Twig::render($template->template, $vars);
|
||||
return $this->twig->render($template->template, $vars);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class ReportMaintenanceCommandHandler
|
||||
*/
|
||||
public function handle(ReportMaintenanceCommand $command)
|
||||
{
|
||||
$scheduledAt = $this->dates->createNormalized('d/m/Y H:i', $command->timestamp);
|
||||
$scheduledAt = $this->dates->create('d/m/Y H:i', $command->timestamp);
|
||||
|
||||
$maintenanceEvent = Incident::create([
|
||||
'name' => $command->name,
|
||||
|
||||
@@ -18,8 +18,13 @@ use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\IncidentTemplate;
|
||||
use Twig_Loader_String;
|
||||
use TwigBridge\Facade\Twig;
|
||||
use TwigBridge\Bridge;
|
||||
|
||||
/**
|
||||
* This is the update incident command handler.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class UpdateIncidentCommandHandler
|
||||
{
|
||||
/**
|
||||
@@ -29,16 +34,25 @@ class UpdateIncidentCommandHandler
|
||||
*/
|
||||
protected $dates;
|
||||
|
||||
/**
|
||||
* The twig bridge instance.
|
||||
*
|
||||
* @var \TwigBridge\Bridge
|
||||
*/
|
||||
protected $twig;
|
||||
|
||||
/**
|
||||
* Create a new update incident command handler instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Dates\DateFactory $dates
|
||||
* @param \TwigBridge\Bridge $twig
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(DateFactory $dates)
|
||||
public function __construct(DateFactory $dates, Bridge $twig)
|
||||
{
|
||||
$this->dates = $dates;
|
||||
$this->twig = $twig;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,7 +73,7 @@ class UpdateIncidentCommandHandler
|
||||
|
||||
// The incident occurred at a different time.
|
||||
if ($command->incident_date) {
|
||||
$incidentDate = $this->dates->createNormalized('d/m/Y H:i', $command->incident_date);
|
||||
$incidentDate = $this->dates->create('d/m/Y H:i', $command->incident_date);
|
||||
|
||||
$incident->update([
|
||||
'created_at' => $incidentDate,
|
||||
@@ -113,9 +127,9 @@ class UpdateIncidentCommandHandler
|
||||
*/
|
||||
protected function parseIncidentTemplate($templateSlug, $vars)
|
||||
{
|
||||
Twig::setLoader(new Twig_Loader_String());
|
||||
$this->twig->setLoader(new Twig_Loader_String());
|
||||
$template = IncidentTemplate::forSlug($templateSlug)->first();
|
||||
|
||||
return Twig::render($template->template, $vars);
|
||||
return $this->twig->render($template->template, $vars);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\IncidentUpdate;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\RemoveIncidentUpdateCommand;
|
||||
use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasRemovedEvent;
|
||||
|
||||
/**
|
||||
* This is the remove incident update command handler.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class RemoveIncidentUpdateCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the remove incident update command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\IncidentUpdate\RemoveIncidentUpdateCommand $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(RemoveIncidentUpdateCommand $command)
|
||||
{
|
||||
$update = $command->incidentUpdate;
|
||||
|
||||
event(new IncidentUpdateWasRemovedEvent($update));
|
||||
|
||||
$update->delete();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\IncidentUpdate;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\ReportIncidentUpdateCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\Incident\UpdateIncidentCommand;
|
||||
use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasReportedEvent;
|
||||
use CachetHQ\Cachet\Models\IncidentUpdate;
|
||||
|
||||
/**
|
||||
* This is the report incident update command handler.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class ReportIncidentUpdateCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the report incident command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\IncidentUpdate\ReportIncidentUpdateCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\IncidentUpdate
|
||||
*/
|
||||
public function handle(ReportIncidentUpdateCommand $command)
|
||||
{
|
||||
$data = [
|
||||
'incident_id' => $command->incident->id,
|
||||
'status' => $command->status,
|
||||
'message' => $command->message,
|
||||
'user_id' => $command->user->id,
|
||||
];
|
||||
|
||||
// Create the incident update.
|
||||
$update = IncidentUpdate::create($data);
|
||||
|
||||
// Update the original incident with the new status.
|
||||
dispatch(new UpdateIncidentCommand(
|
||||
$incident,
|
||||
null,
|
||||
$command->status,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
));
|
||||
|
||||
event(new IncidentUpdateWasReportedEvent($update));
|
||||
|
||||
return $update;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\IncidentUpdate;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\UpdateIncidentUpdateCommand;
|
||||
use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasUpdatedEvent;
|
||||
|
||||
/**
|
||||
* This is the update incident update command handler.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class UpdateIncidentUpdateCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the update incident update command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\IncidentUpdate\UpdateIncidentUpdateCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\IncidentUpdate
|
||||
*/
|
||||
public function handle(UpdateIncidentUpdateCommand $command)
|
||||
{
|
||||
$command->update->update($this->filter($command));
|
||||
|
||||
event(new IncidentUpdateWasUpdatedEvent($command->update));
|
||||
|
||||
return $command->update;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the command data.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\IncidentUpdate\UpdateIncidentUpdateCommand $command
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function filter(UpdateIncidentUpdateCommand $command)
|
||||
{
|
||||
$params = [
|
||||
'status' => $command->status,
|
||||
'message' => $command->message,
|
||||
'user_id' => $command->user->id,
|
||||
];
|
||||
|
||||
return array_filter($params, function ($val) {
|
||||
return $val !== null;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,8 @@ class AddMetricCommandHandler
|
||||
'display_chart' => $command->display_chart,
|
||||
'places' => $command->places,
|
||||
'default_view' => $command->default_view,
|
||||
'threshold' => $command->threshold,
|
||||
'order' => $command->order,
|
||||
]);
|
||||
|
||||
event(new MetricWasAddedEvent($metric));
|
||||
|
||||
@@ -15,6 +15,7 @@ use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricPointCommand;
|
||||
use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasAddedEvent;
|
||||
use CachetHQ\Cachet\Dates\DateFactory;
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class AddMetricPointCommandHandler
|
||||
{
|
||||
@@ -49,19 +50,35 @@ class AddMetricPointCommandHandler
|
||||
$metric = $command->metric;
|
||||
$createdAt = $command->created_at;
|
||||
|
||||
$data = [
|
||||
'metric_id' => $metric->id,
|
||||
'value' => $command->value,
|
||||
];
|
||||
// Do we have an existing point with the same value?
|
||||
$point = $this->findOrCreatePoint($command);
|
||||
|
||||
if ($createdAt) {
|
||||
$data['created_at'] = $this->dates->create('U', $createdAt)->format('Y-m-d H:i:s');
|
||||
$point->increment('counter', 1);
|
||||
|
||||
event(new MetricPointWasAddedEvent($point));
|
||||
|
||||
return $point;
|
||||
}
|
||||
|
||||
protected function findOrCreatePoint(AddMetricPointCommand $command)
|
||||
{
|
||||
$buffer = Carbon::now()->subMinutes($command->metric->threshold);
|
||||
$point = MetricPoint::where('metric_id', $command->metric->id)->where('value', $command->value)->where('created_at', '>=', $buffer)->first();
|
||||
|
||||
if ($point) {
|
||||
return $point;
|
||||
}
|
||||
|
||||
$metricPoint = MetricPoint::create($data);
|
||||
$data = [
|
||||
'metric_id' => $command->metric->id,
|
||||
'value' => $command->value,
|
||||
'counter' => 0,
|
||||
];
|
||||
|
||||
event(new MetricPointWasAddedEvent($metricPoint));
|
||||
if ($command->created_at) {
|
||||
$data['created_at'] = $this->dates->create('U', $command->created_at)->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
return $metricPoint;
|
||||
return MetricPoint::create($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ class UpdateMetricCommandHandler
|
||||
'display_chart' => $command->display_chart,
|
||||
'places' => $command->places,
|
||||
'default_view' => $command->default_view,
|
||||
'threshold' => $command->threshold,
|
||||
'order' => $command->order,
|
||||
];
|
||||
|
||||
return array_filter($params, function ($val) {
|
||||
|
||||
@@ -51,7 +51,7 @@ class UpdateMetricPointCommandHandler
|
||||
|
||||
$data = [
|
||||
'metric_id' => $metric->id,
|
||||
'value' => $command->value,
|
||||
'value' => (float) $command->value,
|
||||
];
|
||||
|
||||
if ($createdAt) {
|
||||
|
||||
@@ -14,8 +14,7 @@ namespace CachetHQ\Cachet\Bus\Handlers\Commands\Subscriber;
|
||||
use CachetHQ\Cachet\Bus\Commands\Subscriber\SubscribeSubscriberCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\Subscriber\VerifySubscriberCommand;
|
||||
use CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasSubscribedEvent;
|
||||
use CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasUpdatedSubscriptionsEvent;
|
||||
use CachetHQ\Cachet\Bus\Exceptions\Subscriber\AlreadySubscribedException;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use CachetHQ\Cachet\Models\Subscription;
|
||||
|
||||
@@ -23,6 +22,8 @@ use CachetHQ\Cachet\Models\Subscription;
|
||||
* This is the subscribe subscriber command handler.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
* @author Joe Cohen <joe@alt-three.com>
|
||||
* @author Graham Campbell <graham@alt-three.com>
|
||||
*/
|
||||
class SubscribeSubscriberCommandHandler
|
||||
{
|
||||
@@ -31,35 +32,34 @@ class SubscribeSubscriberCommandHandler
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\Subscriber\SubscribeSubscriberCommand $command
|
||||
*
|
||||
* @throws \CachetHQ\Cachet\Exceptions\AlreadySubscribedException
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Subscriber
|
||||
*/
|
||||
public function handle(SubscribeSubscriberCommand $command)
|
||||
{
|
||||
if (Subscriber::where('email', $command->email)->first() && $command->subscriptions === null) {
|
||||
throw new AlreadySubscribedException("Cannot subscribe {$command->email} because they're already subscribed.");
|
||||
if ($subscriber = Subscriber::where('email', $command->email)->first()) {
|
||||
return $subscriber;
|
||||
}
|
||||
|
||||
$subscriber = Subscriber::firstOrCreate(['email' => $command->email]);
|
||||
|
||||
// Decide what to subscribe the subscriber to.
|
||||
if ($subscriptions = $command->subscriptions) {
|
||||
foreach ($subscriptions as $subscription => $subscriptionValue) {
|
||||
Subscription::firstOrCreate([
|
||||
'subscriber_id' => $subscriber->id,
|
||||
$subscription => $subscriptionValue,
|
||||
]);
|
||||
}
|
||||
$subscriptions = Component::whereIn('id', $subscriptions);
|
||||
} else {
|
||||
$subscriptions = Component::all();
|
||||
}
|
||||
|
||||
if ($subscriber->is_verified === false) {
|
||||
if ($command->verified) {
|
||||
dispatch(new VerifySubscriberCommand($subscriber));
|
||||
} else {
|
||||
event(new SubscriberHasSubscribedEvent($subscriber));
|
||||
}
|
||||
foreach ($subscriptions as $component) {
|
||||
Subscription::create([
|
||||
'subscriber_id' => $subscriber->id,
|
||||
'component_id' => $component->id,
|
||||
]);
|
||||
}
|
||||
|
||||
if ($command->verified) {
|
||||
dispatch(new VerifySubscriberCommand($subscriber));
|
||||
} else {
|
||||
event(new SubscriberHasUpdatedSubscriptionsEvent($subscriber));
|
||||
event(new SubscriberHasSubscribedEvent($subscriber));
|
||||
}
|
||||
|
||||
return $subscriber;
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Subscriber;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\Subscriber\UpdateSubscriberSubscriptionCommand;
|
||||
use CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasUpdatedSubscriptionsEvent;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use CachetHQ\Cachet\Models\Subscription;
|
||||
|
||||
/**
|
||||
* This is the subscribe subscriber command handler.
|
||||
*
|
||||
* @author Joseph Cohen <joe@alt-three.com>
|
||||
*/
|
||||
class UpdateSubscriberSubscriptionCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the subscribe subscriber command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\Subscriber\UpdateSubscriberSubscriptionCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Subscriber
|
||||
*/
|
||||
public function handle(UpdateSubscriberSubscriptionCommand $command)
|
||||
{
|
||||
$subscriber = $command->subscriber;
|
||||
$subscriptions = $command->subscriptions ?: [];
|
||||
|
||||
$components = Component::all();
|
||||
|
||||
$updateSubscriptions = $components->filter(function ($item) use ($subscriptions) {
|
||||
return in_array($item->id, $subscriptions);
|
||||
});
|
||||
|
||||
$subscriber->global = ($updateSubscriptions->count() === $components->count());
|
||||
|
||||
$subscriber->subscriptions()->delete();
|
||||
|
||||
if (!$updateSubscriptions->isEmpty()) {
|
||||
foreach ($updateSubscriptions as $subscription) {
|
||||
Subscription::firstOrCreate([
|
||||
'subscriber_id' => $subscriber->id,
|
||||
'component_id' => $subscription->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$subscriber->save();
|
||||
|
||||
event(new SubscriberHasUpdatedSubscriptionsEvent($subscriber));
|
||||
|
||||
return $subscriber;
|
||||
}
|
||||
}
|
||||
35
app/Bus/Handlers/Commands/Tag/CreateTagCommandHandler.php
Normal file
35
app/Bus/Handlers/Commands/Tag/CreateTagCommandHandler.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Tag;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\Tag\CreateTagCommand;
|
||||
use CachetHQ\Cachet\Models\Tag;
|
||||
|
||||
class CreateTagCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the create tag command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\Tag\CreateTagCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Tag
|
||||
*/
|
||||
public function handle(CreateTagCommand $command)
|
||||
{
|
||||
$tag = Tag::create([
|
||||
'name' => $command->name,
|
||||
'slug' => $command->slug,
|
||||
]);
|
||||
|
||||
return $tag;
|
||||
}
|
||||
}
|
||||
30
app/Bus/Handlers/Commands/Tag/DeleteTagCommandHandler.php
Normal file
30
app/Bus/Handlers/Commands/Tag/DeleteTagCommandHandler.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Tag;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\Tag\DeleteTagCommand;
|
||||
use CachetHQ\Cachet\Models\Tag;
|
||||
|
||||
class DeleteTagCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the delete tag command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\Tag\DeleteTagCommand $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(DeleteTagCommand $command)
|
||||
{
|
||||
$command->tag->delete();
|
||||
}
|
||||
}
|
||||
51
app/Bus/Handlers/Commands/Tag/UpdateTagCommandHandler.php
Normal file
51
app/Bus/Handlers/Commands/Tag/UpdateTagCommandHandler.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Tag;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\Tag\UpdateTagCommand;
|
||||
use CachetHQ\Cachet\Models\Tag;
|
||||
|
||||
class UpdateTagCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the update tag command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\Tag\UpdateTagCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Tag
|
||||
*/
|
||||
public function handle(UpdateTagCommand $command)
|
||||
{
|
||||
$command->tag->update($this->filter($command));
|
||||
|
||||
return $command->tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the command data.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\Tag\UpdateTagCommand $command
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function filter(UpdateTagCommand $command)
|
||||
{
|
||||
$params = [
|
||||
'name' => $command->name,
|
||||
'slug' => $command->slug,
|
||||
];
|
||||
|
||||
return array_filter($params, function ($val) {
|
||||
return $val !== null;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -11,20 +11,25 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\User;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\User\AddTeamMemberCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\User\AddUserCommand;
|
||||
use CachetHQ\Cachet\Bus\Events\User\UserWasAddedEvent;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
|
||||
class AddTeamMemberCommandHandler
|
||||
/**
|
||||
* This is the add user command handler.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class AddUserCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the add team member command.
|
||||
* Handle the add user command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\User\AddTeamMemberCommand $command
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\User\AddUserCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\User
|
||||
*/
|
||||
public function handle(AddTeamMemberCommand $command)
|
||||
public function handle(AddUserCommand $command)
|
||||
{
|
||||
$user = User::create([
|
||||
'username' => $command->username,
|
||||
@@ -11,20 +11,25 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\User;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\User\InviteTeamMemberCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\User\InviteUserCommand;
|
||||
use CachetHQ\Cachet\Bus\Events\User\UserWasInvitedEvent;
|
||||
use CachetHQ\Cachet\Models\Invite;
|
||||
|
||||
class InviteTeamMemberCommandHandler
|
||||
/**
|
||||
* This is the invite user command handler.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class InviteUserCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the invite team member command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\User\InviteTeamMemberCommand $command
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\User\InviteUserCommand $command
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(InviteTeamMemberCommand $command)
|
||||
public function handle(InviteUserCommand $command)
|
||||
{
|
||||
foreach ($command->emails as $email) {
|
||||
$invite = Invite::create([
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\User;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\User\UpdateTeamMemberCommand;
|
||||
use CachetHQ\Cachet\Bus\Events\User\UserWasUpdatedEvent;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
|
||||
/**
|
||||
* This is the update team member command handler.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class UpdateTeamMemberCommandHandler
|
||||
{
|
||||
/**
|
||||
* Handle the add team member command.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\User\UpdateTeamMemberCommand $command
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\User
|
||||
*/
|
||||
public function handle(UpdateTeamMemberCommand $command)
|
||||
{
|
||||
$user = $command->user;
|
||||
|
||||
$user->update($this->filter($command));
|
||||
|
||||
event(new UserWasUpdatedEvent($user));
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the command data.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Commands\User\UpdateTeamMemberCommand $command
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function filter(UpdateTeamMemberCommand $command)
|
||||
{
|
||||
$params = [
|
||||
'username' => $command->username,
|
||||
'password' => $command->password,
|
||||
'email' => $command->email,
|
||||
'level' => $command->level,
|
||||
];
|
||||
|
||||
return array_filter($params, function ($val) {
|
||||
return $val !== null;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Events\Component;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasRemovedEvent;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Subscription;
|
||||
|
||||
/**
|
||||
* This is the cleanup component subscriptions handler.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class CleanupComponentSubscriptionsHandler
|
||||
{
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Events\Component\ComponentWasRemovedEvent $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(ComponentWasRemovedEvent $event)
|
||||
{
|
||||
$component = $event->component;
|
||||
$subscription = Subscription::forComponent($component->id);
|
||||
|
||||
// Cleanup the subscriptions.
|
||||
$subscription->delete();
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Bus\Handlers\Events\Component;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasUpdatedEvent;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Subscription;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use Illuminate\Contracts\Mail\MailQueue;
|
||||
use Illuminate\Mail\Message;
|
||||
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
|
||||
@@ -27,16 +27,25 @@ class SendComponentUpdateEmailNotificationHandler
|
||||
*/
|
||||
protected $mailer;
|
||||
|
||||
/**
|
||||
* The subscriber instance.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Models\Subscriber
|
||||
*/
|
||||
protected $subscriber;
|
||||
|
||||
/**
|
||||
* Create a new send incident email notification handler.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailer $mailer
|
||||
* @param \Illuminate\Contracts\Mail\Mailer $mailer
|
||||
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MailQueue $mailer)
|
||||
public function __construct(MailQueue $mailer, Subscriber $subscriber)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
$this->subscriber = $subscriber;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +57,42 @@ class SendComponentUpdateEmailNotificationHandler
|
||||
*/
|
||||
public function handle(ComponentWasUpdatedEvent $event)
|
||||
{
|
||||
$component = AutoPresenter::decorate($event->component);
|
||||
$component = $event->component;
|
||||
|
||||
// First notify all global subscribers.
|
||||
$globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get();
|
||||
|
||||
foreach ($globalSubscribers as $subscriber) {
|
||||
$this->notify($component, $subscriber);
|
||||
}
|
||||
|
||||
$notified = $globalSubscribers->pluck('id')->all();
|
||||
|
||||
// Notify the remaining component specific subscribers.
|
||||
$componentSubscribers = $this->subscriber
|
||||
->isVerified()
|
||||
->forComponent($component->id)
|
||||
->get()
|
||||
->reject(function ($subscriber) use ($notified) {
|
||||
return in_array($subscriber->id, $notified);
|
||||
});
|
||||
|
||||
foreach ($componentSubscribers as $subscriber) {
|
||||
$this->notify($component, $subscriber);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send notification to subscriber.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Component $component
|
||||
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function notify(Component $component, Subscriber $subscriber)
|
||||
{
|
||||
$component = AutoPresenter::decorate($component);
|
||||
|
||||
$mail = [
|
||||
'subject' => trans('cachet.subscriber.email.component.subject'),
|
||||
@@ -56,17 +100,14 @@ class SendComponentUpdateEmailNotificationHandler
|
||||
'component_human_status' => $component->human_status,
|
||||
];
|
||||
|
||||
foreach (Subscription::isVerifiedForComponent($component->id)->with('subscriber')->get() as $subscription) {
|
||||
$subscriber = $subscription->subscriber;
|
||||
$mail['email'] = $subscriber->email;
|
||||
$mail['unsubscribe_link'] = route('subscribe.unsubscribe', ['code' => $subscriber->verify_code, 'subscription' => $subscription->id]);
|
||||
$mail['email'] = $subscriber->email;
|
||||
$mail['manage_link'] = route('subscribe.manage', ['code' => $subscriber->verify_code]);
|
||||
|
||||
$this->mailer->queue([
|
||||
'html' => 'emails.components.update-html',
|
||||
'text' => 'emails.components.update-text',
|
||||
], $mail, function (Message $message) use ($mail) {
|
||||
$message->to($mail['email'])->subject($mail['subject']);
|
||||
});
|
||||
}
|
||||
$this->mailer->queue([
|
||||
'html' => 'emails.components.update-html',
|
||||
'text' => 'emails.components.update-text',
|
||||
], $mail, function (Message $message) use ($mail) {
|
||||
$message->to($mail['email'])->subject($mail['subject']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class SendIncidentEmailNotificationHandler
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Events\Incident\IncidentHasReportedEvent $event
|
||||
* @param \CachetHQ\Cachet\Bus\Events\Incident\IncidentWasReportedEvent $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -60,31 +60,74 @@ class SendIncidentEmailNotificationHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only send emails for public incidents.
|
||||
if ($event->incident->visible === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// First notify all global subscribers.
|
||||
$globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get();
|
||||
|
||||
foreach ($globalSubscribers as $subscriber) {
|
||||
$this->notify($event, $subscriber);
|
||||
}
|
||||
|
||||
if (!$event->incident->component) {
|
||||
return;
|
||||
}
|
||||
|
||||
$notified = $globalSubscribers->pluck('id')->all();
|
||||
|
||||
// Notify the remaining component specific subscribers.
|
||||
$componentSubscribers = $this->subscriber
|
||||
->isVerified()
|
||||
->forComponent($event->incident->component->id)
|
||||
->get()
|
||||
->reject(function ($subscriber) use ($notified) {
|
||||
return in_array($subscriber->id, $notified);
|
||||
});
|
||||
|
||||
foreach ($componentSubscribers as $subscriber) {
|
||||
$this->notify($event, $subscriber);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send notification to subscriber.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Events\IncidentWasReportedEvent $event
|
||||
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function notify(IncidentWasReportedEvent $event, $subscriber)
|
||||
{
|
||||
$incident = AutoPresenter::decorate($event->incident);
|
||||
$component = AutoPresenter::decorate($event->incident->component);
|
||||
|
||||
// Only send emails for public incidents.
|
||||
if ($event->incident->visible === 1) {
|
||||
foreach ($this->subscriber->isVerified()->get() as $subscriber) {
|
||||
$mail = [
|
||||
'email' => $subscriber->email,
|
||||
'subject' => 'New incident reported.',
|
||||
'has_component' => ($event->incident->component) ? true : false,
|
||||
'component_name' => $component ? $component->name : null,
|
||||
'status' => $incident->human_status,
|
||||
'html_content' => $incident->formattedMessage,
|
||||
'text_content' => $incident->message,
|
||||
'token' => $subscriber->token,
|
||||
'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]),
|
||||
];
|
||||
$mail = [
|
||||
'email' => $subscriber->email,
|
||||
'subject' => trans('cachet.subscriber.email.incident.subject', [
|
||||
'status' => $incident->human_status,
|
||||
'name' => $incident->name,
|
||||
]),
|
||||
'has_component' => ($event->incident->component) ? true : false,
|
||||
'component_name' => $component ? $component->name : null,
|
||||
'name' => $incident->name,
|
||||
'timestamp' => $incident->created_at_formatted,
|
||||
'status' => $incident->human_status,
|
||||
'html_content' => $incident->formattedMessage,
|
||||
'text_content' => $incident->message,
|
||||
'token' => $subscriber->token,
|
||||
'manage_link' => route('subscribe.manage', ['code' => $subscriber->verify_code]),
|
||||
'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]),
|
||||
];
|
||||
|
||||
$this->mailer->queue([
|
||||
'html' => 'emails.incidents.new-html',
|
||||
'text' => 'emails.incidents.new-text',
|
||||
], $mail, function (Message $message) use ($mail) {
|
||||
$message->to($mail['email'])->subject($mail['subject']);
|
||||
});
|
||||
}
|
||||
}
|
||||
$this->mailer->queue([
|
||||
'html' => 'emails.incidents.new-html',
|
||||
'text' => 'emails.incidents.new-text',
|
||||
], $mail, function (Message $message) use ($mail) {
|
||||
$message->to($mail['email'])->subject($mail['subject']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class SendMaintenanceEmailNotificationHandler
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Events\MaintenanceHasScheduledEvent $event
|
||||
* @param \CachetHQ\Cachet\Bus\Events\MaintenanceWasScheduledEvent $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -60,26 +60,73 @@ class SendMaintenanceEmailNotificationHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = AutoPresenter::decorate($event->incident);
|
||||
// Only send emails for public incidents.
|
||||
if ($event->incident->visible === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->subscriber->isVerified()->get() as $subscriber) {
|
||||
$mail = [
|
||||
'email' => $subscriber->email,
|
||||
'subject' => 'Scheduled maintenance.',
|
||||
'status' => $data->human_status,
|
||||
'html_content' => $data->formattedMessage,
|
||||
'text_content' => $data->message,
|
||||
'scheduled_at' => $data->scheduled_at_formatted,
|
||||
'token' => $subscriber->token,
|
||||
'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]),
|
||||
];
|
||||
// First notify all global subscribers.
|
||||
$globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get();
|
||||
|
||||
$this->mailer->queue([
|
||||
'html' => 'emails.incidents.maintenance-html',
|
||||
'text' => 'emails.incidents.maintenance-text',
|
||||
], $mail, function (Message $message) use ($mail) {
|
||||
$message->to($mail['email'])->subject($mail['subject']);
|
||||
foreach ($globalSubscribers as $subscriber) {
|
||||
$this->notify($event, $subscriber);
|
||||
}
|
||||
|
||||
if (!$event->incident->component) {
|
||||
return;
|
||||
}
|
||||
|
||||
$notified = $globalSubscribers->pluck('id')->all();
|
||||
|
||||
// Notify the remaining component specific subscribers.
|
||||
$componentSubscribers = $this->subscriber
|
||||
->isVerified()
|
||||
->forComponent($event->incident->component->id)
|
||||
->get()
|
||||
->reject(function ($subscriber) use ($notified) {
|
||||
return in_array($subscriber->id, $notified);
|
||||
});
|
||||
|
||||
foreach ($componentSubscribers as $subscriber) {
|
||||
$this->notify($event, $subscriber);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send notification to subscriber.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Bus\Events\MaintenanceWasScheduledEvent $event
|
||||
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function notify(MaintenanceWasScheduledEvent $event, $subscriber)
|
||||
{
|
||||
$incident = AutoPresenter::decorate($event->incident);
|
||||
$component = AutoPresenter::decorate($event->incident->component);
|
||||
|
||||
$mail = [
|
||||
'email' => $subscriber->email,
|
||||
'subject' => trans('cachet.subscriber.email.maintenance.subject', [
|
||||
'name' => $incident->name,
|
||||
]),
|
||||
'has_component' => ($event->incident->component) ? true : false,
|
||||
'component_name' => $component ? $component->name : null,
|
||||
'name' => $incident->name,
|
||||
'timestamp' => $incident->scheduled_at_formatted,
|
||||
'status' => $incident->human_status,
|
||||
'html_content' => $incident->formattedMessage,
|
||||
'text_content' => $incident->message,
|
||||
'token' => $subscriber->token,
|
||||
'manage_link' => route('subscribe.manage', ['code' => $subscriber->verify_code]),
|
||||
'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]),
|
||||
];
|
||||
|
||||
$this->mailer->queue([
|
||||
'html' => 'emails.incidents.maintenance-html',
|
||||
'text' => 'emails.incidents.maintenance-text',
|
||||
], $mail, function (Message $message) use ($mail) {
|
||||
$message->to($mail['email'])->subject($mail['subject']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@ class SendSubscriberVerificationEmailHandler
|
||||
public function handle(SubscriberHasSubscribedEvent $event)
|
||||
{
|
||||
$mail = [
|
||||
'email' => $event->subscriber->email,
|
||||
'subject' => 'Confirm your subscription.',
|
||||
'link' => route('subscribe.verify', ['code' => $event->subscriber->verify_code]),
|
||||
'email' => $event->subscriber->email,
|
||||
'subject' => 'Confirm your subscription.',
|
||||
'link' => route('subscribe.verify', ['code' => $event->subscriber->verify_code]),
|
||||
];
|
||||
|
||||
$this->mailer->queue([
|
||||
|
||||
38
app/Bus/Middleware/UseDatabaseTransactions.php
Normal file
38
app/Bus/Middleware/UseDatabaseTransactions.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* This is the use database transactions bus middleware class.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class UseDatabaseTransactions
|
||||
{
|
||||
/**
|
||||
* Handle the current command in the pipeline.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function handle($command, Closure $next)
|
||||
{
|
||||
return DB::transaction(function () use ($command, $next) {
|
||||
return $next($command);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -11,12 +11,41 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Composers;
|
||||
|
||||
use CachetHQ\Cachet\Dates\DateFactory;
|
||||
use GrahamCampbell\Markdown\Facades\Markdown;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
class AppComposer
|
||||
{
|
||||
/**
|
||||
* The date factory instance.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Dates\DateFactory
|
||||
*/
|
||||
protected $dates;
|
||||
|
||||
/**
|
||||
* The illuminate config instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Config\Repository
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Create a new app composer instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Dates\DateFactory $dates
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(DateFactory $dates, Repository $config)
|
||||
{
|
||||
$this->dates = $dates;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Index page view composer.
|
||||
*
|
||||
@@ -26,27 +55,28 @@ class AppComposer
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$view->withAboutApp(Markdown::convertToHtml(Config::get('setting.app_about')));
|
||||
$view->withAppAnalytics(Config::get('setting.app_analytics'));
|
||||
$view->withAppAnalyticsGoSquared(Config::get('setting.app_analytics_go_squared'));
|
||||
$view->withAppAnalyticsPiwikUrl(Config::get('setting.app_analytics_piwik_url'));
|
||||
$view->withAppAnalyticsPiwikSiteId(Config::get('setting.app_analytics_piwik_siteid'));
|
||||
$view->withAppBanner(Config::get('setting.app_banner'));
|
||||
$view->withAppBannerStyleFullWidth(Config::get('setting.style_fullwidth_header'));
|
||||
$view->withAppBannerType(Config::get('setting.app_banner_type'));
|
||||
$view->withAppDomain(Config::get('setting.app_domain'));
|
||||
$view->withAppGraphs(Config::get('setting.display_graphs'));
|
||||
$view->withAppLocale(Config::get('setting.app_locale'));
|
||||
$view->withAppStylesheet(Config::get('setting.stylesheet'));
|
||||
$view->withAppUrl(Config::get('app.url'));
|
||||
|
||||
$view->withAppName($name = Config::get('setting.app_name'));
|
||||
$view->withShowSupport($support = Config::get('setting.show_support'));
|
||||
|
||||
if ($support) {
|
||||
$view->withSiteTitle(Config::get('setting.app_name').' | Cachet');
|
||||
} else {
|
||||
$view->withSiteTitle(Config::get('setting.app_name'));
|
||||
}
|
||||
$view->withAboutApp(Markdown::convertToHtml($this->config->get('setting.app_about')));
|
||||
$view->withAppAnalytics($this->config->get('setting.app_analytics'));
|
||||
$view->withAppAnalyticsGoSquared($this->config->get('setting.app_analytics_gs'));
|
||||
$view->withAppAnalyticsPiwikUrl($this->config->get('setting.app_analytics_piwik_url'));
|
||||
$view->withAppAnalyticsPiwikSiteId($this->config->get('setting.app_analytics_piwik_site_id'));
|
||||
$view->withAppBanner($this->config->get('setting.app_banner'));
|
||||
$view->withAppBannerStyleFullWidth($this->config->get('setting.style_fullwidth_header'));
|
||||
$view->withAppBannerType($this->config->get('setting.app_banner_type'));
|
||||
$view->withAppDomain($this->config->get('setting.app_domain'));
|
||||
$view->withAppGraphs($this->config->get('setting.display_graphs'));
|
||||
$view->withAppLocale($this->config->get('setting.app_locale'));
|
||||
$view->withAppStylesheet($this->config->get('setting.stylesheet'));
|
||||
$view->withAppUrl($this->config->get('app.url'));
|
||||
$view->withAppHeader($this->config->get('setting.header'));
|
||||
$view->withAppFooter($this->config->get('setting.footer'));
|
||||
$view->withAppName($this->config->get('setting.app_name'));
|
||||
$view->withShowSupport($this->config->get('setting.show_support'));
|
||||
$view->withAutomaticLocalization($this->config->get('setting.automatic_localization'));
|
||||
$view->withEnableExternalDependencies($this->config->get('setting.enable_external_dependencies'));
|
||||
$view->withShowTimezone($this->config->get('setting.show_timezone'));
|
||||
$view->withTimezone($this->dates->getTimezone());
|
||||
$view->withSiteTitle($this->config->get('setting.app_name'));
|
||||
$view->withFontSubset($this->config->get('langs.'.$this->config->get('app.locale').'.subset', 'latin'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace CachetHQ\Cachet\Composers;
|
||||
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\IncidentTemplate;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class DashboardComposer
|
||||
@@ -27,6 +29,8 @@ class DashboardComposer
|
||||
public function compose(View $view)
|
||||
{
|
||||
$view->withIncidentCount(Incident::notScheduled()->count());
|
||||
$view->withIncidentTemplateCount(IncidentTemplate::count());
|
||||
$view->withComponentCount(Component::all()->count());
|
||||
$view->withSubscriberCount(Subscriber::isVerified()->count());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,27 +12,28 @@
|
||||
namespace CachetHQ\Cachet\Composers;
|
||||
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
use CachetHQ\Cachet\Repositories\Metric\MetricRepository;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
class MetricsComposer
|
||||
{
|
||||
/**
|
||||
* @var \CachetHQ\Cachet\Repositories\Metric\MetricRepository
|
||||
* The illuminate config instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Config\Repository
|
||||
*/
|
||||
protected $metricRepository;
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Construct a new home controller instance.
|
||||
* Create a new metrics composer.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Repositories\Metric\MetricRepository $metricRepository
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MetricRepository $metricRepository)
|
||||
public function __construct(Repository $config)
|
||||
{
|
||||
$this->metricRepository = $metricRepository;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,22 +46,11 @@ class MetricsComposer
|
||||
public function compose(View $view)
|
||||
{
|
||||
$metrics = null;
|
||||
$metricData = [];
|
||||
if ($displayMetrics = Config::get('setting.display_graphs')) {
|
||||
$metrics = Metric::where('display_chart', 1)->orderBy('id')->get();
|
||||
|
||||
$metrics->map(function ($metric) use (&$metricData) {
|
||||
$metricData[$metric->id] = [
|
||||
'last_hour' => $this->metricRepository->listPointsLastHour($metric),
|
||||
'today' => $this->metricRepository->listPointsToday($metric),
|
||||
'week' => $this->metricRepository->listPointsForWeek($metric),
|
||||
'month' => $this->metricRepository->listPointsForMonth($metric),
|
||||
];
|
||||
});
|
||||
if ($displayMetrics = $this->config->get('setting.display_graphs')) {
|
||||
$metrics = Metric::displayable()->orderBy('order')->orderBy('id')->get();
|
||||
}
|
||||
|
||||
$view->withDisplayMetrics($displayMetrics)
|
||||
->withMetrics($metrics)
|
||||
->withMetricData($metricData);
|
||||
->withMetrics($metrics);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,38 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Composers;
|
||||
|
||||
use CachetHQ\Cachet\Integrations\Core\System;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
/**
|
||||
* This is the status page composer.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class StatusPageComposer
|
||||
{
|
||||
/**
|
||||
* The system instance.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Integrations\Contracts\System
|
||||
*/
|
||||
protected $system;
|
||||
|
||||
/**
|
||||
* Create a new status page composer instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Integrations\Contracts\System $system
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(System $system)
|
||||
{
|
||||
$this->system = $system;
|
||||
}
|
||||
|
||||
/**
|
||||
* Index page view composer.
|
||||
*
|
||||
@@ -27,40 +52,7 @@ class StatusPageComposer
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$totalComponents = Component::enabled()->count();
|
||||
$majorOutages = Component::enabled()->status(4)->count();
|
||||
$isMajorOutage = $totalComponents ? ($majorOutages / $totalComponents) >= 0.5 : false;
|
||||
|
||||
// Default data
|
||||
$withData = [
|
||||
'system_status' => 'info',
|
||||
'system_message' => trans_choice('cachet.service.bad', $totalComponents),
|
||||
'favicon' => 'favicon-high-alert',
|
||||
];
|
||||
|
||||
if ($isMajorOutage) {
|
||||
$withData = [
|
||||
'system_status' => 'danger',
|
||||
'system_message' => trans_choice('cachet.service.major', $totalComponents),
|
||||
'favicon' => 'favicon-high-alert',
|
||||
];
|
||||
} elseif (Component::enabled()->notStatus(1)->count() === 0) {
|
||||
// If all our components are ok, do we have any non-fixed incidents?
|
||||
$incidents = Incident::notScheduled()->orderBy('created_at', 'desc')->get();
|
||||
$incidentCount = $incidents->count();
|
||||
|
||||
if ($incidentCount === 0 || ($incidentCount >= 1 && (int) $incidents->first()->status === 4)) {
|
||||
$withData = [
|
||||
'system_status' => 'success',
|
||||
'system_message' => trans_choice('cachet.service.good', $totalComponents),
|
||||
'favicon' => 'favicon',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
if (Component::enabled()->whereIn('status', [2, 3])->count() > 0) {
|
||||
$withData['favicon'] = 'favicon-medium-alert';
|
||||
}
|
||||
}
|
||||
$status = $this->system->getStatus();
|
||||
|
||||
// Scheduled maintenance code.
|
||||
$scheduledMaintenance = Incident::scheduled()->orderBy('scheduled_at')->get();
|
||||
@@ -70,7 +62,7 @@ class StatusPageComposer
|
||||
$componentGroups = ComponentGroup::whereIn('id', $usedComponentGroups)->orderBy('order')->get();
|
||||
$ungroupedComponents = Component::enabled()->where('group_id', 0)->orderBy('order')->orderBy('created_at')->get();
|
||||
|
||||
$view->with($withData)
|
||||
$view->with($status)
|
||||
->withComponentGroups($componentGroups)
|
||||
->withUngroupedComponents($ungroupedComponents)
|
||||
->withScheduledMaintenance($scheduledMaintenance);
|
||||
|
||||
@@ -11,11 +11,30 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Composers;
|
||||
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
class ThemeComposer
|
||||
{
|
||||
/**
|
||||
* The illuminate config instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Config\Repository
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Create a new theme composer.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Repository $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
@@ -26,17 +45,17 @@ class ThemeComposer
|
||||
public function compose(View $view)
|
||||
{
|
||||
// Theme colors.
|
||||
$view->withThemeBackgroundColor(Config::get('setting.style_background_color', '#F0F3F4'));
|
||||
$view->withThemeBackgroundFills(Config::get('setting.style_background_fills', '#FFFFFF'));
|
||||
$view->withThemeBannerBackgroundColor(Config::get('setting.style_banner_background_color', ''));
|
||||
$view->withThemeBannerPadding(Config::get('setting.style_banner_padding', '40px 0'));
|
||||
$view->withThemeTextColor(Config::get('setting.style_text_color', '#333333'));
|
||||
$view->withThemeReds(Config::get('setting.style_reds', '#ff6f6f'));
|
||||
$view->withThemeBlues(Config::get('setting.style_blues', '#3498db'));
|
||||
$view->withThemeGreens(Config::get('setting.style_greens', '#7ED321'));
|
||||
$view->withThemeYellows(Config::get('setting.style_yellows', '#F7CA18'));
|
||||
$view->withThemeOranges(Config::get('setting.style_oranges', '#FF8800'));
|
||||
$view->withThemeMetrics(Config::get('setting.style_metrics', '#0dccc0'));
|
||||
$view->withThemeLinks(Config::get('setting.style_links', '#7ED321'));
|
||||
$view->withThemeBackgroundColor($this->config->get('setting.style_background_color', '#F0F3F4'));
|
||||
$view->withThemeBackgroundFills($this->config->get('setting.style_background_fills', '#FFFFFF'));
|
||||
$view->withThemeBannerBackgroundColor($this->config->get('setting.style_banner_background_color', ''));
|
||||
$view->withThemeBannerPadding($this->config->get('setting.style_banner_padding', '40px 0'));
|
||||
$view->withThemeTextColor($this->config->get('setting.style_text_color', '#333333'));
|
||||
$view->withThemeReds($this->config->get('setting.style_reds', '#ff6f6f'));
|
||||
$view->withThemeBlues($this->config->get('setting.style_blues', '#3498db'));
|
||||
$view->withThemeGreens($this->config->get('setting.style_greens', '#7ED321'));
|
||||
$view->withThemeYellows($this->config->get('setting.style_yellows', '#F7CA18'));
|
||||
$view->withThemeOranges($this->config->get('setting.style_oranges', '#FF8800'));
|
||||
$view->withThemeMetrics($this->config->get('setting.style_metrics', '#0dccc0'));
|
||||
$view->withThemeLinks($this->config->get('setting.style_links', '#7ED321'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,30 @@ namespace CachetHQ\Cachet\Composers;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
class TimezoneLocaleComposer
|
||||
{
|
||||
/**
|
||||
* The illuminate config instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Config\Repository
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Create a new timezone locale composer.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Repository $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timezones and Locales composer.
|
||||
*
|
||||
@@ -27,7 +46,7 @@ class TimezoneLocaleComposer
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$enabledLangs = Config::get('langs');
|
||||
$enabledLangs = $this->config->get('langs');
|
||||
|
||||
$langs = array_map(function ($lang) use ($enabledLangs) {
|
||||
$locale = basename($lang);
|
||||
|
||||
@@ -14,11 +14,13 @@ namespace CachetHQ\Cachet\Console\Commands;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\IncidentTemplate;
|
||||
use CachetHQ\Cachet\Models\IncidentUpdate;
|
||||
use CachetHQ\Cachet\Models\Metric;
|
||||
use CachetHQ\Cachet\Models\MetricPoint;
|
||||
use CachetHQ\Cachet\Models\Setting;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
use CachetHQ\Cachet\Settings\Repository;
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
use Illuminate\Console\Command;
|
||||
@@ -48,6 +50,27 @@ class DemoSeederCommand extends Command
|
||||
*/
|
||||
protected $description = 'Seeds Cachet with demo data.';
|
||||
|
||||
/**
|
||||
* The settings repository.
|
||||
*
|
||||
* @var \CachetHQ\Cache\Settings\Repository
|
||||
*/
|
||||
protected $settings;
|
||||
|
||||
/**
|
||||
* Create a new demo seeder command instance.
|
||||
*
|
||||
* @param \CachetHQ\Cache\Settings\Repository $settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Repository $settings)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
@@ -62,6 +85,7 @@ class DemoSeederCommand extends Command
|
||||
$this->seedComponentGroups();
|
||||
$this->seedComponents();
|
||||
$this->seedIncidents();
|
||||
$this->seedIncidentTemplates();
|
||||
$this->seedMetricPoints();
|
||||
$this->seedMetrics();
|
||||
$this->seedSettings();
|
||||
@@ -82,11 +106,11 @@ class DemoSeederCommand extends Command
|
||||
[
|
||||
'name' => 'Websites',
|
||||
'order' => 1,
|
||||
'collapsed' => false,
|
||||
'collapsed' => 0,
|
||||
], [
|
||||
'name' => 'Alt Three',
|
||||
'order' => 2,
|
||||
'collapsed' => true,
|
||||
'collapsed' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -140,6 +164,13 @@ class DemoSeederCommand extends Command
|
||||
'order' => 1,
|
||||
'group_id' => 2,
|
||||
'link' => 'https://styleci.io',
|
||||
], [
|
||||
'name' => 'Patreon Page',
|
||||
'description' => 'Support future development of Cachet.',
|
||||
'status' => 1,
|
||||
'order' => 0,
|
||||
'group_id' => 0,
|
||||
'link' => 'https://patreon.com/jbrooksuk',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -159,51 +190,80 @@ class DemoSeederCommand extends Command
|
||||
{
|
||||
$defaultIncidents = [
|
||||
[
|
||||
'name' => 'Awesome',
|
||||
'message' => ':+1: We totally nailed the fix.',
|
||||
'status' => 4,
|
||||
'name' => 'Our monkeys aren\'t performing',
|
||||
'message' => 'We\'re investigating an issue with our monkeys not performing as they should be.',
|
||||
'status' => Incident::INVESTIGATING,
|
||||
'component_id' => 0,
|
||||
'scheduled_at' => null,
|
||||
'visible' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Monitoring the fix',
|
||||
'message' => ":ship: We've deployed a fix.",
|
||||
'status' => 3,
|
||||
], [
|
||||
'name' => 'This is an unresolved incident',
|
||||
'message' => 'Unresolved incidents are left without a **Fixed** update.',
|
||||
'status' => Incident::INVESTIGATING,
|
||||
'component_id' => 0,
|
||||
'scheduled_at' => null,
|
||||
'visible' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Update',
|
||||
'message' => "We've identified the problem. Our engineers are currently looking at it.",
|
||||
'status' => 2,
|
||||
'component_id' => 0,
|
||||
'scheduled_at' => null,
|
||||
'visible' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Test Incident',
|
||||
'message' => 'Something went wrong, with something or another.',
|
||||
'status' => 1,
|
||||
'component_id' => 0,
|
||||
'scheduled_at' => null,
|
||||
'visible' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'Investigating the API',
|
||||
'message' => ':zap: We\'ve seen high response times from our API. It looks to be fixing itself as time goes on.',
|
||||
'status' => 1,
|
||||
'component_id' => 1,
|
||||
'scheduled_at' => null,
|
||||
'visible' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
Incident::truncate();
|
||||
IncidentUpdate::truncate();
|
||||
|
||||
foreach ($defaultIncidents as $incident) {
|
||||
Incident::create($incident);
|
||||
foreach ($defaultIncidents as $defaultIncident) {
|
||||
$incident = Incident::create($defaultIncident);
|
||||
|
||||
$this->seedIncidentUpdates($incident);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed the incident templates table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function seedIncidentTemplates()
|
||||
{
|
||||
IncidentTemplate::truncate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed the incident updates table for a given incident.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function seedIncidentUpdates($incident)
|
||||
{
|
||||
$defaultUpdates = [
|
||||
1 => [
|
||||
[
|
||||
'status' => Incident::FIXED,
|
||||
'message' => 'The monkeys are back and rested!',
|
||||
'user_id' => 1,
|
||||
], [
|
||||
'status' => Incident::WATCHED,
|
||||
'message' => 'Our monkeys need a break from performing. They\'ll be back after a good rest.',
|
||||
'user_id' => 1,
|
||||
], [
|
||||
'status' => Incident::IDENTIFIED,
|
||||
'message' => 'We have identified the issue with our lovely performing monkeys.',
|
||||
'user_id' => 1,
|
||||
],
|
||||
],
|
||||
2 => [
|
||||
[
|
||||
'status' => Incident::WATCHED,
|
||||
'message' => 'We\'re actively watching this issue, so it remains unresolved.',
|
||||
'user_id' => 1,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$updates = $defaultUpdates[$incident->id];
|
||||
|
||||
foreach ($updates as $updateId => $update) {
|
||||
$update['incident_id'] = $incident->id;
|
||||
|
||||
IncidentUpdate::create($update);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,47 +323,45 @@ class DemoSeederCommand extends Command
|
||||
{
|
||||
$defaultSettings = [
|
||||
[
|
||||
'name' => 'app_name',
|
||||
'key' => 'app_name',
|
||||
'value' => 'Cachet Demo',
|
||||
],
|
||||
[
|
||||
'name' => 'app_domain',
|
||||
], [
|
||||
'key' => 'app_domain',
|
||||
'value' => 'https://demo.cachethq.io',
|
||||
],
|
||||
[
|
||||
'name' => 'show_support',
|
||||
], [
|
||||
'key' => 'show_support',
|
||||
'value' => '1',
|
||||
],
|
||||
[
|
||||
'name' => 'app_locale',
|
||||
], [
|
||||
'key' => 'app_locale',
|
||||
'value' => 'en',
|
||||
],
|
||||
[
|
||||
'name' => 'app_timezone',
|
||||
], [
|
||||
'key' => 'app_timezone',
|
||||
'value' => 'Europe/London',
|
||||
],
|
||||
[
|
||||
'name' => 'app_incident_days',
|
||||
], [
|
||||
'key' => 'app_incident_days',
|
||||
'value' => '7',
|
||||
],
|
||||
[
|
||||
'name' => 'app_analytics',
|
||||
], [
|
||||
'key' => 'app_analytics',
|
||||
'value' => 'UA-58442674-3',
|
||||
],
|
||||
[
|
||||
'name' => 'app_analytics_gs',
|
||||
], [
|
||||
'key' => 'app_analytics_gs',
|
||||
'value' => 'GSN-712462-P',
|
||||
],
|
||||
[
|
||||
'name' => 'display_graphs',
|
||||
], [
|
||||
'key' => 'display_graphs',
|
||||
'value' => '1',
|
||||
], [
|
||||
'key' => 'app_about',
|
||||
'value' => 'This is the demo instance of [Cachet](https://cachethq.io?ref=demo). The open source status page system, for everyone. An [Alt Three](https://alt-three.com) product.',
|
||||
], [
|
||||
'key' => 'enable_subscribers',
|
||||
'value' => '0',
|
||||
],
|
||||
];
|
||||
|
||||
Setting::truncate();
|
||||
$this->settings->clear();
|
||||
|
||||
foreach ($defaultSettings as $setting) {
|
||||
Setting::create($setting);
|
||||
$this->settings->set($setting['key'], $setting['value']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Dates;
|
||||
|
||||
use DateTimeZone;
|
||||
use Jenssegers\Date\Date;
|
||||
|
||||
class DateFactory
|
||||
@@ -88,4 +89,17 @@ class DateFactory
|
||||
{
|
||||
return (new Date($time))->setTimezone($this->cachetTimezone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the abbreviated timezone.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTimezone()
|
||||
{
|
||||
$dateTime = new Date();
|
||||
$dateTime->setTimeZone(new DateTimeZone($this->cachetTimezone));
|
||||
|
||||
return $dateTime->format('T');
|
||||
}
|
||||
}
|
||||
|
||||
88
app/Foundation/Exceptions/Displayers/ThrottleDisplayer.php
Normal file
88
app/Foundation/Exceptions/Displayers/ThrottleDisplayer.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Foundation\Exceptions\Displayers;
|
||||
|
||||
use Exception;
|
||||
use GrahamCampbell\Exceptions\Displayers\DisplayerInterface;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException;
|
||||
|
||||
class ThrottleDisplayer implements DisplayerInterface
|
||||
{
|
||||
/**
|
||||
* The request instance.
|
||||
*
|
||||
* @var \Illuminate\Http\Request
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* Create a new redirect displayer instance.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error response associated with the given exception.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param string $id
|
||||
* @param int $code
|
||||
* @param string[] $headers
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function display(Exception $exception, $id, $code, array $headers)
|
||||
{
|
||||
return redirect()->route('auth.login')->withError(trans('forms.login.rate-limit'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the supported content type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function contentType()
|
||||
{
|
||||
return 'text/html';
|
||||
}
|
||||
|
||||
/**
|
||||
* Can we display the exception?
|
||||
*
|
||||
* @param \Exception $original
|
||||
* @param \Exception $transformed
|
||||
* @param int $code
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canDisplay(Exception $original, Exception $transformed, $code)
|
||||
{
|
||||
return $transformed instanceof TooManyRequestsHttpException && $this->request->is('auth*');
|
||||
}
|
||||
|
||||
/**
|
||||
* Do we provide verbose information about the exception?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isVerbose()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,18 @@
|
||||
namespace CachetHQ\Cachet\Foundation\Providers;
|
||||
|
||||
use AltThree\Bus\Dispatcher;
|
||||
use CachetHQ\Cachet\Bus\Middleware\UseDatabaseTransactions;
|
||||
use CachetHQ\Cachet\Dates\DateFactory;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* This is the app service provider.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
* @author Joe Cohen <joe@alt-three.com>
|
||||
* @author Graham Campbell <graham@alt-three.com>
|
||||
*/
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
@@ -29,6 +37,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
return Dispatcher::simpleMapping($command, 'CachetHQ\Cachet\Bus', 'CachetHQ\Cachet\Bus\Handlers');
|
||||
});
|
||||
|
||||
$dispatcher->pipeThrough([UseDatabaseTransactions::class]);
|
||||
|
||||
Str::macro('canonicalize', function ($url) {
|
||||
return preg_replace('/([^\/])$/', '$1/', $url);
|
||||
});
|
||||
@@ -52,8 +62,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
protected function registerDateFactory()
|
||||
{
|
||||
$this->app->singleton(DateFactory::class, function ($app) {
|
||||
$appTimezone = $app->config->get('app.timezone');
|
||||
$cacheTimezone = $app->config->get('cachet.timezone');
|
||||
$appTimezone = $app['config']->get('app.timezone');
|
||||
$cacheTimezone = $app['config']->get('cachet.timezone');
|
||||
|
||||
return new DateFactory($appTimezone, $cacheTimezone);
|
||||
});
|
||||
|
||||
@@ -33,8 +33,8 @@ class ComposerServiceProvider extends ServiceProvider
|
||||
$factory->composer('*', AppComposer::class);
|
||||
$factory->composer('*', CurrentUserComposer::class);
|
||||
$factory->composer(['index'], MetricsComposer::class);
|
||||
$factory->composer(['index', 'incident', 'subscribe', 'signup'], StatusPageComposer::class);
|
||||
$factory->composer(['index', 'incident', 'subscribe', 'signup', 'dashboard.settings.theme'], ThemeComposer::class);
|
||||
$factory->composer(['index', 'single-incident', 'subscribe', 'signup'], StatusPageComposer::class);
|
||||
$factory->composer(['index', 'single-incident', 'subscribe.*', 'signup', 'dashboard.settings.theme', 'emails.*'], ThemeComposer::class);
|
||||
$factory->composer('dashboard.*', DashboardComposer::class);
|
||||
$factory->composer(['setup', 'dashboard.settings.localization'], TimezoneLocaleComposer::class);
|
||||
}
|
||||
|
||||
@@ -11,11 +11,20 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Foundation\Providers;
|
||||
|
||||
use CachetHQ\Cachet\Config\Repository;
|
||||
use CachetHQ\Cachet\Models\Setting as SettingModel;
|
||||
use CachetHQ\Cachet\Settings\Cache;
|
||||
use CachetHQ\Cachet\Settings\Repository;
|
||||
use Exception;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Jenssegers\Date\Date;
|
||||
|
||||
/**
|
||||
* This is the config service provider class.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
* @author Graham Campbell <graham@alt-three.com>
|
||||
* @author Joe Cohen <joe@alt-three.com>
|
||||
*/
|
||||
class ConfigServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
@@ -25,8 +34,26 @@ class ConfigServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$env = $this->app->environment();
|
||||
$repo = $this->app->make(Repository::class);
|
||||
$cache = $this->app->make(Cache::class);
|
||||
$loaded = $cache->load($env);
|
||||
|
||||
$this->app->terminating(function () use ($repo, $cache) {
|
||||
if ($repo->stale()) {
|
||||
$cache->clear();
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
$this->app->config->set('setting', $this->app->setting->all());
|
||||
if ($loaded === false) {
|
||||
$loaded = $repo->all();
|
||||
$cache->store($env, $loaded);
|
||||
}
|
||||
|
||||
$settings = array_merge($this->app->config->get('setting'), $loaded);
|
||||
|
||||
$this->app->config->set('setting', $settings);
|
||||
} catch (Exception $e) {
|
||||
//
|
||||
}
|
||||
@@ -35,9 +62,10 @@ class ConfigServiceProvider extends ServiceProvider
|
||||
$this->app->config->set('app.url', $appDomain);
|
||||
}
|
||||
|
||||
if ($appLocale = $this->app->config->get('setting.app.locale')) {
|
||||
if ($appLocale = $this->app->config->get('setting.app_locale')) {
|
||||
$this->app->config->set('app.locale', $appLocale);
|
||||
$this->app->translator->setLocale($appLocale);
|
||||
Date::setLocale($appLocale);
|
||||
}
|
||||
|
||||
if ($appTimezone = $this->app->config->get('setting.app_timezone')) {
|
||||
@@ -65,10 +93,12 @@ class ConfigServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->singleton('setting', function () {
|
||||
return new Repository(new SettingModel());
|
||||
$this->app->singleton(Cache::class, function ($app) {
|
||||
return new Cache($app->files, $app->bootstrapPath().'/cachet');
|
||||
});
|
||||
|
||||
$this->app->alias('setting', Repository::class);
|
||||
$this->app->singleton(Repository::class, function () {
|
||||
return new Repository(new SettingModel());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,28 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Foundation\Providers;
|
||||
|
||||
use CachetHQ\Cachet\GitHub\Release;
|
||||
use CachetHQ\Cachet\Subscribers\CommandSubscriber;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class GitHubServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* This is the console service provider.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class ConsoleServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Boot the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$subscriber = $this->app->make(CommandSubscriber::class);
|
||||
|
||||
$this->app->events->subscribe($subscriber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
@@ -23,23 +40,6 @@ class GitHubServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerRelease();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the releases class.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerRelease()
|
||||
{
|
||||
$this->app->singleton('cachet.release', function ($app) {
|
||||
$cache = $app['cache.store'];
|
||||
$config = $app['config'];
|
||||
|
||||
return new Release($cache, $config);
|
||||
});
|
||||
|
||||
$this->app->alias('cachet.release', Release::class);
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -34,14 +34,23 @@ class EventServiceProvider extends ServiceProvider
|
||||
//
|
||||
],
|
||||
'CachetHQ\Cachet\Bus\Events\Component\ComponentWasRemovedEvent' => [
|
||||
//
|
||||
'CachetHQ\Cachet\Bus\Handlers\Events\Component\CleanupComponentSubscriptionsHandler',
|
||||
],
|
||||
'CachetHQ\Cachet\Bus\Events\Component\ComponentWasUpdatedEvent' => [
|
||||
'CachetHQ\Cachet\Bus\Handlers\Events\Component\SendComponentUpdateEmailNotificationHandler',
|
||||
],
|
||||
'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasRemovedEvent' => [
|
||||
//
|
||||
],
|
||||
'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasReportedEvent' => [
|
||||
'CachetHQ\Cachet\Bus\Handlers\Events\Incident\SendIncidentEmailNotificationHandler',
|
||||
],
|
||||
'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasUpdatedEvent' => [
|
||||
//
|
||||
],
|
||||
'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasRemovedEvent' => [
|
||||
//
|
||||
],
|
||||
'CachetHQ\Cachet\Bus\Events\Incident\MaintenanceWasScheduledEvent' => [
|
||||
'CachetHQ\Cachet\Bus\Handlers\Events\Incident\SendMaintenanceEmailNotificationHandler',
|
||||
],
|
||||
@@ -84,5 +93,11 @@ class EventServiceProvider extends ServiceProvider
|
||||
'CachetHQ\Cachet\Bus\Events\User\UserWasInvitedEvent' => [
|
||||
'CachetHQ\Cachet\Bus\Handlers\Events\User\SendInviteUserEmailHandler',
|
||||
],
|
||||
'CachetHQ\Cachet\Bus\Events\User\UserWasUpdatedEvent' => [
|
||||
//
|
||||
],
|
||||
'CachetHQ\Cachet\Bus\Events\User\UserWasRemovedEvent' => [
|
||||
//
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
100
app/Foundation/Providers/IntegrationServiceProvider.php
Normal file
100
app/Foundation/Providers/IntegrationServiceProvider.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Foundation\Providers;
|
||||
|
||||
use CachetHQ\Cachet\Integrations\Contracts\Credits as CreditsContract;
|
||||
use CachetHQ\Cachet\Integrations\Contracts\Feed as FeedContract;
|
||||
use CachetHQ\Cachet\Integrations\Contracts\Releases as ReleasesContract;
|
||||
use CachetHQ\Cachet\Integrations\Contracts\System as SystemContract;
|
||||
use CachetHQ\Cachet\Integrations\Core\Credits;
|
||||
use CachetHQ\Cachet\Integrations\Core\Feed;
|
||||
use CachetHQ\Cachet\Integrations\Core\System;
|
||||
use CachetHQ\Cachet\Integrations\GitHub\Releases;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
/**
|
||||
* This is the integration service provider.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class IntegrationServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerCredits();
|
||||
$this->registerFeed();
|
||||
$this->registerSystem();
|
||||
|
||||
$this->registerReleases();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the credits class.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerCredits()
|
||||
{
|
||||
$this->app->singleton(CreditsContract::class, function ($app) {
|
||||
$cache = $app['cache.store'];
|
||||
|
||||
return new Credits($cache);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the feed class.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerFeed()
|
||||
{
|
||||
$this->app->singleton(FeedContract::class, function ($app) {
|
||||
$cache = $app['cache.store'];
|
||||
|
||||
return new Feed($cache);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the system class.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerSystem()
|
||||
{
|
||||
$this->app->singleton(SystemContract::class, function (Container $app) {
|
||||
return new System();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the releases class.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerReleases()
|
||||
{
|
||||
$this->app->singleton(ReleasesContract::class, function ($app) {
|
||||
$cache = $app['cache.store'];
|
||||
$token = $app['config']->get('services.github.token');
|
||||
|
||||
return new Releases($cache, $token);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,15 @@ use CachetHQ\Cachet\Repositories\Metric\MetricRepository;
|
||||
use CachetHQ\Cachet\Repositories\Metric\MySqlRepository as MetricMySqlRepository;
|
||||
use CachetHQ\Cachet\Repositories\Metric\PgSqlRepository as MetricPgSqlRepository;
|
||||
use CachetHQ\Cachet\Repositories\Metric\SqliteRepository as MetricSqliteRepository;
|
||||
use Illuminate\Contracts\Config\Repository as ConfigRepository;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
/**
|
||||
* This is the repository service provider.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class RepositoryServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
@@ -37,22 +44,21 @@ class RepositoryServiceProvider extends ServiceProvider
|
||||
*/
|
||||
protected function registerMetricRepository()
|
||||
{
|
||||
$this->app->singleton('cachet.metricrepository', function ($app) {
|
||||
$dbDriver = $app['config']->get('database.default');
|
||||
$this->app->singleton(MetricRepository::class, function (Container $app) {
|
||||
$config = $app->make(ConfigRepository::class);
|
||||
$driver = $config->get('database.default');
|
||||
|
||||
if ($dbDriver == 'mysql') {
|
||||
$repository = new MetricMySqlRepository();
|
||||
} elseif ($dbDriver == 'pgsql') {
|
||||
$repository = new MetricPgSqlRepository();
|
||||
} elseif ($dbDriver == 'sqlite') {
|
||||
$repository = new MetricSqliteRepository();
|
||||
if ($driver == 'mysql') {
|
||||
$repository = new MetricMySqlRepository($config);
|
||||
} elseif ($driver == 'pgsql') {
|
||||
$repository = new MetricPgSqlRepository($config);
|
||||
} elseif ($driver == 'sqlite') {
|
||||
$repository = new MetricSqliteRepository($config);
|
||||
}
|
||||
|
||||
$dates = $app->make(DateFactory::class);
|
||||
|
||||
return new MetricRepository($repository, $dates);
|
||||
});
|
||||
|
||||
$this->app->alias('cachet.metricrepository', MetricRepository::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ use Illuminate\Routing\Router;
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* This namespace is applied to the controller routes in your routes file.
|
||||
* This namespace is applied to your controller routes.
|
||||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
@@ -28,34 +28,36 @@ class RouteServiceProvider extends ServiceProvider
|
||||
/**
|
||||
* Define the route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
$this->app->call([$this, 'bind']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the bindings for the application.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Router $router)
|
||||
public function bind(Router $router)
|
||||
{
|
||||
parent::boot($router);
|
||||
|
||||
$this->registerBindings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register model bindings.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerBindings()
|
||||
{
|
||||
$this->app->router->model('component', 'CachetHQ\Cachet\Models\Component');
|
||||
$this->app->router->model('component_group', 'CachetHQ\Cachet\Models\ComponentGroup');
|
||||
$this->app->router->model('incident', 'CachetHQ\Cachet\Models\Incident');
|
||||
$this->app->router->model('incident_template', 'CachetHQ\Cachet\Models\IncidentTemplate');
|
||||
$this->app->router->model('metric', 'CachetHQ\Cachet\Models\Metric');
|
||||
$this->app->router->model('metric_point', 'CachetHQ\Cachet\Models\MetricPoint');
|
||||
$this->app->router->model('setting', 'CachetHQ\Cachet\Models\Setting');
|
||||
$this->app->router->model('subscriber', 'CachetHQ\Cachet\Models\Subscriber');
|
||||
$this->app->router->model('subscription', 'CachetHQ\Cachet\Models\Subscription');
|
||||
$this->app->router->model('user', 'CachetHQ\Cachet\Models\User');
|
||||
$router->model('component', 'CachetHQ\Cachet\Models\Component');
|
||||
$router->model('component_group', 'CachetHQ\Cachet\Models\ComponentGroup');
|
||||
$router->model('component_tag', 'CachetHQ\Cachet\Models\ComponentTag');
|
||||
$router->model('incident', 'CachetHQ\Cachet\Models\Incident');
|
||||
$router->model('incident_template', 'CachetHQ\Cachet\Models\IncidentTemplate');
|
||||
$router->model('metric', 'CachetHQ\Cachet\Models\Metric');
|
||||
$router->model('metric_point', 'CachetHQ\Cachet\Models\MetricPoint');
|
||||
$router->model('setting', 'CachetHQ\Cachet\Models\Setting');
|
||||
$router->model('subscriber', 'CachetHQ\Cachet\Models\Subscriber');
|
||||
$router->model('subscription', 'CachetHQ\Cachet\Models\Subscription');
|
||||
$router->model('tag', 'CachetHQ\Cachet\Models\Tag');
|
||||
$router->model('user', 'CachetHQ\Cachet\Models\User');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\GitHub;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Contracts\Cache\Repository as CacheRepository;
|
||||
use Illuminate\Contracts\Config\Repository as ConfigRepository;
|
||||
|
||||
class Release
|
||||
{
|
||||
/**
|
||||
* The cache repository instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Cache\Repository
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* The config repository instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Config\Repository
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Creates a new release instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Cache\Repository $cache
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(CacheRepository $cache, ConfigRepository $config)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the latest GitHub release.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function latest()
|
||||
{
|
||||
$release = $this->cache->remember('version', 720, function () {
|
||||
$headers = ['Accept' => 'application/vnd.github.v3+json'];
|
||||
|
||||
// We can re-use the Emoji token here, if we have it.
|
||||
if ($token = $this->config->get('services.github.token')) {
|
||||
$headers['OAUTH-TOKEN'] = $token;
|
||||
}
|
||||
|
||||
return json_decode((new Client())->get('https://api.github.com/repos/cachethq/cachet/releases/latest', [
|
||||
'headers' => $headers,
|
||||
])->getBody(), true);
|
||||
});
|
||||
|
||||
return $release['tag_name'];
|
||||
}
|
||||
}
|
||||
@@ -161,12 +161,6 @@ abstract class AbstractApiController extends Controller
|
||||
|
||||
$items = $paginator->getCollection();
|
||||
|
||||
if ($sortBy = $request->get('sort')) {
|
||||
$direction = $request->has('order') && $request->get('order') == 'desc';
|
||||
|
||||
$items = $items->sortBy($sortBy, SORT_REGULAR, $direction);
|
||||
}
|
||||
|
||||
return $this->setMetaData($pagination)->setData(AutoPresenter::decorate($items->values()))->respond();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,12 +32,22 @@ class ComponentController extends AbstractApiController
|
||||
public function getComponents()
|
||||
{
|
||||
if (app(Guard::class)->check()) {
|
||||
$components = Component::whereRaw('1 = 1');
|
||||
$components = Component::query();
|
||||
} else {
|
||||
$components = Component::enabled();
|
||||
}
|
||||
|
||||
return $this->paginator($components->paginate(Binput::get('per_page', 20)), Request::instance());
|
||||
$components->search(Binput::except(['sort', 'order', 'per_page']));
|
||||
|
||||
if ($sortBy = Binput::get('sort')) {
|
||||
$direction = Binput::has('order') && Binput::get('order') == 'desc';
|
||||
|
||||
$components->sort($sortBy, $direction);
|
||||
}
|
||||
|
||||
$components = $components->paginate(Binput::get('per_page', 20));
|
||||
|
||||
return $this->paginator($components, Request::instance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,13 @@ use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
/**
|
||||
* This is the component group controller.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
* @author Graham Campbell <graham@alt-three.com>
|
||||
* @author Joe Cohen <joe@alt-three.com>
|
||||
*/
|
||||
class ComponentGroupController extends AbstractApiController
|
||||
{
|
||||
/**
|
||||
@@ -29,7 +36,17 @@ class ComponentGroupController extends AbstractApiController
|
||||
*/
|
||||
public function getGroups()
|
||||
{
|
||||
$groups = ComponentGroup::paginate(Binput::get('per_page', 20));
|
||||
$groups = ComponentGroup::query();
|
||||
|
||||
$groups->search(Binput::except(['sort', 'order', 'per_page']));
|
||||
|
||||
if ($sortBy = Binput::get('sort')) {
|
||||
$direction = Binput::has('order') && Binput::get('order') == 'desc';
|
||||
|
||||
$groups->sort($sortBy, $direction);
|
||||
}
|
||||
|
||||
$groups = $groups->paginate(Binput::get('per_page', 20));
|
||||
|
||||
return $this->paginator($groups, Request::instance());
|
||||
}
|
||||
@@ -57,7 +74,7 @@ class ComponentGroupController extends AbstractApiController
|
||||
$group = dispatch(new AddComponentGroupCommand(
|
||||
Binput::get('name'),
|
||||
Binput::get('order', 0),
|
||||
Binput::get('collapsed')
|
||||
Binput::get('collapsed', 0)
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
@@ -79,7 +96,7 @@ class ComponentGroupController extends AbstractApiController
|
||||
$group = dispatch(new UpdateComponentGroupCommand(
|
||||
$group,
|
||||
Binput::get('name'),
|
||||
Binput::get('order', 0),
|
||||
Binput::get('order'),
|
||||
Binput::get('collapsed')
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
|
||||
117
app/Http/Controllers/Api/ComponentTagController.php
Normal file
117
app/Http/Controllers/Api/ComponentTagController.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Api;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\ComponentTag\AddComponentTagCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\ComponentTag\DeleteComponentTagCommand;
|
||||
use CachetHQ\Cachet\Bus\Exceptions\Tag\TagDoesNotExistOnComponentException;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\ComponentTag;
|
||||
use CachetHQ\Cachet\Models\Tag;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
/**
|
||||
* This is the component tag controller class.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class ComponentTagController extends AbstractApiController
|
||||
{
|
||||
/**
|
||||
* Get all tags.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getTags()
|
||||
{
|
||||
$tags = Tag::query();
|
||||
|
||||
$tags->search(Binput::except(['sort', 'order', 'per_page']));
|
||||
|
||||
if ($sortBy = Binput::get('sort')) {
|
||||
$direction = Binput::has('order') && Binput::get('order') == 'desc';
|
||||
|
||||
$tags->sort($sortBy, $direction);
|
||||
}
|
||||
|
||||
$tags = $tags->paginate(Binput::get('per_page', 20));
|
||||
|
||||
return $this->paginator($tags, Request::instance());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single component tag.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\ComponentTag $componentTag
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getTag(ComponentTag $componentTag)
|
||||
{
|
||||
return $this->item($componentTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new component tag.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function postTags()
|
||||
{
|
||||
$component = Component::find(Binput::get('component_id'));
|
||||
$tag = Tag::find(Binput::get('tag_id'));
|
||||
|
||||
if (!($component && $tag)) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
try {
|
||||
$tag = dispatch(new AddComponentTagCommand(
|
||||
$component,
|
||||
$tag
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
return $this->item($tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an existing tag.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function deleteTag()
|
||||
{
|
||||
$component = Component::find(Binput::get('component_id'));
|
||||
$tag = Tag::find(Binput::get('tag_id'));
|
||||
|
||||
if (!($component && $tag)) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
try {
|
||||
dispatch(new DeleteComponentTagCommand(
|
||||
$component,
|
||||
$tag
|
||||
));
|
||||
} catch (TagDoesNotExistOnComponentException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
return $this->noContent();
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,14 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Api;
|
||||
|
||||
use CachetHQ\Cachet\Integrations\Contracts\Releases;
|
||||
use CachetHQ\Cachet\Integrations\Contracts\System;
|
||||
|
||||
/**
|
||||
* This is the general api controller.
|
||||
*
|
||||
* @author James Brooks <james@bluebaytravel.co.uk>
|
||||
*/
|
||||
class GeneralController extends AbstractApiController
|
||||
{
|
||||
/**
|
||||
@@ -22,4 +30,31 @@ class GeneralController extends AbstractApiController
|
||||
{
|
||||
return $this->item('Pong!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Endpoint to show the Cachet version.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function version()
|
||||
{
|
||||
$latest = app()->make(Releases::class)->latest();
|
||||
|
||||
return $this->setMetaData([
|
||||
'on_latest' => version_compare(CACHET_VERSION, $latest['tag_name']) === 1,
|
||||
'latest' => $latest,
|
||||
])->item(CACHET_VERSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the system status message.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function status()
|
||||
{
|
||||
$system = app()->make(System::class)->getStatus();
|
||||
|
||||
return $this->item($system['system_message']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,17 @@ class IncidentController extends AbstractApiController
|
||||
{
|
||||
$incidentVisibility = app(Guard::class)->check() ? 0 : 1;
|
||||
|
||||
$incidents = Incident::where('visible', '>=', $incidentVisibility)->paginate(Binput::get('per_page', 20));
|
||||
$incidents = Incident::where('visible', '>=', $incidentVisibility);
|
||||
|
||||
$incidents->search(Binput::except(['sort', 'order', 'per_page']));
|
||||
|
||||
if ($sortBy = Binput::get('sort')) {
|
||||
$direction = Binput::has('order') && Binput::get('order') == 'desc';
|
||||
|
||||
$incidents->sort($sortBy, $direction);
|
||||
}
|
||||
|
||||
$incidents = $incidents->paginate(Binput::get('per_page', 20));
|
||||
|
||||
return $this->paginator($incidents, Request::instance());
|
||||
}
|
||||
|
||||
132
app/Http/Controllers/Api/IncidentUpdateController.php
Normal file
132
app/Http/Controllers/Api/IncidentUpdateController.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Api;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\RemoveIncidentUpdateCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\ReportIncidentUpdateCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\UpdateIncidentUpdateCommand;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\IncidentUpdate;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
/**
|
||||
* This is the incident update controller.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class IncidentUpdateController extends AbstractApiController
|
||||
{
|
||||
/**
|
||||
* Return all updates on the incident.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getIncidentUpdates(Incident $incident)
|
||||
{
|
||||
$updates = IncidentUpdate::orderBy('created_at', 'desc');
|
||||
|
||||
if ($sortBy = Binput::get('sort')) {
|
||||
$direction = Binput::has('order') && Binput::get('order') == 'desc';
|
||||
|
||||
$updates->sort($sortBy, $direction);
|
||||
}
|
||||
|
||||
$updates = $updates->paginate(Binput::get('per_page', 20));
|
||||
|
||||
return $this->paginator($updates, Request::instance());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a single incident update.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getIncidentUpdate(Incident $incident, IncidentUpdate $update)
|
||||
{
|
||||
return $this->item($update);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new incident update.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function postIncidentUpdate(Incident $incident)
|
||||
{
|
||||
try {
|
||||
$update = dispatch(new ReportIncidentUpdateCommand(
|
||||
$incident,
|
||||
Binput::get('status'),
|
||||
Binput::get('message'),
|
||||
Auth::user()
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
return $this->item($update);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an incident update.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function putIncidentUpdate(Incident $incident, IncidentUpdate $update)
|
||||
{
|
||||
try {
|
||||
$update = dispatch(new UpdateIncidentUpdateCommand(
|
||||
$update,
|
||||
Binput::get('status'),
|
||||
Binput::get('message'),
|
||||
Auth::user()
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
return $this->item($update);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new incident update.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function deleteIncidentUpdate(Incident $incident, IncidentUpdate $update)
|
||||
{
|
||||
try {
|
||||
dispatch(new RemoveIncidentUpdateCommand($update));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
return $this->noContent();
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,15 @@ class MetricController extends AbstractApiController
|
||||
*/
|
||||
public function getMetrics()
|
||||
{
|
||||
$metrics = Metric::paginate(Binput::get('per_page', 20));
|
||||
$metrics = Metric::query();
|
||||
|
||||
if ($sortBy = Binput::get('sort')) {
|
||||
$direction = Binput::has('order') && Binput::get('order') == 'desc';
|
||||
|
||||
$metrics->sort($sortBy, $direction);
|
||||
}
|
||||
|
||||
$metrics = $metrics->paginate(Binput::get('per_page', 20));
|
||||
|
||||
return $this->paginator($metrics, Request::instance());
|
||||
}
|
||||
@@ -55,7 +63,9 @@ class MetricController extends AbstractApiController
|
||||
*/
|
||||
public function getMetricPoints(Metric $metric)
|
||||
{
|
||||
return $this->collection($metric->points);
|
||||
$points = $metric->points()->paginate(Binput::get('per_page', 20));
|
||||
|
||||
return $this->paginator($points, Request::instance());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,9 +82,11 @@ class MetricController extends AbstractApiController
|
||||
Binput::get('description'),
|
||||
Binput::get('default_value'),
|
||||
Binput::get('calc_type', 0),
|
||||
Binput::get('display_chart'),
|
||||
Binput::get('display_chart', true),
|
||||
Binput::get('places', 2),
|
||||
Binput::get('view', 1)
|
||||
Binput::get('default_view', Binput::get('view', 1)),
|
||||
Binput::get('threshold', 5),
|
||||
Binput::get('order', 0)
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
@@ -99,10 +111,12 @@ class MetricController extends AbstractApiController
|
||||
Binput::get('suffix'),
|
||||
Binput::get('description'),
|
||||
Binput::get('default_value'),
|
||||
Binput::get('calc_type', 0),
|
||||
Binput::get('calc_type'),
|
||||
Binput::get('display_chart'),
|
||||
Binput::get('places', 2),
|
||||
Binput::get('view', 1)
|
||||
Binput::get('places'),
|
||||
Binput::get('default_view', Binput::get('view')),
|
||||
Binput::get('threshold'),
|
||||
Binput::get('order')
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
|
||||
@@ -48,8 +48,8 @@ class MetricPointController extends AbstractApiController
|
||||
$metricPoint = dispatch(new AddMetricPointCommand(
|
||||
$metric,
|
||||
Binput::get('value'),
|
||||
Binput::get('timestamp'))
|
||||
);
|
||||
Binput::get('timestamp')
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
@@ -17,10 +17,17 @@ use CachetHQ\Cachet\Bus\Commands\Subscriber\UnsubscribeSubscriptionCommand;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use CachetHQ\Cachet\Models\Subscription;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
/**
|
||||
* This is the subscriber controller class.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
* @author Graham Campbell <graham@alt-three.com>
|
||||
*/
|
||||
class SubscriberController extends AbstractApiController
|
||||
{
|
||||
/**
|
||||
@@ -42,8 +49,10 @@ class SubscriberController extends AbstractApiController
|
||||
*/
|
||||
public function postSubscribers()
|
||||
{
|
||||
$verified = Binput::get('verify', app(Repository::class)->get('setting.skip_subscriber_verification'));
|
||||
|
||||
try {
|
||||
$subscriber = dispatch(new SubscribeSubscriberCommand(Binput::get('email'), Binput::get('verify', false), null));
|
||||
$subscriber = dispatch(new SubscribeSubscriberCommand(Binput::get('email'), $verified, Binput::get('components')));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
113
app/Http/Controllers/Api/TagController.php
Normal file
113
app/Http/Controllers/Api/TagController.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Api;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\Tag\CreateTagCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\Tag\DeleteTagCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\Tag\UpdateTagCommand;
|
||||
use CachetHQ\Cachet\Models\Tag;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
class TagController extends AbstractApiController
|
||||
{
|
||||
/**
|
||||
* Get all tags.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getTags()
|
||||
{
|
||||
$tags = Tag::query();
|
||||
|
||||
$tags->search(Binput::except(['sort', 'order', 'per_page']));
|
||||
|
||||
if ($sortBy = Binput::get('sort')) {
|
||||
$direction = Binput::has('order') && Binput::get('order') == 'desc';
|
||||
|
||||
$tags->sort($sortBy, $direction);
|
||||
}
|
||||
|
||||
$tags = $tags->paginate(Binput::get('per_page', 20));
|
||||
|
||||
return $this->paginator($tags, Request::instance());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single tag.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Tag $tag
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getTag(Tag $tag)
|
||||
{
|
||||
return $this->item($tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new tag.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function postTags()
|
||||
{
|
||||
try {
|
||||
$tag = dispatch(new CreateTagCommand(
|
||||
Binput::get('name'),
|
||||
Binput::get('slug')
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
return $this->item($tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing tag.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Tag $tag
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function putTag(Tag $tag)
|
||||
{
|
||||
try {
|
||||
$tag = dispatch(new UpdateTagCommand(
|
||||
$tag,
|
||||
Binput::get('name'),
|
||||
Binput::get('slug')
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
return $this->item($tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an existing tag.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Tag $tag
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function deleteTag(Tag $tag)
|
||||
{
|
||||
dispatch(new DeleteTagCommand($tag));
|
||||
|
||||
return $this->noContent();
|
||||
}
|
||||
}
|
||||
87
app/Http/Controllers/Api/UserController.php
Normal file
87
app/Http/Controllers/Api/UserController.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Api;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\User\AddTeamMemberCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\User\RemoveUserCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\User\UpdateTeamMemberCommand;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
/**
|
||||
* This is the user controller class.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class UserController extends AbstractApiController
|
||||
{
|
||||
/**
|
||||
* Create a new user.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function postUsers()
|
||||
{
|
||||
try {
|
||||
$user = dispatch(new AddTeamMemberCommand(
|
||||
Binput::get('username'),
|
||||
Binput::get('password'),
|
||||
Binput::get('email'),
|
||||
Binput::get('level', User::LEVEL_USER)
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
return $this->item($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing user.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\User $user
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function putUser(User $user)
|
||||
{
|
||||
try {
|
||||
dispatch(new UpdateTeamMemberCommand(
|
||||
$user,
|
||||
Binput::get('username'),
|
||||
Binput::get('password'),
|
||||
Binput::get('email'),
|
||||
Binput::get('level')
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
return $this->item($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a user from the system.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\User $user
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function deleteUser(User $user)
|
||||
{
|
||||
dispatch(new RemoveUserCommand($user));
|
||||
|
||||
return $this->noContent();
|
||||
}
|
||||
}
|
||||
@@ -41,11 +41,11 @@ class AuthController extends Controller
|
||||
*/
|
||||
public function postLogin()
|
||||
{
|
||||
$loginData = Binput::only(['login', 'password']);
|
||||
$loginData = Binput::only(['username', 'password']);
|
||||
|
||||
// Login with username or email.
|
||||
$loginKey = Str::contains($loginData['login'], '@') ? 'email' : 'username';
|
||||
$loginData[$loginKey] = array_pull($loginData, 'login');
|
||||
$loginKey = Str::contains($loginData['username'], '@') ? 'email' : 'username';
|
||||
$loginData[$loginKey] = array_pull($loginData, 'username');
|
||||
|
||||
// Validate login credentials.
|
||||
if (Auth::validate($loginData)) {
|
||||
|
||||
@@ -11,34 +11,46 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
|
||||
|
||||
use CachetHQ\Cachet\GitHub\Release;
|
||||
use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\UpdateComponentGroupCommand;
|
||||
use CachetHQ\Cachet\Http\Controllers\Api\AbstractApiController;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
use CachetHQ\Cachet\Models\IncidentTemplate;
|
||||
use Exception;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
class ApiController extends Controller
|
||||
class ApiController extends AbstractApiController
|
||||
{
|
||||
/**
|
||||
* Updates a component with the entered info.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Component $component
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
|
||||
*
|
||||
* @return \CachetHQ\Cachet\Models\Component
|
||||
*/
|
||||
public function postUpdateComponent(Component $component)
|
||||
{
|
||||
if (!$component->update(Binput::except(['_token']))) {
|
||||
throw new Exception(trans('dashboard.components.edit.failure'));
|
||||
try {
|
||||
dispatch(new UpdateComponentCommand(
|
||||
$component,
|
||||
$component->name,
|
||||
$component->description,
|
||||
Binput::get('status'),
|
||||
$component->link,
|
||||
$component->order,
|
||||
$component->group_id,
|
||||
$component->enabled
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
return $component;
|
||||
return $this->item($component);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,11 +63,25 @@ class ApiController extends Controller
|
||||
$componentData = Binput::get('ids');
|
||||
|
||||
foreach ($componentData as $order => $componentId) {
|
||||
// Ordering should be 1-based, data comes in 0-based
|
||||
Component::find($componentId)->update(['order' => $order + 1]);
|
||||
try {
|
||||
$component = Component::find($componentId);
|
||||
|
||||
dispatch(new UpdateComponentCommand(
|
||||
$component,
|
||||
$component->name,
|
||||
$component->description,
|
||||
$component->status,
|
||||
$component->link,
|
||||
$order + 1,
|
||||
$component->group_id,
|
||||
$component->enabled
|
||||
));
|
||||
} catch (QueryException $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
}
|
||||
|
||||
return $componentData;
|
||||
return $this->collection(Component::query()->orderBy('order')->get());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,10 +94,17 @@ class ApiController extends Controller
|
||||
$groupData = Binput::get('ids');
|
||||
|
||||
foreach ($groupData as $order => $groupId) {
|
||||
ComponentGroup::find($groupId)->update(['order' => $order + 1]);
|
||||
$group = ComponentGroup::find($groupId);
|
||||
|
||||
dispatch(new UpdateComponentGroupCommand(
|
||||
$group,
|
||||
$group->name,
|
||||
$order + 1,
|
||||
$group->collapsed
|
||||
));
|
||||
}
|
||||
|
||||
return $groupData;
|
||||
return $this->collection(ComponentGroup::query()->orderBy('order')->get());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,20 +124,4 @@ class ApiController extends Controller
|
||||
|
||||
throw new ModelNotFoundException("Incident template for $templateSlug could not be found.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if Cachet is up to date.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function checkVersion()
|
||||
{
|
||||
$latest = app(Release::class)->latest();
|
||||
|
||||
return Response::json([
|
||||
'cachet_version' => CACHET_VERSION,
|
||||
'latest_version' => $latest,
|
||||
'is_latest' => version_compare(CACHET_VERSION, $latest) === 1,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ class ComponentController extends Controller
|
||||
$group = dispatch(new UpdateComponentGroupCommand(
|
||||
$group,
|
||||
Binput::get('name'),
|
||||
Binput::get('order', 0),
|
||||
$group->order,
|
||||
Binput::get('collapsed')
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
|
||||
@@ -11,11 +11,14 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
|
||||
|
||||
use CachetHQ\Cachet\Integrations\Contracts\Feed;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Jenssegers\Date\Date;
|
||||
|
||||
@@ -36,16 +39,36 @@ class DashboardController extends Controller
|
||||
protected $timeZone;
|
||||
|
||||
/**
|
||||
* Creates a new dashboard controller.
|
||||
* The feed integration.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Integrations\Feed
|
||||
*/
|
||||
protected $feed;
|
||||
|
||||
/**
|
||||
* Creates a new dashboard controller instance.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Integrations\Feed $feed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(Feed $feed)
|
||||
{
|
||||
$this->feed = $feed;
|
||||
$this->startDate = new Date();
|
||||
$this->dateTimeZone = Config::get('cachet.timezone');
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect /admin to /dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function redirectAdmin()
|
||||
{
|
||||
return Redirect::route('dashboard.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the dashboard view.
|
||||
*
|
||||
@@ -56,12 +79,23 @@ class DashboardController extends Controller
|
||||
$components = Component::orderBy('order')->get();
|
||||
$incidents = $this->getIncidents();
|
||||
$subscribers = $this->getSubscribers();
|
||||
$usedComponentGroups = Component::enabled()->where('group_id', '>', 0)->groupBy('group_id')->pluck('group_id');
|
||||
$componentGroups = ComponentGroup::whereIn('id', $usedComponentGroups)->orderBy('order')->get();
|
||||
$ungroupedComponents = Component::enabled()->where('group_id', 0)->orderBy('order')->orderBy('created_at')->get();
|
||||
|
||||
$entries = null;
|
||||
if ($feed = $this->feed->latest()) {
|
||||
$entries = array_slice($feed->channel->item, 0, 5);
|
||||
}
|
||||
|
||||
return View::make('dashboard.index')
|
||||
->withPageTitle(trans('dashboard.dashboard'))
|
||||
->withComponents($components)
|
||||
->withIncidents($incidents)
|
||||
->withSubscribers($subscribers);
|
||||
->withSubscribers($subscribers)
|
||||
->withEntries($entries)
|
||||
->withComponentGroups($componentGroups)
|
||||
->withUngroupedComponents($ungroupedComponents);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,15 +15,22 @@ use AltThree\Validator\ValidationException;
|
||||
use CachetHQ\Cachet\Bus\Commands\Incident\RemoveIncidentCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\Incident\ReportIncidentCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\Incident\UpdateIncidentCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\ReportIncidentUpdateCommand;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use CachetHQ\Cachet\Models\IncidentTemplate;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
/**
|
||||
* This is the incident controller.
|
||||
*
|
||||
* @author James Brooks <james@alt-three.com>
|
||||
*/
|
||||
class IncidentController extends Controller
|
||||
{
|
||||
/**
|
||||
@@ -33,13 +40,24 @@ class IncidentController extends Controller
|
||||
*/
|
||||
protected $subMenu = [];
|
||||
|
||||
/**
|
||||
* The guard instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Auth\Guard
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* Creates a new incident controller instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(Guard $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
|
||||
$this->subMenu = [
|
||||
'incidents' => [
|
||||
'title' => trans('dashboard.incidents.incidents'),
|
||||
@@ -114,7 +132,7 @@ class IncidentController extends Controller
|
||||
Binput::get('visible', true),
|
||||
Binput::get('component_id'),
|
||||
Binput::get('component_status'),
|
||||
Binput::get('notify', true),
|
||||
Binput::get('notify', false),
|
||||
Binput::get('created_at'),
|
||||
null,
|
||||
null
|
||||
@@ -279,4 +297,43 @@ class IncidentController extends Controller
|
||||
return Redirect::route('dashboard.templates.edit', ['id' => $template->id])
|
||||
->withUpdatedTemplate($template);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the incident update form.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showIncidentUpdateAction(Incident $incident)
|
||||
{
|
||||
return View::make('dashboard.incidents.update')->withIncident($incident);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new incident update.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Models\Incident $incident
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createIncidentUpdateAction(Incident $incident)
|
||||
{
|
||||
try {
|
||||
$incident = dispatch(new ReportIncidentUpdateCommand(
|
||||
$incident,
|
||||
Binput::get('status'),
|
||||
Binput::get('message'),
|
||||
$this->auth->user()
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return Redirect::route('dashboard.incidents.update', ['id' => $incident->id])
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.incidents.templates.edit.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return Redirect::route('dashboard.incidents.index')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.delete.success')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class MetricController extends Controller
|
||||
*/
|
||||
public function showMetrics()
|
||||
{
|
||||
$metrics = Metric::orderBy('created_at', 'desc')->get();
|
||||
$metrics = Metric::orderBy('order')->orderBy('id')->get();
|
||||
|
||||
return View::make('dashboard.metrics.index')
|
||||
->withPageTitle(trans('dashboard.metrics.metrics').' - '.trans('dashboard.dashboard'))
|
||||
@@ -79,7 +79,8 @@ class MetricController extends Controller
|
||||
$metricData['calc_type'],
|
||||
$metricData['display_chart'],
|
||||
$metricData['places'],
|
||||
$metricData['default_view']
|
||||
$metricData['default_view'],
|
||||
$metricData['threshold']
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return Redirect::route('dashboard.metrics.add')
|
||||
@@ -151,7 +152,8 @@ class MetricController extends Controller
|
||||
Binput::get('calc_type', null, false),
|
||||
Binput::get('display_chart', null, false),
|
||||
Binput::get('places', null, false),
|
||||
Binput::get('default_view', null, false)
|
||||
Binput::get('default_view', null, false),
|
||||
Binput::get('threshold', null, false)
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return Redirect::route('dashboard.metrics.edit', ['id' => $metric->id])
|
||||
|
||||
@@ -95,10 +95,10 @@ class ScheduleController extends Controller
|
||||
{
|
||||
try {
|
||||
$incident = dispatch(new ReportMaintenanceCommand(
|
||||
Binput::get('incident.name'),
|
||||
Binput::get('incident.message'),
|
||||
Binput::get('incident.notify'),
|
||||
Binput::get('incident.scheduled_at')
|
||||
Binput::get('name'),
|
||||
Binput::get('message'),
|
||||
Binput::get('notify'),
|
||||
Binput::get('scheduled_at')
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return Redirect::route('dashboard.schedule.add')
|
||||
@@ -140,7 +140,7 @@ class ScheduleController extends Controller
|
||||
$scheduleData = Binput::get('incident');
|
||||
|
||||
// Parse the schedule date.
|
||||
$scheduledAt = app(DateFactory::class)->createNormalized('d/m/Y H:i', $scheduleData['scheduled_at']);
|
||||
$scheduledAt = app(DateFactory::class)->create('d/m/Y H:i', $scheduleData['scheduled_at']);
|
||||
|
||||
if ($scheduledAt->isPast()) {
|
||||
$messageBag = new MessageBag();
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
|
||||
|
||||
use CachetHQ\Cachet\Integrations\Contracts\Credits;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
use CachetHQ\Cachet\Settings\Repository;
|
||||
use Exception;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Routing\Controller;
|
||||
@@ -20,6 +22,7 @@ use Illuminate\Support\Facades\Lang;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
@@ -56,6 +59,12 @@ class SettingsController extends Controller
|
||||
'icon' => 'ion-paintbucket',
|
||||
'active' => false,
|
||||
],
|
||||
'customization' => [
|
||||
'title' => trans('dashboard.settings.customization.customization'),
|
||||
'url' => route('dashboard.settings.customization'),
|
||||
'icon' => 'ion-wand',
|
||||
'active' => false,
|
||||
],
|
||||
'localization' => [
|
||||
'title' => trans('dashboard.settings.localization.localization'),
|
||||
'url' => route('dashboard.settings.localization'),
|
||||
@@ -74,6 +83,12 @@ class SettingsController extends Controller
|
||||
'icon' => 'ion-stats-bars',
|
||||
'active' => false,
|
||||
],
|
||||
'credits' => [
|
||||
'title' => trans('dashboard.settings.credits.credits'),
|
||||
'url' => route('dashboard.settings.credits'),
|
||||
'icon' => 'ion-ios-list',
|
||||
'active' => false,
|
||||
],
|
||||
'about' => [
|
||||
'title' => CACHET_VERSION,
|
||||
'url' => 'javascript: void(0);',
|
||||
@@ -137,6 +152,22 @@ class SettingsController extends Controller
|
||||
->withSubMenu($this->subMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the settings customization view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showCustomizationView()
|
||||
{
|
||||
$this->subMenu['customization']['active'] = true;
|
||||
|
||||
Session::flash('redirect_to', $this->subMenu['customization']['url']);
|
||||
|
||||
return View::make('dashboard.settings.customization')
|
||||
->withPageTitle(trans('dashboard.settings.customization.customization').' - '.trans('dashboard.dashboard'))
|
||||
->withSubMenu($this->subMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the settings theme view.
|
||||
*
|
||||
@@ -188,6 +219,30 @@ class SettingsController extends Controller
|
||||
->withSubMenu($this->subMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the credits view.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showCreditsView()
|
||||
{
|
||||
$this->subMenu['credits']['active'] = true;
|
||||
|
||||
$credits = app(Credits::class)->latest();
|
||||
|
||||
$backers = $credits['backers'];
|
||||
$contributors = $credits['contributors'];
|
||||
|
||||
shuffle($backers);
|
||||
shuffle($contributors);
|
||||
|
||||
return View::make('dashboard.settings.credits')
|
||||
->withPageTitle(trans('dashboard.settings.credits.credits').' - '.trans('dashboard.dashboard'))
|
||||
->withBackers($backers)
|
||||
->withContributors($contributors)
|
||||
->withSubMenu($this->subMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the status page settings.
|
||||
*
|
||||
@@ -195,42 +250,44 @@ class SettingsController extends Controller
|
||||
*/
|
||||
public function postSettings()
|
||||
{
|
||||
$redirectUrl = Session::get('redirect_to', route('dashboard.settings.setup'));
|
||||
|
||||
$setting = app('setting');
|
||||
$setting = app(Repository::class);
|
||||
|
||||
if (Binput::get('remove_banner') === '1') {
|
||||
$setting->set('app_banner', null);
|
||||
}
|
||||
|
||||
if (Binput::hasFile('app_banner')) {
|
||||
$file = Binput::file('app_banner');
|
||||
$parameters = Binput::all();
|
||||
|
||||
// Image Validation.
|
||||
// Image size in bytes.
|
||||
$maxSize = $file->getMaxFilesize();
|
||||
|
||||
if ($file->getSize() > $maxSize) {
|
||||
return Redirect::to($redirectUrl)->withErrors(trans('dashboard.settings.app-setup.too-big', ['size' => $maxSize]));
|
||||
if (isset($parameters['header'])) {
|
||||
if ($header = Binput::get('header', null, false, false)) {
|
||||
$setting->set('header', $header);
|
||||
} else {
|
||||
$setting->delete('header');
|
||||
}
|
||||
|
||||
if (!$file->isValid() || $file->getError()) {
|
||||
return Redirect::to($redirectUrl)->withErrors($file->getErrorMessage());
|
||||
}
|
||||
|
||||
if (!starts_with($file->getMimeType(), 'image/')) {
|
||||
return Redirect::to($redirectUrl)->withErrors(trans('dashboard.settings.app-setup.images-only'));
|
||||
}
|
||||
|
||||
// Store the banner.
|
||||
$setting->set('app_banner', base64_encode(file_get_contents($file->getRealPath())));
|
||||
|
||||
// Store the banner type.
|
||||
$setting->set('app_banner_type', $file->getMimeType());
|
||||
}
|
||||
|
||||
if (isset($parameters['footer'])) {
|
||||
if ($footer = Binput::get('footer', null, false, false)) {
|
||||
$setting->set('footer', $footer);
|
||||
} else {
|
||||
$setting->delete('footer');
|
||||
}
|
||||
}
|
||||
|
||||
if (Binput::hasFile('app_banner')) {
|
||||
$this->handleUpdateBanner($setting);
|
||||
}
|
||||
|
||||
$excludedParams = [
|
||||
'_token',
|
||||
'app_banner',
|
||||
'remove_banner',
|
||||
'header',
|
||||
'footer',
|
||||
];
|
||||
|
||||
try {
|
||||
foreach (Binput::except(['app_banner', 'remove_banner']) as $settingName => $settingValue) {
|
||||
foreach (Binput::except($excludedParams) as $settingName => $settingValue) {
|
||||
if ($settingName === 'app_analytics_pi_url') {
|
||||
$settingValue = rtrim($settingValue, '/');
|
||||
}
|
||||
@@ -238,13 +295,47 @@ class SettingsController extends Controller
|
||||
$setting->set($settingName, $settingValue);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return Redirect::to($redirectUrl)->withErrors(trans('dashboard.settings.edit.failure'));
|
||||
return Redirect::back()->withErrors(trans('dashboard.settings.edit.failure'));
|
||||
}
|
||||
|
||||
if (Binput::has('app_locale')) {
|
||||
Lang::setLocale(Binput::get('app_locale'));
|
||||
}
|
||||
|
||||
return Redirect::to($redirectUrl)->withSuccess(trans('dashboard.settings.edit.success'));
|
||||
return Redirect::back()->withSuccess(trans('dashboard.settings.edit.success'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle updating of the banner image.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Settings\Repository $setting
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function handleUpdateBanner(Repository $setting)
|
||||
{
|
||||
$file = Binput::file('app_banner');
|
||||
|
||||
// Image Validation.
|
||||
// Image size in bytes.
|
||||
$maxSize = $file->getMaxFilesize();
|
||||
|
||||
if ($file->getSize() > $maxSize) {
|
||||
return Redirect::to($redirectUrl)->withErrors(trans('dashboard.settings.app-setup.too-big', ['size' => $maxSize]));
|
||||
}
|
||||
|
||||
if (!$file->isValid() || $file->getError()) {
|
||||
return Redirect::to($redirectUrl)->withErrors($file->getErrorMessage());
|
||||
}
|
||||
|
||||
if (!Str::startsWith($file->getMimeType(), 'image/')) {
|
||||
return Redirect::to($redirectUrl)->withErrors(trans('dashboard.settings.app-setup.images-only'));
|
||||
}
|
||||
|
||||
// Store the banner.
|
||||
$setting->set('app_banner', base64_encode(file_get_contents($file->getRealPath())));
|
||||
|
||||
// Store the banner type.
|
||||
$setting->set('app_banner_type', $file->getMimeType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ use CachetHQ\Cachet\Bus\Commands\Subscriber\SubscribeSubscriberCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\Subscriber\UnsubscribeSubscriberCommand;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\View;
|
||||
@@ -52,8 +53,14 @@ class SubscriberController extends Controller
|
||||
*/
|
||||
public function createSubscriberAction()
|
||||
{
|
||||
$verified = app(Repository::class)->get('setting.skip_subscriber_verification');
|
||||
|
||||
try {
|
||||
dispatch(new SubscribeSubscriberCommand(Binput::get('email')));
|
||||
$subscribers = preg_split("/\r\n|\n|\r/", Binput::get('email'));
|
||||
|
||||
foreach ($subscribers as $subscriber) {
|
||||
dispatch(new SubscribeSubscriberCommand($subscriber, $verified));
|
||||
}
|
||||
} catch (ValidationException $e) {
|
||||
return Redirect::route('dashboard.subscribers.add')
|
||||
->withInput(Binput::all())
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
|
||||
|
||||
use AltThree\Validator\ValidationException;
|
||||
use CachetHQ\Cachet\Bus\Commands\User\AddTeamMemberCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\User\InviteTeamMemberCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\User\AddUserCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\User\InviteUserCommand;
|
||||
use CachetHQ\Cachet\Bus\Commands\User\RemoveUserCommand;
|
||||
use CachetHQ\Cachet\Models\User;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
@@ -81,7 +81,7 @@ class TeamController extends Controller
|
||||
public function postAddUser()
|
||||
{
|
||||
try {
|
||||
dispatch(new AddTeamMemberCommand(
|
||||
dispatch(new AddUserCommand(
|
||||
Binput::get('username'),
|
||||
Binput::get('password'),
|
||||
Binput::get('email'),
|
||||
@@ -130,7 +130,7 @@ class TeamController extends Controller
|
||||
public function postInviteUser()
|
||||
{
|
||||
try {
|
||||
dispatch(new InviteTeamMemberCommand(
|
||||
dispatch(new InviteUserCommand(
|
||||
array_unique(array_filter((array) Binput::get('emails')))
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
|
||||
@@ -79,7 +79,7 @@ class FeedController extends Controller
|
||||
private function feedAction(ComponentGroup &$group, $isRss)
|
||||
{
|
||||
if ($group->exists) {
|
||||
$group->components->map(function ($component) {
|
||||
$group->components->map(function ($component) use ($isRss) {
|
||||
$component->incidents()->visible()->orderBy('created_at', 'desc')->get()->map(function ($incident) use ($isRss) {
|
||||
$this->feedAddItem($incident, $isRss);
|
||||
});
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user