File size: 4,580 Bytes
7d0c16f
 
 
 
0324409
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d0c16f
0324409
 
 
 
 
7d0c16f
 
 
 
0324409
 
 
 
 
 
7d0c16f
0324409
 
 
 
 
 
 
 
 
 
 
 
7d0c16f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
{% extends "base.html.j2" %}
{% import "components.html.j2" as ui %}

{% block content %}
  <header class="doc-header">
    <h1>Map/Reduce 路 {{ doc.metadata.description or doc.metadata.script_type }}</h1>
    <p class="doc-header-meta">
      Pipeline de procesamiento por lotes (SuiteScript Map/Reduce).
    </p>
    <p class="muted">Procesos masivos, b煤squedas y operaciones sobre registros.</p>
  </header>

  {{ ui.metadata_block(doc.metadata) }}
  {{ ui.summary_block(doc.summary) }}

  {# ------------------------ getInputData ------------------------ #}
  {% if doc.getInputData %}
    <div class="section">
      <h2>getInputData</h2>

      {% if doc.getInputData.details %}
        <p>{{ doc.getInputData.details }}</p>
      {% endif %}

      {% if doc.getInputData.filters %}
        {{ ui.table_block("Filtros", doc.getInputData.filters, [
          {"field": "field", "title": "Campo"},
          {"field": "operator", "title": "Operador"},
          {"field": "value", "title": "Valor"}
        ]) }}
      {% endif %}

      {% if doc.getInputData.columns %}
        {{ ui.table_block("Columnas", doc.getInputData.columns, [
          {"field": "name", "title": "Nombre"},
          {"field": "label", "title": "Etiqueta"}
        ]) }}
      {% endif %}
    </div>
  {% endif %}

  {# ------------------------ map ------------------------ #}
  {% if doc.map %}
    <div class="section">
      <h2>map</h2>

      {% if doc.map.logic %}
        <p>{{ doc.map.logic }}</p>
      {% endif %}

      {% if doc.map.fields_used %}
        {{ ui.list_block("Campos utilizados", doc.map.fields_used) }}
      {% endif %}

      {% if doc.map.record_operations %}
        {{ ui.table_block("Operaciones en registros (map)", doc.map.record_operations, [
          {"field": "type", "title": "Operaci贸n"},
          {"field": "recordType", "title": "Record"},
          {"field": "fields", "title": "Campos"}
        ]) }}
      {% endif %}
    </div>
  {% endif %}

  {# ------------------------ reduce ------------------------ #}
  {% if doc.reduce %}
    <div class="section">
      <h2>reduce</h2>

      {% if doc.reduce.logic %}
        <p>{{ doc.reduce.logic }}</p>
      {% endif %}

      {% if doc.reduce.aggregations %}
        {{ ui.list_block("Agregaciones", doc.reduce.aggregations) }}
      {% endif %}

      {% if doc.reduce.record_operations %}
        {{ ui.table_block("Operaciones en registros (reduce)", doc.reduce.record_operations, [
          {"field": "type", "title": "Operaci贸n"},
          {"field": "recordType", "title": "Record"},
          {"field": "fields", "title": "Campos"}
        ]) }}
      {% endif %}
    </div>
  {% endif %}

  {# ------------------------ summarize ------------------------ #}
  {% if doc.summarize %}
    <div class="section">
      <h2>summarize</h2>

      {% if doc.summarize.usage %}
        <p>{{ doc.summarize.usage }}</p>
      {% endif %}

      {% if doc.summarize.errors %}
        {{ ui.list_block("Errores", doc.summarize.errors) }}
      {% endif %}

      {% if doc.summarize.final_actions %}
        {{ ui.list_block("Acciones finales", doc.summarize.final_actions) }}
      {% endif %}
    </div>
  {% endif %}

  {# ------------------------ b煤squedas globales ------------------------ #}
  {% if doc.searches %}
    {{ ui.table_block("B煤squedas utilizadas", doc.searches, [
      {"field": "id", "title": "ID"},
      {"field": "filters", "title": "Filtros"},
      {"field": "columns", "title": "Columnas"}
    ]) }}
  {% endif %}

  {# ------------------------ operaciones globales con registros ------------------------ #}
  {% if doc.records %}
    {{ ui.table_block("Operaciones con registros", doc.records, [
      {"field": "type", "title": "Operaci贸n"},
      {"field": "recordType", "title": "Record"},
      {"field": "fields", "title": "Campos"}
    ]) }}
  {% endif %}

  {# ------------------------ side effects globales ------------------------ #}
  {% if doc.side_effects %}
    {{ ui.list_block("Side effects", doc.side_effects) }}
  {% endif %}

  {# ------------------------ errores globales ------------------------ #}
  {% if doc.errors %}
    {% if doc.errors is mapping %}
      {{ ui.list_block("Errores", doc.errors.explicit_checks or []) }}
      {{ ui.list_block("Manejo de excepciones", doc.errors.exception_handling or []) }}
    {% else %}
      {{ ui.table_block("Errores", doc.errors, [
        {"field": "location", "title": "Ubicaci贸n"},
        {"field": "description", "title": "Descripci贸n"}
      ]) }}
    {% endif %}
  {% endif %}
{% endblock %}