Skip to content

Commit

Permalink
Merge 026b036 into f4b06c8
Browse files Browse the repository at this point in the history
  • Loading branch information
vokimon committed Jun 26, 2023
2 parents f4b06c8 + 026b036 commit 7f4b3be
Show file tree
Hide file tree
Showing 103 changed files with 6,163 additions and 2,411 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
REACT_APP_VERSION=$npm_package_version
REACT_APP_NAME=$npm_package_name
BUILD_PATH='tomatic/ui-dist'
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
/coverage

# Translations
*.mo
Expand All @@ -69,3 +70,14 @@ drive-certificate.json

# callinfo
claim_types.txt

# editorsç
.*sw?

# dependencies
/.pnp
.pnp.js

# misc
.DS_Store
npm-debug.log*
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": false,
"singleQuote": true
}
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# Changelog

## Unreleased

- New React UI, still in progress (Mithril and React will coexist for a while)
- New persons editor
- List based view that allows comparing values
- Also sorting, filtering...
- Groups assignment are editable
- Turn loads are editable
- Upgrade notes:
- New frontend dependencies, npm install required
- Frontend development flow has changed, see docs
- Ideal loads are now kept in persons.yaml

## Unreleased

Expand Down
112 changes: 54 additions & 58 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,66 +3,65 @@
## Backlog

- [ ] Initial setup
- [ ] Option --fake is not working in debug mode since FastAPI migration.
Because of that tomatic.pbx.pbxirontec.Irontec.BackendError unless you have it configured
Why? uvicorn creates a new app instance and commandline pbx queue configuration is loss.
Workaround: configure tomatic.pbx="fake" in dbconfig.
Future Solution: Using env vars to communicate command line and the app instance?
- [ ] default for callinfoPath as callinfo
- [ ] execution requires a holidays.conf (now it is not needed)
- [ ] graelles dir does not exist, uploading timetable fails
- [ ] When planner generates timetable, some filed are passed by the API but fails if they don't exist
- [ ] oneshot.conf
- [ ] indisponibilitats.conf
- [ ] indisponibilitats-vacances.conf
- [ ] holidays.conf
- [ ] Option --fake is not working in debug mode since FastAPI migration.
Because of that tomatic.pbx.pbxirontec.Irontec.BackendError unless you have it configured
Why? uvicorn creates a new app instance and commandline pbx queue configuration is loss.
Workaround: configure tomatic.pbx="fake" in dbconfig.
Future Solution: Using env vars to communicate command line and the app instance?
- [ ] default for callinfoPath as callinfo
- [ ] execution requires a holidays.conf (now it is not needed)
- [ ] graelles dir does not exist, uploading timetable fails
- [ ] When planner generates timetable, some filed are passed by the API but fails if they don't exist
- [ ] oneshot.conf
- [ ] indisponibilitats.conf
- [ ] indisponibilitats-vacances.conf
- [ ] holidays.conf
- [ ] Remove config.yaml from git (backup the file to use it in production)
- [ ] Remove extensions for Inalàmbric / Recepcio / Contestador
- [ ] Configurable timetable directory ('graelles')
- [ ] Configurable execution directory ('executions')
- [ ] Move shiftload generated files to a configurable dir (maybe same as timetables dir?)
- [ ] callinfo: As an agent i want to be able to see cancelled contracts in callinfo (pe. for claims of unauthorized switching)
- [ ] Google login
- [x] callinfo: As an agent i want to be able to see cancelled contracts in callinfo (pe. for claims of unauthorized switching)
- [x] Google login
- [ ] API tests in fastapi
- [ ] Accept fragile erp tests
- [ ] GSpread docs say that moving the credential to `~/.config/gspread/service_account.json` avoids having to pass it around as parameter
- [ ] `tomatic_calls` should use persons module instead referring persons.yaml directly

- Planner:
- [ ] Refactor as Single Page App
- [ ] Style it
- [ ] Show cutting reasons of best solutions
- [ ] Show cost sources when hovering the cost
- [ ] Ask before deleting, killing, uploading...
- [ ] Refactor as Single Page App
- [ ] Style it
- [ ] Show cutting reasons of best solutions
- [ ] Show cost sources when hovering the cost
- [ ] Ask before deleting, killing, uploading...
- Scheduler:
- [ ] Like we did with callinfo, review files loaded and dumped to rationalize it
- [ ] Like we did with callinfo, review files loaded and dumped to rationalize it
- Person editor:
- [ ] Disable ok until all fields are valid
- [ ] Check extension not taken already
- [ ] Check erp user exists
- [ ] Take person info from holidays manager
- [ ] List/admin mode
- [ ] Disable ok until all fields are valid
- [ ] Check extension not taken already
- [ ] Check erp user exists
- [ ] Take person info from holidays manager
- [ ] List/admin mode
- Callinfo
- [ ] Edit previous annotations
- [ ] /api/info/ringring -> api/call/ringring (ext) (caution: used by partners)
- [ ] /api/personlog/<ext> en els casos de fallada returnar una llista buida sense errors (no son de fallada, encara no hi ha logs i prou)
- [ ] /api/personlog/{ext} -> api/call/log/{user}
- [ ] /api/call/categories/update -> called by cron or init
- [ ] Ask AiS: All cases set to state=done but the unsolved state=open, is ok?
- [ ] Check: are we translating CONSULTA to HELPDESK when saving cases
- [ ] Call Info: Report diferently, search cleared from no search found
- [ ] Special search results (too many, not found, error...) meaningfull (ie, "empty" means searching, while {} means not found)
- [ ] Call Info: Intercept backend connection errors and behave
- [ ] Call info: List previous calls from same person/contract
- [ ] New alert: Unpaid invoices
- [ ] join cases with call log (consider performance and usage)
- [ ] create crm: extract seccio del reason and remove the field
- [ ] create crm: test cas contracte no existeix
- [ ] callreg: Rename Claims to reflect its repurposing
- [ ] callreg: On failing annotation, ui notifies the user
- [ ] Urlencoding the search does not work (search something with slash, commas...)
- [ ] Manual annotations with some search renders "Registre..." in the call list

- [ ] Edit previous annotations
- [ ] /api/info/ringring -> api/call/ringring (ext) (caution: used by partners)
- [ ] /api/personlog/<ext> en els casos de fallada returnar una llista buida sense errors (no son de fallada, encara no hi ha logs i prou)
- [ ] /api/personlog/{ext} -> api/call/log/{user}
- [ ] /api/call/categories/update -> called by cron or init
- [ ] Ask AiS: All cases set to state=done but the unsolved state=open, is ok?
- [ ] Check: are we translating CONSULTA to HELPDESK when saving cases
- [ ] Call Info: Report diferently, search cleared from no search found
- [ ] Special search results (too many, not found, error...) meaningfull (ie, "empty" means searching, while {} means not found)
- [ ] Call Info: Intercept backend connection errors and behave
- [ ] Call info: List previous calls from same person/contract
- [ ] New alert: Unpaid invoices
- [ ] join cases with call log (consider performance and usage)
- [ ] create crm: extract seccio del reason and remove the field
- [ ] create crm: test cas contracte no existeix
- [ ] callreg: Rename Claims to reflect its repurposing
- [ ] callreg: On failing annotation, ui notifies the user
- [ ] Urlencoding the search does not work (search something with slash, commas...)
- [ ] Manual annotations with some search renders "Registre..." in the call list

## Dones

Expand Down Expand Up @@ -96,7 +95,7 @@
- [x] Fix: Person color picker sliders are not valued with the initial color
- [x] persons interface: api uses persons
- [x] persons interface: persons() set attributes with ns() if not found
- [x] persons interface: persons.update(person, **kwds)
- [x] persons interface: persons.update(person, \*\*kwds)
- [x] persons interface: tomatic_says use persons
- [x] persons interface: scheduler use persons
- [x] persons interface: shiftload uses persons
Expand Down Expand Up @@ -130,10 +129,10 @@
- [x] Detecting user changed by other tab or cookie timeout
- [x] Call Registry: Codi titular -> Persona atesa
- [x] Change websocket lib to enable sharing http port and debug mode
- [x] Fast api spike
- [x] Migrate main api
- [x] Migrate sockets
- [x] Migrate planner api
- [x] Fast api spike
- [x] Migrate main api
- [x] Migrate sockets
- [x] Migrate planner api
- [x] Fix: annotations save date with miliseconds and duplicates existing entries
- [x] Menu for planner and scripts
- [x] As an agent i want to annotate about a partner having no contracts
Expand All @@ -148,10 +147,10 @@

- [x] Create Claim case
- [x] One endpoint for call registry in API
- [x] joining updatelog, infoCase and atrCase
- [x] api/updatelog/{user} -> api/call/annotation (joined)
- [x] api/infoCase -> api/call/annotation (joined)
- [x] api/atrCase -> api/call/annotation (joined)
- [x] joining updatelog, infoCase and atrCase
- [x] api/updatelog/{user} -> api/call/annotation (joined)
- [x] api/infoCase -> api/call/annotation (joined)
- [x] api/atrCase -> api/call/annotation (joined)
- [x] One method for call registry in CallRegistry
- [x] Bug: Antotacions UI: Radio button no resolt + tenia rao > no tenia rao
- [x] create crm: cas amb tot
Expand All @@ -163,6 +162,3 @@
- [x] empty kalinfo.crmcase and remove
- [x] Claims.get_claims -> claimCategories()
- [x] callinfo log: do not dump cups



94 changes: 56 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,77 @@
{
"name": "somenergia-tomatic",
"version": "4.13.1",
"description": "Phone Support helper",
"main": "index.js",
"description": "Phone Support Companion",
"dependencies": {
"@emotion/css": "^11.10.6",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@mui/icons-material": "^5.11.9",
"@mui/material": "^5.11.10",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"js-yaml": "^4.1.0",
"js-yaml-loader": "^1.2.2",
"mithril": "^2.2.2",
"mmsvg": "^1.5.3",
"mui-color-input": "^1.0.5",
"polythene-mithril": "^1.7.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "^5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "webpack --progress --watch --mode development",
"deploy": "webpack --progress --mode production",
"build": "webpack --progress --mode development",
"server": "webpack-dev-server",
"test": "echo \"Error: no test specified\" && exit 1"
"start": "BUILD_PATH=tomatic/dist BROWSER=none react-app-rewired --openssl-legacy-provider start",
"build": "BUILD_PATH=tomatic/dist react-app-rewired --openssl-legacy-provider build",
"test": "BUILD_PATH=tomatic/dist react-app-rewired test",
"eject": "react-scripts eject"
},
"config-overrides-path": "tomatic/ui/config-overrides.js",
"repository": {
"type": "git",
"url": "git+https://github.com/Som-Energia/somenergia-tomatic.git"
},
"keywords": [
"phone",
"asterisk",
"scheduling"
"scheduling",
"crm"
],
"author": "David García Garzón",
"license": "AGPL-3.0+",
"author": "Som Energia SCCL",
"license": "AGPL-3.0-or-later",
"bugs": {
"url": "https://github.com/Som-Energia/somenergia-tomatic/issues"
},
"homepage": "https://github.com/Som-Energia/somenergia-tomatic#readme",
"dependencies": {
"js-yaml": "^3.14.1",
"mithril": "^2.0.4",
"polythene-core": "^1.7.5",
"polythene-css": "^1.7.2",
"polythene-mithril": "^1.7.2",
"polythene-utilities": "^1.7.5",
"webpack-roboto": "^1.0.0"
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/core": "^7.18.9",
"@emotion/css": "^11.9.0",
"@emotion/babel-plugin": "^11.9.2",
"babel-core": "^6.26.3",
"babel-loader": "^8.2.5",
"browserslist": "^4.21.2",
"buffer": "^6.0.3",
"clean-webpack-plugin": "^0.1.16",
"css-loader": "^6.5.1",
"html-webpack-plugin": "^5.5.0",
"mini-css-extract-plugin": "^2.5.2",
"mmsvg": "^1.5.3",
"postcss": "^8.4.14",
"style-loader": "^3.3.1",
"stylus": "^0.54.5",
"mini-css-extract-plugin": "^2.7.5",
"prettier": "^2.8.4",
"react-app-rewire-multiple-entry": "^2.2.3",
"react-app-rewire-stylus-modules": "^0.0.2",
"react-app-rewire-yaml": "^1.1.0",
"react-app-rewired": "^2.2.1",
"react-router-dom": "^6.8.2",
"stylus-loader": "^7.1.0",
"webpack": "^5.66.0",
"webpack-bundle-analyzer": "^4.4.2",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.7.3"
"webpack-cli": "^5.0.1",
"yaml-loader": "^0.8.0"
}
}
7 changes: 7 additions & 0 deletions scripts/compile-icons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Requires convert from imagemagik and inkscape

convert -density 300 -define icon:auto-resize=256,128,96,64,48,32,16 -background none tomatic/ui/public/tomatic-logo.svg tomatic/ui/public/tomatic-logo.ico
inkscape -C tomatic/ui/public/tomatic-logo.svg --export-filename=tomatic/ui/public/tomatic-logo.png -h 512 -w 512
inkscape -C tomatic/ui/public/tomatic-logo.svg --export-filename=tomatic/ui/public/tomatic-logo-24.png -h 24 -w 24
12 changes: 12 additions & 0 deletions tomatic/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
RedirectResponse,
)
from starlette.middleware.sessions import SessionMiddleware
from fastapi.middleware.cors import CORSMiddleware
import asyncio
import re
import os
Expand Down Expand Up @@ -76,6 +77,13 @@ def thisweek():

app = FastAPI()
app.add_middleware(SessionMiddleware, secret_key="Hola, Supers!")
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(Planner, prefix='/api/planner')
app.include_router(Auth, prefix='/api/auth')

Expand Down Expand Up @@ -152,6 +160,10 @@ def sender(message):
def tomatic(request: Request, file=None):
return FileResponse(distpath / (file or 'index.html'))

@app.get('/static/{dir}/{file}')
def tomatic(request: Request, file=None, dir=None):
return FileResponse(distpath / 'static' / dir / (file or 'index.html'))

@app.get('/api/version')
@yamlerrors
def apiVersion():
Expand Down
Loading

0 comments on commit 7f4b3be

Please sign in to comment.