@longline/aqua-ui 1.0.284 → 1.0.286
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface IProps {
|
|
2
|
+
/**
|
|
3
|
+
* HTTP status code, e.g. 503
|
|
4
|
+
*/
|
|
5
|
+
status: number;
|
|
6
|
+
/**
|
|
7
|
+
* Type of text to return: `title` for a short text (e.g. "Service unavailable")
|
|
8
|
+
* or `description` for a longer description of the status.
|
|
9
|
+
* @default title
|
|
10
|
+
*/
|
|
11
|
+
type?: 'title' | 'description';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* This formatter converts a HTTP status code to either a short title
|
|
15
|
+
* (e.g. status 503 would be "Service unavailable") or a long description
|
|
16
|
+
* (e.g. status 503 would be "The server is not ready to handle the request.
|
|
17
|
+
* Common causes are a server that is down for maintenance or that is
|
|
18
|
+
* overloaded. Note that together with this response, a user-friendly page
|
|
19
|
+
* explaining the problem should be sent. This response should be used for
|
|
20
|
+
* temporary conditions and the Retry-After HTTP header should, if possible,
|
|
21
|
+
* contain the estimated time before the recovery of the service. The
|
|
22
|
+
* webmaster must also take care about the caching-related headers that are
|
|
23
|
+
* sent along with this response, as these temporary condition responses
|
|
24
|
+
* should usually not be cached.").
|
|
25
|
+
*/
|
|
26
|
+
declare const HttpStatusFormatter: (props: IProps) => string;
|
|
27
|
+
export { HttpStatusFormatter };
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
var HttpStatusCodes = {
|
|
2
|
+
100: {
|
|
3
|
+
header: "Continue",
|
|
4
|
+
desc: "This interim response indicates that the client should continue the request or ignore the response if the request is already finished."
|
|
5
|
+
},
|
|
6
|
+
101: {
|
|
7
|
+
header: "Switching protocols",
|
|
8
|
+
desc: "This code is sent in response to an Upgrade request header from the client and indicates the protocol the server is switching to."
|
|
9
|
+
},
|
|
10
|
+
102: {
|
|
11
|
+
header: "Processing",
|
|
12
|
+
desc: "This code indicates that the server has received and is processing the request, but no response is available yet."
|
|
13
|
+
},
|
|
14
|
+
103: {
|
|
15
|
+
header: "Early hints",
|
|
16
|
+
desc: "This status code is primarily intended to be used with the Link header, letting the user agent start preloading resources while the server prepares a response."
|
|
17
|
+
},
|
|
18
|
+
200: {
|
|
19
|
+
header: "OK",
|
|
20
|
+
desc: "Operation successful."
|
|
21
|
+
},
|
|
22
|
+
201: {
|
|
23
|
+
header: "Created",
|
|
24
|
+
desc: "The request succeeded, and a new resource was created as a result. This is typically the response sent after POST requests, or some PUT requests."
|
|
25
|
+
},
|
|
26
|
+
202: {
|
|
27
|
+
header: "Accepted",
|
|
28
|
+
desc: "The request has been received but not yet acted upon. It is noncommittal, since there is no way in HTTP to later send an asynchronous response indicating the outcome of the request. It is intended for cases where another process or server handles the request, or for batch processing."
|
|
29
|
+
},
|
|
30
|
+
203: {
|
|
31
|
+
header: "Non-authoritative information",
|
|
32
|
+
desc: "This response code means the returned metadata is not exactly the same as is available from the origin server, but is collected from a local or a third-party copy. This is mostly used for mirrors or backups of another resource. Except for that specific case, the 200 OK response is preferred to this status."
|
|
33
|
+
},
|
|
34
|
+
204: {
|
|
35
|
+
header: "No content",
|
|
36
|
+
desc: "There is no content to send for this request, but the headers may be useful. The user agent may update its cached headers for this resource with the new ones."
|
|
37
|
+
},
|
|
38
|
+
205: {
|
|
39
|
+
header: "Reset content",
|
|
40
|
+
desc: "Tells the user agent to reset the document which sent this request."
|
|
41
|
+
},
|
|
42
|
+
206: {
|
|
43
|
+
header: "Partial content",
|
|
44
|
+
desc: "This response code is used when the Range header is sent from the client to request only part of a resource."
|
|
45
|
+
},
|
|
46
|
+
207: {
|
|
47
|
+
header: "Multi-status",
|
|
48
|
+
desc: "Conveys information about multiple resources, for situations where multiple status codes might be appropriate."
|
|
49
|
+
},
|
|
50
|
+
208: {
|
|
51
|
+
header: "Already reported",
|
|
52
|
+
desc: "Used inside a <dav:propstat> response element to avoid repeatedly enumerating the internal members of multiple bindings to the same collection."
|
|
53
|
+
},
|
|
54
|
+
226: {
|
|
55
|
+
header: "IM Used",
|
|
56
|
+
desc: "The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance."
|
|
57
|
+
},
|
|
58
|
+
300: {
|
|
59
|
+
header: "Multiple Choices",
|
|
60
|
+
desc: "The request has more than one possible response. The user agent or user should choose one of them. (There is no standardized way of choosing one of the responses, but HTML links to the possibilities are recommended so the user can pick.)"
|
|
61
|
+
},
|
|
62
|
+
301: {
|
|
63
|
+
header: "Moved Permanently",
|
|
64
|
+
desc: "The URL of the requested resource has been changed permanently. The new URL is given in the response."
|
|
65
|
+
},
|
|
66
|
+
302: {
|
|
67
|
+
header: "Found",
|
|
68
|
+
desc: "This response code means that the URI of requested resource has been changed temporarily. Further changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests."
|
|
69
|
+
},
|
|
70
|
+
303: {
|
|
71
|
+
header: "See other",
|
|
72
|
+
desc: "The server sent this response to direct the client to get the requested resource at another URI with a GET request."
|
|
73
|
+
},
|
|
74
|
+
304: {
|
|
75
|
+
header: "Not modified",
|
|
76
|
+
desc: "This is used for caching purposes. It tells the client that the response has not been modified, so the client can continue to use the same cached version of the response."
|
|
77
|
+
},
|
|
78
|
+
305: {
|
|
79
|
+
header: "Use proxy deprecated",
|
|
80
|
+
desc: "Defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy."
|
|
81
|
+
},
|
|
82
|
+
306: {
|
|
83
|
+
header: "Unused",
|
|
84
|
+
desc: "This response code is no longer used; it is just reserved. It was used in a previous version of the HTTP/1.1 specification."
|
|
85
|
+
},
|
|
86
|
+
307: {
|
|
87
|
+
header: "Temporary redirect",
|
|
88
|
+
desc: "The server sends this response to direct the client to get the requested resource at another URI with same method that was used in the prior request. This has the same semantics as the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request."
|
|
89
|
+
},
|
|
90
|
+
308: {
|
|
91
|
+
header: "Permanent redirect",
|
|
92
|
+
desc: "This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request."
|
|
93
|
+
},
|
|
94
|
+
400: {
|
|
95
|
+
header: "Bad request",
|
|
96
|
+
desc: "The server cannot process your request due to validation errors. Please verify that any form fields are filled out correctly."
|
|
97
|
+
},
|
|
98
|
+
401: {
|
|
99
|
+
header: "Unauthorized",
|
|
100
|
+
desc: "Your session is not authenticated."
|
|
101
|
+
},
|
|
102
|
+
402: {
|
|
103
|
+
header: "Payment required",
|
|
104
|
+
desc: "(No description provided.)"
|
|
105
|
+
},
|
|
106
|
+
403: {
|
|
107
|
+
header: "Forbidden",
|
|
108
|
+
desc: "You do not have sufficient permissions to execute this operation."
|
|
109
|
+
},
|
|
110
|
+
404: {
|
|
111
|
+
header: "Resource not found",
|
|
112
|
+
desc: "The requested resource could not be found on the server."
|
|
113
|
+
},
|
|
114
|
+
405: {
|
|
115
|
+
header: "Method not allowed",
|
|
116
|
+
desc: "The database API tried to execute an HTTP method that was disallowed by the server. This may be indicative of a missing route implementation on the server."
|
|
117
|
+
},
|
|
118
|
+
406: {
|
|
119
|
+
header: "Not acceptable",
|
|
120
|
+
desc: "This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content that conforms to the criteria given by the user agent."
|
|
121
|
+
},
|
|
122
|
+
407: {
|
|
123
|
+
header: "Proxy authentication required",
|
|
124
|
+
desc: "Your session is not authenticated. Authentication is needed to be done by a proxy."
|
|
125
|
+
},
|
|
126
|
+
408: {
|
|
127
|
+
header: "Request timeout",
|
|
128
|
+
desc: "This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message."
|
|
129
|
+
},
|
|
130
|
+
409: {
|
|
131
|
+
header: "Conflict",
|
|
132
|
+
desc: "This response is sent when a request conflicts with the current state of the server."
|
|
133
|
+
},
|
|
134
|
+
410: {
|
|
135
|
+
header: "Gone",
|
|
136
|
+
desc: "This response is sent when the requested content has been permanently deleted from server, with no forwarding address. Clients are expected to remove their caches and links to the resource. APIs should not feel compelled to indicate resources that have been deleted with this status code."
|
|
137
|
+
},
|
|
138
|
+
411: {
|
|
139
|
+
header: "Length required",
|
|
140
|
+
desc: "Server rejected the request because the Content-Length header field is not defined and the server requires it."
|
|
141
|
+
},
|
|
142
|
+
412: {
|
|
143
|
+
header: "Precondition failed",
|
|
144
|
+
desc: "The client has indicated preconditions in its headers which the server does not meet."
|
|
145
|
+
},
|
|
146
|
+
413: {
|
|
147
|
+
header: "Payload too large",
|
|
148
|
+
desc: "Request entity is larger than limits defined by server. The server might close the connection or return an Retry-After header field."
|
|
149
|
+
},
|
|
150
|
+
414: {
|
|
151
|
+
header: "URI too long",
|
|
152
|
+
desc: "The URI requested by the client is longer than the server is willing to interpret."
|
|
153
|
+
},
|
|
154
|
+
415: {
|
|
155
|
+
header: "Unsupported media type",
|
|
156
|
+
desc: "The media format of the requested data is not supported by the server, so the server is rejecting the request."
|
|
157
|
+
},
|
|
158
|
+
416: {
|
|
159
|
+
header: "Range not satisfiable",
|
|
160
|
+
desc: "The range specified by the Range header field in the request cannot be fulfilled. It's possible that the range is outside the size of the target URI's data."
|
|
161
|
+
},
|
|
162
|
+
417: {
|
|
163
|
+
header: "Expectation failed",
|
|
164
|
+
desc: "This response code means the expectation indicated by the Expect request header field cannot be met by the server."
|
|
165
|
+
},
|
|
166
|
+
418: {
|
|
167
|
+
header: "I'm a teapot",
|
|
168
|
+
desc: "The server refuses the attempt to brew coffee with teapot."
|
|
169
|
+
},
|
|
170
|
+
421: {
|
|
171
|
+
header: "Misdirected request",
|
|
172
|
+
desc: "The request was directed at a server that is not able to produce a response. This can be sent by a server that is not configured to produce responses for the combination of scheme and authority that are included in the request URI."
|
|
173
|
+
},
|
|
174
|
+
422: {
|
|
175
|
+
header: "Validation problems",
|
|
176
|
+
desc: "The request could not be validated."
|
|
177
|
+
},
|
|
178
|
+
423: {
|
|
179
|
+
header: "Locked",
|
|
180
|
+
desc: "The resource that is being accessed is locked."
|
|
181
|
+
},
|
|
182
|
+
424: {
|
|
183
|
+
header: "Failed dependency",
|
|
184
|
+
desc: "The request failed due to failure of a previous request."
|
|
185
|
+
},
|
|
186
|
+
425: {
|
|
187
|
+
header: "Too early",
|
|
188
|
+
desc: "Indicates that the server is unwilling to risk processing a request that might be replayed."
|
|
189
|
+
},
|
|
190
|
+
426: {
|
|
191
|
+
header: "Upgrade required",
|
|
192
|
+
desc: "The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol. The server sends an Upgrade header in a 426 response to indicate the required protocol(s)."
|
|
193
|
+
},
|
|
194
|
+
428: {
|
|
195
|
+
header: "Precondition required",
|
|
196
|
+
desc: "The origin server requires the request to be conditional. This response is intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict."
|
|
197
|
+
},
|
|
198
|
+
429: {
|
|
199
|
+
header: "Too many requests",
|
|
200
|
+
desc: "The user has sent too many requests in a given amount of time (rate limiting)."
|
|
201
|
+
},
|
|
202
|
+
431: {
|
|
203
|
+
header: "Request header fields too large",
|
|
204
|
+
desc: "The server is unwilling to process the request because its header fields are too large. The request may be resubmitted after reducing the size of the request header fields."
|
|
205
|
+
},
|
|
206
|
+
451: {
|
|
207
|
+
header: "Unavailable for legal reasons",
|
|
208
|
+
desc: "The user agent requested a resource that cannot legally be provided, such as a web page censored by a government."
|
|
209
|
+
},
|
|
210
|
+
500: {
|
|
211
|
+
header: "Internal server error",
|
|
212
|
+
desc: "The server API encountered an error. This is indicative of a server implementation error.",
|
|
213
|
+
},
|
|
214
|
+
501: {
|
|
215
|
+
header: "Not implemented",
|
|
216
|
+
desc: "The request method is not supported by the server and cannot be handled. This may be indicative of a missing route implementation on the server."
|
|
217
|
+
},
|
|
218
|
+
502: {
|
|
219
|
+
header: "Bad gateway",
|
|
220
|
+
desc: "This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response."
|
|
221
|
+
},
|
|
222
|
+
503: {
|
|
223
|
+
header: "Service unavailable",
|
|
224
|
+
desc: "The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This response should be used for temporary conditions and the Retry-After HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached."
|
|
225
|
+
},
|
|
226
|
+
504: {
|
|
227
|
+
header: "Gateway timeout",
|
|
228
|
+
desc: "This error response is given when the server is acting as a gateway and cannot get a response in time."
|
|
229
|
+
},
|
|
230
|
+
505: {
|
|
231
|
+
header: "HTTP version not supported",
|
|
232
|
+
desc: "The HTTP version used in the request is not supported by the server."
|
|
233
|
+
},
|
|
234
|
+
506: {
|
|
235
|
+
header: "Variant also negates",
|
|
236
|
+
desc: "The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process."
|
|
237
|
+
},
|
|
238
|
+
507: {
|
|
239
|
+
header: "Insufficient storage",
|
|
240
|
+
desc: "The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request."
|
|
241
|
+
},
|
|
242
|
+
508: {
|
|
243
|
+
header: "Loop detected",
|
|
244
|
+
desc: "The server detected an infinite loop while processing the request."
|
|
245
|
+
},
|
|
246
|
+
510: {
|
|
247
|
+
header: "Not extended",
|
|
248
|
+
desc: "Further extensions to the request are required for the server to fulfill it."
|
|
249
|
+
},
|
|
250
|
+
511: {
|
|
251
|
+
header: "Network authentication failed",
|
|
252
|
+
desc: "Indicates that the client needs to authenticate to gain network access."
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* This formatter converts a HTTP status code to either a short title
|
|
257
|
+
* (e.g. status 503 would be "Service unavailable") or a long description
|
|
258
|
+
* (e.g. status 503 would be "The server is not ready to handle the request.
|
|
259
|
+
* Common causes are a server that is down for maintenance or that is
|
|
260
|
+
* overloaded. Note that together with this response, a user-friendly page
|
|
261
|
+
* explaining the problem should be sent. This response should be used for
|
|
262
|
+
* temporary conditions and the Retry-After HTTP header should, if possible,
|
|
263
|
+
* contain the estimated time before the recovery of the service. The
|
|
264
|
+
* webmaster must also take care about the caching-related headers that are
|
|
265
|
+
* sent along with this response, as these temporary condition responses
|
|
266
|
+
* should usually not be cached.").
|
|
267
|
+
*/
|
|
268
|
+
var HttpStatusFormatter = function (props) {
|
|
269
|
+
var status = HttpStatusCodes[props.status];
|
|
270
|
+
if (!status)
|
|
271
|
+
return "Unknown error";
|
|
272
|
+
return props.type === 'description' ? status.desc : status.header;
|
|
273
|
+
};
|
|
274
|
+
export { HttpStatusFormatter };
|
package/package.json
CHANGED
|
@@ -13,260 +13,7 @@ import * as React from 'react';
|
|
|
13
13
|
// Other controls
|
|
14
14
|
import { Dialog } from './Dialog';
|
|
15
15
|
import { PrimaryButton } from '../../controls/PrimaryButton';
|
|
16
|
-
|
|
17
|
-
100: {
|
|
18
|
-
header: "Continue",
|
|
19
|
-
desc: "This interim response indicates that the client should continue the request or ignore the response if the request is already finished."
|
|
20
|
-
},
|
|
21
|
-
101: {
|
|
22
|
-
header: "Switching protocols",
|
|
23
|
-
desc: "This code is sent in response to an Upgrade request header from the client and indicates the protocol the server is switching to."
|
|
24
|
-
},
|
|
25
|
-
102: {
|
|
26
|
-
header: "Processing",
|
|
27
|
-
desc: "This code indicates that the server has received and is processing the request, but no response is available yet."
|
|
28
|
-
},
|
|
29
|
-
103: {
|
|
30
|
-
header: "Early hints",
|
|
31
|
-
desc: "This status code is primarily intended to be used with the Link header, letting the user agent start preloading resources while the server prepares a response."
|
|
32
|
-
},
|
|
33
|
-
200: {
|
|
34
|
-
header: "OK",
|
|
35
|
-
desc: "Operation successful."
|
|
36
|
-
},
|
|
37
|
-
201: {
|
|
38
|
-
header: "Created",
|
|
39
|
-
desc: "The request succeeded, and a new resource was created as a result. This is typically the response sent after POST requests, or some PUT requests."
|
|
40
|
-
},
|
|
41
|
-
202: {
|
|
42
|
-
header: "Accepted",
|
|
43
|
-
desc: "The request has been received but not yet acted upon. It is noncommittal, since there is no way in HTTP to later send an asynchronous response indicating the outcome of the request. It is intended for cases where another process or server handles the request, or for batch processing."
|
|
44
|
-
},
|
|
45
|
-
203: {
|
|
46
|
-
header: "Non-authoritative information",
|
|
47
|
-
desc: "This response code means the returned metadata is not exactly the same as is available from the origin server, but is collected from a local or a third-party copy. This is mostly used for mirrors or backups of another resource. Except for that specific case, the 200 OK response is preferred to this status."
|
|
48
|
-
},
|
|
49
|
-
204: {
|
|
50
|
-
header: "No content",
|
|
51
|
-
desc: "There is no content to send for this request, but the headers may be useful. The user agent may update its cached headers for this resource with the new ones."
|
|
52
|
-
},
|
|
53
|
-
205: {
|
|
54
|
-
header: "Reset content",
|
|
55
|
-
desc: "Tells the user agent to reset the document which sent this request."
|
|
56
|
-
},
|
|
57
|
-
206: {
|
|
58
|
-
header: "Partial content",
|
|
59
|
-
desc: "This response code is used when the Range header is sent from the client to request only part of a resource."
|
|
60
|
-
},
|
|
61
|
-
207: {
|
|
62
|
-
header: "Multi-status",
|
|
63
|
-
desc: "Conveys information about multiple resources, for situations where multiple status codes might be appropriate."
|
|
64
|
-
},
|
|
65
|
-
208: {
|
|
66
|
-
header: "Already reported",
|
|
67
|
-
desc: "Used inside a <dav:propstat> response element to avoid repeatedly enumerating the internal members of multiple bindings to the same collection."
|
|
68
|
-
},
|
|
69
|
-
226: {
|
|
70
|
-
header: "IM Used",
|
|
71
|
-
desc: "The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance."
|
|
72
|
-
},
|
|
73
|
-
300: {
|
|
74
|
-
header: "Multiple Choices",
|
|
75
|
-
desc: "The request has more than one possible response. The user agent or user should choose one of them. (There is no standardized way of choosing one of the responses, but HTML links to the possibilities are recommended so the user can pick.)"
|
|
76
|
-
},
|
|
77
|
-
301: {
|
|
78
|
-
header: "Moved Permanently",
|
|
79
|
-
desc: "The URL of the requested resource has been changed permanently. The new URL is given in the response."
|
|
80
|
-
},
|
|
81
|
-
302: {
|
|
82
|
-
header: "Found",
|
|
83
|
-
desc: "This response code means that the URI of requested resource has been changed temporarily. Further changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests."
|
|
84
|
-
},
|
|
85
|
-
303: {
|
|
86
|
-
header: "See other",
|
|
87
|
-
desc: "The server sent this response to direct the client to get the requested resource at another URI with a GET request."
|
|
88
|
-
},
|
|
89
|
-
304: {
|
|
90
|
-
header: "Not modified",
|
|
91
|
-
desc: "This is used for caching purposes. It tells the client that the response has not been modified, so the client can continue to use the same cached version of the response."
|
|
92
|
-
},
|
|
93
|
-
305: {
|
|
94
|
-
header: "Use proxy deprecated",
|
|
95
|
-
desc: "Defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy."
|
|
96
|
-
},
|
|
97
|
-
306: {
|
|
98
|
-
header: "Unused",
|
|
99
|
-
desc: "This response code is no longer used; it is just reserved. It was used in a previous version of the HTTP/1.1 specification."
|
|
100
|
-
},
|
|
101
|
-
307: {
|
|
102
|
-
header: "Temporary redirect",
|
|
103
|
-
desc: "The server sends this response to direct the client to get the requested resource at another URI with same method that was used in the prior request. This has the same semantics as the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request."
|
|
104
|
-
},
|
|
105
|
-
308: {
|
|
106
|
-
header: "Permanent redirect",
|
|
107
|
-
desc: "This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: if a POST was used in the first request, a POST must be used in the second request."
|
|
108
|
-
},
|
|
109
|
-
400: {
|
|
110
|
-
header: "Bad request",
|
|
111
|
-
desc: "The server cannot process your request due to validation errors. Please verify that any form fields are filled out correctly."
|
|
112
|
-
},
|
|
113
|
-
401: {
|
|
114
|
-
header: "Unauthorized",
|
|
115
|
-
desc: "Your session is not authenticated."
|
|
116
|
-
},
|
|
117
|
-
402: {
|
|
118
|
-
header: "Payment required",
|
|
119
|
-
desc: "(No description provided.)"
|
|
120
|
-
},
|
|
121
|
-
403: {
|
|
122
|
-
header: "Forbidden",
|
|
123
|
-
desc: "You do not have sufficient permissions to execute this operation."
|
|
124
|
-
},
|
|
125
|
-
404: {
|
|
126
|
-
header: "Resource not found",
|
|
127
|
-
desc: "The requested resource could not be found on the server."
|
|
128
|
-
},
|
|
129
|
-
405: {
|
|
130
|
-
header: "Method not allowed",
|
|
131
|
-
desc: "The database API tried to execute an HTTP method that was disallowed by the server. This may be indicative of a missing route implementation on the server."
|
|
132
|
-
},
|
|
133
|
-
406: {
|
|
134
|
-
header: "Not acceptable",
|
|
135
|
-
desc: "This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content that conforms to the criteria given by the user agent."
|
|
136
|
-
},
|
|
137
|
-
407: {
|
|
138
|
-
header: "Proxy authentication required",
|
|
139
|
-
desc: "Your session is not authenticated. Authentication is needed to be done by a proxy."
|
|
140
|
-
},
|
|
141
|
-
408: {
|
|
142
|
-
header: "Request timeout",
|
|
143
|
-
desc: "This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message."
|
|
144
|
-
},
|
|
145
|
-
409: {
|
|
146
|
-
header: "Conflict",
|
|
147
|
-
desc: "This response is sent when a request conflicts with the current state of the server."
|
|
148
|
-
},
|
|
149
|
-
410: {
|
|
150
|
-
header: "Gone",
|
|
151
|
-
desc: "This response is sent when the requested content has been permanently deleted from server, with no forwarding address. Clients are expected to remove their caches and links to the resource. APIs should not feel compelled to indicate resources that have been deleted with this status code."
|
|
152
|
-
},
|
|
153
|
-
411: {
|
|
154
|
-
header: "Length required",
|
|
155
|
-
desc: "Server rejected the request because the Content-Length header field is not defined and the server requires it."
|
|
156
|
-
},
|
|
157
|
-
412: {
|
|
158
|
-
header: "Precondition failed",
|
|
159
|
-
desc: "The client has indicated preconditions in its headers which the server does not meet."
|
|
160
|
-
},
|
|
161
|
-
413: {
|
|
162
|
-
header: "Payload too large",
|
|
163
|
-
desc: "Request entity is larger than limits defined by server. The server might close the connection or return an Retry-After header field."
|
|
164
|
-
},
|
|
165
|
-
414: {
|
|
166
|
-
header: "URI too long",
|
|
167
|
-
desc: "The URI requested by the client is longer than the server is willing to interpret."
|
|
168
|
-
},
|
|
169
|
-
415: {
|
|
170
|
-
header: "Unsupported media type",
|
|
171
|
-
desc: "The media format of the requested data is not supported by the server, so the server is rejecting the request."
|
|
172
|
-
},
|
|
173
|
-
416: {
|
|
174
|
-
header: "Range not satisfiable",
|
|
175
|
-
desc: "The range specified by the Range header field in the request cannot be fulfilled. It's possible that the range is outside the size of the target URI's data."
|
|
176
|
-
},
|
|
177
|
-
417: {
|
|
178
|
-
header: "Expectation failed",
|
|
179
|
-
desc: "This response code means the expectation indicated by the Expect request header field cannot be met by the server."
|
|
180
|
-
},
|
|
181
|
-
418: {
|
|
182
|
-
header: "I'm a teapot",
|
|
183
|
-
desc: "The server refuses the attempt to brew coffee with teapot."
|
|
184
|
-
},
|
|
185
|
-
421: {
|
|
186
|
-
header: "Misdirected request",
|
|
187
|
-
desc: "The request was directed at a server that is not able to produce a response. This can be sent by a server that is not configured to produce responses for the combination of scheme and authority that are included in the request URI."
|
|
188
|
-
},
|
|
189
|
-
422: {
|
|
190
|
-
header: "Validation problems",
|
|
191
|
-
desc: "The request could not be validated."
|
|
192
|
-
},
|
|
193
|
-
423: {
|
|
194
|
-
header: "Locked",
|
|
195
|
-
desc: "The resource that is being accessed is locked."
|
|
196
|
-
},
|
|
197
|
-
424: {
|
|
198
|
-
header: "Failed dependency",
|
|
199
|
-
desc: "The request failed due to failure of a previous request."
|
|
200
|
-
},
|
|
201
|
-
425: {
|
|
202
|
-
header: "Too early",
|
|
203
|
-
desc: "Indicates that the server is unwilling to risk processing a request that might be replayed."
|
|
204
|
-
},
|
|
205
|
-
426: {
|
|
206
|
-
header: "Upgrade required",
|
|
207
|
-
desc: "The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol. The server sends an Upgrade header in a 426 response to indicate the required protocol(s)."
|
|
208
|
-
},
|
|
209
|
-
428: {
|
|
210
|
-
header: "Precondition required",
|
|
211
|
-
desc: "The origin server requires the request to be conditional. This response is intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict."
|
|
212
|
-
},
|
|
213
|
-
429: {
|
|
214
|
-
header: "Too many requests",
|
|
215
|
-
desc: "The user has sent too many requests in a given amount of time (rate limiting)."
|
|
216
|
-
},
|
|
217
|
-
431: {
|
|
218
|
-
header: "Request header fields too large",
|
|
219
|
-
desc: "The server is unwilling to process the request because its header fields are too large. The request may be resubmitted after reducing the size of the request header fields."
|
|
220
|
-
},
|
|
221
|
-
451: {
|
|
222
|
-
header: "Unavailable for legal reasons",
|
|
223
|
-
desc: "The user agent requested a resource that cannot legally be provided, such as a web page censored by a government."
|
|
224
|
-
},
|
|
225
|
-
500: {
|
|
226
|
-
header: "Internal server error",
|
|
227
|
-
desc: "The server API encountered an error. This is indicative of a server implementation error.",
|
|
228
|
-
},
|
|
229
|
-
501: {
|
|
230
|
-
header: "Not implemented",
|
|
231
|
-
desc: "The request method is not supported by the server and cannot be handled. This may be indicative of a missing route implementation on the server."
|
|
232
|
-
},
|
|
233
|
-
502: {
|
|
234
|
-
header: "Bad gateway",
|
|
235
|
-
desc: "This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response."
|
|
236
|
-
},
|
|
237
|
-
503: {
|
|
238
|
-
header: "Service unavailable",
|
|
239
|
-
desc: "The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This response should be used for temporary conditions and the Retry-After HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached."
|
|
240
|
-
},
|
|
241
|
-
504: {
|
|
242
|
-
header: "Gateway timeout",
|
|
243
|
-
desc: "This error response is given when the server is acting as a gateway and cannot get a response in time."
|
|
244
|
-
},
|
|
245
|
-
505: {
|
|
246
|
-
header: "HTTP version not supported",
|
|
247
|
-
desc: "The HTTP version used in the request is not supported by the server."
|
|
248
|
-
},
|
|
249
|
-
506: {
|
|
250
|
-
header: "Variant also negates",
|
|
251
|
-
desc: "The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process."
|
|
252
|
-
},
|
|
253
|
-
507: {
|
|
254
|
-
header: "Insufficient storage",
|
|
255
|
-
desc: "The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request."
|
|
256
|
-
},
|
|
257
|
-
508: {
|
|
258
|
-
header: "Loop detected",
|
|
259
|
-
desc: "The server detected an infinite loop while processing the request."
|
|
260
|
-
},
|
|
261
|
-
510: {
|
|
262
|
-
header: "Not extended",
|
|
263
|
-
desc: "Further extensions to the request are required for the server to fulfill it."
|
|
264
|
-
},
|
|
265
|
-
511: {
|
|
266
|
-
header: "Network authentication failed",
|
|
267
|
-
desc: "Indicates that the client needs to authenticate to gain network access."
|
|
268
|
-
}
|
|
269
|
-
};
|
|
16
|
+
import { HttpStatusFormatter } from '../../formatters/HttpStatusFormatter/HttpStatusFormatter';
|
|
270
17
|
/**
|
|
271
18
|
* A `Dialog.Xhr` is a preset dialog that takes an `error` object from an
|
|
272
19
|
* Axios request. It then displays a human-readable version of this error.
|
|
@@ -277,8 +24,8 @@ var XhrDialog = function (_a) {
|
|
|
277
24
|
var _b = _a.open, open = _b === void 0 ? false : _b, _c = _a.title, title = _c === void 0 ? "Network error" : _c, props = __rest(_a, ["open", "title"]);
|
|
278
25
|
var getStatusHeader = function () {
|
|
279
26
|
if (props.error.response) {
|
|
280
|
-
var status_1 =
|
|
281
|
-
return status_1
|
|
27
|
+
var status_1 = React.createElement(HttpStatusFormatter, { type: "title", status: props.error.response.status });
|
|
28
|
+
return status_1 || "Server error";
|
|
282
29
|
}
|
|
283
30
|
else if (props.error.request) {
|
|
284
31
|
return props.error.message;
|
|
@@ -289,8 +36,8 @@ var XhrDialog = function (_a) {
|
|
|
289
36
|
};
|
|
290
37
|
var getStatusText = function () {
|
|
291
38
|
if (props.error.response) {
|
|
292
|
-
var status_2 =
|
|
293
|
-
return status_2
|
|
39
|
+
var status_2 = React.createElement(HttpStatusFormatter, { type: "description", status: props.error.response.status });
|
|
40
|
+
return status_2 || "An error occurred on the server. Please try again later.";
|
|
294
41
|
}
|
|
295
42
|
else if (props.error.request) {
|
|
296
43
|
return "There was a problem communicating with the server. Please try again later.";
|
package/services/Toast/Toast.js
CHANGED
|
@@ -46,6 +46,8 @@ var ToastBase = function (props) {
|
|
|
46
46
|
return function () { return toggle(false); };
|
|
47
47
|
}, []);
|
|
48
48
|
React.useEffect(function () {
|
|
49
|
+
if (props.duration === 0)
|
|
50
|
+
return undefined;
|
|
49
51
|
// Set a timeout on the toast, saving the
|
|
50
52
|
// timer handle for later cleanup.
|
|
51
53
|
timerHandle.current = window.setTimeout(function () {
|
|
@@ -72,7 +74,7 @@ var ToastBase = function (props) {
|
|
|
72
74
|
var Message = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n flex: 1;\n padding-left: 16px;\n padding-right: 16px;\n"], ["\n display: flex;\n align-items: center;\n flex: 1;\n padding-left: 16px;\n padding-right: 16px;\n"])));
|
|
73
75
|
var CloseButton = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n cursor: pointer;\n\n svg {\n fill: ", ";\n width: 20px;\n height: 20px;\n } \n &:hover {\n svg {\n fill: ", ";\n }\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n cursor: pointer;\n\n svg {\n fill: ", ";\n width: 20px;\n height: 20px;\n } \n &:hover {\n svg {\n fill: ", ";\n }\n }\n"])), function (p) { return p.theme.colors.neutral[95]; }, function (p) { return p.theme.colors.neutral[100]; });
|
|
74
76
|
var Action = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding-left: 8px;\n color: ", ";\n cursor: pointer;\n white-space: nowrap;\n font: ", ";\n text-transform: uppercase;\n transition: color ease-in-out ", "ms;\n &:hover {\n color: ", ";\n }\n &:last-child {\n padding-right: 16px;\n }\n"], ["\n display: flex;\n align-items: center;\n padding-left: 8px;\n color: ", ";\n cursor: pointer;\n white-space: nowrap;\n font: ", ";\n text-transform: uppercase;\n transition: color ease-in-out ", "ms;\n &:hover {\n color: ", ";\n }\n &:last-child {\n padding-right: 16px;\n }\n"])), function (p) { return p.theme.colors.primary[4]; }, function (p) { return p.theme.font.labelCaps; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.colors.primary[2]; });
|
|
75
|
-
var ToastStyled = styled(ToastBase)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n // Position and size:\n display: flex;\n width: 344px;\n box-sizing: border-box;\n align-items: stretch;\n justify-content: space-between;\n user-select: none;\n pointer-events: all;\n\n // Space between toasts:\n margin: 8px 0 8px 0; \n\n // Appearance:\n padding: 14px 0 14px 0;\n background-color: ", ";\n color: #fff;\n border-radius: ", "px;\n font: ", ";\n\n /* useTransitionState classes */\n transition: opacity ", "ms ease;\n &.preEnter, &.exiting, &.unmounted {\n opacity: 0;\n }\n &.entering {\n opacity: 1;\n }\n &.entered {\n opacity: 1;\n }\n\n"], ["\n // Position and size:\n display: flex;\n width: 344px;\n box-sizing: border-box;\n align-items: stretch;\n justify-content: space-between;\n user-select: none;\n pointer-events: all;\n\n // Space between toasts:\n margin: 8px 0 8px 0; \n\n // Appearance:\n padding: 14px 0 14px 0;\n background-color: ", ";\n color: #fff;\n border-radius: ", "px;\n font: ", ";\n\n /* useTransitionState classes */\n transition: opacity ", "ms ease;\n &.preEnter, &.exiting, &.unmounted {\n opacity: 0;\n }\n &.entering {\n opacity: 1;\n }\n &.entered {\n opacity: 1;\n }\n\n"])), function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.theme.radius.normal; }, function (p) { return p.theme.font.bodyMedium; }, function (p) { return p.theme.animation.duration * 2; });
|
|
77
|
+
var ToastStyled = styled(ToastBase)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n // Position and size:\n display: flex;\n width: 344px;\n box-sizing: border-box;\n align-items: stretch;\n justify-content: space-between;\n user-select: none;\n pointer-events: all;\n\n // Space between toasts:\n margin: 8px 0 8px 0; \n\n // Appearance:\n padding: 14px 0 14px 0;\n background-color: ", ";\n color: #fff;\n border-radius: ", "px;\n font: ", ";\n\n // Content:\n a {\n color: ", " !important;\n }\n\n /* useTransitionState classes */\n transition: opacity ", "ms ease;\n &.preEnter, &.exiting, &.unmounted {\n opacity: 0;\n }\n &.entering {\n opacity: 1;\n }\n &.entered {\n opacity: 1;\n }\n\n"], ["\n // Position and size:\n display: flex;\n width: 344px;\n box-sizing: border-box;\n align-items: stretch;\n justify-content: space-between;\n user-select: none;\n pointer-events: all;\n\n // Space between toasts:\n margin: 8px 0 8px 0; \n\n // Appearance:\n padding: 14px 0 14px 0;\n background-color: ", ";\n color: #fff;\n border-radius: ", "px;\n font: ", ";\n\n // Content:\n a {\n color: ", " !important;\n }\n\n /* useTransitionState classes */\n transition: opacity ", "ms ease;\n &.preEnter, &.exiting, &.unmounted {\n opacity: 0;\n }\n &.entering {\n opacity: 1;\n }\n &.entered {\n opacity: 1;\n }\n\n"])), function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.theme.radius.normal; }, function (p) { return p.theme.font.bodyMedium; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.theme.animation.duration * 2; });
|
|
76
78
|
/**
|
|
77
79
|
* A `Toast` is generated through the `ToastProvider.toast` method.
|
|
78
80
|
*
|