The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/importer/client/admin/adminImport.js

51 lines
1.2 KiB

import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { Importers } from '..';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { Template } from 'meteor/templating';
import { TAPi18n } from 'meteor/rocketchat:tap-i18n';
import { hasRole } from '../../../authorization';
import { t, handleError } from '../../../utils';
import { SideNav } from '../../../ui-utils/client';
Template.adminImport.helpers({
isAdmin() {
return hasRole(Meteor.userId(), 'admin');
},
getDescription(importer) {
return TAPi18n.__('Importer_From_Description', { from: importer.name });
},
importers() {
return Importers.getAll();
},
});
Template.adminImport.events({
'click .import-history'() {
FlowRouter.go('/admin/import/history');
},
'click .start-import'() {
const importer = this;
Meteor.call('setupImporter', importer.key, function(error) {
if (error) {
console.log(t('importer_setup_error'), importer.key, error);
handleError(error);
return;
}
FlowRouter.go(`/admin/import/prepare/${ importer.key }`);
});
},
});
Template.adminImport.onRendered(() => {
Tracker.afterFlush(() => {
SideNav.setFlex('adminFlex');
SideNav.openFlex();
});
});