No Description

modal_add_attribute.html 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <div class="modal-header">
  2. <h4>Edit attribute {{ attribute.attribute_display_name }}</h4>
  3. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
  4. aria-hidden="true">&times;</span></button>
  5. </div>
  6. <div class="modal-body">
  7. <div class="container col-md-12">
  8. <form method="post" action="" id="form_new_attribute" enctype="multipart/form-data">
  9. <div class="row">
  10. <div class="col-6">
  11. <div class="accordion accordion-primary">
  12. <h2>{{ attribute.attribute_display_name }} attributes</h2>
  13. <p>Attributes allow to extend the fields available for analysts when they add or edit {{ attribute.attribute_display_name }}.</p>
  14. <div class="alert-std alert-warning" role="alert">
  15. Attributes can be added by administrator in this UI, or they can be pushed by modules.<br/>
  16. This means each {{ attribute.attribute_display_name }} object may have a different set of attributes.
  17. Updating the default objects here will result in an update of every existing object, which might take a huge amount of time.
  18. <p>Typing wrong attributes here might result in UI breaks. IRIS will attempt to validate the attributes' taxonomy before committing.</p>
  19. <b>To avoid this, use the Preview button before saving. It displays a 1-to-1 UI representation of the attributes</b>
  20. </div>
  21. <div class="card">
  22. <div class="card-header collapsed" id="drop_attr_description" data-toggle="collapse" data-target="#drop_attr_desc" aria-expanded="false" aria-controls="drop_attr_desc" role="button">
  23. <div class="span-icon">
  24. <div class="flaticon-tea-cup"></div>
  25. </div>
  26. <div class="span-title">
  27. More details
  28. </div>
  29. <div class="span-mode"></div>
  30. </div>
  31. <div id="drop_attr_desc" class="collapse" aria-labelledby="drop_tax_attr" style="">
  32. <div class="card-body">
  33. <p>These attributes are stored in each {{ attribute.attribute_display_name }} object in the form of a JSON structure.</p>
  34. <p>Attributes in this page represent the default attributes of each new {{ attribute.attribute_display_name }} objects. Existing object are updated if they
  35. don't hold the specified attributes. <b>Other existing attributes are not deleted.</b></p>
  36. Attributes can have the following purposes:
  37. <ul>
  38. <li><b>Inputs</b>: Offer analysts the possibility to fill additional details. Multiple types of inputs are supported. See taxonomy for more details</li>
  39. <li><b>Raw</b>: A static content rendered in raw text. HTML is not interpreted.</li>
  40. <li><b>HTML</b>: A static content rendered as HTML for infinite possibilities. <b>Careful, this is by nature prone to vulnerabilities.</b></li>
  41. </ul>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="card">
  46. <div class="card-header collapsed" id="drop_attr_taxonomy" data-toggle="collapse" data-target="#drop_tax_attr" aria-expanded="false" aria-controls="drop_tax_attr" role="button">
  47. <div class="span-icon">
  48. <div class="flaticon-pencil"></div>
  49. </div>
  50. <div class="span-title">
  51. Attributes taxonomy
  52. </div>
  53. <div class="span-mode"></div>
  54. </div>
  55. <div id="drop_tax_attr" class="collapse" aria-labelledby="drop_tax_attr" style="">
  56. <div class="card-body">
  57. Attributes are defined as below.
  58. <pre>
  59. {
  60. "Tab Name 1": { // Defines a new tab in the {{ attribute.attribute_display_name }} modal
  61. "Field 1": { // Defines a new field within the Tab Name 1
  62. "type": "input_string", // Defines the type of field, here a standard string input
  63. "mandatory": true, // Indicates whether the field is mandatory upon saving
  64. "value": "" // Default value if any, else empty
  65. },
  66. "Field 2": { // Defines a second field within the tab Tab Name 1
  67. "type": "input_checkbox", // Defines an input checkbox
  68. "mandatory": false, // Indicates whether the field is mandatory upon saving
  69. "value": true // Default value
  70. }
  71. },
  72. "VT report": { // Defines a second tab named VT report
  73. "Content": { // Defines a new field Content within the VT Report
  74. "type": "html", // Defines an HTML interpreted content
  75. "value": "" // Default value if any, else empty
  76. }
  77. }
  78. }
  79. </pre>
  80. <h4>Field types</h4>
  81. The supported fields types are:
  82. <ul>
  83. <li>input_string: Standard input text</li>
  84. <li>input_textfield: Standard input textfield</li>
  85. <li>input_checkbox: Standard checkbox</li>
  86. <li>input_date: Standard date input</li>
  87. <li>input_datetime: Standard date and time input</li>
  88. <li>input_select: Standard select input. Need "options" tag to describe the available options</li>
  89. <li>raw: A static content rendered in raw text. HTML is not interpreted.</li>
  90. <li>html: A static content rendered as HTML. <b>Careful, this is by nature prone to vulnerabilities.</b></li>
  91. </ul>
  92. </div>
  93. </div>
  94. </div>
  95. <div class="card">
  96. <div class="card-header collapsed" id="drop_attr_over" data-toggle="collapse" data-target="#drop_attr_overwrite" aria-expanded="false" aria-controls="drop_attr_overwrite" role="button">
  97. <div class="span-icon">
  98. <div class="flaticon-exclamation"></div>
  99. </div>
  100. <div class="span-title">
  101. Overwrite features
  102. </div>
  103. <div class="span-mode"></div>
  104. </div>
  105. <div id="drop_attr_overwrite" class="collapse" aria-labelledby="drop_tax_attr" style="">
  106. <div class="card-body">
  107. <p>Changing types of fields in attributes might result in incompatibles types and existing objects being unable to be migrated.</p>
  108. <p>When this happens, IRIS will not update the fields of these objects and let them as is to prevent any data loss.</p>
  109. <p>This behavior can however be changed by using the <kbd>Complete overwrite</kbd> and <kbd>Partial overwrite</kbd> buttons.</p>
  110. <p><kbd>Partial overwrite</kbd> basically resets the attributes values of every {{ attribute.attribute_display_name }} objects that matches the current ones, and then applies the current attributes.
  111. All associated values are lost. This does not impact attributes pushed by modules.</p>
  112. <p><kbd>Complete overwrite</kbd> resets all attributes of every {{ attribute.attribute_display_name }} objects, including the ones created by modules, and then applies the current attributes.
  113. All associated values are lost.</p>
  114. <b>In any case, none of the native values of the {{ attribute.attribute_display_name }} objects are modified. This only concerns custom attributes.</b>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <div class="col-6">
  121. {{ form.hidden_tag() }}
  122. <div class="form-group">
  123. <label for="Attribute content" class="mr-4">Attribute definition
  124. </label>
  125. <div id="editor_detail">{{ attribute.attribute_content|tojsonsafe }}</div>
  126. </div>
  127. </div>
  128. </div>
  129. </form>
  130. </div>
  131. <div class="alert alert-warning" style="display:none;" role="alert" id="alert_attributes_details">
  132. <span id="alert_attributes_edit"></span><br/>
  133. <b>Logs:</b>
  134. <ul id="attributes_err_details_list">
  135. </ul>
  136. </div>
  137. </div>
  138. <div class="modal-footer">
  139. <button type="button" class="btn btn-outline-danger float-right" id="submit_complete_overwrite">Complete overwrite</button>
  140. <button type="button" class="btn btn-outline-danger mr-auto" id="submit_partial_overwrite">Partial overwrite</button>
  141. <button type="button" class="btn btn-outline-black float-right" id="preview_attribute">Preview</button>
  142. <button type="button" class="btn btn-outline-success float-right" id="submit_new_attribute">Update</button>
  143. </div>