open-vault/ui/app/models/auth-config/github.js

30 lines
703 B
JavaScript
Raw Normal View History

import { computed } from '@ember/object';
2018-04-03 14:16:57 +00:00
import DS from 'ember-data';
import AuthConfig from '../auth-config';
import fieldToAttrs from 'vault/utils/field-to-attrs';
2019-02-14 18:52:34 +00:00
import { combineFieldGroups } from 'vault/utils/openapi-to-attrs';
2018-04-03 14:16:57 +00:00
const { attr } = DS;
export default AuthConfig.extend({
2019-02-14 18:52:34 +00:00
useOpenAPI: true,
2018-04-03 14:16:57 +00:00
organization: attr('string'),
baseUrl: attr('string', {
label: 'Base URL',
}),
fieldGroups: computed(function() {
2019-02-14 18:52:34 +00:00
let groups = [
2018-04-03 14:16:57 +00:00
{ default: ['organization'] },
{
'GitHub Options': ['baseUrl'],
},
];
2019-02-14 18:52:34 +00:00
if (this.newFields) {
groups = combineFieldGroups(groups, this.newFields, []);
}
2018-04-03 14:16:57 +00:00
return fieldToAttrs(this, groups);
}),
});