浏览代码

Improve ui schema.

master
YJC 3 年前
父节点
当前提交
8433fb6bd9
共有 3 个文件被更改,包括 18 次插入20 次删除
  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 查看文件

{ {
"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": [ "fields": [
{ {
"key": "corr_vars", "key": "corr_vars",
"valueType": "select", "valueType": "select",
"title": "Correlation Variables", "title": "Correlation Variables",
"tooltip": "Which variables do you want to analyze?", "tooltip": "Which variables do you want to analyze?",
"valueEnum": {{ columns }},
"valueEnum": "{{{tojson columns }}}",
"fieldProps": { "fieldProps": {
"mode": "multiple",
"mode": "multiple"
}, },
"formItemProps": { "formItemProps": {
"rules": [ "rules": [
"dataIndex": "sig_level", "dataIndex": "sig_level",
"valueType": "switch", "valueType": "switch",
"title": "Cluster Ordered", "title": "Cluster Ordered",
"tooltip": "Significant level, greater than 0 and less than 1."
"tooltip": "Significant level, greater than 0 and less than 1.",
"fieldProps": { "fieldProps": {
"step": 0.01 "step": 0.01
}, },

+ 7
- 1
resources/tservice-plugin.yaml 查看文件

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

+ 8
- 6
src/tservice/plugins/corrplot.clj 查看文件



(s/def ::sig_level (s/def ::sig_level
(st/spec (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." :description "Significant level, greater than 0 and less than 1."
:swagger/default 0.05 :swagger/default 0.05
:reason "The sig_level must be a float."})) :reason "The sig_level must be a float."}))
;; Handlers ;; Handlers
(defn get-handler (defn get-handler
[{{:keys [config-dir]} :plugin-env}] [{{: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 (defn post-handler
[{:keys [datafile corr_vars sig_level hc_order hc_method corr_type method plugin-env] [{:keys [datafile corr_vars sig_level hc_order hc_method corr_type method plugin-env]
:env-dir (:env-dir plugin-env) :env-dir (:env-dir plugin-env)
:dest-dir workdir :dest-dir workdir
:task-id task-id}) :task-id task-id})
response))
(merge response {:task-id task-id})))


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

正在加载...
取消
保存