<commit_before>kd                  = require 'kd'
KDView              = kd.CustomHTMLView
KDNotificationView  = kd.NotificationView
showError           = require 'app/util/showError'
contentModal = require 'app/components/contentModal'

module.exports = class AccountCredentialEditModal extends contentModal


  constructor: (options = {}, data) ->

    options.cssClass  = kd.utils.curry 'content-modal with-form', options.cssClass
    options.title   or= 'Edit Credential'

    super options, data

    { ui }                    = kd.singletons.computeController
    { credential, provider }  = options

    formOptions       =
      provider        : provider
      defaultValues   : data.meta
      defaultTitle    : data.title
      requiredFields  : credential.fields
      callback        : (title, data) =>

        credential.update {
          provider, title, meta: data
        }, (err, credential) =>
          @form.buttons.Save.hideLoader()

          unless showError err
            @form.emit 'CredentialUpdated', credential


    # @main.addSubView @wrapper = new KDView { cssClass : '', tagName: 'main' }

    @main.addSubView @form = ui.generateAddCredentialFormFor formOptions

    @form.on 'Cancel', @bound 'cancel'
<commit_msg>give width style for edit credential page<commit_after>kd                  = require 'kd'
KDView              = kd.CustomHTMLView
KDNotificationView  = kd.NotificationView
showError           = require 'app/util/showError'
contentModal = require 'app/components/contentModal'

module.exports = class AccountCredentialEditModal extends contentModal


  constructor: (options = {}, data) ->

    options.cssClass  = kd.utils.curry 'content-modal with-form', options.cssClass
    options.title or= 'Edit Credential'
    options.width = 600

    super options, data

    { ui }                    = kd.singletons.computeController
    { credential, provider }  = options

    formOptions       =
      provider        : provider
      defaultValues   : data.meta
      defaultTitle    : data.title
      requiredFields  : credential.fields
      callback        : (title, data) =>

        credential.update {
          provider, title, meta: data
        }, (err, credential) =>
          @form.buttons.Save.hideLoader()

          unless showError err
            @form.emit 'CredentialUpdated', credential


    # @main.addSubView @wrapper = new KDView { cssClass : '', tagName: 'main' }

    @main.addSubView @form = ui.generateAddCredentialFormFor formOptions

    @form.on 'Cancel', @bound 'cancel'

{'fraction_non_alphanumeric': 0.09404388714733543, 'fraction_numerical': 0.0011755485893416929, 'mean_word_length': 2.3904382470119523, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4664597', 'n_tokens_mistral': 726, 'n_tokens_neox': 683, 'n_words': 166}