implementovane zobrazenie API pomocnika
This commit is contained in:
parent
eab71c2c4d
commit
58a7444da2
78
api.php
78
api.php
@ -63,13 +63,77 @@ function help()
|
||||
{
|
||||
return [
|
||||
'actions' => [
|
||||
'help' => 'Show this help',
|
||||
'add' => 'Add report',
|
||||
'update' => 'Update report',
|
||||
'delete' => 'Delete report',
|
||||
'get' => 'Get report',
|
||||
'getall' => 'Get all reports',
|
||||
'getallgrouped' => 'Get all reports grouped by group',
|
||||
'help' => [
|
||||
'name' => 'help',
|
||||
'description' => 'Show this help',
|
||||
'params' => []
|
||||
],
|
||||
'add' => [
|
||||
'name' => 'add',
|
||||
'description' => 'Add report',
|
||||
'params' => [
|
||||
'title' => 'Report title',
|
||||
'description' => 'Report description',
|
||||
'status' => 'Report status',
|
||||
'group' => 'Report group',
|
||||
'priority' => 'Report priority',
|
||||
]
|
||||
],
|
||||
'update' => [
|
||||
'name' => 'update',
|
||||
'description' => 'Update report',
|
||||
'params' => [
|
||||
'report_id' => 'Report id',
|
||||
'title' => 'Report title',
|
||||
'description' => 'Report description',
|
||||
'status' => 'Report status',
|
||||
'group' => 'Report group',
|
||||
'priority' => 'Report priority',
|
||||
]
|
||||
],
|
||||
'delete' => [
|
||||
'name' => 'delete',
|
||||
'description' => 'Delete report',
|
||||
'params' => [
|
||||
'report_id' => 'Report id',
|
||||
]
|
||||
],
|
||||
'get' => [
|
||||
'name' => 'get',
|
||||
'description' => 'Get report',
|
||||
'params' => [
|
||||
'report_id' => 'Report id',
|
||||
]
|
||||
],
|
||||
'getall' => [
|
||||
'name' => 'getall',
|
||||
'description' => 'Get all reports',
|
||||
'params' => [
|
||||
'status' => '(ptional) Report status, default: 0,1,2,3',
|
||||
]
|
||||
],
|
||||
'getallgrouped' => [
|
||||
'name' => 'getallgrouped',
|
||||
'description' => 'Get all reports grouped by group',
|
||||
'params' => [
|
||||
'status' => '(ptional) Report status, default: 0,1,2,3',
|
||||
]
|
||||
],
|
||||
'updateordnum' => [
|
||||
'name' => 'updateordnum',
|
||||
'description' => 'Update report ordnum',
|
||||
'params' => [
|
||||
'ordnums' => 'Report ordnums in json format {report_id: ordnum, ...}',
|
||||
]
|
||||
],
|
||||
'updatestatus' => [
|
||||
'name' => 'updatestatus',
|
||||
'description' => 'Update report status',
|
||||
'params' => [
|
||||
'report_id' => 'Report id',
|
||||
'status' => 'Report status',
|
||||
]
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -239,6 +239,30 @@ button:focus-visible,
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
#api .action {
|
||||
margin-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
background-color: var(--color-bg2);
|
||||
transition: all 0.3s;
|
||||
min-width: 150px;
|
||||
}
|
||||
#api .action:hover {
|
||||
filter: brightness(1.2);
|
||||
}
|
||||
#api .action h3 {
|
||||
background-color: var(--color-bg0);
|
||||
margin: 0px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
#api .action h4 {
|
||||
margin: 0px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
#api .action p {
|
||||
padding: 10px;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------
|
||||
07 - ABOUT
|
||||
|
@ -44,6 +44,10 @@ export const backend = {
|
||||
/* ----------------------------------------------------
|
||||
* API akcie
|
||||
*/
|
||||
help() {
|
||||
return this.callPromise('help', {});
|
||||
},
|
||||
|
||||
add(title, description, status, group, priority) {
|
||||
return this.callPromise('add', {
|
||||
title: title,
|
||||
|
@ -2,18 +2,73 @@
|
||||
<div id="api">
|
||||
<h1>API</h1>
|
||||
<p>
|
||||
API prípojny bod je dostupná na adrese
|
||||
API prípojny bod je dostupný na adrese
|
||||
<a href="{{ api_endpoint }}">{{ api_endpoint }}</a
|
||||
>.
|
||||
</p>
|
||||
<h2>Zoznam akcii</h2>
|
||||
<ul>
|
||||
<li v-for="action in help.actions" :key="action.name">
|
||||
<a :href="'#' + action.name">{{ action.name }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h2>Prehľad parametrov akcií</h2>
|
||||
<div v-for="action in help.actions" :key="action.name" class="action">
|
||||
<h3 :id="action.name">{{ action.name }}</h3>
|
||||
<p>
|
||||
{{ action.description }} <br />
|
||||
<a :href="api_endpoint + '?action=' + action.name" target="_blank">{{
|
||||
api_endpoint + "?action=" + action.name
|
||||
}}</a>
|
||||
</p>
|
||||
<h4>Parametre</h4>
|
||||
<p v-if="Object.keys(action.params).length == 0">
|
||||
<font-awesome-icon :icon="['fas', 'circle-info']" />
|
||||
|
||||
Ziadne parametre
|
||||
</p>
|
||||
<ul>
|
||||
<li v-for="(param_desc, param_name) in action.params" :key="param_name">
|
||||
<strong>{{ param_name }}</strong>
|
||||
–
|
||||
{{ param_desc }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { backend } from "../backend";
|
||||
|
||||
export default {
|
||||
name: "API",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
api_endpoint: window.location.origin + __SUBPATH__ + "api.php",
|
||||
api_endpoint: backend.endpont,
|
||||
help: {
|
||||
actions: {
|
||||
help: {
|
||||
name: "help",
|
||||
description: "This help",
|
||||
params: {
|
||||
foo: "bar",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.loadHelp();
|
||||
},
|
||||
methods: {
|
||||
loadHelp() {
|
||||
backend.help().then((response) => {
|
||||
this.help = response;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user