|
15 | 15 | import SealInputPassword from '@/components/seal-form/components/seal-input-password.vue';
|
16 | 16 | import SealInput from '@/components/seal-form/components/seal-input.vue';
|
17 | 17 | import SealSwitch from '@/components/seal-form/components/seal-switch.vue';
|
| 18 | + import ModuleWrapper from '@/components/module-wrapper/index.vue'; |
18 | 19 | import {
|
19 | 20 | GlobalNamespace,
|
20 | 21 | createSubjectProvider,
|
|
55 | 56 | const { t } = i18n.global;
|
56 | 57 | const submitLoading = ref(false);
|
57 | 58 | const formref = ref();
|
| 59 | + const showAdavanced = ref(false); |
| 60 | + const configOptions = ref([]); |
58 | 61 | const formData = ref<FormData>({
|
59 | 62 | apiVersion,
|
60 | 63 | kind: ResourceKinds.SubjectProvider,
|
|
202 | 205 | );
|
203 | 206 | };
|
204 | 207 |
|
205 |
| - const renderProviderConfig = () => { |
206 |
| - const configList = |
207 |
| - ProviderSpecConfig[formData.value.spec.type || 'GitHub']; |
208 |
| - return _.map(configList, (item, index) => { |
| 208 | + const renderOptions = (options) => { |
| 209 | + if (!options || options.length === 0) { |
| 210 | + return null; |
| 211 | + } |
| 212 | + return _.map(options, (item, index) => { |
209 | 213 | let Component: any = null;
|
210 | 214 | if (item.type === FieldType.boolean) {
|
211 | 215 | Component = SealSwitch;
|
|
266 | 270 | );
|
267 | 271 | });
|
268 | 272 | };
|
| 273 | + const renderAdvancedOptions = () => { |
| 274 | + const advancedOptions = _.filter(configOptions.value, (item) => { |
| 275 | + return item.key === 'AdvancedOptions'; |
| 276 | + }); |
| 277 | + return ( |
| 278 | + <> |
| 279 | + {advancedOptions.length > 0 && ( |
| 280 | + <div title="Advanced Options"> |
| 281 | + <a-button |
| 282 | + class="size-14" |
| 283 | + type="text" |
| 284 | + style={{ |
| 285 | + padding: '0 2px', |
| 286 | + marginBottom: '12px', |
| 287 | + fontSize: 'var(--font-size-large)' |
| 288 | + }} |
| 289 | + onClick={() => { |
| 290 | + showAdavanced.value = !showAdavanced.value; |
| 291 | + }} |
| 292 | + v-slots={{ |
| 293 | + icon: () => { |
| 294 | + return <icon-settings />; |
| 295 | + } |
| 296 | + }} |
| 297 | + > |
| 298 | + Advanced Options |
| 299 | + </a-button> |
| 300 | + {showAdavanced.value && |
| 301 | + renderOptions(advancedOptions?.[0]?.options)} |
| 302 | + </div> |
| 303 | + )} |
| 304 | + </> |
| 305 | + ); |
| 306 | + }; |
| 307 | + const renderProviderConfig = () => { |
| 308 | + configOptions.value = |
| 309 | + ProviderSpecConfig[formData.value.spec.type || 'GitHub']; |
| 310 | + const basicOptions = _.filter(configOptions.value, (item) => { |
| 311 | + return item.key !== 'AdvancedOptions'; |
| 312 | + }); |
| 313 | +
|
| 314 | + return <>{renderOptions(basicOptions)}</>; |
| 315 | + }; |
269 | 316 | return () => (
|
270 | 317 | <a-modal
|
271 | 318 | top="5%"
|
|
389 | 436 | </seal-select>
|
390 | 437 | </a-form-item>
|
391 | 438 | {renderProviderConfig()}
|
| 439 | + {renderAdvancedOptions()} |
392 | 440 | <a-form-item label={t('common.table.description')} hide-label>
|
393 | 441 | <seal-textarea
|
394 | 442 | v-model={formData.value.spec.description}
|
|
0 commit comments