123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- @using Edge.Core.Processor;
- @using System.Reflection;
- @using Edge.Core.Processor.Dispatcher;
- @model IEnumerable<ProcessorMetaDescriptor>;
- @{
- ViewData["Title"] = "Meta Api - Active Processor meta config";
- }
- <link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre.min.css">
- <link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-exp.min.css">
- <link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-icons.min.css">
- <script src="https://cdn.jsdelivr.net/npm/@@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
- <div class="text-center">
- <h4 class="display-4">Processor Meta Descriptor</h4>
- <h5>当前加载的 Processors 分别由什么 MetaParts 组成, 以及它们的初始参数</h5>
- </div>
- <div>
- <p>CurrentDomain Assemblies count: @ObjectInstanceCreator.CurrentDomainAssemblies.Count(), ProcessorEndPointTypes(meta descriptor Entrance) count: @ObjectInstanceCreator.CurrentDomainProcessorEndPointTypes.ExtractProcessorMetaDescriptor().Count(), showing count: @Model.Count()</p>
- <ul>
- @foreach (var pMetaDescriptor in Model)
- {
- <li>
- <b>@pMetaDescriptor.SourceEndpointFullTypeStr - @pMetaDescriptor.Type</b><br />
- <blockquote>
- <p>DisplayName: @pMetaDescriptor.DisplayName</p>
- <p>Description: @pMetaDescriptor.Description</p>
- <p>Tags: <i>@(pMetaDescriptor.Tags?.Aggregate((acc, n) => acc + ", " + n)??"")</i></p>
- </blockquote>
- MetaParts(@pMetaDescriptor.MetaPartsGroupDescriptors.Count() types):
- <br />
- <ul>
- @foreach (var partsDescriptorGroup in pMetaDescriptor.MetaPartsGroupDescriptors)//.GroupBy(g => g.GroupType))
- {
- <li>
- @partsDescriptorGroup.GroupType (1 of below <b>@partsDescriptorGroup.MetaPartsDescriptors.Count()</b> types are support)<br />
- <ul>
- @foreach (var partsDescriptor in partsDescriptorGroup.MetaPartsDescriptors)
- {
- <li>
- @partsDescriptor.FullTypeString<br />
- <blockquote>
- <p>DisplayName: @partsDescriptor.DisplayName</p>
- <p>Description: @partsDescriptor.Description</p>
- </blockquote>
- 此 MetaParts 的初始化入口有 <b>@partsDescriptor.ParametersJsonSchemaStrings.Count()</b> 种方式,分列其 parameters json schemas 如下:<br />
- <ul>
- @for (int ctorIndex = 0; ctorIndex < partsDescriptor.ParametersJsonSchemaStrings.Count(); ctorIndex++)
- {
- var uniquePartsTypeStr = (pMetaDescriptor.SourceEndpointFullTypeStr + "_" + partsDescriptor.TypeString)
- .Replace(".", "__")
- .Replace(", ", "___")
- .Replace("=", "_")
- .Replace("<", "___left").Replace(">", "___right")
- .Replace("`", "___generic")
- .Replace("+", "___plus___");
- var uniqueCtorSubmitButtonId = uniquePartsTypeStr +
- "_CtorIndex" + ctorIndex;
- var ctorJsonSchemaStrings = partsDescriptor.ParametersJsonSchemaStrings.ElementAt(ctorIndex);
- <li>
- 第 @(ctorIndex + 1) 种初始化入口参数 json schema str 列表:
- <ul>
- @for (int paramIndex = 0; paramIndex < ctorJsonSchemaStrings.Count; paramIndex++)
- {
- var paramSchemaStr = ctorJsonSchemaStrings[paramIndex];
- //change this must align with bottom part
- var editorHolderId = "editor_holder" + "_CtorIndex" + ctorIndex +
- "_ParamIndex" + paramIndex + "_" + uniquePartsTypeStr;
- <li>
- @paramSchemaStr
- <div id='@editorHolderId' style="border:double;padding:2px"></div>
- </li>
- }
- </ul>
- <div>
- <div style="margin-top:5px"><button id='@uniqueCtorSubmitButtonId'>Validate&Submit (console.log)</button></div>
- <script>
- var singleCtorJsonEditors_@uniqueCtorSubmitButtonId = [];
- @for (int paramIndex = 0; paramIndex < ctorJsonSchemaStrings.Count; paramIndex++)
- {
- var paramSchemaStr = ctorJsonSchemaStrings[paramIndex];
- var editorHolderId = "editor_holder" + "_CtorIndex" + ctorIndex +
- "_ParamIndex" + paramIndex + "_" + uniquePartsTypeStr;
- @:// Initialize the editor with a JSON schema
- @:var editor_@editorHolderId =
- @: new JSONEditor(
- @: document.getElementById('@editorHolderId'),
- @: {
- @: theme: 'spectre',
- @: iconlib: "spectre",
- @: disable_edit_json: true,
- @: disable_array_reorder: true,
- @: array_controls_top: true,
- @: disable_collapse: true,
- @: disable_properties: true,
- @: schema: @Html.Raw(paramSchemaStr)
- @: });
- @:(singleCtorJsonEditors_@uniqueCtorSubmitButtonId).push(editor_@editorHolderId);
- }
- // Hook up the submit button to log to the console
- document.getElementById('@uniqueCtorSubmitButtonId').addEventListener('click', function () {
- // Get the value from the editor
- var singleCtorJsonValues_@uniqueCtorSubmitButtonId = [];
- (singleCtorJsonEditors_@uniqueCtorSubmitButtonId).forEach(function (editor, index, array) {
- const errors = editor.validate();
- if (errors.length) {
- // errors is an array of objects, each with a `path`, `property`, and `message` parameter
- // `property` is the schema keyword that triggered the validation error (e.g. "minLength")
- // `path` is a dot separated path into the JSON object (e.g. "root.path.to.field")
- console.error('Input value failed for schema validation! error details followed');
- console.error(errors[0]['message']);
- (singleCtorJsonValues_@uniqueCtorSubmitButtonId).push(editor.getValue());
- }
- else {
- // It's valid!
- (singleCtorJsonValues_@uniqueCtorSubmitButtonId).push(editor.getValue());
- }
- });
- console.info('Value generated for MetaParts FullTypeStr: @(partsDescriptor.FullTypeString + " PartsType: "+ @partsDescriptorGroup.GroupType + " PartsTypeString: " + @partsDescriptor.TypeString)')
- console.info(JSON.stringify(singleCtorJsonValues_@uniqueCtorSubmitButtonId));
- });
- </script>
- </div>
- </li>
- }
- </ul>
- </li>
- }
- </ul>
- </li>
- }
- </ul>
- </li>
- }
- </ul>
- </div>
|