Sfoglia il codice sorgente

add tags handling

master
Pascal Gloor 5 anni fa
parent
commit
4cca6047b6
3 ha cambiato i file con 92 aggiunte e 15 eliminazioni
  1. 77
    0
      etc/openapi.json
  2. 5
    14
      www/index.html
  3. 10
    1
      www/js/autodoc.js

+ 77
- 0
etc/openapi.json Vedi File

@@ -166,6 +166,28 @@
}
}
}
},
"tags": {
"description": "Tag object",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"color": {
"type": "string"
}
}
},
"tagslist": {
"description": "array of tag objects",
"type": "array",
"items": {
"$ref": "#/components/schemas/tags"
}
}
},
"parameters": {},
@@ -182,6 +204,61 @@
}
],
"paths": {
"/tags": {
"get": {
"description": "Get tags list",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tagslist"
}
}
}
}
}
}
},
"/tags/{tagId}": {
"patch": {
"description": "Update a tag",
"parameters": [
{
"name": "tagId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
},
"delete": {
"description": "Delete a tag",
"parameters": [
{
"name": "tagId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/documents": {
"post": {
"summary": "Create a new document",

+ 5
- 14
www/index.html Vedi File

@@ -211,9 +211,6 @@
<!-- Tags -->
<div class="container d-none" id="autodoc_tab_tags">
<h3>Manage Tags</h3>
<div class="row">
<h5>Add Tags</h5>
</div>
<div class="row">
<div class="col">
<table class="table table-borderless">
@@ -228,7 +225,11 @@
<tbody>
<tr>
<td>
<input type="text" placeholder="Tag name" class="autodoc_tag_text">
<select class="custom-select autodoc_tag_list">
<option>Choose tag to edit</option>
</select>

<input type="text" placeholder="Tag name" class="autodoc_tag_text d-none">
</td>
<td>
<div class="btn-group" role="group">
@@ -297,16 +298,6 @@
</span>
</button>
</div>
<!--
<a href="#" class="autodoc_tag_color badge badge-primary" data="primary">0</a>
<a href="#" class="autodoc_tag_color badge badge-secondary" data="secondary">0</a>
<a href="#" class="autodoc_tag_color badge badge-success" data="success">0</a>
<a href="#" class="autodoc_tag_color badge badge-danger" data="danger">0</a>
<a href="#" class="autodoc_tag_color badge badge-warning" data="warning">0</a>
<a href="#" class="autodoc_tag_color badge badge-info" data="info">0</a>
<a href="#" class="autodoc_tag_color badge badge-light" data="light">0</a>
<a href="#" class="autodoc_tag_color badge badge-dark" data="dark">0</a>
-->
</td>
<td>
<span id="autodoc_tag_result" class="badge badge-primary"></span>

+ 10
- 1
www/js/autodoc.js Vedi File

@@ -5,7 +5,8 @@ var conf = {
openapi: "/v1",
pageinit: {
home: "page_load_home()",
upload: "page_load_upload()"
upload: "page_load_upload()",
tags: "page_load_tags()"
},
home: {
width: 4,
@@ -169,6 +170,14 @@ function page_load_upload() {
upload_status();
}

function page_load_tags() {
// update tag list
$.getJSON(
conf.openapi +
"/tags"
)
}

function document_load() {
if (conf.home.curpage == 0) {
$("#autodoc_home_body").html("");

Loading…
Annulla
Salva