code: function(e) {
              if (e) e.preventDefault();
              var that = this;
  
              return api.execute("get:types")
              .fail(dialogs.error)
              .then(function(events) {
  
                  return dialogs.fields(i18n.t("alerts.create.title"), {
                      "title": {
                          "label": i18n.t("alerts.create.fields.title.label"),
                          "type": "text"
                      },
                      "eventName": {
                          'label': i18n.t("alerts.create.fields.eventName.label"),
                          'type': "select",
                          'options': _.chain(events)
                          .map(function(type) {
                              return [type.type, type.type];
                          })
                          .object()
                          .value()
                      },
                      "type": {
                          'label': i18n.t("alerts.create.fields.type.label"),
                          'type': "select",
                          'options': _.chain(allAlerts)
                          .map(function(a, aId) {
                              return [aId, a.title];
                          })
                          .object()
                          .value()
                      },
                      "interval": {
                          "label": i18n.t("alerts.create.fields.interval.label"),
                          "type": "number",
                          'min': 1,
                          'default': 1,
                          'help': i18n.t("alerts.create.fields.interval.help")
                      },
                      "condition": {
                          "label": i18n.t("alerts.create.fields.condition.label"),
                          "type": "text",
                          "help": i18n.t("alerts.create.fields.condition.help")
                      },
                  });
              })
              .then(function(data) {
                  return that.alerts.create({
                      'title': data.title,
                      'condition': data.condition,
                      'eventName': data.eventName,
                      'interval': data.interval,
                      'type': data.type
                  })
                  .then(that.manageAlerts.bind(that), dialogs.error)
              });
          }
docs: Create an alert