2022-01-17 13:05:27 +03:00
|
|
|
import AdminRoute from 'ghost-admin/routes/admin';
|
2022-11-03 14:14:36 +03:00
|
|
|
import {inject} from 'ghost-admin/decorators/inject';
|
2021-10-18 15:46:29 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
|
|
|
|
2022-01-17 12:34:55 +03:00
|
|
|
export default class ZapierRoute extends AdminRoute {
|
|
|
|
@service router;
|
2022-11-03 14:14:36 +03:00
|
|
|
|
|
|
|
@inject config;
|
2021-10-18 15:46:29 +03:00
|
|
|
|
|
|
|
beforeModel() {
|
2022-01-17 12:34:55 +03:00
|
|
|
super.beforeModel(...arguments);
|
2021-10-18 15:46:29 +03:00
|
|
|
|
2022-10-07 17:24:03 +03:00
|
|
|
if (this.config.hostSettings?.limits?.customIntegrations?.disabled) {
|
2022-01-17 13:05:27 +03:00
|
|
|
return this.transitionTo('settings.integrations');
|
|
|
|
}
|
2022-01-17 12:34:55 +03:00
|
|
|
}
|
2021-10-18 15:46:29 +03:00
|
|
|
|
|
|
|
model(params, transition) {
|
|
|
|
// use the integrations controller to fetch all integrations and pick
|
|
|
|
// out the one we want. Allows navigation back to integrations screen
|
|
|
|
// without a loading state
|
|
|
|
return this
|
2021-11-05 15:42:38 +03:00
|
|
|
.controllerFor('settings.integrations')
|
2021-10-18 15:46:29 +03:00
|
|
|
.integrationModelHook('slug', 'zapier', this, transition);
|
2022-01-17 12:34:55 +03:00
|
|
|
}
|
2021-10-18 15:46:29 +03:00
|
|
|
|
2022-11-14 12:41:09 +03:00
|
|
|
resetController(controller) {
|
|
|
|
controller.regeneratedApiKey = null;
|
|
|
|
}
|
|
|
|
|
2021-10-18 15:46:29 +03:00
|
|
|
buildRouteInfoMetadata() {
|
|
|
|
return {
|
|
|
|
titleToken: 'Zapier'
|
|
|
|
};
|
|
|
|
}
|
2022-01-17 12:34:55 +03:00
|
|
|
}
|