fehlerkategorie + fehlerursachekategorie finished

This commit is contained in:
darthsandmann 2017-01-17 18:59:39 +01:00
parent 00ecaf25c6
commit 9f156a8d63
23 changed files with 389 additions and 29 deletions

View File

@ -3,13 +3,25 @@
import json import json
import cherrypy import cherrypy
#from .database import SourceDatabase_cl, EvaluatedDatabase_cl from .database import KatfehlerDatabase_cl, KatursacheDatabase_cl, FehlerDatabase_cl
# Method-Dispatching! # Method-Dispatching!
# Übersicht Anforderungen / Methoden # Übersicht Anforderungen / Methoden
# (beachte: / relativ zu /navigation, siehe Konfiguration Server!) # (beachte: / relativ zu /navigation, siehe Konfiguration Server!)
#-------------------------------------------------------
def adjustId_p(id_spl, data_opl):
#-------------------------------------------------------
if id_spl == None:
data_opl['id'] = ''
elif id_spl == '':
data_opl['id'] = ''
elif id_spl == '0':
data_opl['id'] = ''
else:
data_opl['id'] = id_spl
return data_opl
""" """
Anforderung GET PUT POST DELETE Anforderung GET PUT POST DELETE
@ -30,27 +42,87 @@ class KatFehler_cl(object):
#------------------------------------------------------- #-------------------------------------------------------
def __init__(self): def __init__(self):
#------------------------------------------------------- #-------------------------------------------------------
pass self.db_o = KatfehlerDatabase_cl()
#------------------------------------------------------- #-------------------------------------------------------
def GET(self): def GET(self, id = None):
#------------------------------------------------------- #-------------------------------------------------------
return json.dumps(retVal_o) retVal_o = {
'data': None
}
if id == None:
# Anforderung der Liste
retVal_o['data'] = self.db_o.read_px()
else:
# Anforderung eines Dokuments
data_o = self.db_o.read_px(id)
if data_o != None:
retVal_o['data'] = adjustId_p(id, data_o)
return retVal_o
#------------------------------------------------------- #-------------------------------------------------------
def PUT(self): def PUT(self, data_opl):
#------------------------------------------------------- #-------------------------------------------------------
return json.dumps(retVal_o) # Sichern der Daten: jetzt wird keine vollständige Seite
# zurückgeliefert, sondern nur noch die Information, ob das
# Speichern erfolgreich war
retVal_o = {
'id': None
}
# data_opl: Dictionary mit den gelieferten key-value-Paaren
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
id_s = data_opl["id_s"]
data_o = {
'name': data_opl["name_s"],
'id': data_opl["id_s"]
}
# Update-Operation
retVal_o['id'] = id_s
if self.db_o.update_px(id_s, data_o):
pass
else:
retVal_o['id'] = None
return retVal_o
#------------------------------------------------------- #-------------------------------------------------------
def POST(self): def POST(self, data_opl):
#------------------------------------------------------- #-------------------------------------------------------
return json.dumps(retVal_o) retVal_o = {
'id': None
}
# data_opl: Dictionary mit den gelieferten key-value-Paaren
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
data_o = {
'name': data_opl["name_s"]
}
# Create-Operation
id_s = self.db_o.create_px(data_o)
retVal_o['id'] = id_s
return retVal_o
#------------------------------------------------------- #-------------------------------------------------------
def DELETE(self): def DELETE(self, id):
#------------------------------------------------------- #-------------------------------------------------------
return json.dumps(retVal_o) # Eintrag löschen, nur noch Rückmeldung liefern
retVal_o = {
'id': id
}
if self.db_o.delete_px(id):
pass
else:
retVal_o['id'] = None
return retVal_o
@ -73,27 +145,87 @@ class KatUrsache_cl(object):
#------------------------------------------------------- #-------------------------------------------------------
def __init__(self): def __init__(self):
#------------------------------------------------------- #-------------------------------------------------------
pass self.db_o = KatursacheDatabase_cl()
#------------------------------------------------------- #-------------------------------------------------------
def GET(self): def GET(self, id = None):
#------------------------------------------------------- #-------------------------------------------------------
return json.dumps(retVal_o) retVal_o = {
'data': None
}
if id == None:
# Anforderung der Liste
retVal_o['data'] = self.db_o.read_px()
else:
# Anforderung eines Dokuments
data_o = self.db_o.read_px(id)
if data_o != None:
retVal_o['data'] = adjustId_p(id, data_o)
return retVal_o
#------------------------------------------------------- #-------------------------------------------------------
def PUT(self): def PUT(self, data_opl):
#------------------------------------------------------- #-------------------------------------------------------
return json.dumps(retVal_o) # Sichern der Daten: jetzt wird keine vollständige Seite
# zurückgeliefert, sondern nur noch die Information, ob das
# Speichern erfolgreich war
retVal_o = {
'id': None
}
# data_opl: Dictionary mit den gelieferten key-value-Paaren
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
id_s = data_opl["id_s"]
data_o = {
'name': data_opl["name_s"],
'id': data_opl["id_s"]
}
# Update-Operation
retVal_o['id'] = id_s
if self.db_o.update_px(id_s, data_o):
pass
else:
retVal_o['id'] = None
return retVal_o
#------------------------------------------------------- #-------------------------------------------------------
def POST(self): def POST(self, data_opl):
#------------------------------------------------------- #-------------------------------------------------------
return json.dumps(retVal_o) retVal_o = {
'id': None
}
# data_opl: Dictionary mit den gelieferten key-value-Paaren
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
data_o = {
'name': data_opl["name_s"]
}
# Create-Operation
id_s = self.db_o.create_px(data_o)
retVal_o['id'] = id_s
return retVal_o
#------------------------------------------------------- #-------------------------------------------------------
def DELETE(self): def DELETE(self, id):
#------------------------------------------------------- #-------------------------------------------------------
return json.dumps(retVal_o) # Eintrag löschen, nur noch Rückmeldung liefern
retVal_o = {
'id': id
}
if self.db_o.delete_px(id):
pass
else:
retVal_o['id'] = None
return retVal_o
@ -119,22 +251,87 @@ class Fehler_cl(object):
#------------------------------------------------------- #-------------------------------------------------------
def __init__(self): def __init__(self):
#------------------------------------------------------- #-------------------------------------------------------
pass self.db_o = FehlerDatabase_cl()
#------------------------------------------------------- #-------------------------------------------------------
def GET(self): def GET(self, id = None):
#------------------------------------------------------- #-------------------------------------------------------
return json.dumps(retVal_o) retVal_o = {
'data': None
}
if id == None:
# Anforderung der Liste
retVal_o['data'] = self.db_o.read_px()
else:
# Anforderung eines Dokuments
data_o = self.db_o.read_px(id)
if data_o != None:
retVal_o['data'] = adjustId_p(id, data_o)
return retVal_o
#------------------------------------------------------- #-------------------------------------------------------
def PUT(self): def PUT(self, data_opl):
#------------------------------------------------------- #-------------------------------------------------------
return json.dumps(retVal_o) # Sichern der Daten: jetzt wird keine vollständige Seite
# zurückgeliefert, sondern nur noch die Information, ob das
# Speichern erfolgreich war
retVal_o = {
'id': None
}
# data_opl: Dictionary mit den gelieferten key-value-Paaren
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
id_s = data_opl["id_s"]
data_o = {
'name': data_opl["name_s"],
'id': data_opl["id_s"]
}
# Update-Operation
retVal_o['id'] = id_s
if self.db_o.update_px(id_s, data_o):
pass
else:
retVal_o['id'] = None
return retVal_o
#------------------------------------------------------- #-------------------------------------------------------
def POST(self): def POST(self, data_opl):
#------------------------------------------------------- #-------------------------------------------------------
return json.dumps(retVal_o) retVal_o = {
'id': None
}
# data_opl: Dictionary mit den gelieferten key-value-Paaren
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
data_o = {
'name': data_opl["name_s"]
}
# Create-Operation
id_s = self.db_o.create_px(data_o)
retVal_o['id'] = id_s
return retVal_o
#-------------------------------------------------------
def DELETE(self, id):
#-------------------------------------------------------
# Eintrag löschen, nur noch Rückmeldung liefern
retVal_o = {
'id': id
}
if self.db_o.delete_px(id):
pass
else:
retVal_o['id'] = None
return retVal_o
# EOF # EOF

View File

@ -38,7 +38,8 @@ class Navigation_cl(object):
{'action': 'komponente' , 'text': 'Pflege Komponenten'}, {'action': 'komponente' , 'text': 'Pflege Komponenten'},
{'action': 'qsmitarbeiter' , 'text': 'Pflege Daten QS-Mitarbeiter'}, {'action': 'qsmitarbeiter' , 'text': 'Pflege Daten QS-Mitarbeiter'},
{'action': 'swentwickler' , 'text': 'Pflege Daten SW-Entwickler'}, {'action': 'swentwickler' , 'text': 'Pflege Daten SW-Entwickler'},
{'action': 'kategorien' , 'text': 'Pflege Kategorien'}, {'action': 'katfehler' , 'text': 'Pflege Fehler-Kategorien'},
{'action': 'katursache' , 'text': 'Pflege Fehlerursachen-Kategorien'},
{'action': 'prolist' , 'text': 'Auswertung Projekte/Fehler'}, {'action': 'prolist' , 'text': 'Auswertung Projekte/Fehler'},
{'action': 'catlist' , 'text': 'Auswertung Kategorien/Fehler'} {'action': 'catlist' , 'text': 'Auswertung Kategorien/Fehler'}
] ]

View File

@ -0,0 +1,4 @@
{
"name": "Fehlerkategorie1",
"id": "1"
}

View File

@ -0,0 +1,4 @@
{
"name": "Fehlerkategorie2",
"id": "2"
}

View File

@ -0,0 +1,4 @@
{
"name": "Fehlerkategorie3",
"id": "3"
}

View File

@ -0,0 +1,4 @@
{
"name": "Fehlerkategorie5",
"id": "5"
}

View File

@ -0,0 +1,4 @@
{
"name": "Fehlerkategorie6",
"id": "6"
}

View File

@ -1 +1 @@
0 6

View File

@ -0,0 +1,4 @@
{
"name": "Fehlerursachekategorie1",
"id": "1"
}

View File

@ -0,0 +1,4 @@
{
"name": "Fehlerursachekategorie2",
"id": "2"
}

View File

@ -0,0 +1,4 @@
{
"name": "Fehlerursachekategorie3",
"id": "3"
}

View File

@ -0,0 +1,4 @@
{
"name": "Fehlerursachekategorie4",
"id": "4"
}

View File

@ -0,0 +1,4 @@
{
"name": "Fehlerursachekategorie6",
"id": "6"
}

View File

@ -0,0 +1,4 @@
{
"name": "Fehlerursachekategorie7",
"id": "7"
}

View File

@ -1 +1 @@
0 7

View File

@ -33,6 +33,12 @@ APP.Application_cl = class {
this.listSwEntwickler_o = new APP.ListView_cl('swentwickler', '/swentwickler/', 'swentwicklerlist.tpl'); this.listSwEntwickler_o = new APP.ListView_cl('swentwickler', '/swentwickler/', 'swentwicklerlist.tpl');
this.detailSwEntwickler_o = new APP.DetailView_cl('swentwickler', '/swentwickler/', 'swentwicklerdetail.tpl'); this.detailSwEntwickler_o = new APP.DetailView_cl('swentwickler', '/swentwickler/', 'swentwicklerdetail.tpl');
this.listKatFehler_o = new APP.ListView_cl('katfehler', '/katfehler/', 'katfehlerlist.tpl');
this.detailKatFehler_o = new APP.DetailView_cl('katfehler', '/katfehler/', 'katfehlerdetail.tpl');
this.listKatUrsache_o = new APP.ListView_cl('katursache', '/katursache/', 'katursachelist.tpl');
this.detailKatUrsache_o = new APP.DetailView_cl('katursache', '/katursache/', 'katursachedetail.tpl');
// this.listSources_o = new APP.ListView_cl('source', '/source/', 'sourceslist.tpl'); // this.listSources_o = new APP.ListView_cl('source', '/source/', 'sourceslist.tpl');
// this.detailSources_o = new APP.SourceDetailView_cl('source', '/source/', 'sourcedetail.tpl'); // this.detailSources_o = new APP.SourceDetailView_cl('source', '/source/', 'sourcedetail.tpl');
// this.listEvaluated_o = new APP.ListView_cl('evaluated', '/evaluated/', 'evaluatedlist.tpl'); // this.listEvaluated_o = new APP.ListView_cl('evaluated', '/evaluated/', 'evaluatedlist.tpl');
@ -97,6 +103,28 @@ APP.Application_cl = class {
// Detailformular im Content-Bereich anzeigen // Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailSwEntwickler_o, data_apl[1]); self_opl.setContent_p(self_opl.detailSwEntwickler_o, data_apl[1]);
break; break;
case 'katfehler':
self_opl.setContent_p(self_opl.listKatFehler_o, data_apl[1]);
break;
case 'katfehler.add':
// (leeres) Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailKatFehler_o, data_apl[1]);
break;
case 'katfehler.edit':
// Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailKatFehler_o, data_apl[1]);
break;
case 'katursache':
self_opl.setContent_p(self_opl.listKatUrsache_o, data_apl[1]);
break;
case 'katursache.add':
// (leeres) Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailKatUrsache_o, data_apl[1]);
break;
case 'katursache.edit':
// Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailKatUrsache_o, data_apl[1]);
break;
default: default:
console.warn('[Application_cl] unbekannte app-Notification: '+data_apl[0]); console.warn('[Application_cl] unbekannte app-Notification: '+data_apl[0]);
break; break;

Binary file not shown.

View File

@ -0,0 +1,20 @@
<!-- Template -->
<form id="idForm" class="clContent">
<h2 id="idContentHeader" class="clContentHeader">
Pflege Fehlerkategorien
</h2>
<div id="idContentArea" class="clContentArea">
<input type="hidden" value="#context.data.id#" id="id_s" name="id_s" />
<div class="clFormRow">
<label for="name_s">Name <span class="clRequired"></span></label>
<input type="text" value="#context.data.name#" id="name_s" name="name_s" autofocus required />
</div>
</div>
<div id="idButtonArea" class="clButtonArea">
<button data-action="back" class="clButton">Zurück</button>
<button data-action="save" class="clButton">Speichern</button>
</div>
</form>
<!-- EOF -->

View File

@ -0,0 +1,25 @@
<!-- Template -->
<div id="idListContent" class="clContent">
<h2 id="idContentHeader" class="clContentHeader">
Pflege Fehlerkategorien
</h2>
<div id="idContentArea" class="clContentArea">
<table id="idList">
<tr class="listheader"><th>Name</th><th>ID</th></tr>
@var rows_o = context['data'];@
@for var key_s in rows_o@
<tr id='#key_s#'>
@var row_o = rows_o[key_s];@
<td>#row_o['name']#</td><td>#row_o['id']#</td>
</tr>
@endfor@
</table>
</div>
<div id="idButtonArea" class="clButtonArea">
<button data-action="add" class="clButton">Hinzufügen</button>
<button data-action="edit" class="clButton">Bearbeiten</button>
<button data-action="delete" class="clButton">Löschen</button>
</div>
</div>
<!-- EOF -->

View File

@ -0,0 +1,20 @@
<!-- Template -->
<form id="idForm" class="clContent">
<h2 id="idContentHeader" class="clContentHeader">
Pflege Fehlerursachekategorien
</h2>
<div id="idContentArea" class="clContentArea">
<input type="hidden" value="#context.data.id#" id="id_s" name="id_s" />
<div class="clFormRow">
<label for="name_s">Name <span class="clRequired"></span></label>
<input type="text" value="#context.data.name#" id="name_s" name="name_s" autofocus required />
</div>
</div>
<div id="idButtonArea" class="clButtonArea">
<button data-action="back" class="clButton">Zurück</button>
<button data-action="save" class="clButton">Speichern</button>
</div>
</form>
<!-- EOF -->

View File

@ -0,0 +1,25 @@
<!-- Template -->
<div id="idListContent" class="clContent">
<h2 id="idContentHeader" class="clContentHeader">
Pflege Fehlerursachekategorien
</h2>
<div id="idContentArea" class="clContentArea">
<table id="idList">
<tr class="listheader"><th>Name</th><th>ID</th></tr>
@var rows_o = context['data'];@
@for var key_s in rows_o@
<tr id='#key_s#'>
@var row_o = rows_o[key_s];@
<td>#row_o['name']#</td><td>#row_o['id']#</td>
</tr>
@endfor@
</table>
</div>
<div id="idButtonArea" class="clButtonArea">
<button data-action="add" class="clButton">Hinzufügen</button>
<button data-action="edit" class="clButton">Bearbeiten</button>
<button data-action="delete" class="clButton">Löschen</button>
</div>
</div>
<!-- EOF -->