|
9 | 9 | size="large" |
10 | 10 | :name="$t('calendar', 'Import destination selection')" |
11 | 11 | @close="cancelImport"> |
12 | | - <h2 class="import-modal__title"> |
13 | | - {{ $t('calendar', 'Import calendars') }} |
14 | | - </h2> |
15 | | - <h4 class="import-modal__subtitle"> |
16 | | - <!-- eslint-disable-next-line no-irregular-whitespace --> |
17 | | - {{ $t('calendar', 'Please select a calendar to import into …') }} |
18 | | - </h4> |
19 | | - |
20 | | - <transition-group class="import-modal__file-list" tag="ul"> |
21 | | - <li key="import-header-row" class="import-modal-file-item import-modal-file-item--header"> |
22 | | - <div class="import-modal-file-item__filename"> |
23 | | - {{ $t('calendar', 'Filename') }} |
| 12 | + <template v-if="isSelecting"> |
| 13 | + <h2 class="import-modal__title"> |
| 14 | + {{ $t('calendar', 'Import calendars') }} |
| 15 | + </h2> |
| 16 | + <h4 class="import-modal__subtitle"> |
| 17 | + {{ $t('calendar', 'Please select a calendar to import into …') }} |
| 18 | + </h4> |
| 19 | + |
| 20 | + <transition-group class="import-modal__file-list" tag="ul"> |
| 21 | + <li key="import-header-row" class="import-modal-file-item import-modal-file-item--header"> |
| 22 | + <div class="import-modal-file-item__filename"> |
| 23 | + {{ $t('calendar', 'Filename') }} |
| 24 | + </div> |
| 25 | + <div class="import-modal-file-item__calendar-select"> |
| 26 | + {{ $t('calendar', 'Calendar to import into') }} |
| 27 | + </div> |
| 28 | + </li> |
| 29 | + <ImportScreenRow v-for="(file, index) in files" :key="`import-file-${index}`" :file="file" /> |
| 30 | + </transition-group> |
| 31 | + |
| 32 | + <div class="import-modal__actions"> |
| 33 | + <NcButton @click="cancelImport"> |
| 34 | + {{ $t('calendar', 'Cancel') }} |
| 35 | + </NcButton> |
| 36 | + <NcButton class="primary" @click="importCalendar"> |
| 37 | + {{ $n('calendar', 'Import calendar', 'Import calendars', files.length) }} |
| 38 | + </NcButton> |
| 39 | + </div> |
| 40 | + </template> |
| 41 | + |
| 42 | + <template v-else> |
| 43 | + <h2 class="import-modal__title"> |
| 44 | + {{ $t('calendar', 'Importing calendars') }} |
| 45 | + </h2> |
| 46 | + <h4 class="import-modal__subtitle"> |
| 47 | + {{ activeFileLabel }} |
| 48 | + </h4> |
| 49 | + |
| 50 | + <progress |
| 51 | + class="settings-fieldset-interior-item__import-progress-bar" |
| 52 | + :value="totals.processed" |
| 53 | + :max="Math.max(totals.discovered, 1)" /> |
| 54 | + |
| 55 | + <div class="import-modal__counters"> |
| 56 | + <div class="import-modal__counter"> |
| 57 | + <span class="import-modal__counter-icon" aria-hidden="true"> |
| 58 | + <ProgressQuestionIcon :size="18" decorative /> |
| 59 | + </span> |
| 60 | + <div class="import-modal__counter-content"> |
| 61 | + <strong>{{ totals.discovered }}</strong> |
| 62 | + <span>{{ $t('calendar', 'Discovered') }}</span> |
| 63 | + </div> |
| 64 | + </div> |
| 65 | + <div class="import-modal__counter"> |
| 66 | + <span class="import-modal__counter-icon" aria-hidden="true"> |
| 67 | + <ProgressClockIcon :size="18" decorative /> |
| 68 | + </span> |
| 69 | + <div class="import-modal__counter-content"> |
| 70 | + <strong>{{ totals.processed }}</strong> |
| 71 | + <span>{{ $t('calendar', 'Processed') }}</span> |
| 72 | + </div> |
24 | 73 | </div> |
25 | | - <div class="import-modal-file-item__calendar-select"> |
26 | | - {{ $t('calendar', 'Calendar to import into') }} |
| 74 | + <div class="import-modal__counter"> |
| 75 | + <span class="import-modal__counter-icon" aria-hidden="true"> |
| 76 | + <CheckBoldIcon :size="18" decorative /> |
| 77 | + </span> |
| 78 | + <div class="import-modal__counter-content"> |
| 79 | + <strong>{{ totals.created }}</strong> |
| 80 | + <span>{{ $t('calendar', 'Created') }}</span> |
| 81 | + </div> |
27 | 82 | </div> |
28 | | - </li> |
29 | | - <ImportScreenRow v-for="(file, index) in files" :key="`import-file-${index}`" :file="file" /> |
30 | | - </transition-group> |
31 | | - |
32 | | - <div class="import-modal__actions"> |
33 | | - <NcButton @click="cancelImport"> |
34 | | - {{ $t('calendar', 'Cancel') }} |
35 | | - </NcButton> |
36 | | - <NcButton class="primary" @click="importCalendar"> |
37 | | - {{ $n('calendar', 'Import calendar', 'Import calendars', files.length) }} |
38 | | - </NcButton> |
39 | | - </div> |
| 83 | + <div class="import-modal__counter"> |
| 84 | + <span class="import-modal__counter-icon" aria-hidden="true"> |
| 85 | + <ReloadIcon :size="18" decorative /> |
| 86 | + </span> |
| 87 | + <div class="import-modal__counter-content"> |
| 88 | + <strong>{{ totals.updated }}</strong> |
| 89 | + <span>{{ $t('calendar', 'Updated') }}</span> |
| 90 | + </div> |
| 91 | + </div> |
| 92 | + <div class="import-modal__counter"> |
| 93 | + <span class="import-modal__counter-icon" aria-hidden="true"> |
| 94 | + <CloseIcon :size="18" decorative /> |
| 95 | + </span> |
| 96 | + <div class="import-modal__counter-content"> |
| 97 | + <strong>{{ totals.exists }}</strong> |
| 98 | + <span>{{ $t('calendar', 'Skipped') }}</span> |
| 99 | + </div> |
| 100 | + </div> |
| 101 | + <div class="import-modal__counter"> |
| 102 | + <span class="import-modal__counter-icon" aria-hidden="true"> |
| 103 | + <AlertCircleOutlineIcon :size="18" decorative /> |
| 104 | + </span> |
| 105 | + <div class="import-modal__counter-content"> |
| 106 | + <strong>{{ totals.error }}</strong> |
| 107 | + <span>{{ $t('calendar', 'Errors') }}</span> |
| 108 | + </div> |
| 109 | + </div> |
| 110 | + </div> |
| 111 | + </template> |
40 | 112 | </Modal> |
41 | 113 | </template> |
42 | 114 |
|
43 | 115 | <script> |
44 | 116 | import { NcModal as Modal, NcButton } from '@nextcloud/vue' |
| 117 | +import AlertCircleOutlineIcon from 'vue-material-design-icons/AlertCircleOutline' |
| 118 | +import CheckBoldIcon from 'vue-material-design-icons/CheckBold' |
| 119 | +import CloseIcon from 'vue-material-design-icons/Close' |
| 120 | +import ProgressClockIcon from 'vue-material-design-icons/ProgressClock' |
| 121 | +import ProgressQuestionIcon from 'vue-material-design-icons/ProgressQuestion' |
| 122 | +import ReloadIcon from 'vue-material-design-icons/Reload' |
45 | 123 | import ImportScreenRow from './ImportScreenRow.vue' |
46 | 124 |
|
47 | 125 | export default { |
48 | 126 | name: 'ImportScreen', |
49 | 127 | components: { |
| 128 | + AlertCircleOutlineIcon, |
| 129 | + CheckBoldIcon, |
| 130 | + CloseIcon, |
50 | 131 | NcButton, |
51 | 132 | ImportScreenRow, |
52 | 133 | Modal, |
| 134 | + ProgressClockIcon, |
| 135 | + ProgressQuestionIcon, |
| 136 | + ReloadIcon, |
53 | 137 | }, |
54 | 138 |
|
55 | 139 | props: { |
56 | 140 | files: { |
57 | 141 | type: Array, |
58 | 142 | required: true, |
59 | 143 | }, |
| 144 | +
|
| 145 | + stage: { |
| 146 | + type: String, |
| 147 | + required: true, |
| 148 | + }, |
| 149 | +
|
| 150 | + totals: { |
| 151 | + type: Object, |
| 152 | + required: true, |
| 153 | + }, |
| 154 | +
|
| 155 | + activeSession: { |
| 156 | + type: Object, |
| 157 | + default: null, |
| 158 | + }, |
| 159 | + }, |
| 160 | +
|
| 161 | + emits: ['cancelImport', 'importCalendar'], |
| 162 | +
|
| 163 | + computed: { |
| 164 | + isSelecting() { |
| 165 | + return this.stage === 'selecting' |
| 166 | + }, |
| 167 | +
|
| 168 | + activeFileLabel() { |
| 169 | + if (!this.activeSession) { |
| 170 | + return this.$t('calendar', 'Preparing import…') |
| 171 | + } |
| 172 | +
|
| 173 | + return this.$t('calendar', 'Importing {fileName} into {calendar}', { |
| 174 | + fileName: this.activeSession.fileName, |
| 175 | + calendar: this.activeSession.targetDisplayName || this.$t('calendar', 'selected calendar'), |
| 176 | + }) |
| 177 | + }, |
60 | 178 | }, |
61 | 179 |
|
62 | 180 | methods: { |
|
0 commit comments