mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 12:52:05 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,16 @@
|
|||
odoo.define("base_rest.swagger", function (require) {
|
||||
"use strict";
|
||||
|
||||
var publicWidget = require("web.public.widget");
|
||||
var SwaggerUi = require("base_rest.swagger_ui");
|
||||
|
||||
publicWidget.registry.Swagger = publicWidget.Widget.extend({
|
||||
selector: "#swagger-ui",
|
||||
start: function () {
|
||||
var def = this._super.apply(this, arguments);
|
||||
var swagger_ui = new SwaggerUi("#swagger-ui");
|
||||
swagger_ui.start();
|
||||
return def;
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/* global SwaggerUIBundle, SwaggerUIStandalonePreset*/
|
||||
odoo.define("base_rest.swagger_ui", function (require) {
|
||||
"use strict";
|
||||
|
||||
var core = require("web.core");
|
||||
|
||||
var SwaggerUI = core.Class.extend({
|
||||
init: function (selector) {
|
||||
this.selector = selector;
|
||||
this.$el = $(this.selector);
|
||||
},
|
||||
_swagger_bundle_settings: function () {
|
||||
const defaults = {
|
||||
dom_id: this.selector,
|
||||
deepLinking: true,
|
||||
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
|
||||
plugins: [SwaggerUIBundle.plugins.DownloadUrl],
|
||||
layout: "StandaloneLayout",
|
||||
operationsSorter: function (a, b) {
|
||||
var methodsOrder = [
|
||||
"get",
|
||||
"post",
|
||||
"put",
|
||||
"delete",
|
||||
"patch",
|
||||
"options",
|
||||
"trace",
|
||||
];
|
||||
var result =
|
||||
methodsOrder.indexOf(a.get("method")) -
|
||||
methodsOrder.indexOf(b.get("method"));
|
||||
if (result === 0) {
|
||||
result = a.get("path").localeCompare(b.get("path"));
|
||||
}
|
||||
return result;
|
||||
},
|
||||
tagsSorter: "alpha",
|
||||
onComplete: function () {
|
||||
if (this.web_btn === undefined) {
|
||||
this.web_btn = $(
|
||||
"<a class='fa fa-th-large swg-odoo-web-btn' href='/web' accesskey='h'></a>"
|
||||
);
|
||||
$(".topbar").prepend(this.web_btn);
|
||||
}
|
||||
},
|
||||
oauth2RedirectUrl:
|
||||
window.location.origin +
|
||||
"/base_rest/static/lib/swagger-ui-3.51.1/oauth2-redirect.html",
|
||||
};
|
||||
const config = this.$el.data("settings");
|
||||
return Object.assign({}, defaults, config);
|
||||
},
|
||||
start: function () {
|
||||
this.ui = SwaggerUIBundle(this._swagger_bundle_settings());
|
||||
},
|
||||
});
|
||||
|
||||
return SwaggerUI;
|
||||
});
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#swagger-ui {
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.swg-odoo-web-btn {
|
||||
font-family: fontAwesome !important;
|
||||
display: block;
|
||||
float: left;
|
||||
padding-top: 8px;
|
||||
padding-right: 0px;
|
||||
padding-bottom: 8px;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
.col {
|
||||
width: unset;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue