Browse Source

Improve ui schema.

master
YJC 3 years ago
parent
commit
8433fb6bd9
3 changed files with 18 additions and 20 deletions
  1. +3
    -13
      resources/templates/plugin-schema.handlebars.json
  2. +7
    -1
      resources/tservice-plugin.yaml
  3. +8
    -6
      src/tservice/plugins/corrplot.clj

resources/templates/plugin-schema.json.mustache → resources/templates/plugin-schema.handlebars.json View File

@@ -1,14 +1,4 @@
{
"title": "Correlation Plot",
"maintainer": "Jingcheng Yang",
"description": "Correlation plots can be used to quickly find insights. It is used to investigate the dependence between multiple variables at the same time and to highlight the most correlated variables in a data table.",
"logo": "https://store-images.s-microsoft.com/image/apps.30079.0034b9fb-e1fa-4c69-b5b7-de0750ba3098.c645c7e3-2d23-4418-9288-0bd1322b1070.9112ecd7-1c16-4a37-ab49-a5b2c2b61542.png",
"version": "v0.1.0",
"readme": "http: //nordata-cdn.oss-cn-shanghai.aliyuncs.com/test.md",
"tags": [
"R",
"Chart"
],
"fields": [
{
"key": "corr_vars",
@@ -16,9 +6,9 @@
"valueType": "select",
"title": "Correlation Variables",
"tooltip": "Which variables do you want to analyze?",
"valueEnum": {{ columns }},
"valueEnum": "{{{tojson columns }}}",
"fieldProps": {
"mode": "multiple",
"mode": "multiple"
},
"formItemProps": {
"rules": [
@@ -119,7 +109,7 @@
"dataIndex": "sig_level",
"valueType": "switch",
"title": "Cluster Ordered",
"tooltip": "Significant level, greater than 0 and less than 1."
"tooltip": "Significant level, greater than 0 and less than 1.",
"fieldProps": {
"step": 0.01
},

+ 7
- 1
resources/tservice-plugin.yaml View File

@@ -7,10 +7,16 @@ info:
source: PGx
short_name: corrplot
icons:
- src: ""
- src: "http://nordata-cdn.oss-cn-shanghai.aliyuncs.com/biominer/corrplot-logo-144x144.png"
type: image/png
sizes: 192x192
author: Jingcheng Yang
maintainers:
- Jingcheng Yang
tags:
- R
- Chart
readme: http://nordata-cdn.oss-cn-shanghai.aliyuncs.com/test.md
plugin:
name: corrplot
display-name: Correlation Plot

+ 8
- 6
src/tservice/plugins/corrplot.clj View File

@@ -61,8 +61,9 @@

(s/def ::sig_level
(st/spec
{:spec #(and (>= % 0) (<= % 1))
:type :float
{:spec #(and float? (>= % 0) (<= % 1))
:type :number
:format :float
:description "Significant level, greater than 0 and less than 1."
:swagger/default 0.05
:reason "The sig_level must be a float."}))
@@ -76,8 +77,8 @@
;; Handlers
(defn get-handler
[{{:keys [config-dir]} :plugin-env}]
(let [plugin-schema (fs-lib/join-paths config-dir "templates/plugin-schema.json.mustache")]
{:data (slurp plugin-schema)}))
(let [plugin-schema (fs-lib/join-paths config-dir "templates/plugin-schema.handlebars.json")]
{:schema (json/read-str (slurp plugin-schema))}))

(defn post-handler
[{:keys [datafile corr_vars sig_level hc_order hc_method corr_type method plugin-env]
@@ -117,12 +118,13 @@
:env-dir (:env-dir plugin-env)
:dest-dir workdir
:task-id task-id})
response))
(merge response {:task-id task-id})))

(def metadata
(make-routes "corrplot" :ChartPlugin
{:method-type :get
:summary "A json schema for corrplot plugin."
:endpoint "corrplot-ui-schema"
:summary "A ui schema for corrplot plugin."
:query-schema nil
:path-schema nil
:response-schema map?

Loading…
Cancel
Save