You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/03/13 04:27:08 UTC

[incubator-apisix-dashboard] 01/01: feat: added Plugin typings

This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch plugins
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git

commit 4f585073b419483855cee5ab442cac2ae19b5982
Author: juzhiyuan <jj...@gmail.com>
AuthorDate: Fri Mar 13 12:26:28 2020 +0800

    feat: added Plugin typings
---
 src/typings.d.ts | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/src/typings.d.ts b/src/typings.d.ts
index c2f9e64..3a78a66 100644
--- a/src/typings.d.ts
+++ b/src/typings.d.ts
@@ -38,3 +38,54 @@ declare let ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: 'site' | undefine
 declare const REACT_APP_ENV: 'test' | 'dev' | 'pre' | false;
 
 declare type PageMode = 'CREATE' | 'EDIT' | 'VIEW';
+
+declare const FetchPluginNameList: string[];
+
+/**
+ * TODO: //
+ * 1. key-auth 在前端生成 Key
+ * 2. prometheus 没有 properties 字段,选中后直接标记为启用。
+ * 4. ip-restriction 较为复杂
+ * 5.
+ */
+
+interface PluginProperty {
+  type: 'number' | 'string' | 'integer' | 'array' | 'boolean' | 'object';
+  // NOTE: maybe 0.00001
+  minimum?: number;
+  maximum?: number;
+  enum?: string[];
+  minLength?: number;
+  maxLength?: number;
+  minItems?: number;
+  maxItems?: number;
+  pattern?: string; // e.g "^/.*"
+  requried?: string[];
+  description?: string;
+  default?: any; // the same as type
+  minProperties?: number;
+  additionalProperties?: boolean;
+  items?: {
+    type: string;
+    anyOf?: Array<{
+      type?: string;
+      description?: string;
+      enum?: string[];
+      pattern?: string;
+    }>;
+  };
+}
+
+declare interface Plugin {
+  type: 'object';
+  id?: string;
+  required?: string[];
+  additionalProperties?: boolean;
+  minProperties?: number;
+  oneOf?: Array<{
+    required: string[];
+  }>;
+  properties?: {
+    [propertyName: string]: PluginProperty;
+  };
+}