mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-06 22:19:25 +08:00
* chore: export xlsx command * chore: container service * chore: report export progress * chore: export * chore: performInsert * chore: export command * chore: base exporter * chore: limit option * chore: export * chore: export * chore: types * chore: ws socket with auth * refactor: refactor exporter, change addRows method to handleRow method to support row-by-row processing * chore: xlsx exporter * chore: base exporter * chore: export limit * chore: import action * chore: load websocket * chore: import action * chore: object to cli args * chore: import options * chore: import action * chore: import runner * chore: import action * chore: import options * chore: import options * chore: plugin load event * chore: test * chore: i18n * chore: i18n * chore: i18n * fix: ws auth status * chore: cache in data source * chore: load datasource * chore: import with field alias * fix: build * fix: test * fix: build * fix: import schema settings * fix: import action * fix: import progress * chore: template creator * fix: import error message * fix: import error message * chore: test * chore: workflow dispatch event * chore: export alias * fix: typo * chore: error render * fix: event error * chore: send message to tags * fix: test * fix: import action setting
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
/**
|
|
* This file is part of the NocoBase (R) project.
|
|
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
* Authors: NocoBase Team.
|
|
*
|
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
*/
|
|
|
|
import { Plugin } from '@nocobase/server';
|
|
import { exportXlsx } from './actions';
|
|
|
|
export class PluginActionExportServer extends Plugin {
|
|
beforeLoad() {
|
|
this.app.on('afterInstall', async () => {
|
|
if (!this.app.db.getRepository('roles')) {
|
|
return;
|
|
}
|
|
|
|
const roleNames = ['admin', 'member'];
|
|
const roles = await this.app.db.getRepository('roles').find({
|
|
filter: {
|
|
name: roleNames,
|
|
},
|
|
});
|
|
|
|
for (const role of roles) {
|
|
await this.app.db.getRepository('roles').update({
|
|
filter: {
|
|
name: role.name,
|
|
},
|
|
values: {
|
|
strategy: {
|
|
...role.strategy,
|
|
actions: [...role.strategy.actions, 'export'],
|
|
},
|
|
},
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
async load() {
|
|
this.app.dataSourceManager.afterAddDataSource((dataSource) => {
|
|
dataSource.resourceManager.registerActionHandler('export', exportXlsx);
|
|
dataSource.acl.setAvailableAction('export', {
|
|
displayName: '{{t("Export")}}',
|
|
allowConfigureFields: true,
|
|
aliases: ['export', 'exportAttachments'],
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
export default PluginActionExportServer;
|
|
|
|
export * from './services/base-exporter';
|
|
export * from './services/xlsx-exporter';
|