-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SHIBUI-914 Fixed issues with providers/resolvers edit screens
- Loading branch information
Showing
22 changed files
with
200 additions
and
126 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
ui/src/app/metadata/domain/model/wizards/metadata-source-base.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { Wizard, WizardStep } from '../../../../wizard/model'; | ||
import { MetadataResolver } from '../metadata-resolver'; | ||
import { FormProperty } from 'ngx-schema-form/lib/model/formproperty'; | ||
import { ArrayProperty } from 'ngx-schema-form/lib/model/arrayproperty'; | ||
import { ObjectProperty } from 'ngx-schema-form/lib/model/objectproperty'; | ||
|
||
export class MetadataSourceBase implements Wizard<MetadataResolver> { | ||
label = 'Metadata Source'; | ||
type = '@MetadataProvider'; | ||
steps: WizardStep[] = []; | ||
|
||
bindings = { | ||
'/securityInfo/x509CertificateAvailable': [ | ||
{ | ||
'input': (event, property: FormProperty) => { | ||
let available = !property.value, | ||
parent = property.parent, | ||
certs = parent.getProperty('x509Certificates'); | ||
if (available && !certs.value.length) { | ||
certs.setValue([ | ||
{ | ||
name: '', | ||
type: 'both', | ||
value: '' | ||
} | ||
], true); | ||
} | ||
|
||
if (!available && certs.value.length > 0) { | ||
certs.setValue([], true); | ||
} | ||
} | ||
} | ||
], | ||
'/assertionConsumerServices/*/makeDefault': [ | ||
{ | ||
'input': (event, property: FormProperty) => { | ||
let parent = property.parent.parent as ArrayProperty; | ||
let props = parent.properties as ObjectProperty[]; | ||
props.forEach(prop => { | ||
if (prop !== property) { | ||
prop.setValue({ | ||
...prop.value, | ||
makeDefault: false | ||
}, false); | ||
} | ||
}); | ||
} | ||
} | ||
] | ||
}; | ||
|
||
parser(changes: Partial<MetadataResolver>, schema?: any): any { | ||
return changes; | ||
} | ||
|
||
formatter(changes: Partial<MetadataResolver>, schema?: any): any { | ||
return changes; | ||
} | ||
|
||
getValidators(entityIdList: string[]): { [key: string]: any } { | ||
const validators = { | ||
'/': (value, property, form_current) => { | ||
let errors; | ||
// iterate all customer | ||
Object.keys(value).forEach((key) => { | ||
const item = value[key]; | ||
const validatorKey = `/${key}`; | ||
const validator = validators.hasOwnProperty(validatorKey) ? validators[validatorKey] : null; | ||
const error = validator ? validator(item, { path: `/${key}` }, form_current) : null; | ||
if (error) { | ||
errors = errors || []; | ||
errors.push(error); | ||
} | ||
}); | ||
return errors; | ||
}, | ||
'/entityId': (value, property, form) => { | ||
const err = entityIdList.indexOf(value) > -1 ? { | ||
code: 'INVALID_ID', | ||
path: `#${property.path}`, | ||
message: 'message.id-unique', | ||
params: [value] | ||
} : null; | ||
return err; | ||
} | ||
}; | ||
return validators; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.