|
|
@@ -1,29 +1,19 @@
|
|
|
import { SupportedAction } from '~/interfaces/activity';
|
|
|
-import UserGroup from '~/server/models/user-group';
|
|
|
import loggerFactory from '~/utils/logger';
|
|
|
|
|
|
const logger = loggerFactory('growi:routes:admin');
|
|
|
-const debug = require('debug')('growi:routes:admin');
|
|
|
|
|
|
/* eslint-disable no-use-before-define */
|
|
|
module.exports = function(crowi, app) {
|
|
|
|
|
|
- const models = crowi.models;
|
|
|
- const UserGroupRelation = models.UserGroupRelation;
|
|
|
- const GlobalNotificationSetting = models.GlobalNotificationSetting;
|
|
|
-
|
|
|
const {
|
|
|
configManager,
|
|
|
- aclService,
|
|
|
- slackIntegrationService,
|
|
|
exportService,
|
|
|
} = crowi;
|
|
|
|
|
|
- const recommendedWhitelist = require('~/services/xss/recommended-whitelist');
|
|
|
const ApiResponse = require('../util/apiResponse');
|
|
|
const importer = require('../util/importer')(crowi);
|
|
|
|
|
|
- const MAX_PAGE_LIST = 50;
|
|
|
const actions = {};
|
|
|
|
|
|
const { check, param } = require('express-validator');
|
|
|
@@ -32,61 +22,6 @@ module.exports = function(crowi, app) {
|
|
|
|
|
|
const api = {};
|
|
|
|
|
|
- function createPager(total, limit, page, pagesCount, maxPageList) {
|
|
|
- const pager = {
|
|
|
- page,
|
|
|
- pagesCount,
|
|
|
- pages: [],
|
|
|
- total,
|
|
|
- previous: null,
|
|
|
- previousDots: false,
|
|
|
- next: null,
|
|
|
- nextDots: false,
|
|
|
- };
|
|
|
-
|
|
|
- if (page > 1) {
|
|
|
- pager.previous = page - 1;
|
|
|
- }
|
|
|
-
|
|
|
- if (page < pagesCount) {
|
|
|
- pager.next = page + 1;
|
|
|
- }
|
|
|
-
|
|
|
- let pagerMin = Math.max(1, Math.ceil(page - maxPageList / 2));
|
|
|
- let pagerMax = Math.min(pagesCount, Math.floor(page + maxPageList / 2));
|
|
|
- if (pagerMin === 1) {
|
|
|
- if (MAX_PAGE_LIST < pagesCount) {
|
|
|
- pagerMax = MAX_PAGE_LIST;
|
|
|
- }
|
|
|
- else {
|
|
|
- pagerMax = pagesCount;
|
|
|
- }
|
|
|
- }
|
|
|
- if (pagerMax === pagesCount) {
|
|
|
- if ((pagerMax - MAX_PAGE_LIST) < 1) {
|
|
|
- pagerMin = 1;
|
|
|
- }
|
|
|
- else {
|
|
|
- pagerMin = pagerMax - MAX_PAGE_LIST;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- pager.previousDots = null;
|
|
|
- if (pagerMin > 1) {
|
|
|
- pager.previousDots = true;
|
|
|
- }
|
|
|
-
|
|
|
- pager.nextDots = null;
|
|
|
- if (pagerMax < pagesCount) {
|
|
|
- pager.nextDots = true;
|
|
|
- }
|
|
|
-
|
|
|
- for (let i = pagerMin; i <= pagerMax; i++) {
|
|
|
- pager.pages.push(i);
|
|
|
- }
|
|
|
-
|
|
|
- return pager;
|
|
|
- }
|
|
|
|
|
|
// Importer management
|
|
|
actions.importer = {};
|