mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
event logging
This commit is contained in:
parent
b6c676149a
commit
93ed361705
48 changed files with 861 additions and 853 deletions
|
@ -31,7 +31,6 @@ module.exports = {
|
|||
"stubUserNotification": true,
|
||||
"userLogin": true,
|
||||
"Keycloak": true,
|
||||
"Intercom": true,
|
||||
"slug": true
|
||||
}
|
||||
};
|
||||
|
|
|
@ -251,8 +251,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
meta: meta
|
||||
};
|
||||
|
||||
this.audit.record("added-section-" + section.get('contentType'));
|
||||
|
||||
const promise = this.addSection(model);
|
||||
promise.then((id) => {
|
||||
this.set('pageId', id);
|
||||
|
@ -297,8 +295,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
meta: meta
|
||||
};
|
||||
|
||||
this.audit.record("added-content-block-" + block.get('contentType'));
|
||||
|
||||
const promise = this.addSection(model);
|
||||
promise.then((id) => {
|
||||
this.set('pageId', id);
|
||||
|
|
|
@ -65,7 +65,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
});
|
||||
|
||||
this.on("addedfile", function ( /*file*/ ) {
|
||||
self.audit.record('attached-file');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -101,7 +101,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
this.attrs.onPageSequenceChange(pendingChanges);
|
||||
|
||||
this.send('onEntryClick', this.get('currentPageId'));
|
||||
this.audit.record("moved-page-up");
|
||||
this.showNotification("Moved up");
|
||||
}
|
||||
},
|
||||
|
@ -121,7 +120,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
this.attrs.onPageSequenceChange(pendingChanges);
|
||||
|
||||
this.send('onEntryClick', this.get('currentPageId'));
|
||||
this.audit.record("moved-page-down");
|
||||
this.showNotification("Moved down");
|
||||
}
|
||||
},
|
||||
|
@ -141,7 +139,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
this.attrs.onPageLevelChange(pendingChanges);
|
||||
|
||||
this.showNotification("Indent");
|
||||
this.audit.record("changed-page-sequence");
|
||||
this.send('onEntryClick', this.get('currentPageId'));
|
||||
}
|
||||
},
|
||||
|
@ -161,7 +158,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
this.attrs.onPageLevelChange(pendingChanges);
|
||||
|
||||
this.showNotification("Outdent");
|
||||
this.audit.record("changed-page-sequence");
|
||||
this.send('onEntryClick', this.get('currentPageId'));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -72,7 +72,6 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
|
|||
},
|
||||
|
||||
onPrintDocument() {
|
||||
this.audit.record('printed-document');
|
||||
$("#sidebar-zone-more-button").click();
|
||||
window.print();
|
||||
},
|
||||
|
@ -90,8 +89,6 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
|
|||
},
|
||||
|
||||
onUnpin() {
|
||||
this.audit.record('unpinned-document');
|
||||
|
||||
this.get('pinned').unpinItem(this.get('pinState.pinId')).then(() => {
|
||||
this.set('pinState.isPinned', false);
|
||||
this.set('pinState.pinId', '');
|
||||
|
@ -111,8 +108,6 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
|
|||
return false;
|
||||
}
|
||||
|
||||
this.audit.record('pinned-document');
|
||||
|
||||
this.get('pinned').pinItem(pin).then((pin) => {
|
||||
this.set('pinState.isPinned', true);
|
||||
this.set('pinState.pinId', pin.get('id'));
|
||||
|
|
|
@ -84,8 +84,6 @@ export default Ember.Component.extend({
|
|||
|
||||
this.get('onChange')(save);
|
||||
|
||||
this.audit.record('added-tag');
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -106,7 +104,6 @@ export default Ember.Component.extend({
|
|||
|
||||
this.set('tagz', tags);
|
||||
this.get('onChange')(save);
|
||||
this.audit.record('removed tag');
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
|
@ -22,7 +22,6 @@ export default Ember.Component.extend({
|
|||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.audit.record('viewed-space');
|
||||
this.set('selectedDocuments', []);
|
||||
this.set('canCreate', this.get('folderService').get('canEditCurrentFolder'));
|
||||
this.set('deleteTargets', this.get('folders').rejectBy('id', this.get('folder.id')));
|
||||
|
|
|
@ -70,8 +70,6 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, AuthMixin, {
|
|||
},
|
||||
|
||||
onUnpin() {
|
||||
this.audit.record('unpinned-space');
|
||||
|
||||
this.get('pinned').unpinItem(this.get('pinState.pinId')).then(() => {
|
||||
this.set('pinState.isPinned', false);
|
||||
this.set('pinState.pinId', '');
|
||||
|
@ -91,8 +89,6 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, AuthMixin, {
|
|||
return false;
|
||||
}
|
||||
|
||||
this.audit.record('pinned-space');
|
||||
|
||||
this.get('pinned').pinItem(pin).then((pin) => {
|
||||
this.set('pinState.isPinned', true);
|
||||
this.set('pinState.pinId', pin.get('id'));
|
||||
|
|
|
@ -95,7 +95,6 @@ export default Ember.Component.extend(NotifierMixin, {
|
|||
|
||||
this.on("addedfile", function (file) {
|
||||
self.send('onDocumentImporting', file.name);
|
||||
self.audit.record('converted-document');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -113,14 +112,12 @@ export default Ember.Component.extend(NotifierMixin, {
|
|||
},
|
||||
|
||||
editTemplate(template) {
|
||||
this.audit.record('edited-saved-template');
|
||||
this.get('router').transitionTo('document', this.get('folder.id'), this.get('folder.slug'), template.get('id'), template.get('slug'));
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
startDocument(template) {
|
||||
this.audit.record('used-saved-template');
|
||||
this.send("showNotification", "Creating");
|
||||
|
||||
this.get('templateService').importSavedTemplate(this.folder.get('id'), template.id, this.get('newDocumentName')).then((document) => {
|
||||
|
|
|
@ -80,8 +80,6 @@ export default Ember.Component.extend(TooltipMixin, {
|
|||
var sortable = Sortable.create(document.getElementById('pinned-zone'), {
|
||||
animation: 150,
|
||||
onEnd: function () {
|
||||
self.audit.record('reorganized-pins');
|
||||
|
||||
self.get('pinned').updateSequence(this.toArray()).then((pins) => {
|
||||
self.set('pins', pins);
|
||||
});
|
||||
|
@ -144,7 +142,6 @@ export default Ember.Component.extend(TooltipMixin, {
|
|||
|
||||
actions: {
|
||||
switchAccount(domain) {
|
||||
this.audit.record('switched-account');
|
||||
window.location.href = netUtil.getAppUrl(domain);
|
||||
},
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
export function initialize(application) {
|
||||
application.inject('route', 'audit', 'service:audit');
|
||||
application.inject('controller', 'audit', 'service:audit');
|
||||
application.inject('component', 'audit', 'service:audit');
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'audit',
|
||||
after: 'session',
|
||||
initialize: initialize
|
||||
};
|
|
@ -19,6 +19,5 @@ export function initialize(application) {
|
|||
export default {
|
||||
name: 'session',
|
||||
after: 'application',
|
||||
before: 'audit',
|
||||
initialize: initialize
|
||||
};
|
|
@ -36,7 +36,6 @@ export default Ember.Route.extend({
|
|||
let data = this.get('kcAuth').mapProfile(profile);
|
||||
|
||||
this.get("session").authenticate('authenticator:keycloak', data).then(() => {
|
||||
this.get('audit').record("logged-in-keycloak");
|
||||
this.transitionTo('folders');
|
||||
}, (reject) => {
|
||||
this.set('message', reject.Error);
|
||||
|
|
|
@ -15,7 +15,6 @@ import AuthProvider from '../../../mixins/auth';
|
|||
export default Ember.Controller.extend(AuthProvider, {
|
||||
appMeta: Ember.inject.service('app-meta'),
|
||||
session: Ember.inject.service('session'),
|
||||
audit: Ember.inject.service('audit'),
|
||||
invalidCredentials: false,
|
||||
|
||||
reset() {
|
||||
|
@ -35,7 +34,6 @@ export default Ember.Controller.extend(AuthProvider, {
|
|||
let creds = this.getProperties('email', 'password');
|
||||
|
||||
this.get('session').authenticate('authenticator:documize', creds).then((response) => {
|
||||
this.get('audit').record("logged-in");
|
||||
this.transitionToRoute('folders');
|
||||
return response;
|
||||
}).catch(() => {
|
||||
|
|
|
@ -17,9 +17,6 @@ export default Ember.Route.extend({
|
|||
appMeta: Ember.inject.service(),
|
||||
|
||||
activate: function () {
|
||||
this.audit.record("logged-out");
|
||||
this.audit.stop();
|
||||
|
||||
this.get('session').invalidate().then(() => {
|
||||
if (config.environment === 'test') {
|
||||
this.transitionTo('auth.login');
|
||||
|
|
|
@ -32,7 +32,6 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
|
||||
this.get('folderService').save(folder).then(() => {
|
||||
this.showNotification("Changed");
|
||||
this.audit.record('changed-folder-owner');
|
||||
});
|
||||
|
||||
this.send('onChangeOwner');
|
||||
|
|
|
@ -31,7 +31,6 @@ export default Ember.Controller.extend({
|
|||
b.set('externalSource', meta.get('externalSource'));
|
||||
|
||||
this.get('sectionService').updateBlock(b).then(function () {
|
||||
self.audit.record("edited-block");
|
||||
self.transitionToRoute('document');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
model(params) {
|
||||
let self = this;
|
||||
|
||||
this.audit.record("edited-block");
|
||||
|
||||
return Ember.RSVP.hash({
|
||||
folder: self.modelFor('document').folder,
|
||||
document: self.modelFor('document').document,
|
||||
|
|
|
@ -6,16 +6,12 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
|
||||
actions: {
|
||||
onFetchDiff(pageId, revisionId) {
|
||||
this.audit.record("compared-diff");
|
||||
|
||||
this.get('documentService').getPageRevisionDiff(this.get('model.document.id'), pageId, revisionId).then((revision) => {
|
||||
this.set('model.diff', revision);
|
||||
});
|
||||
},
|
||||
|
||||
onRollback(pageId, revisionId) {
|
||||
this.audit.record("restored-page");
|
||||
|
||||
this.get('documentService').rollbackPage(this.get('model.document.id'), pageId, revisionId).then(() => {
|
||||
this.transitionToRoute('document.index',
|
||||
this.get('model.folder.id'),
|
||||
|
|
|
@ -66,8 +66,6 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
page = up;
|
||||
this.set('pageId', page.get('id'));
|
||||
});
|
||||
|
||||
this.audit.record("edited-page");
|
||||
},
|
||||
|
||||
onPageDeleted(deletePage) {
|
||||
|
@ -81,8 +79,6 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
let pageIndex = _.indexOf(pages, page, false);
|
||||
let pendingChanges = [];
|
||||
|
||||
this.audit.record("deleted-page");
|
||||
|
||||
// select affected pages
|
||||
for (var i = pageIndex + 1; i < pages.get('length'); i++) {
|
||||
if (pages[i].get('level') <= page.get('level')) {
|
||||
|
@ -155,7 +151,6 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
onDeleteBlock(blockId) {
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
this.get('sectionService').deleteBlock(blockId).then(() => {
|
||||
this.audit.record("deleted-block");
|
||||
this.send("showNotification", "Deleted");
|
||||
resolve();
|
||||
});
|
||||
|
@ -173,7 +168,6 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
|
||||
onDocumentDelete() {
|
||||
this.get('documentService').deleteDocument(this.get('model.document.id')).then(() => {
|
||||
this.audit.record("deleted-page");
|
||||
this.send("showNotification", "Deleted");
|
||||
this.transitionToRoute('folder', this.get('model.folder.id'), this.get('model.folder.slug'));
|
||||
});
|
||||
|
|
|
@ -44,8 +44,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
},
|
||||
|
||||
model() {
|
||||
this.audit.record('viewed-document');
|
||||
|
||||
return Ember.RSVP.hash({
|
||||
folders: this.get('folders'),
|
||||
folder: this.get('folder'),
|
||||
|
|
|
@ -34,7 +34,6 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
};
|
||||
|
||||
this.get('documentService').updatePage(page.get('documentId'), page.get('id'), model).then((page) => {
|
||||
this.audit.record("edited-page");
|
||||
let data = this.get('store').normalize('page', page);
|
||||
this.get('store').push(data);
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ export default Ember.Controller.extend({
|
|||
}.observes('filter'),
|
||||
|
||||
fetch() {
|
||||
this.audit.record('searched');
|
||||
let self = this;
|
||||
|
||||
this.get('searchService').find(this.get('filter')).then(function (response) {
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import netUtil from '../utils/net';
|
||||
import config from '../config/environment';
|
||||
|
||||
const {
|
||||
inject: { service }
|
||||
} = Ember;
|
||||
|
||||
export default Ember.Service.extend({
|
||||
session: service('session'),
|
||||
appMeta: service(),
|
||||
ready: false,
|
||||
enabled: config.APP.auditEnabled,
|
||||
appId: config.APP.intercomKey,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.start();
|
||||
},
|
||||
|
||||
record(id) {
|
||||
if (!this.get('enabled') || this.get('appId').length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.get('ready')) {
|
||||
this.start();
|
||||
}
|
||||
|
||||
Intercom('trackEvent', id); //jshint ignore: line
|
||||
Intercom('update'); //jshint ignore: line
|
||||
},
|
||||
|
||||
stop() {
|
||||
if (!this.get('enabled') || this.get('appId').length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Intercom('shutdown'); //jshint ignore: line
|
||||
},
|
||||
|
||||
start() {
|
||||
let self = this;
|
||||
let user = this.get('session.user');
|
||||
|
||||
if (is.undefined(user) || this.get('appId') === "" || !this.get('enabled') || !this.get('session.authenticated') || this.get('ready')) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.set('ready', true);
|
||||
|
||||
window.intercomSettings = {
|
||||
app_id: this.get('appId'),
|
||||
name: user.get('fullname'),
|
||||
email: user.get('email'),
|
||||
user_id: user.get('id'),
|
||||
"administrator": user.get('admin'),
|
||||
company: {
|
||||
id: self.get('appMeta.orgId'),
|
||||
name: self.get('appMeta.title'),
|
||||
"domain": netUtil.getSubdomain(),
|
||||
"version": self.get('appMeta.version')
|
||||
}
|
||||
};
|
||||
|
||||
if (!this.get('session.isMobile')) {
|
||||
// uncomment these lines if you want to use Intercom messenger within Documize
|
||||
// window.intercomSettings.widget = {
|
||||
// activator: "#IntercomDefaultWidget"
|
||||
// };
|
||||
}
|
||||
|
||||
window.Intercom('boot', window.intercomSettings);
|
||||
},
|
||||
});
|
|
@ -18,7 +18,6 @@ const {
|
|||
|
||||
export default Ember.Service.extend({
|
||||
sessionService: service('session'),
|
||||
audit: service(),
|
||||
ajax: service(),
|
||||
appMeta: service(),
|
||||
keycloak: null,
|
||||
|
@ -43,7 +42,6 @@ export default Ember.Service.extend({
|
|||
// };
|
||||
|
||||
this.get('keycloak').init().success(() => {
|
||||
this.get('audit').record("initialized-keycloak");
|
||||
resolve(this.get('keycloak'));
|
||||
}).error((err) => {
|
||||
reject(err);
|
||||
|
|
|
@ -36,9 +36,6 @@ module.exports = function (environment) {
|
|||
routeIfAlreadyAuthenticated: 'folders'
|
||||
},
|
||||
APP: {
|
||||
// Allows to disable audit service in tests
|
||||
auditEnabled: true,
|
||||
intercomKey: ""
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -69,7 +66,6 @@ module.exports = function (environment) {
|
|||
ENV['ember-cli-mirage'] = {
|
||||
enabled: true
|
||||
};
|
||||
ENV.APP.auditEnabled = false;
|
||||
|
||||
ENV.apiHost = "https://localhost:5001";
|
||||
}
|
||||
|
@ -86,10 +82,6 @@ module.exports = function (environment) {
|
|||
|
||||
process.argv.forEach(function (element) {
|
||||
if (element !== undefined) {
|
||||
if (element.startsWith("intercom=")) {
|
||||
element = element.replace("intercom=", "");
|
||||
ENV.APP.intercomKey = element;
|
||||
}
|
||||
if (element.startsWith("apiHost=")) {
|
||||
element = element.replace("apiHost=", "");
|
||||
ENV.apiHost = element;
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
/*jshint node:true*/
|
||||
module.exports = {
|
||||
name: 'intercom',
|
||||
|
||||
contentFor: function (type, config) {
|
||||
// Not using Intercom for app activity logging?
|
||||
if (!config.APP.auditEnabled) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var appId = config.APP.intercomKey;
|
||||
|
||||
if ('head-footer' === type && appId.length > 0) {
|
||||
return "<script type='text/javascript'> (function() { var w = window; var ic = w.Intercom; if (typeof ic === 'function') { ic('reattach_activator'); ic('update', intercomSettings); } else { var d = document; var i = function() { i.c(arguments) }; i.q = []; i.c = function(args) { i.q.push(args) }; w.Intercom = i; function l() { var s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = 'https://widget.intercom.io/widget/${appId}'; var x = d.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); } if (w.attachEvent) { w.attachEvent('onload', l); } else { w.addEventListener('load', l, false); } } })() </script>";
|
||||
}
|
||||
},
|
||||
|
||||
isDevelopingAddon: function () {
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"name": "intercom",
|
||||
"keywords": [
|
||||
"ember-addon"
|
||||
]
|
||||
}
|
|
@ -13,7 +13,6 @@ import Mirage from 'ember-cli-mirage';
|
|||
|
||||
export default function () {
|
||||
|
||||
this.passthrough('https://widget.intercom.io/widget/%7Bapp_id%7D');
|
||||
this.urlPrefix = 'https://localhost:5001'; // make this `http://localhost:8080`, for example, if your API is on a different server
|
||||
this.namespace = 'api'; // make this `api`, for example, if your API is namespaced
|
||||
// this.timing = 400; // delay for each request, automatically set to 0 during testing
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "documize",
|
||||
"version": "1.46.2",
|
||||
"version": "1.47.0",
|
||||
"description": "The Document IDE",
|
||||
"private": true,
|
||||
"repository": "",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue