Skip to content

Commit c9d2fc3

Browse files
authored
Merge pull request #496 from marle3003/develop
v.0.13.1
2 parents 532df26 + 54365d6 commit c9d2fc3

File tree

5 files changed

+40
-15
lines changed

5 files changed

+40
-15
lines changed

docs/configuration/dynamic/git.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ MOKAPI_PROVIDERS_GIT_URL=https://github.com/PATH-TO/REPOSITORY?ref=branch-name
4848
```
4949

5050
### Pull Interval
51-
Defines in which interval Mokapi pulls possible changes, default 5 seconds.
51+
Defines in which interval Mokapi pulls possible changes, default 3 minutes.
5252
Valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`.
5353

5454
```yaml tab=File (YAML)
5555
providers:
5656
git:
57-
pullInterval: 2h45m
57+
pullInterval: 3m30s
5858
```
5959
```bash tab=CLI
60-
--providers-git-pull-interval 2h45m
60+
--providers-git-pull-interval 3m30s
6161
```
6262
```bash tab=Env
63-
MOKAPI_PROVIDERS_GIT_PULL-INTERVAL=2h45m
63+
MOKAPI_PROVIDERS_GIT_PULL-INTERVAL=3m30s
6464
```
6565

6666
## Advanced Repository Settings
@@ -109,7 +109,7 @@ providers:
109109
git:
110110
repositories:
111111
- url: https://github.com/PATH-TO/REPOSITORY
112-
pullInterval: 2h45m
112+
pullInterval: 3m30s
113113
```
114114
115115
### TempDir

docs/configuration/dynamic/http.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@ MOKAPI_PROVIDERS_HTTP_URL=http://127.0.0.1/api
5353
```
5454

5555
### Poll Interval
56-
Defines in which interval possible changes are checked, default 5 seconds.
56+
Defines in which interval possible changes are checked, default 3 minutes.
5757
Valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`.
5858

5959
```yaml tab=File (YAML)
6060
providers:
6161
http:
62-
pollInterval: 2h45m
62+
pollInterval: 3m30s
6363
```
6464
```bash tab=CLI
65-
--providers-http-poll-interval 2h45m
65+
--providers-http-poll-interval 3m30s
6666
```
6767
```bash tab=Env
68-
MOKAPI_PROVIDERS_HTTP_POLL_INTERVAL=2h45m
68+
MOKAPI_PROVIDERS_HTTP_POLL_INTERVAL=3m30s
6969
```
7070

7171
### Poll Timeout

examples/mokapi/http_handler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { on, env } from 'mokapi'
1+
import { on, env, sleep } from 'mokapi'
22
import { clusters, events as kafkaEvents, configs as kafkaConfigs } from 'kafka.js'
33
import { apps as httpServices, events as httpEvents, configs as httpConfigs } from 'services_http.js'
44
import { server as smtpServers, mails, mailEvents, getMail, getAttachment } from 'smtp.js'
@@ -87,6 +87,7 @@ export default async function() {
8787
return true
8888
}
8989
case 'validate':
90+
sleep(1000)
9091
let url = `${apiBaseUrl}/api/schema/validate`
9192
if (request.query['outputFormat']) {
9293
url += '?outputFormat=' + request.query['outputFormat']

providers/openapi/handler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,11 @@ func writeError(rw http.ResponseWriter, r *http.Request, err error, serviceName
296296
status = http.StatusInternalServerError
297297
}
298298

299-
entry := log.WithFields(log.Fields{"url": r.URL, "method": r.Method, "status": status})
299+
logMessage := fmt.Sprintf("HTTP request failed with status code %d: %s %s: %s", status, r.Method, r.URL.String(), err.Error())
300300
if status == http.StatusInternalServerError {
301-
entry.Error(message)
301+
log.Errorf(logMessage)
302302
} else {
303-
entry.Info(message)
303+
log.Infof(logMessage)
304304
}
305305
if m, ok := monitor.HttpFromContext(r.Context()); ok {
306306
endpointPath := r.Context().Value("endpointPath")

webui/src/components/dashboard/SchemaValidate.vue

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const state = reactive({
3030
errors: '',
3131
result: null,
3232
validated: false,
33+
validating: false,
3334
view: 'preview'
3435
})
3536
@@ -73,6 +74,9 @@ function setExample() {
7374
}
7475
7576
function validate() {
77+
state.validating = true
78+
state.validated = false
79+
7680
const body = {
7781
format: props.schema.format,
7882
schema: props.schema.schema,
@@ -102,6 +106,7 @@ function validate() {
102106
}))
103107
}
104108
}).then(({ status, body }) => {
109+
state.validating = false
105110
state.validated = true
106111
107112
if (status === 500) {
@@ -193,8 +198,9 @@ function formatResultItem(result: any): [string, number] {
193198
<div class="modal-footer justify-content-between">
194199
<span class="float-start">
195200
<span class="status" role="status">
196-
<i v-if="state.errors.length == 0 && state.result == null && state.validated" class="valid bi bi-check-circle-fill"> Valid</i>
197-
<i v-else-if="state.validated" class="failed bi bi-x-circle-fill"> Failed</i>
201+
<span v-if="state.validating" class="loading"><i class="bi bi-arrow-repeat spin"></i> Validating...</span>
202+
<i v-else-if="state.errors.length == 0 && state.result == null && state.validated" class="valid bi bi-check-circle-fill fade-in"> Valid</i>
203+
<i v-else-if="state.validated" class="failed bi bi-x-circle-fill fade-in"> Failed</i>
198204
</span>
199205
</span>
200206
<div class="float-end">
@@ -222,4 +228,22 @@ function formatResultItem(result: any): [string, number] {
222228
.modal-footer .status .failed {
223229
color: var(--color-red);
224230
}
231+
.modal-footer .status .loading {
232+
color: var(--color-blue);
233+
}
234+
.spin {
235+
display: inline-block;
236+
animation: spin 1s linear infinite;
237+
}
238+
@keyframes spin {
239+
from { transform: rotate(0deg); }
240+
to { transform: rotate(360deg); }
241+
}
242+
.fade-in {
243+
animation: fadeIn 0.5s ease-in-out;
244+
}
245+
@keyframes fadeIn {
246+
from { opacity: 0; }
247+
to { opacity: 1; }
248+
}
225249
</style>

0 commit comments

Comments
 (0)