Refactor CI workflow and enhance AdminBanSystem component

- Updated CI workflow to use 'dev' branch instead of 'develop' and renamed job from 'lint-and-typecheck' to 'lint-and-build'.
- Simplified linting and type checking steps in the CI process.
- Refactored switch cases in AdminBanSystem component for better readability and structure, ensuring consistent handling of API calls for various tabs.
This commit is contained in:
PEDZEO
2026-01-16 21:05:39 +03:00
parent 5de8a2e576
commit fd68d3ec7c
2 changed files with 27 additions and 46 deletions

View File

@@ -2,12 +2,12 @@ name: CI
on:
push:
branches: [main, develop]
branches: [main, dev]
pull_request:
branches: [main, develop]
branches: [main, dev]
jobs:
lint-and-typecheck:
lint-and-build:
runs-on: ubuntu-latest
steps:
@@ -24,39 +24,10 @@ jobs:
run: npm ci
- name: Run ESLint
run: npm run lint -- --max-warnings 50
run: npm run lint
- name: Type check
run: npm run type-check
- name: Run TypeScript check
run: npx tsc --noEmit
build:
runs-on: ubuntu-latest
needs: lint-and-typecheck
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build application
- name: Build
run: npm run build
env:
VITE_API_URL: /api
VITE_TELEGRAM_BOT_USERNAME: test_bot
VITE_APP_NAME: Cabinet
VITE_APP_LOGO: V
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 7

View File

@@ -183,47 +183,57 @@ export default function AdminBanSystem() {
setError(null)
switch (tab) {
case 'dashboard':
case 'dashboard': {
const statsData = await banSystemApi.getStats()
setStats(statsData)
break
case 'users':
}
case 'users': {
const usersData = await banSystemApi.getUsers({ limit: 50 })
setUsers(usersData)
break
case 'punishments':
}
case 'punishments': {
const punishmentsData = await banSystemApi.getPunishments()
setPunishments(punishmentsData)
break
case 'nodes':
}
case 'nodes': {
const nodesData = await banSystemApi.getNodes()
setNodes(nodesData)
break
case 'agents':
}
case 'agents': {
const agentsData = await banSystemApi.getAgents()
setAgents(agentsData)
break
case 'violations':
}
case 'violations': {
const violationsData = await banSystemApi.getTrafficViolations()
setViolations(violationsData)
break
case 'settings':
}
case 'settings': {
const settingsData = await banSystemApi.getSettings()
setSettings(settingsData)
break
case 'traffic':
}
case 'traffic': {
const trafficData = await banSystemApi.getTraffic()
setTraffic(trafficData)
break
case 'reports':
}
case 'reports': {
const reportData = await banSystemApi.getReport(reportHours)
setReport(reportData)
break
case 'health':
}
case 'health': {
const healthData = await banSystemApi.getHealth()
setHealth(healthData)
break
}
}
} catch {
setError(t('banSystem.loadError'))
} finally {