<commit_before>/**
 * @license
 * Copyright 2020 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.CLASS({
  package: 'foam.nanos.crunch',
  name: 'AgentCapabilityJunctionDAOSummaryView',
  extends: 'foam.comics.v2.DAOSummaryView',

  imports: [
    'notify',
    'stack'
  ],

  requires: [
    'foam.dao.AbstractDAO',
    'foam.log.LogLevel',
    'foam.nanos.approval.ApprovalRequest',
    'foam.nanos.approval.ApprovalStatus'
  ],

  messages: [
    { name: 'SUCCESS_UPDATED', message: 'Successfuly updated onboarding information.'},
    { name: 'SUCCESS_REMOVED', message: 'Successfuly removed onboarding information.'}
  ],

  css: `
    ^ {
      padding-bottom: 0px !important;
    }
    ^view-container .foam-u2-stack-StackView {
      padding-left: 0px !important;
    }
    ^ .foam-u2-wizard-ScrollingStepWizardView-fix-grid {
      height: calc(100vh - 221px) !important;
    }
  `,

  classes: [
    {
      name: 'ScrollingWizardStackView',
      extends: 'foam.u2.View',
      imports: [
        'crunchController',
        'userDAO'
      ],
      requires: [
        'foam.nanos.auth.Subject',
        'foam.u2.ControllerMode',
        'foam.u2.crunch.wizardflow.SaveAllAgent',
        'foam.u2.stack.Stack',
        'foam.u2.stack.StackView'
      ],

      properties: [
        'ucj',
        {
          class: 'Function',
          name: 'onSave'
        }
      ],
      methods: [
        async function initE() {          
          var user = await this.userDAO.find(this.ucj.effectiveUser);
          var realUser = await this.userDAO.find(this.ucj.sourceId);
          var subject = this.Subject.create({ user: user, realUser: realUser });
          var stack = this.Stack.create();
          var x = this.__subContext__.createSubContext({ stack: stack, subject: subject, controllerMode: this.ControllerMode.EDIT });
          
          this.crunchController.createWizardSequence(this.ucj.targetId, x)
            .reconfigure('LoadCapabilitiesAgent', {
              subject: subject })
            .reconfigure('ConfigureFlowAgent', {
              popupMode: false
            })
            .remove('RequirementsPreviewAgent')
            .remove('SkipGrantedAgent')
            .remove('AutoSaveWizardletsAgent')
            .remove('PutFinalJunctionsAgent')
            .add(this.SaveAllAgent, { onSave: this.onSave })
            .execute();

          this.tag(this.StackView.create({ data: stack, showActions: false }, x));
        }
      ]
    }
  ],

  properties: [
    {
      class: 'foam.u2.ViewSpec',
      name: 'viewView',
      factory: function() {
        let onSave = async (isValid, ucj) => {
          this.notify(isValid ? this.SUCCESS_UPDATED : this.SUCCESS_REMOVED, '', this.LogLevel.INFO, true);
          this.stack.back();
        }
        return this.ScrollingWizardStackView.create({ ucj: this.data, onSave: onSave });
      }
    }
  ]
});<commit_msg>remove WizardStateAgent from AgentCapabilityJunctionDAOSummaryView (#5019)<commit_after>/**
 * @license
 * Copyright 2020 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.CLASS({
  package: 'foam.nanos.crunch',
  name: 'AgentCapabilityJunctionDAOSummaryView',
  extends: 'foam.comics.v2.DAOSummaryView',

  imports: [
    'notify',
    'stack'
  ],

  requires: [
    'foam.dao.AbstractDAO',
    'foam.log.LogLevel',
    'foam.nanos.approval.ApprovalRequest',
    'foam.nanos.approval.ApprovalStatus'
  ],

  messages: [
    { name: 'SUCCESS_UPDATED', message: 'Successfuly updated onboarding information.'},
    { name: 'SUCCESS_REMOVED', message: 'Successfuly removed onboarding information.'}
  ],

  css: `
    ^ {
      padding-bottom: 0px !important;
    }
    ^view-container .foam-u2-stack-StackView {
      padding-left: 0px !important;
    }
    ^ .foam-u2-wizard-ScrollingStepWizardView-fix-grid {
      height: calc(100vh - 221px) !important;
    }
  `,

  classes: [
    {
      name: 'ScrollingWizardStackView',
      extends: 'foam.u2.View',
      imports: [
        'crunchController',
        'userDAO'
      ],
      requires: [
        'foam.nanos.auth.Subject',
        'foam.u2.ControllerMode',
        'foam.u2.crunch.wizardflow.SaveAllAgent',
        'foam.u2.stack.Stack',
        'foam.u2.stack.StackView'
      ],

      properties: [
        'ucj',
        {
          class: 'Function',
          name: 'onSave'
        }
      ],
      methods: [
        async function initE() {          
          var user = await this.userDAO.find(this.ucj.effectiveUser);
          var realUser = await this.userDAO.find(this.ucj.sourceId);
          var subject = this.Subject.create({ user: user, realUser: realUser });
          var stack = this.Stack.create();
          var x = this.__subContext__.createSubContext({ stack: stack, subject: subject, controllerMode: this.ControllerMode.EDIT });
          
          this.crunchController.createWizardSequence(this.ucj.targetId, x)
            .reconfigure('LoadCapabilitiesAgent', {
              subject: subject })
            .reconfigure('ConfigureFlowAgent', {
              popupMode: false
            })
            .remove('RequirementsPreviewAgent')
            .remove('SkipGrantedAgent')
            .remove('WizardStateAgent')
            .remove('AutoSaveWizardletsAgent')
            .remove('PutFinalJunctionsAgent')
            .add(this.SaveAllAgent, { onSave: this.onSave })
            .execute();

          this.tag(this.StackView.create({ data: stack, showActions: false }, x));
        }
      ]
    }
  ],

  properties: [
    {
      class: 'foam.u2.ViewSpec',
      name: 'viewView',
      factory: function() {
        let onSave = async (isValid, ucj) => {
          this.notify(isValid ? this.SUCCESS_UPDATED : this.SUCCESS_REMOVED, '', this.LogLevel.INFO, true);
          this.stack.back();
        }
        return this.ScrollingWizardStackView.create({ ucj: this.data, onSave: onSave });
      }
    }
  ]
});
{'fraction_non_alphanumeric': 0.13523841169629505, 'fraction_numerical': 0.00830702774547267, 'mean_word_length': 2.2072456046883326, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3955105', 'n_tokens_mistral': 1959, 'n_tokens_neox': 1913, 'n_words': 309}