| 6 | import {getSchemaTpl, tipedLabel} from 'amis-editor-core'; |
| 7 | |
| 8 | export class LogPlugin extends BasePlugin { |
| 9 | static id = 'LogPlugin'; |
| 10 | // 关联渲染器名字 |
| 11 | rendererName = 'log'; |
| 12 | $schema = '/schemas/LogSchema.json'; |
| 13 | |
| 14 | // 组件名称 |
| 15 | name = '日志'; |
| 16 | isBaseComponent = true; |
| 17 | icon = 'fa fa-file-text-o'; |
| 18 | pluginIcon = 'log-plugin'; |
| 19 | description = '用来实时显示日志'; |
| 20 | searchKeywords = '实时日志'; |
| 21 | docLink = '/amis/zh-CN/components/log'; |
| 22 | tags = ['展示']; |
| 23 | previewSchema = { |
| 24 | type: 'log', |
| 25 | height: 120, |
| 26 | autoScroll: true |
| 27 | }; |
| 28 | scaffold: any = { |
| 29 | type: 'log', |
| 30 | autoScroll: true, |
| 31 | height: 500, |
| 32 | encoding: 'utf-8' |
| 33 | }; |
| 34 | panelJustify = true; |
| 35 | panelTitle = '日志'; |
| 36 | panelBodyCreator = (context: BaseEventContext) => { |
| 37 | const renderer: any = context.info.renderer; |
| 38 | return getSchemaTpl('tabs', [ |
| 39 | { |
| 40 | title: '属性', |
| 41 | body: getSchemaTpl('collapseGroup', [ |
| 42 | { |
| 43 | title: '基本', |
| 44 | body: [ |
| 45 | getSchemaTpl('apiControl', { |
| 46 | required: true, |
| 47 | name: 'source', |
| 48 | renderLabel: true, |
| 49 | label: tipedLabel( |
| 50 | '数据源', |
| 51 | `返回日志信息的服务,后端需要通过流的方式返回结果。 |
| 52 | 可参考<a target="_blank" href="https://baidu.github.io/amis/zh-CN/components/log#%E5%90%8E%E7%AB%AF%E5%AE%9E%E7%8E%B0%E5%8F%82%E8%80%83">示例</a>` |
| 53 | ) |
| 54 | }), |
| 55 | { |
| 56 | type: 'input-text', |
| 57 | label: tipedLabel( |
| 58 | '文本编码', |
| 59 | '返回内容的字符编码,例如 UTF-8、ISO-8859-2、KOI8-R、GBK等等。默认UTF-8' |
| 60 | ), |
| 61 | name: 'encoding' |
| 62 | }, |
| 63 | getSchemaTpl('placeholder', { |
| 64 | label: '加载提示', |
| 65 | placeholder: '加载中' |
nothing calls this directly
no test coverage detected