Revert "feat(org): expose enterprise drawing and task logs"
This reverts commit 72bec4f8f1.
This commit is contained in:
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import test from 'node:test';
|
||||
|
||||
const hook = readFileSync(
|
||||
new URL('../src/hooks/task-logs/useTaskLogsData.js', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
const columns = readFileSync(
|
||||
new URL(
|
||||
'../src/components/table/task-logs/TaskLogsColumnDefs.jsx',
|
||||
import.meta.url,
|
||||
),
|
||||
'utf8',
|
||||
);
|
||||
const actions = readFileSync(
|
||||
new URL(
|
||||
'../src/components/table/task-logs/TaskLogsActions.jsx',
|
||||
import.meta.url,
|
||||
),
|
||||
'utf8',
|
||||
);
|
||||
const filters = readFileSync(
|
||||
new URL(
|
||||
'../src/components/table/task-logs/TaskLogsFilters.jsx',
|
||||
import.meta.url,
|
||||
),
|
||||
'utf8',
|
||||
);
|
||||
const orgLogs = readFileSync(
|
||||
new URL('../src/pages/Organization/OrgLogs.jsx', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
const usageRecord = readFileSync(
|
||||
new URL('../src/pages/UserCenter/UsageRecord.jsx', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
|
||||
test('enterprise task records use the organization-scoped endpoint', () => {
|
||||
assert.match(hook, /organizationMode/);
|
||||
assert.match(hook, /`\/api\/org\/tasks\?\$\{params\.toString\(\)\}`/);
|
||||
assert.match(
|
||||
orgLogs,
|
||||
/sharedStartTimestamp=\{appliedFilters\.startTimestamp\}/,
|
||||
);
|
||||
assert.match(orgLogs, /sharedEndTimestamp=\{appliedFilters\.endTimestamp\}/);
|
||||
assert.match(orgLogs, /sharedFilterRevision=\{taskFilterRevision\}/);
|
||||
assert.match(hook, /DEFAULT_TASK_RANGE_DAYS = 7/);
|
||||
assert.match(hook, /const usesSharedDateRange/);
|
||||
assert.match(filters, /hideDateRange = false/);
|
||||
assert.match(filters, /!hideDateRange/);
|
||||
});
|
||||
|
||||
test('platform is not exposed as a task-log presentation field', () => {
|
||||
assert.doesNotMatch(columns, /COLUMN_KEYS\.PLATFORM/);
|
||||
assert.doesNotMatch(columns, /title: t\('平台'\)/);
|
||||
assert.doesNotMatch(actions, /key: 'platform'/);
|
||||
assert.doesNotMatch(actions, /title: t\('平台'\)/);
|
||||
});
|
||||
|
||||
test('task details can only be opened by the system root user', () => {
|
||||
assert.match(
|
||||
hook,
|
||||
/import \{[\s\S]*isRoot[\s\S]*\} from '\.\.\/\.\.\/helpers';/,
|
||||
);
|
||||
assert.match(hook, /const isRootUser = !organizationMode && isRoot\(\);/);
|
||||
assert.match(columns, /isRootUser = false/);
|
||||
assert.match(columns, /isRootUser\s*\?\s*\(\) => openContentModal/);
|
||||
assert.match(columns, /isRootUser\s*\?\s*'cursor-pointer/);
|
||||
});
|
||||
|
||||
test('personal usage records reuse the same platform-free task view', () => {
|
||||
assert.match(usageRecord, /<TaskLogsTable usageRecordMode \/>/);
|
||||
assert.doesNotMatch(actions, /key: 'platform'/);
|
||||
assert.match(columns, /isRootUser\s*\?\s*\(\) => openContentModal/);
|
||||
});
|
||||
Reference in New Issue
Block a user