| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 1 | <template> |
| 2 | <div> |
| 3 | <b-modal |
| 4 | id="generate-csr" |
| 5 | ref="modal" |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 6 | v-model="isVisible" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 7 | size="lg" |
| 8 | no-stacking |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 9 | :title="$t('pageCertificates.modal.generateACertificateSigningRequest')" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 10 | @ok="onOkGenerateCsrModal" |
| 11 | @cancel="resetForm" |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 12 | @hidden="v$.$reset()" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 13 | > |
| Chandra Harkude | 373d243 | 2022-12-15 20:51:02 +0530 | [diff] [blame] | 14 | <b-form id="generate-csr-form" novalidate> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 15 | <b-container fluid> |
| 16 | <b-row> |
| 17 | <b-col lg="9"> |
| 18 | <b-row> |
| 19 | <b-col lg="6"> |
| 20 | <b-form-group |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 21 | :label="$t('pageCertificates.modal.certificateType')" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 22 | label-for="certificate-type" |
| 23 | > |
| 24 | <b-form-select |
| 25 | id="certificate-type" |
| 26 | v-model="form.certificateType" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 27 | data-test-id="modalGenerateCsr-select-certificateType" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 28 | :options="certificateOptions" |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 29 | :state="getValidationState(v$.form.certificateType)" |
| 30 | @input="v$.form.certificateType.$touch()" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 31 | > |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 32 | <template #first> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 33 | <b-form-select-option :value="null" disabled> |
| 34 | {{ $t('global.form.selectAnOption') }} |
| 35 | </b-form-select-option> |
| 36 | </template> |
| 37 | </b-form-select> |
| 38 | <b-form-invalid-feedback role="alert"> |
| 39 | {{ $t('global.form.fieldRequired') }} |
| 40 | </b-form-invalid-feedback> |
| 41 | </b-form-group> |
| 42 | </b-col> |
| 43 | <b-col lg="6"> |
| 44 | <b-form-group |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 45 | :label="$t('pageCertificates.modal.country')" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 46 | label-for="country" |
| 47 | > |
| 48 | <b-form-select |
| 49 | id="country" |
| 50 | v-model="form.country" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 51 | data-test-id="modalGenerateCsr-select-country" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 52 | :options="countryOptions" |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 53 | :state="getValidationState(v$.form.country)" |
| 54 | @input="v$.form.country.$touch()" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 55 | > |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 56 | <template #first> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 57 | <b-form-select-option :value="null" disabled> |
| 58 | {{ $t('global.form.selectAnOption') }} |
| 59 | </b-form-select-option> |
| 60 | </template> |
| 61 | </b-form-select> |
| 62 | <b-form-invalid-feedback role="alert"> |
| 63 | {{ $t('global.form.fieldRequired') }} |
| 64 | </b-form-invalid-feedback> |
| 65 | </b-form-group> |
| 66 | </b-col> |
| 67 | </b-row> |
| 68 | <b-row> |
| 69 | <b-col lg="6"> |
| 70 | <b-form-group |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 71 | :label="$t('pageCertificates.modal.state')" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 72 | label-for="state" |
| 73 | > |
| 74 | <b-form-input |
| 75 | id="state" |
| 76 | v-model="form.state" |
| 77 | type="text" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 78 | data-test-id="modalGenerateCsr-input-state" |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 79 | :state="getValidationState(v$.form.state)" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 80 | /> |
| 81 | <b-form-invalid-feedback role="alert"> |
| 82 | {{ $t('global.form.fieldRequired') }} |
| 83 | </b-form-invalid-feedback> |
| 84 | </b-form-group> |
| 85 | </b-col> |
| 86 | <b-col lg="6"> |
| 87 | <b-form-group |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 88 | :label="$t('pageCertificates.modal.city')" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 89 | label-for="city" |
| 90 | > |
| 91 | <b-form-input |
| 92 | id="city" |
| 93 | v-model="form.city" |
| 94 | type="text" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 95 | data-test-id="modalGenerateCsr-input-city" |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 96 | :state="getValidationState(v$.form.city)" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 97 | /> |
| 98 | <b-form-invalid-feedback role="alert"> |
| 99 | {{ $t('global.form.fieldRequired') }} |
| 100 | </b-form-invalid-feedback> |
| 101 | </b-form-group> |
| 102 | </b-col> |
| 103 | </b-row> |
| 104 | <b-row> |
| 105 | <b-col lg="6"> |
| 106 | <b-form-group |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 107 | :label="$t('pageCertificates.modal.companyName')" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 108 | label-for="company-name" |
| 109 | > |
| 110 | <b-form-input |
| 111 | id="company-name" |
| 112 | v-model="form.companyName" |
| 113 | type="text" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 114 | data-test-id="modalGenerateCsr-input-companyName" |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 115 | :state="getValidationState(v$.form.companyName)" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 116 | /> |
| 117 | <b-form-invalid-feedback role="alert"> |
| 118 | {{ $t('global.form.fieldRequired') }} |
| 119 | </b-form-invalid-feedback> |
| 120 | </b-form-group> |
| 121 | </b-col> |
| 122 | <b-col lg="6"> |
| 123 | <b-form-group |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 124 | :label="$t('pageCertificates.modal.companyUnit')" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 125 | label-for="company-unit" |
| 126 | > |
| 127 | <b-form-input |
| 128 | id="company-unit" |
| 129 | v-model="form.companyUnit" |
| 130 | type="text" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 131 | data-test-id="modalGenerateCsr-input-companyUnit" |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 132 | :state="getValidationState(v$.form.companyUnit)" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 133 | /> |
| 134 | <b-form-invalid-feedback role="alert"> |
| 135 | {{ $t('global.form.fieldRequired') }} |
| 136 | </b-form-invalid-feedback> |
| 137 | </b-form-group> |
| 138 | </b-col> |
| 139 | </b-row> |
| 140 | <b-row> |
| 141 | <b-col lg="6"> |
| 142 | <b-form-group |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 143 | :label="$t('pageCertificates.modal.commonName')" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 144 | label-for="common-name" |
| 145 | > |
| 146 | <b-form-input |
| 147 | id="common-name" |
| 148 | v-model="form.commonName" |
| 149 | type="text" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 150 | data-test-id="modalGenerateCsr-input-commonName" |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 151 | :state="getValidationState(v$.form.commonName)" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 152 | /> |
| 153 | <b-form-invalid-feedback role="alert"> |
| 154 | {{ $t('global.form.fieldRequired') }} |
| 155 | </b-form-invalid-feedback> |
| 156 | </b-form-group> |
| 157 | </b-col> |
| 158 | <b-col lg="6"> |
| Dixsie Wolmers | 46f17ef | 2020-09-08 14:53:25 -0500 | [diff] [blame] | 159 | <b-form-group label-for="contact-person"> |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 160 | <template #label> |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 161 | {{ $t('pageCertificates.modal.contactPerson') }} |
| 162 | - |
| Dixsie Wolmers | 46f17ef | 2020-09-08 14:53:25 -0500 | [diff] [blame] | 163 | <span class="form-text d-inline"> |
| 164 | {{ $t('global.form.optional') }} |
| 165 | </span> |
| 166 | </template> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 167 | <b-form-input |
| 168 | id="contact-person" |
| 169 | v-model="form.contactPerson" |
| 170 | type="text" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 171 | data-test-id="modalGenerateCsr-input-contactPerson" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 172 | /> |
| 173 | </b-form-group> |
| 174 | </b-col> |
| Vedangi Mittal | dfba4e5 | 2024-04-23 14:13:23 +0530 | [diff] [blame] | 175 | </b-row> |
| 176 | <b-row> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 177 | <b-col lg="6"> |
| Dixsie Wolmers | 46f17ef | 2020-09-08 14:53:25 -0500 | [diff] [blame] | 178 | <b-form-group label-for="email-address"> |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 179 | <template #label> |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 180 | {{ $t('pageCertificates.modal.emailAddress') }} |
| 181 | - |
| Dixsie Wolmers | 46f17ef | 2020-09-08 14:53:25 -0500 | [diff] [blame] | 182 | <span class="form-text d-inline"> |
| 183 | {{ $t('global.form.optional') }} |
| 184 | </span> |
| 185 | </template> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 186 | <b-form-input |
| 187 | id="email-address" |
| 188 | v-model="form.emailAddress" |
| 189 | type="text" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 190 | data-test-id="modalGenerateCsr-input-emailAddress" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 191 | /> |
| 192 | </b-form-group> |
| 193 | </b-col> |
| 194 | </b-row> |
| 195 | <b-row> |
| 196 | <b-col lg="12"> |
| Dixsie Wolmers | 46f17ef | 2020-09-08 14:53:25 -0500 | [diff] [blame] | 197 | <b-form-group label-for="alternate-name"> |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 198 | <template #label> |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 199 | {{ $t('pageCertificates.modal.alternateName') }} |
| 200 | - |
| Dixsie Wolmers | 46f17ef | 2020-09-08 14:53:25 -0500 | [diff] [blame] | 201 | <span class="form-text d-inline"> |
| 202 | {{ $t('global.form.optional') }} |
| 203 | </span> |
| 204 | </template> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 205 | <b-form-text id="alternate-name-help-block"> |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 206 | {{ $t('pageCertificates.modal.alternateNameHelperText') }} |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 207 | </b-form-text> |
| 208 | <b-form-tags |
| 209 | v-model="form.alternateName" |
| 210 | :remove-on-delete="true" |
| 211 | :tag-pills="true" |
| 212 | input-id="alternate-name" |
| 213 | size="lg" |
| 214 | separator=" " |
| 215 | :input-attrs="{ |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 216 | 'aria-describedby': 'alternate-name-help-block', |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 217 | }" |
| 218 | :duplicate-tag-text=" |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 219 | $t('pageCertificates.modal.duplicateAlternateName') |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 220 | " |
| 221 | placeholder="" |
| Sandeepa Singh | 92f8755 | 2021-02-12 18:13:46 +0530 | [diff] [blame] | 222 | data-test-id="modalGenerateCsr-input-alternateName" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 223 | > |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 224 | <template #add-button-text> |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 225 | <icon-add /> |
| 226 | {{ $t('global.action.add') }} |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 227 | </template> |
| 228 | </b-form-tags> |
| 229 | </b-form-group> |
| 230 | </b-col> |
| 231 | </b-row> |
| 232 | </b-col> |
| 233 | <b-col lg="3"> |
| 234 | <b-row> |
| 235 | <b-col lg="12"> |
| 236 | <p class="col-form-label"> |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 237 | {{ $t('pageCertificates.modal.privateKey') }} |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 238 | </p> |
| 239 | <b-form-group |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 240 | :label="$t('pageCertificates.modal.keyPairAlgorithm')" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 241 | label-for="key-pair-algorithm" |
| 242 | > |
| 243 | <b-form-select |
| 244 | id="key-pair-algorithm" |
| 245 | v-model="form.keyPairAlgorithm" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 246 | data-test-id="modalGenerateCsr-select-keyPairAlgorithm" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 247 | :options="keyPairAlgorithmOptions" |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 248 | :state="getValidationState(v$.form.keyPairAlgorithm)" |
| 249 | @input="v$.form.keyPairAlgorithm.$touch()" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 250 | > |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 251 | <template #first> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 252 | <b-form-select-option :value="null" disabled> |
| 253 | {{ $t('global.form.selectAnOption') }} |
| 254 | </b-form-select-option> |
| 255 | </template> |
| 256 | </b-form-select> |
| 257 | <b-form-invalid-feedback role="alert"> |
| 258 | {{ $t('global.form.fieldRequired') }} |
| 259 | </b-form-invalid-feedback> |
| 260 | </b-form-group> |
| 261 | </b-col> |
| 262 | </b-row> |
| 263 | <b-row> |
| 264 | <b-col lg="12"> |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 265 | <template v-if="v$.form.keyPairAlgorithm.$model === 'EC'"> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 266 | <b-form-group |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 267 | :label="$t('pageCertificates.modal.keyCurveId')" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 268 | label-for="key-curve-id" |
| 269 | > |
| 270 | <b-form-select |
| 271 | id="key-curve-id" |
| 272 | v-model="form.keyCurveId" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 273 | data-test-id="modalGenerateCsr-select-keyCurveId" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 274 | :options="keyCurveIdOptions" |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 275 | :state="getValidationState(v$.form.keyCurveId)" |
| 276 | @input="v$.form.keyCurveId.$touch()" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 277 | > |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 278 | <template #first> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 279 | <b-form-select-option :value="null" disabled> |
| 280 | {{ $t('global.form.selectAnOption') }} |
| 281 | </b-form-select-option> |
| 282 | </template> |
| 283 | </b-form-select> |
| 284 | <b-form-invalid-feedback role="alert"> |
| 285 | {{ $t('global.form.fieldRequired') }} |
| 286 | </b-form-invalid-feedback> |
| 287 | </b-form-group> |
| 288 | </template> |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 289 | <template v-if="v$.form.keyPairAlgorithm.$model === 'RSA'"> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 290 | <b-form-group |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 291 | :label="$t('pageCertificates.modal.keyBitLength')" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 292 | label-for="key-bit-length" |
| 293 | > |
| 294 | <b-form-select |
| 295 | id="key-bit-length" |
| 296 | v-model="form.keyBitLength" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 297 | data-test-id="modalGenerateCsr-select-keyBitLength" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 298 | :options="keyBitLengthOptions" |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 299 | :state="getValidationState(v$.form.keyBitLength)" |
| 300 | @input="v$.form.keyBitLength.$touch()" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 301 | > |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 302 | <template #first> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 303 | <b-form-select-option :value="null" disabled> |
| 304 | {{ $t('global.form.selectAnOption') }} |
| 305 | </b-form-select-option> |
| 306 | </template> |
| 307 | </b-form-select> |
| 308 | <b-form-invalid-feedback role="alert"> |
| 309 | {{ $t('global.form.fieldRequired') }} |
| 310 | </b-form-invalid-feedback> |
| 311 | </b-form-group> |
| 312 | </template> |
| 313 | </b-col> |
| 314 | </b-row> |
| 315 | </b-col> |
| 316 | </b-row> |
| 317 | </b-container> |
| 318 | </b-form> |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 319 | <template #footer="{ ok, cancel }"> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 320 | <b-button variant="secondary" @click="cancel()"> |
| 321 | {{ $t('global.action.cancel') }} |
| 322 | </b-button> |
| 323 | <b-button |
| 324 | form="generate-csr-form" |
| 325 | type="submit" |
| 326 | variant="primary" |
| SurenNeware | d0df7d2 | 2020-07-22 16:41:20 +0530 | [diff] [blame] | 327 | data-test-id="modalGenerateCsr-button-ok" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 328 | @click="ok()" |
| 329 | > |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 330 | {{ $t('pageCertificates.generateCsr') }} |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 331 | </b-button> |
| 332 | </template> |
| 333 | </b-modal> |
| 334 | <b-modal |
| 335 | id="csr-string" |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 336 | v-model="showCsrString" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 337 | no-stacking |
| 338 | size="lg" |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 339 | :title="$t('pageCertificates.modal.certificateSigningRequest')" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 340 | @hidden="onHiddenCsrStringModal" |
| 341 | > |
| 342 | {{ csrString }} |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 343 | <template #footer> |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 344 | <b-btn variant="secondary" @click="copyCsrString"> |
| 345 | <template v-if="csrStringCopied"> |
| 346 | <icon-checkmark /> |
| 347 | {{ $t('global.status.copied') }} |
| 348 | </template> |
| 349 | <template v-else> |
| 350 | {{ $t('global.action.copy') }} |
| 351 | </template> |
| 352 | </b-btn> |
| 353 | <a |
| Sivaprabu Ganesan | c72f1e3 | 2023-01-06 20:06:04 +0530 | [diff] [blame] | 354 | :href=" |
| 355 | `data:application/json;charset=utf-8,` + |
| 356 | encodeURIComponent(`${csrString}`) |
| 357 | " |
| 358 | download="certificate.csr" |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 359 | class="btn btn-primary" |
| 360 | > |
| 361 | {{ $t('global.action.download') }} |
| 362 | </a> |
| 363 | </template> |
| 364 | </b-modal> |
| 365 | </div> |
| 366 | </template> |
| 367 | |
| 368 | <script> |
| 369 | import IconAdd from '@carbon/icons-vue/es/add--alt/20'; |
| 370 | import IconCheckmark from '@carbon/icons-vue/es/checkmark/20'; |
| 371 | |
| Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 372 | import { required, requiredIf } from '@vuelidate/validators'; |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 373 | |
| 374 | import { COUNTRY_LIST } from './CsrCountryCodes'; |
| SurenNeware | 6185909 | 2020-10-01 09:37:32 +0530 | [diff] [blame] | 375 | import BVToastMixin from '@/components/Mixins/BVToastMixin'; |
| 376 | import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js'; |
| Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 377 | import { useVuelidate } from '@vuelidate/core'; |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 378 | import { useI18n } from 'vue-i18n'; |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 379 | |
| 380 | export default { |
| 381 | name: 'ModalGenerateCsr', |
| 382 | components: { IconAdd, IconCheckmark }, |
| 383 | mixins: [BVToastMixin, VuelidateMixin], |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 384 | props: { |
| 385 | modelValue: { |
| 386 | type: Boolean, |
| 387 | default: false, |
| 388 | }, |
| 389 | }, |
| 390 | emits: ['update:modelValue'], |
| Ed Tanous | 7d6b44c | 2024-03-23 14:56:34 -0700 | [diff] [blame] | 391 | setup() { |
| 392 | return { |
| 393 | v$: useVuelidate(), |
| 394 | }; |
| 395 | }, |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 396 | data() { |
| 397 | return { |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 398 | $t: useI18n().t, |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 399 | showCsrString: false, |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 400 | form: { |
| 401 | certificateType: null, |
| 402 | country: null, |
| 403 | state: null, |
| 404 | city: null, |
| 405 | companyName: null, |
| 406 | companyUnit: null, |
| 407 | commonName: null, |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 408 | contactPerson: null, |
| 409 | emailAddress: null, |
| 410 | alternateName: [], |
| 411 | keyPairAlgorithm: null, |
| 412 | keyCurveId: null, |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 413 | keyBitLength: null, |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 414 | }, |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 415 | countryOptions: COUNTRY_LIST.map((country) => ({ |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 416 | text: country.label, |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 417 | value: country.code, |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 418 | })), |
| 419 | keyPairAlgorithmOptions: ['EC', 'RSA'], |
| 420 | keyCurveIdOptions: ['prime256v1', 'secp521r1', 'secp384r1'], |
| 421 | keyBitLengthOptions: [2048], |
| 422 | csrString: '', |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 423 | csrStringCopied: false, |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 424 | }; |
| 425 | }, |
| Sean Zhang | 8841b7d | 2024-06-15 08:42:41 +0300 | [diff] [blame] | 426 | computed: { |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 427 | isVisible: { |
| 428 | get() { |
| 429 | return this.modelValue; |
| 430 | }, |
| 431 | set(value) { |
| 432 | this.$emit('update:modelValue', value); |
| 433 | }, |
| 434 | }, |
| Sean Zhang | 8841b7d | 2024-06-15 08:42:41 +0300 | [diff] [blame] | 435 | certificateTypes() { |
| 436 | return this.$store.getters['certificates/certificateTypes']; |
| 437 | }, |
| 438 | certificateOptions() { |
| 439 | return this.certificateTypes.reduce((arr, cert) => { |
| 440 | if (cert.type === 'TrustStore Certificate') return arr; |
| 441 | arr.push({ |
| 442 | text: cert.label, |
| 443 | value: cert.type, |
| 444 | }); |
| 445 | return arr; |
| 446 | }, []); |
| 447 | }, |
| 448 | }, |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 449 | validations: { |
| 450 | form: { |
| 451 | certificateType: { required }, |
| 452 | country: { required }, |
| 453 | state: { required }, |
| 454 | city: { required }, |
| 455 | companyName: { required }, |
| 456 | companyUnit: { required }, |
| 457 | commonName: { required }, |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 458 | contactPerson: {}, |
| 459 | emailAddress: {}, |
| 460 | alternateName: {}, |
| 461 | keyPairAlgorithm: { required }, |
| 462 | keyCurveId: { |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 463 | reuired: requiredIf(function (form) { |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 464 | return form.keyPairAlgorithm === 'EC'; |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 465 | }), |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 466 | }, |
| 467 | keyBitLength: { |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 468 | reuired: requiredIf(function (form) { |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 469 | return form.keyPairAlgorithm === 'RSA'; |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 470 | }), |
| 471 | }, |
| 472 | }, |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 473 | }, |
| 474 | methods: { |
| 475 | handleSubmit() { |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 476 | this.v$.$touch(); |
| 477 | if (this.v$.$invalid) return; |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 478 | this.$store |
| Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 479 | .dispatch('certificates/generateCsr', this.form) |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 480 | .then(({ data: { CSRString } }) => { |
| 481 | this.csrString = CSRString; |
| jason westover | d36ac8a | 2025-11-03 20:58:59 -0600 | [diff] [blame^] | 482 | this.showCsrString = true; |
| Surya V | de23ea2 | 2024-07-11 15:19:46 +0530 | [diff] [blame] | 483 | this.v$.$reset(); |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 484 | }); |
| 485 | }, |
| 486 | resetForm() { |
| 487 | for (let key of Object.keys(this.form)) { |
| 488 | if (key === 'alternateName') { |
| 489 | this.form[key] = []; |
| 490 | } else { |
| 491 | this.form[key] = null; |
| 492 | } |
| 493 | } |
| 494 | }, |
| 495 | onOkGenerateCsrModal(bvModalEvt) { |
| 496 | // prevent modal close |
| 497 | bvModalEvt.preventDefault(); |
| 498 | this.handleSubmit(); |
| 499 | }, |
| 500 | onHiddenCsrStringModal() { |
| 501 | this.csrString = ''; |
| 502 | this.resetForm(); |
| 503 | }, |
| 504 | copyCsrString(bvModalEvt) { |
| 505 | // prevent modal close |
| 506 | bvModalEvt.preventDefault(); |
| 507 | navigator.clipboard.writeText(this.csrString).then(() => { |
| 508 | // Show copied text for 5 seconds |
| 509 | this.csrStringCopied = true; |
| 510 | setTimeout(() => { |
| 511 | this.csrStringCopied = false; |
| 512 | }, 5000 /*5 seconds*/); |
| 513 | }); |
| Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 514 | }, |
| 515 | }, |
| Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 516 | }; |
| 517 | </script> |