Initial commit
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
// Backbone Models
|
||||
import ConfigModel from 'dashboard/data/config-model';
|
||||
import UserModel from 'dashboard/data/user-model';
|
||||
import OrganizationModel from 'dashboard/data/organization-model';
|
||||
import UserGroupsCollection from 'dashboard/data/user-groups-collection';
|
||||
import BackgroundPollingModel from 'dashboard/data/background-polling/dashboard-background-polling-model';
|
||||
import getCARTOData from 'new-dashboard/store/utils/getCARTOData';
|
||||
|
||||
const BackboneCoreModels = {};
|
||||
|
||||
BackboneCoreModels.install = function (Vue, options) {
|
||||
Vue.mixin({
|
||||
beforeCreate () {
|
||||
this.$cartoModels = options;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const CARTOData = getCARTOData();
|
||||
|
||||
const configModel = new ConfigModel({
|
||||
...CARTOData.config,
|
||||
base_url: CARTOData.user_data.base_url
|
||||
});
|
||||
const userModel = configureUserModel(CARTOData.user_data);
|
||||
|
||||
const backgroundPollingModel = new BackgroundPollingModel({
|
||||
showGeocodingDatasetURLButton: true,
|
||||
geocodingsPolling: true,
|
||||
importsPolling: true
|
||||
}, { configModel, userModel });
|
||||
|
||||
Vue.use(BackboneCoreModels, {
|
||||
config: configModel,
|
||||
user: userModel,
|
||||
backgroundPolling: backgroundPollingModel
|
||||
});
|
||||
|
||||
function configureUserModel (userData) {
|
||||
const userModel = new UserModel(userData);
|
||||
|
||||
if (userData.organization) {
|
||||
userModel.setOrganization(new OrganizationModel(userData.organization, { configModel }));
|
||||
}
|
||||
|
||||
if (userData.groups) {
|
||||
userModel.setGroups(new UserGroupsCollection(userData.groups, { configModel }));
|
||||
}
|
||||
|
||||
return userModel;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export default function createModalModel (handlers) {
|
||||
return {
|
||||
create: handlers.create,
|
||||
destroy: handlers.destroy
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import ForbiddenAction from 'builder/data/backbone/network-interceptors/interceptors/forbidden-403';
|
||||
import NetworkResponseInterceptor from 'builder/data/backbone/network-interceptors/interceptor';
|
||||
|
||||
NetworkResponseInterceptor.addURLPattern('api/v');
|
||||
NetworkResponseInterceptor.addErrorInterceptor(ForbiddenAction());
|
||||
NetworkResponseInterceptor.start();
|
||||
Reference in New Issue
Block a user