Ghost/ghost/admin/app/models/integration.js
Kevin Ansfield 5047b9f3d7 Added initial custom integrations UI (#1051)
refs https://github.com/TryGhost/Ghost/issues/9865, https://github.com/TryGhost/Ghost/issues/9942

- `integration`, `api-key`, and `webhook` models and respective mirage mocks
- moves integration routes around to match ember's concept of nested routes (nested routes reflect nested UI not nested URLs)
- adds custom integrations list to integrations screen
- adds custom integration screen
  - allow editing of integration details
  - show list of webhooks
  - webhook creation modal

NB: the `enableDeveloperExperiments` flag needs to be enabled in the `config.development.json` file for the custom integrations UI to be displayed until it's out of development.
2018-10-18 00:18:29 +01:00

36 lines
989 B
JavaScript

import Model from 'ember-data/model';
import ValidationEngine from 'ghost-admin/mixins/validation-engine';
import attr from 'ember-data/attr';
import {computed} from '@ember/object';
import {hasMany} from 'ember-data/relationships';
export default Model.extend(ValidationEngine, {
validationType: 'integration',
name: attr('string'),
slug: attr('string'),
iconImage: attr('string'),
description: attr('string'),
createdAtUTC: attr('moment-utc'),
createdBy: attr('number'),
updatedAtUTC: attr('moment-utc'),
updatedBy: attr('number'),
apiKeys: hasMany('api-key', {
embedded: 'always',
async: false
}),
webhooks: hasMany('webhook', {
embedded: 'always',
async: false
}),
adminKey: computed('apiKeys.[]', function () {
return this.apiKeys.findBy('type', 'admin');
}),
contentKey: computed('apiKeys.[]', function () {
return this.apiKeys.findBy('type', 'content');
})
});