<commit_before><template>
  <div class="component-container container-fluid">
    <div class="panel panel-default">
      <!-- Title -->
      <div class="panel-heading">短信发送驱动设置</div>
      <!-- Loading -->
      <div v-if="loadding" class="panel-body text-center">
        <span class="glyphicon glyphicon-refresh component-loadding-icon"></span>
        加载中...
      </div>
      <!-- Loading Error. -->
      <div v-else-if="loaddingError" class="panel-body">
        <div class="alert alert-danger" role="alert">{{ loaddingErrorMessage }}</div>
        <button type="button" class="btn btn-primary" @click.stop.prevent="request">刷新</button>
      </div>
      <!-- Body -->
      <div v-else class="form-horizontal panel-body">
        <!-- 驱动设置表单 -->
        <div class="form-group">
          <label class="col-sm-2 control-label">驱动</label>
          <div class="col-sm-4">
            <div class="radio" v-for="name, value in driver" :key="value">
              <label>
                <input type="radio" name="default" :value="value" v-model="selected">
                {{ name }}
              </label>
            </div>
          </div>
          <div class="col-sm-6">
            <span class="help-block">请选择用于发送短信的驱动程序。</span>
          </div>
        </div>
        <!-- 提交表单按钮 -->
        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-4">
            <button type="button" class="btn btn-primary">提交</button>
          </div>
          <div class="col-sm-6 help-block">
            <span class="text-success">Test tip</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import request, { createRequestURI } from '../../util/request';

const DriverComponent = {
  data: () => ({
    selected: null,
    driver: [],
    loadding: true,
    loaddingError: false,
    loaddingErrorMessage: '',
  }),
  methods: {
    request() {
      this.loadding = true;
      request.get(createRequestURI('sms/driver'), { validateStatus: status => status === 200 })
        .then(({ data = {} }) => {
          const { default: selected = null, driver = [] } = data;
          this.loadding = false;
          this.loaddingError = false;
          this.selected = selected;
          this.driver = driver;
        })
        .catch(({ response: { data: { message: [message = '加载驱动设置失败，请刷新重新尝试！'] = [] } = {} } = {} }) => {
          this.loadding = false;
          this.loaddingError = true;
          this.loaddingErrorMessage = message;
        });
    },
    submit() {
      const selected = this.selected;
    }<commit_msg>添加提交处理消息事件。<commit_after><template>
  <div class="component-container container-fluid">
    <div class="panel panel-default">
      <!-- Title -->
      <div class="panel-heading">短信发送驱动设置</div>
      <!-- Loading -->
      <div v-if="loadding" class="panel-body text-center">
        <span class="glyphicon glyphicon-refresh component-loadding-icon"></span>
        加载中...
      </div>
      <!-- Loading Error. -->
      <div v-else-if="loaddingError" class="panel-body">
        <div class="alert alert-danger" role="alert">{{ loaddingErrorMessage }}</div>
        <button type="button" class="btn btn-primary" @click.stop.prevent="request">刷新</button>
      </div>
      <!-- Body -->
      <div v-else class="form-horizontal panel-body">
        <!-- 驱动设置表单 -->
        <div class="form-group">
          <label class="col-sm-2 control-label">驱动</label>
          <div class="col-sm-4">
            <div class="radio" v-for="name, value in driver" :key="value">
              <label>
                <input type="radio" name="default" :value="value" v-model="selected">
                {{ name }}
              </label>
            </div>
          </div>
          <div class="col-sm-6">
            <span class="help-block">请选择用于发送短信的驱动程序。</span>
          </div>
        </div>
        <!-- 提交表单按钮 -->
        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-4">
            <button type="button" class="btn btn-primary">提交</button>
          </div>
          <div class="col-sm-6 help-block">
            <span :class="`text-${submit.messageType}`">{{ submit.message }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import request, { createRequestURI } from '../../util/request';

const DriverComponent = {
  data: () => ({
    selected: null,
    driver: [],
    loadding: true,
    loaddingError: false,
    loaddingErrorMessage: '',
    submit: {
      loadding: false,
      message: '',
      messageType: 'muted'
    }
  }),
  methods: {
    request() {
      this.loadding = true;
      request.get(createRequestURI('sms/driver'), { validateStatus: status => status === 200 })
        .then(({ data = {} }) => {
          const { default: selected = null, driver = [] } = data;
          this.loadding = false;
          this.loaddingError = false;
          this.selected = selected;
          this.driver = driver;
        })
        .catch(({ response: { data: { message: [message = '加载驱动设置失败，请刷新重新尝试！'] = [] } = {} } = {} }) => {
          this.loadding = false;
          this.loaddingError = true;
          this.loaddingErrorMessage = message;
        });
    },
    submit() {
      const selected = this.selected;
    }
{'fraction_non_alphanumeric': 0.18060263653483993, 'fraction_numerical': 0.003389830508474576, 'mean_word_length': 1.96207473508087, 'pattern_counts': {'":': 0, '<': 107, '<?xml version=': 0, '>': 115, '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': '1782090', 'n_tokens_mistral': 1698, 'n_tokens_neox': 1712, 'n_words': 317}