Ver Fonte

Add limit parameter

Ryohei Ueda há 6 anos atrás
pai
commit
ce874482fd
2 ficheiros alterados com 12 adições e 1 exclusões
  1. 7 1
      main.py
  2. 5 0
      templates/main.html

+ 7 - 1
main.py

@@ -59,6 +59,7 @@ def new_rule(interface):
     reorder = request.form['Reorder']
     reorder_correlation = request.form['ReorderCorrelation']
     corrupt = request.form['Corrupt']
+    limit = request.form['Limit']
     rate = request.form['Rate']
     rate_unit = request.form['rate_unit']
 
@@ -88,6 +89,8 @@ def new_rule(interface):
             command += ' %s%%' % reorder_correlation
     if corrupt != '':
         command += ' corrupt %s%%' % corrupt
+    if limit != '':
+        command += ' limit %s' % limit
     print(command)
     command = command.split(' ')
     proc = subprocess.Popen(command)
@@ -130,7 +133,8 @@ def parse_rule(split_rule):
             'duplicate':          None,
             'reorder':            None,
             'reorderCorrelation': None,
-            'corrupt':            None}
+            'corrupt':            None,
+            'limit':              None}
     i = 0
     for argument in split_rule:
         if argument == 'dev':
@@ -163,6 +167,8 @@ def parse_rule(split_rule):
                 rule['reorderCorrelation'] = split_rule[i + 2]
         elif argument == 'corrupt':
             rule['corrupt'] = split_rule[i + 1]
+        elif argument == 'limit':
+            rule['limit'] = split_rule[i + 1]
         i += 1
     return rule
 

+ 5 - 0
templates/main.html

@@ -62,6 +62,11 @@
                         <td>{{ rule['corrupt'] }}</td>
                         <td><input type="number" name="Corrupt" size="5"> %</td>
                     </tr>
+                    <tr>
+                        <td>Limit</td>
+                        <td>{{ rule['limit'] }}</td>
+                        <td><input type="number" name="Limit" size="5"></td>
+                    </tr>
                 </table>
                 <input type="submit" value="Apply Rules">
             </form>