|
17 | 17 |
|
18 | 18 | <template> |
19 | 19 | <div> |
20 | | - <div v-ctrl-enter="handleOpenAddVMModal"> |
| 20 | + <div @keyup.ctrl.enter="handleOpenAddVMModal"> |
21 | 21 | <div class="form"> |
22 | 22 | <div class="form__item" ref="newRuleName"> |
23 | 23 | <div class="form__label"><span class="form__required">*</span>{{ $t('label.name') }}</div> |
|
346 | 346 | </div> |
347 | 347 | </a-modal> |
348 | 348 |
|
349 | | - <a-modal |
350 | | - :title="$t('label.add.vms')" |
351 | | - :maskClosable="false" |
352 | | - :closable="true" |
353 | | - v-model="addVmModalVisible" |
354 | | - class="vm-modal" |
355 | | - width="60vw" |
356 | | - :footer="null" |
357 | | - v-ctrl-enter="handleAddNewRule" |
358 | | - > |
359 | | - <div> |
360 | | - <span |
361 | | - v-if="'vpcid' in resource && !('associatednetworkid' in resource)"> |
362 | | - <strong>{{ $t('label.select.tier') }} </strong> |
363 | | - <a-select |
364 | | - :autoFocus="'vpcid' in resource && !('associatednetworkid' in resource)" |
365 | | - v-model="selectedTier" |
366 | | - @change="fetchVirtualMachines()" |
367 | | - :placeholder="$t('label.select.tier')" |
368 | | - showSearch |
369 | | - optionFilterProp="children" |
370 | | - :filterOption="(input, option) => { |
371 | | - return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
372 | | - }" > |
373 | | - <a-select-option |
374 | | - v-for="tier in tiers.data" |
375 | | - :loading="tiers.loading" |
376 | | - :key="tier.id"> |
377 | | - {{ tier.displaytext }} |
378 | | - </a-select-option> |
379 | | - </a-select> |
380 | | - </span> |
381 | | - <a-input-search |
382 | | - :autoFocus="!('vpcid' in resource && !('associatednetworkid' in resource))" |
383 | | - class="input-search" |
384 | | - :placeholder="$t('label.search')" |
385 | | - v-model="searchQuery" |
386 | | - allowClear |
387 | | - @search="onSearch" /> |
388 | | - <a-table |
389 | | - size="small" |
390 | | - class="list-view" |
391 | | - :loading="addVmModalLoading" |
392 | | - :columns="vmColumns" |
393 | | - :dataSource="vms" |
394 | | - :pagination="false" |
395 | | - :rowKey="record => record.id" |
396 | | - :scroll="{ y: 300 }"> |
397 | | - <div slot="name" slot-scope="text, record, index"> |
398 | | - <span> |
399 | | - {{ text }} |
400 | | - </span> |
401 | | - <a-icon v-if="addVmModalNicLoading" type="loading"></a-icon> |
| 349 | + <div |
| 350 | + @keyup.ctrl.enter="handleAddNewRule"> |
| 351 | + <a-modal |
| 352 | + :title="$t('label.add.vms')" |
| 353 | + :maskClosable="false" |
| 354 | + :closable="true" |
| 355 | + v-model="addVmModalVisible" |
| 356 | + class="vm-modal" |
| 357 | + width="60vw" |
| 358 | + :footer="null" |
| 359 | + > |
| 360 | + <div> |
| 361 | + <span |
| 362 | + v-if="'vpcid' in resource && !('associatednetworkid' in resource)"> |
| 363 | + <strong>{{ $t('label.select.tier') }} </strong> |
402 | 364 | <a-select |
403 | | - style="display: block" |
404 | | - v-else-if="!addVmModalNicLoading && newRule.virtualmachineid[index] === record.id" |
405 | | - mode="multiple" |
406 | | - v-model="newRule.vmguestip[index]" |
| 365 | + :autoFocus="'vpcid' in resource && !('associatednetworkid' in resource)" |
| 366 | + v-model="selectedTier" |
| 367 | + @change="fetchVirtualMachines()" |
| 368 | + :placeholder="$t('label.select.tier')" |
407 | 369 | showSearch |
408 | 370 | optionFilterProp="children" |
409 | 371 | :filterOption="(input, option) => { |
410 | 372 | return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
411 | 373 | }" > |
412 | | - <a-select-option v-for="(nic, nicIndex) in nics[index]" :key="nic" :value="nic"> |
413 | | - {{ nic }}{{ nicIndex === 0 ? ` (${$t('label.primary')})` : null }} |
| 374 | + <a-select-option |
| 375 | + v-for="tier in tiers.data" |
| 376 | + :loading="tiers.loading" |
| 377 | + :key="tier.id"> |
| 378 | + {{ tier.displaytext }} |
414 | 379 | </a-select-option> |
415 | 380 | </a-select> |
416 | | - </div> |
| 381 | + </span> |
| 382 | + <a-input-search |
| 383 | + :autoFocus="!('vpcid' in resource && !('associatednetworkid' in resource))" |
| 384 | + class="input-search" |
| 385 | + :placeholder="$t('label.search')" |
| 386 | + v-model="searchQuery" |
| 387 | + allowClear |
| 388 | + @search="onSearch" /> |
| 389 | + <a-table |
| 390 | + size="small" |
| 391 | + class="list-view" |
| 392 | + :loading="addVmModalLoading" |
| 393 | + :columns="vmColumns" |
| 394 | + :dataSource="vms" |
| 395 | + :pagination="false" |
| 396 | + :rowKey="record => record.id" |
| 397 | + :scroll="{ y: 300 }"> |
| 398 | + <div slot="name" slot-scope="text, record, index"> |
| 399 | + <span> |
| 400 | + {{ text }} |
| 401 | + </span> |
| 402 | + <a-icon v-if="addVmModalNicLoading" type="loading"></a-icon> |
| 403 | + <a-select |
| 404 | + style="display: block" |
| 405 | + v-else-if="!addVmModalNicLoading && newRule.virtualmachineid[index] === record.id" |
| 406 | + mode="multiple" |
| 407 | + v-model="newRule.vmguestip[index]" |
| 408 | + showSearch |
| 409 | + optionFilterProp="children" |
| 410 | + :filterOption="(input, option) => { |
| 411 | + return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
| 412 | + }" > |
| 413 | + <a-select-option v-for="(nic, nicIndex) in nics[index]" :key="nic" :value="nic"> |
| 414 | + {{ nic }}{{ nicIndex === 0 ? ` (${$t('label.primary')})` : null }} |
| 415 | + </a-select-option> |
| 416 | + </a-select> |
| 417 | + </div> |
417 | 418 |
|
418 | | - <div slot="state" slot-scope="text"> |
419 | | - <status :text="text ? text : ''" displayText></status> |
420 | | - </div> |
| 419 | + <div slot="state" slot-scope="text"> |
| 420 | + <status :text="text ? text : ''" displayText></status> |
| 421 | + </div> |
421 | 422 |
|
422 | | - <div slot="action" slot-scope="text, record, index" style="text-align: center"> |
423 | | - <a-checkbox :value="record.id" @change="e => fetchNics(e, index)" /> |
424 | | - </div> |
425 | | - </a-table> |
426 | | - <a-pagination |
427 | | - class="pagination" |
428 | | - size="small" |
429 | | - :current="vmPage" |
430 | | - :pageSize="vmPageSize" |
431 | | - :total="vmCount" |
432 | | - :showTotal="total => `${$t('label.total')} ${total} ${$t('label.items')}`" |
433 | | - :pageSizeOptions="['10', '20', '40', '80', '100']" |
434 | | - @change="handleChangeVmPage" |
435 | | - @showSizeChange="handleChangeVmPageSize" |
436 | | - showSizeChanger> |
437 | | - <template slot="buildOptionText" slot-scope="props"> |
438 | | - <span>{{ props.value }} / {{ $t('label.page') }}</span> |
439 | | - </template> |
440 | | - </a-pagination> |
441 | | - </div> |
| 423 | + <div slot="action" slot-scope="text, record, index" style="text-align: center"> |
| 424 | + <a-checkbox :value="record.id" @change="e => fetchNics(e, index)" /> |
| 425 | + </div> |
| 426 | + </a-table> |
| 427 | + <a-pagination |
| 428 | + class="pagination" |
| 429 | + size="small" |
| 430 | + :current="vmPage" |
| 431 | + :pageSize="vmPageSize" |
| 432 | + :total="vmCount" |
| 433 | + :showTotal="total => `${$t('label.total')} ${total} ${$t('label.items')}`" |
| 434 | + :pageSizeOptions="['10', '20', '40', '80', '100']" |
| 435 | + @change="handleChangeVmPage" |
| 436 | + @showSizeChange="handleChangeVmPageSize" |
| 437 | + showSizeChanger> |
| 438 | + <template slot="buildOptionText" slot-scope="props"> |
| 439 | + <span>{{ props.value }} / {{ $t('label.page') }}</span> |
| 440 | + </template> |
| 441 | + </a-pagination> |
| 442 | + </div> |
442 | 443 |
|
443 | | - <div :span="24" class="action-button"> |
444 | | - <a-button @click="closeModal">{{ $t('label.cancel') }}</a-button> |
445 | | - <a-button :disabled="newRule.virtualmachineid === []" type="primary" @click="handleAddNewRule">{{ $t('label.ok') }}</a-button> |
446 | | - </div> |
447 | | - </a-modal> |
| 444 | + <div :span="24" class="action-button"> |
| 445 | + <a-button @click="closeModal">{{ $t('label.cancel') }}</a-button> |
| 446 | + <a-button :disabled="newRule.virtualmachineid === []" type="primary" @click="handleAddNewRule">{{ $t('label.ok') }}</a-button> |
| 447 | + </div> |
| 448 | + </a-modal> |
| 449 | + </div> |
448 | 450 |
|
449 | 451 | <bulk-action-view |
450 | 452 | v-if="showConfirmationAction || showGroupActionModal" |
|
0 commit comments