feat(khira): application-oriented error form with drafts and database cleanup
This commit is contained in:
+34
-10
@@ -113,6 +113,16 @@ CREATE TABLE IF NOT EXISTS errors (
|
||||
created_by VARCHAR(64) NOT NULL DEFAULT '',
|
||||
request_payload TEXT NOT NULL DEFAULT '',
|
||||
archived BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
platform VARCHAR(32) NOT NULL DEFAULT 'iOS',
|
||||
current_phase VARCHAR(64) NOT NULL DEFAULT 'development phase',
|
||||
error_screen VARCHAR(128) NOT NULL DEFAULT '',
|
||||
feature_name VARCHAR(128) NOT NULL DEFAULT '',
|
||||
error_type VARCHAR(32) NOT NULL DEFAULT 'Bug',
|
||||
description TEXT NOT NULL DEFAULT '',
|
||||
image_url TEXT NOT NULL DEFAULT '',
|
||||
additional_info TEXT NOT NULL DEFAULT '',
|
||||
is_draft BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
assigned_to VARCHAR(64) NOT NULL DEFAULT '',
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
@@ -213,8 +223,23 @@ func connectDB(url string) (*sql.DB, error) {
|
||||
}
|
||||
|
||||
func initSchema(db *sql.DB) error {
|
||||
_, err := db.Exec(ddlSchema)
|
||||
return err
|
||||
if _, err := db.Exec(ddlSchema); err != nil {
|
||||
return err
|
||||
}
|
||||
// Ensure application-oriented error columns exist
|
||||
_, _ = db.Exec(`
|
||||
ALTER TABLE errors ADD COLUMN IF NOT EXISTS platform VARCHAR(32) NOT NULL DEFAULT 'iOS';
|
||||
ALTER TABLE errors ADD COLUMN IF NOT EXISTS current_phase VARCHAR(64) NOT NULL DEFAULT 'development phase';
|
||||
ALTER TABLE errors ADD COLUMN IF NOT EXISTS error_screen VARCHAR(128) NOT NULL DEFAULT '';
|
||||
ALTER TABLE errors ADD COLUMN IF NOT EXISTS feature_name VARCHAR(128) NOT NULL DEFAULT '';
|
||||
ALTER TABLE errors ADD COLUMN IF NOT EXISTS error_type VARCHAR(32) NOT NULL DEFAULT 'Bug';
|
||||
ALTER TABLE errors ADD COLUMN IF NOT EXISTS description TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE errors ADD COLUMN IF NOT EXISTS image_url TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE errors ADD COLUMN IF NOT EXISTS additional_info TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE errors ADD COLUMN IF NOT EXISTS is_draft BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
ALTER TABLE errors ADD COLUMN IF NOT EXISTS assigned_to VARCHAR(64) NOT NULL DEFAULT '';
|
||||
`)
|
||||
return nil
|
||||
}
|
||||
|
||||
func seedDefaultUsers(db *sql.DB) error {
|
||||
@@ -232,11 +257,6 @@ func seedDefaultUsers(db *sql.DB) error {
|
||||
avatar string
|
||||
}{
|
||||
{"admin", "System Administrator", "admin", "team_lead", "Team Lead", "A"},
|
||||
{"charlie", "Charlie Diaz", "charlie123", "tester", "Tester", "🕵️♂️"},
|
||||
{"alice", "Alice Sharma", "alice123", "ios_dev", "iOS Dev", "👩💻"},
|
||||
{"bob", "Bob Anderson", "bob123", "backend_dev", "Backend Dev", "👨💻"},
|
||||
{"diana", "Diana Prince", "diana123", "android_dev", "Android Dev", "🤖"},
|
||||
{"eva", "Eva Chen", "eva123", "designer", "Designer", "🎨"},
|
||||
}
|
||||
|
||||
for _, u := range defaultUsers {
|
||||
@@ -438,7 +458,8 @@ func SyncDatabases(primaryDB, backupDB *sql.DB) (map[string]any, error) {
|
||||
errRows, err := primaryDB.Query(`
|
||||
SELECT id, fingerprint, app_name, version, environment, service, endpoint, exception_type, message,
|
||||
stack_trace, severity, status, occurrences, first_seen, last_seen, resolved_at, resolved_by,
|
||||
resolution_notes, linked_ticket_id, created_by, request_payload, archived, created_at
|
||||
resolution_notes, linked_ticket_id, created_by, request_payload, archived, created_at,
|
||||
platform, current_phase, error_screen, feature_name, error_type, description, image_url, additional_info, is_draft, assigned_to
|
||||
FROM errors
|
||||
`)
|
||||
if err != nil {
|
||||
@@ -449,8 +470,9 @@ func SyncDatabases(primaryDB, backupDB *sql.DB) (map[string]any, error) {
|
||||
errStmt, err := tx.Prepare(`
|
||||
INSERT INTO errors (id, fingerprint, app_name, version, environment, service, endpoint, exception_type, message,
|
||||
stack_trace, severity, status, occurrences, first_seen, last_seen, resolved_at, resolved_by,
|
||||
resolution_notes, linked_ticket_id, created_by, request_payload, archived, created_at)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23)
|
||||
resolution_notes, linked_ticket_id, created_by, request_payload, archived, created_at,
|
||||
platform, current_phase, error_screen, feature_name, error_type, description, image_url, additional_info, is_draft, assigned_to)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33)
|
||||
`)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -463,6 +485,7 @@ func SyncDatabases(primaryDB, backupDB *sql.DB) (map[string]any, error) {
|
||||
&e.ID, &e.Fingerprint, &e.AppName, &e.Version, &e.Environment, &e.Service, &e.Endpoint, &e.ExceptionType, &e.Message,
|
||||
&e.StackTrace, &e.Severity, &e.Status, &e.Occurrences, &e.FirstSeen, &e.LastSeen, &e.ResolvedAt, &e.ResolvedBy,
|
||||
&e.ResolutionNotes, &e.LinkedTicketID, &e.CreatedBy, &e.RequestPayload, &e.Archived, &e.CreatedAt,
|
||||
&e.Platform, &e.CurrentPhase, &e.ErrorScreen, &e.FeatureName, &e.ErrorType, &e.Description, &e.ImageURL, &e.AdditionalInfo, &e.IsDraft, &e.AssignedTo,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -470,6 +493,7 @@ func SyncDatabases(primaryDB, backupDB *sql.DB) (map[string]any, error) {
|
||||
e.ID, e.Fingerprint, e.AppName, e.Version, e.Environment, e.Service, e.Endpoint, e.ExceptionType, e.Message,
|
||||
e.StackTrace, e.Severity, e.Status, e.Occurrences, e.FirstSeen, e.LastSeen, e.ResolvedAt, e.ResolvedBy,
|
||||
e.ResolutionNotes, e.LinkedTicketID, e.CreatedBy, e.RequestPayload, e.Archived, e.CreatedAt,
|
||||
e.Platform, e.CurrentPhase, e.ErrorScreen, e.FeatureName, e.ErrorType, e.Description, e.ImageURL, e.AdditionalInfo, e.IsDraft, e.AssignedTo,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -144,6 +144,9 @@ func (s *Server) RegisterRoutes(r chi.Router) {
|
||||
api.Post("/errors", s.handleIngestError)
|
||||
api.Get("/errors/stats", s.handleErrorStats)
|
||||
api.Get("/errors/{id}", s.handleGetError)
|
||||
api.Put("/errors/{id}", s.handleUpdateError)
|
||||
api.Post("/errors/{id}", s.handleUpdateError)
|
||||
api.Delete("/errors/{id}", s.handleDeleteError)
|
||||
api.Put("/errors/{id}/status", s.handleUpdateErrorStatus)
|
||||
api.Post("/errors/{id}/status", s.handleUpdateErrorStatus)
|
||||
api.Post("/errors/{id}/escalate", s.handleEscalateError)
|
||||
@@ -1177,7 +1180,7 @@ func (s *Server) handleIngestError(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
var ticket *Ticket
|
||||
if assignee != "" && actor != nil {
|
||||
if !saved.IsDraft && assignee != "" && actor != nil {
|
||||
title := fmt.Sprintf("[%s] %s: %s", saved.AppName, saved.ExceptionType, saved.Message)
|
||||
if len(title) > 80 {
|
||||
title = title[:77] + "..."
|
||||
@@ -1196,6 +1199,76 @@ func (s *Server) handleIngestError(w http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) handleUpdateError(w http.ResponseWriter, r *http.Request) {
|
||||
actor := s.getActor(r)
|
||||
if actor == nil {
|
||||
s.writeJSON(w, http.StatusUnauthorized, map[string]string{"error": "Please sign in to update errors"})
|
||||
return
|
||||
}
|
||||
id := chi.URLParam(r, "id")
|
||||
|
||||
var req struct {
|
||||
AppError
|
||||
AssignedTo string `json:"assigned_to"`
|
||||
AssigneeUsername string `json:"assignee_username"`
|
||||
Notes string `json:"notes"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
s.writeJSON(w, http.StatusBadRequest, map[string]string{"error": "Invalid request payload"})
|
||||
return
|
||||
}
|
||||
|
||||
assignee := strings.TrimSpace(req.AssignedTo)
|
||||
if assignee == "" {
|
||||
assignee = strings.TrimSpace(req.AssigneeUsername)
|
||||
}
|
||||
if assignee != "" {
|
||||
req.AppError.AssignedTo = assignee
|
||||
}
|
||||
|
||||
updated, err := s.Store.UpdateError(id, &req.AppError, actor)
|
||||
if err != nil {
|
||||
s.writeJSON(w, http.StatusBadRequest, map[string]string{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
var ticket *Ticket
|
||||
if !updated.IsDraft && assignee != "" && updated.LinkedTicketID == "" {
|
||||
title := fmt.Sprintf("[%s] %s: %s", updated.AppName, updated.ExceptionType, updated.Message)
|
||||
if len(title) > 80 {
|
||||
title = title[:77] + "..."
|
||||
}
|
||||
t, errItem, errEsc := s.Store.EscalateErrorToTicket(updated.ID, title, assignee, updated.Severity, req.Notes, actor)
|
||||
if errEsc == nil {
|
||||
ticket = t
|
||||
updated = errItem
|
||||
}
|
||||
}
|
||||
|
||||
s.writeJSON(w, http.StatusOK, map[string]any{
|
||||
"status": "ok",
|
||||
"error": updated,
|
||||
"ticket": ticket,
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) handleDeleteError(w http.ResponseWriter, r *http.Request) {
|
||||
actor := s.getActor(r)
|
||||
if actor == nil {
|
||||
s.writeJSON(w, http.StatusUnauthorized, map[string]string{"error": "Please sign in to delete errors"})
|
||||
return
|
||||
}
|
||||
id := chi.URLParam(r, "id")
|
||||
if err := s.Store.DeleteError(id, actor); err != nil {
|
||||
s.writeJSON(w, http.StatusBadRequest, map[string]string{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
s.writeJSON(w, http.StatusOK, map[string]any{
|
||||
"status": "ok",
|
||||
"id": id,
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) handleUpdateErrorStatus(w http.ResponseWriter, r *http.Request) {
|
||||
actor := s.getActor(r)
|
||||
if actor == nil {
|
||||
|
||||
@@ -167,6 +167,7 @@ const (
|
||||
ErrorStatusInvestigating ErrorStatus = "investigating"
|
||||
ErrorStatusResolved ErrorStatus = "resolved"
|
||||
ErrorStatusIgnored ErrorStatus = "ignored"
|
||||
ErrorStatusDraft ErrorStatus = "draft"
|
||||
)
|
||||
|
||||
type AppError struct {
|
||||
@@ -181,7 +182,7 @@ type AppError struct {
|
||||
Message string `json:"message"`
|
||||
StackTrace string `json:"stack_trace"`
|
||||
Severity string `json:"severity"` // critical, high, medium, low
|
||||
Status string `json:"status"` // unresolved, investigating, resolved, ignored
|
||||
Status string `json:"status"` // unresolved, investigating, resolved, ignored, draft
|
||||
Occurrences int `json:"occurrences"`
|
||||
FirstSeen time.Time `json:"first_seen"`
|
||||
LastSeen time.Time `json:"last_seen"`
|
||||
@@ -194,6 +195,18 @@ type AppError struct {
|
||||
Archived bool `json:"archived"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
|
||||
// Application-oriented error fields
|
||||
Platform string `json:"platform"` // iOS or Android
|
||||
CurrentPhase string `json:"current_phase"` // development phase or ready to live
|
||||
ErrorScreen string `json:"error_screen"` // screen or view where error occurred
|
||||
FeatureName string `json:"feature_name"` // feature name
|
||||
ErrorType string `json:"error_type"` // Bug or Crash
|
||||
Description string `json:"description"` // user description of error
|
||||
ImageURL string `json:"image_url"` // attached image URL
|
||||
AdditionalInfo string `json:"additional_info"` // any additional info
|
||||
IsDraft bool `json:"is_draft"` // draft flag
|
||||
AssignedTo string `json:"assigned_to"` // assigned developer or recipient username
|
||||
}
|
||||
|
||||
type Notification struct {
|
||||
|
||||
+188
-32
@@ -1267,31 +1267,82 @@ func (s *Store) MarkNotificationsRead(username string) {
|
||||
// ─────────────────────────────────────────────
|
||||
|
||||
func (s *Store) IngestError(errItem *AppError, actor *User) (*AppError, error) {
|
||||
|
||||
if errItem.AppName == "" || errItem.ExceptionType == "" || errItem.Message == "" {
|
||||
return nil, errors.New("app_name, exception_type and message are required")
|
||||
// Normalize defaults for application-oriented error reports
|
||||
if errItem.Platform == "" {
|
||||
errItem.Platform = "iOS"
|
||||
}
|
||||
if errItem.CurrentPhase == "" {
|
||||
errItem.CurrentPhase = "development phase"
|
||||
}
|
||||
if errItem.ErrorType == "" {
|
||||
errItem.ErrorType = "Bug"
|
||||
}
|
||||
if errItem.Description != "" && errItem.Message == "" {
|
||||
errItem.Message = errItem.Description
|
||||
}
|
||||
if errItem.ErrorType != "" && errItem.ExceptionType == "" {
|
||||
errItem.ExceptionType = errItem.ErrorType
|
||||
}
|
||||
if errItem.FeatureName != "" && errItem.Service == "" {
|
||||
errItem.Service = errItem.FeatureName
|
||||
}
|
||||
if errItem.Severity == "" {
|
||||
if strings.EqualFold(errItem.ErrorType, "Crash") {
|
||||
errItem.Severity = "critical"
|
||||
} else {
|
||||
errItem.Severity = "medium"
|
||||
}
|
||||
}
|
||||
if errItem.Environment == "" {
|
||||
errItem.Environment = errItem.CurrentPhase
|
||||
}
|
||||
|
||||
// Fingerprint for deduplication
|
||||
fpRaw := fmt.Sprintf("%s:%s:%s", errItem.AppName, errItem.ExceptionType, errItem.Message)
|
||||
h := sha256.Sum256([]byte(fpRaw))
|
||||
fingerprint := fmt.Sprintf("%x", h)[:16]
|
||||
if errItem.IsDraft {
|
||||
errItem.Status = string(ErrorStatusDraft)
|
||||
if errItem.AppName == "" {
|
||||
errItem.AppName = "Draft Application"
|
||||
}
|
||||
if errItem.Message == "" {
|
||||
errItem.Message = "(Draft Error)"
|
||||
}
|
||||
if errItem.ExceptionType == "" {
|
||||
errItem.ExceptionType = "Bug"
|
||||
}
|
||||
} else {
|
||||
if errItem.AppName == "" || errItem.Message == "" {
|
||||
return nil, errors.New("app_name and description/message are required")
|
||||
}
|
||||
if errItem.ExceptionType == "" {
|
||||
errItem.ExceptionType = "Bug"
|
||||
}
|
||||
if errItem.Status == "" || errItem.Status == string(ErrorStatusDraft) {
|
||||
errItem.Status = string(ErrorStatusUnresolved)
|
||||
}
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
|
||||
// Check if already exists with same fingerprint
|
||||
var existingID string
|
||||
var occurrences int
|
||||
err := s.primaryDB.QueryRow(`
|
||||
SELECT id, occurrences FROM errors WHERE fingerprint = $1 AND status != 'resolved'
|
||||
`, fingerprint).Scan(&existingID, &occurrences)
|
||||
// Only deduplicate non-draft errors
|
||||
if !errItem.IsDraft {
|
||||
fpRaw := fmt.Sprintf("%s:%s:%s", errItem.AppName, errItem.ExceptionType, errItem.Message)
|
||||
h := sha256.Sum256([]byte(fpRaw))
|
||||
fingerprint := fmt.Sprintf("%x", h)[:16]
|
||||
errItem.Fingerprint = fingerprint
|
||||
|
||||
if err == nil && existingID != "" {
|
||||
// Update existing error occurrences
|
||||
_, _ = s.primaryDB.Exec(`
|
||||
UPDATE errors SET occurrences = occurrences + 1, last_seen = $1 WHERE id = $2
|
||||
`, now, existingID)
|
||||
return s.GetError(existingID)
|
||||
var existingID string
|
||||
var occurrences int
|
||||
err := s.primaryDB.QueryRow(`
|
||||
SELECT id, occurrences FROM errors WHERE fingerprint = $1 AND status != 'resolved' AND is_draft = FALSE
|
||||
`, fingerprint).Scan(&existingID, &occurrences)
|
||||
|
||||
if err == nil && existingID != "" {
|
||||
_, _ = s.primaryDB.Exec(`
|
||||
UPDATE errors SET occurrences = occurrences + 1, last_seen = $1 WHERE id = $2
|
||||
`, now, existingID)
|
||||
return s.GetError(existingID)
|
||||
}
|
||||
} else {
|
||||
errItem.Fingerprint = "draft-" + uuid.New().String()[:8]
|
||||
}
|
||||
|
||||
id, err := s.nextSeq("error_seq", "ERR")
|
||||
@@ -1299,11 +1350,9 @@ func (s *Store) IngestError(errItem *AppError, actor *User) (*AppError, error) {
|
||||
return nil, err
|
||||
}
|
||||
errItem.ID = id
|
||||
errItem.Fingerprint = fingerprint
|
||||
errItem.Occurrences = 1
|
||||
errItem.FirstSeen = now
|
||||
errItem.LastSeen = now
|
||||
errItem.Status = string(ErrorStatusUnresolved)
|
||||
if actor != nil {
|
||||
errItem.CreatedBy = actor.Username
|
||||
}
|
||||
@@ -1311,35 +1360,126 @@ func (s *Store) IngestError(errItem *AppError, actor *User) (*AppError, error) {
|
||||
_, err = s.primaryDB.Exec(`
|
||||
INSERT INTO errors (
|
||||
id, fingerprint, app_name, version, environment, service, endpoint, exception_type, message,
|
||||
stack_trace, severity, status, occurrences, first_seen, last_seen, created_by, request_payload, created_at
|
||||
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18)
|
||||
stack_trace, severity, status, occurrences, first_seen, last_seen, created_by, request_payload,
|
||||
platform, current_phase, error_screen, feature_name, error_type, description, image_url, additional_info, is_draft, assigned_to, created_at
|
||||
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28)
|
||||
`, errItem.ID, errItem.Fingerprint, errItem.AppName, errItem.Version, errItem.Environment, errItem.Service,
|
||||
errItem.Endpoint, errItem.ExceptionType, errItem.Message, errItem.StackTrace, errItem.Severity,
|
||||
errItem.Status, errItem.Occurrences, errItem.FirstSeen, errItem.LastSeen, errItem.CreatedBy,
|
||||
errItem.RequestPayload, now)
|
||||
errItem.RequestPayload, errItem.Platform, errItem.CurrentPhase, errItem.ErrorScreen, errItem.FeatureName,
|
||||
errItem.ErrorType, errItem.Description, errItem.ImageURL, errItem.AdditionalInfo, errItem.IsDraft,
|
||||
errItem.AssignedTo, now)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to insert error: %w", err)
|
||||
}
|
||||
|
||||
if s.Broker != nil {
|
||||
s.Broker.Broadcast("error_logged", "", errItem.ID, "", "log", map[string]string{"app": errItem.AppName, "severity": errItem.Severity})
|
||||
actionType := "log"
|
||||
if errItem.IsDraft {
|
||||
actionType = "draft_created"
|
||||
}
|
||||
s.Broker.Broadcast("error_logged", "", errItem.ID, "", actionType, map[string]string{
|
||||
"app": errItem.AppName, "severity": errItem.Severity, "status": errItem.Status, "is_draft": fmt.Sprintf("%v", errItem.IsDraft),
|
||||
})
|
||||
}
|
||||
|
||||
return errItem, nil
|
||||
}
|
||||
|
||||
func (s *Store) UpdateError(id string, u *AppError, actor *User) (*AppError, error) {
|
||||
if u.Platform == "" {
|
||||
u.Platform = "iOS"
|
||||
}
|
||||
if u.CurrentPhase == "" {
|
||||
u.CurrentPhase = "development phase"
|
||||
}
|
||||
if u.ErrorType == "" {
|
||||
u.ErrorType = "Bug"
|
||||
}
|
||||
if u.Description != "" && u.Message == "" {
|
||||
u.Message = u.Description
|
||||
}
|
||||
if u.ErrorType != "" && u.ExceptionType == "" {
|
||||
u.ExceptionType = u.ErrorType
|
||||
}
|
||||
if u.FeatureName != "" && u.Service == "" {
|
||||
u.Service = u.FeatureName
|
||||
}
|
||||
if u.Severity == "" {
|
||||
if strings.EqualFold(u.ErrorType, "Crash") {
|
||||
u.Severity = "critical"
|
||||
} else {
|
||||
u.Severity = "medium"
|
||||
}
|
||||
}
|
||||
if u.Environment == "" {
|
||||
u.Environment = u.CurrentPhase
|
||||
}
|
||||
|
||||
if u.IsDraft {
|
||||
u.Status = string(ErrorStatusDraft)
|
||||
} else {
|
||||
if u.Status == "" || u.Status == string(ErrorStatusDraft) {
|
||||
u.Status = string(ErrorStatusUnresolved)
|
||||
}
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
_, err := s.primaryDB.Exec(`
|
||||
UPDATE errors SET
|
||||
app_name = $1, version = $2, environment = $3, service = $4, endpoint = $5,
|
||||
exception_type = $6, message = $7, stack_trace = $8, severity = $9, status = $10,
|
||||
platform = $11, current_phase = $12, error_screen = $13, feature_name = $14,
|
||||
error_type = $15, description = $16, image_url = $17, additional_info = $18,
|
||||
is_draft = $19, assigned_to = $20, last_seen = $21
|
||||
WHERE id = $22
|
||||
`, u.AppName, u.Version, u.Environment, u.Service, u.Endpoint,
|
||||
u.ExceptionType, u.Message, u.StackTrace, u.Severity, u.Status,
|
||||
u.Platform, u.CurrentPhase, u.ErrorScreen, u.FeatureName,
|
||||
u.ErrorType, u.Description, u.ImageURL, u.AdditionalInfo,
|
||||
u.IsDraft, u.AssignedTo, now, id)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to update error: %w", err)
|
||||
}
|
||||
|
||||
if s.Broker != nil {
|
||||
actionType := "error_updated"
|
||||
if !u.IsDraft {
|
||||
actionType = "error_published"
|
||||
}
|
||||
s.Broker.Broadcast("error_updated", "", id, "", actionType, map[string]string{
|
||||
"app": u.AppName, "severity": u.Severity, "status": u.Status, "is_draft": fmt.Sprintf("%v", u.IsDraft),
|
||||
})
|
||||
}
|
||||
|
||||
return s.GetError(id)
|
||||
}
|
||||
|
||||
func (s *Store) DeleteError(id string, actor *User) error {
|
||||
_, err := s.primaryDB.Exec("DELETE FROM errors WHERE id = $1", id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if s.Broker != nil {
|
||||
s.Broker.Broadcast("error_deleted", "", id, "", "delete", map[string]string{})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Store) GetError(id string) (*AppError, error) {
|
||||
|
||||
var e AppError
|
||||
err := s.primaryDB.QueryRow(`
|
||||
SELECT id, fingerprint, app_name, version, environment, service, endpoint, exception_type, message,
|
||||
stack_trace, severity, status, occurrences, first_seen, last_seen, resolved_at, resolved_by,
|
||||
resolution_notes, linked_ticket_id, created_by, request_payload, archived
|
||||
resolution_notes, linked_ticket_id, created_by, request_payload, archived,
|
||||
platform, current_phase, error_screen, feature_name, error_type, description, image_url, additional_info, is_draft, assigned_to
|
||||
FROM errors WHERE id = $1
|
||||
`, id).Scan(
|
||||
&e.ID, &e.Fingerprint, &e.AppName, &e.Version, &e.Environment, &e.Service, &e.Endpoint, &e.ExceptionType, &e.Message,
|
||||
&e.StackTrace, &e.Severity, &e.Status, &e.Occurrences, &e.FirstSeen, &e.LastSeen, &e.ResolvedAt, &e.ResolvedBy,
|
||||
&e.ResolutionNotes, &e.LinkedTicketID, &e.CreatedBy, &e.RequestPayload, &e.Archived,
|
||||
&e.Platform, &e.CurrentPhase, &e.ErrorScreen, &e.FeatureName, &e.ErrorType, &e.Description, &e.ImageURL, &e.AdditionalInfo, &e.IsDraft, &e.AssignedTo,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, errors.New("error not found")
|
||||
@@ -1353,11 +1493,19 @@ func (s *Store) ListErrors(status, severity, app, query string) []*AppError {
|
||||
var args []any
|
||||
idx := 1
|
||||
|
||||
if status != "" {
|
||||
conds = append(conds, fmt.Sprintf("LOWER(status) = LOWER($%d)", idx))
|
||||
if strings.EqualFold(status, "draft") {
|
||||
conds = append(conds, "is_draft = TRUE")
|
||||
} else if strings.EqualFold(status, "all_with_drafts") {
|
||||
// Include all
|
||||
} else if status != "" {
|
||||
conds = append(conds, fmt.Sprintf("LOWER(status) = LOWER($%d) AND is_draft = FALSE", idx))
|
||||
args = append(args, status)
|
||||
idx++
|
||||
} else {
|
||||
// Default: list non-draft errors
|
||||
conds = append(conds, "is_draft = FALSE")
|
||||
}
|
||||
|
||||
if severity != "" {
|
||||
conds = append(conds, fmt.Sprintf("LOWER(severity) = LOWER($%d)", idx))
|
||||
args = append(args, severity)
|
||||
@@ -1370,7 +1518,7 @@ func (s *Store) ListErrors(status, severity, app, query string) []*AppError {
|
||||
}
|
||||
if query != "" {
|
||||
q := "%" + strings.ToLower(query) + "%"
|
||||
conds = append(conds, fmt.Sprintf("(LOWER(id) LIKE $%d OR LOWER(message) LIKE $%d OR LOWER(exception_type) LIKE $%d OR LOWER(endpoint) LIKE $%d)", idx, idx, idx, idx))
|
||||
conds = append(conds, fmt.Sprintf("(LOWER(id) LIKE $%d OR LOWER(message) LIKE $%d OR LOWER(description) LIKE $%d OR LOWER(exception_type) LIKE $%d OR LOWER(feature_name) LIKE $%d OR LOWER(error_screen) LIKE $%d OR LOWER(endpoint) LIKE $%d)", idx, idx, idx, idx, idx, idx, idx))
|
||||
args = append(args, q)
|
||||
idx++
|
||||
}
|
||||
@@ -1383,7 +1531,8 @@ func (s *Store) ListErrors(status, severity, app, query string) []*AppError {
|
||||
querySQL := fmt.Sprintf(`
|
||||
SELECT id, fingerprint, app_name, version, environment, service, endpoint, exception_type, message,
|
||||
stack_trace, severity, status, occurrences, first_seen, last_seen, resolved_at, resolved_by,
|
||||
resolution_notes, linked_ticket_id, created_by, request_payload, archived
|
||||
resolution_notes, linked_ticket_id, created_by, request_payload, archived,
|
||||
platform, current_phase, error_screen, feature_name, error_type, description, image_url, additional_info, is_draft, assigned_to
|
||||
FROM errors
|
||||
%s
|
||||
ORDER BY last_seen DESC LIMIT 100
|
||||
@@ -1402,6 +1551,7 @@ func (s *Store) ListErrors(status, severity, app, query string) []*AppError {
|
||||
&e.ID, &e.Fingerprint, &e.AppName, &e.Version, &e.Environment, &e.Service, &e.Endpoint, &e.ExceptionType, &e.Message,
|
||||
&e.StackTrace, &e.Severity, &e.Status, &e.Occurrences, &e.FirstSeen, &e.LastSeen, &e.ResolvedAt, &e.ResolvedBy,
|
||||
&e.ResolutionNotes, &e.LinkedTicketID, &e.CreatedBy, &e.RequestPayload, &e.Archived,
|
||||
&e.Platform, &e.CurrentPhase, &e.ErrorScreen, &e.FeatureName, &e.ErrorType, &e.Description, &e.ImageURL, &e.AdditionalInfo, &e.IsDraft, &e.AssignedTo,
|
||||
); err == nil {
|
||||
list = append(list, &e)
|
||||
}
|
||||
@@ -1419,9 +1569,10 @@ func (s *Store) GetErrorStats() map[string]int {
|
||||
"critical": 0,
|
||||
"high": 0,
|
||||
"escalated": 0,
|
||||
"drafts": 0,
|
||||
}
|
||||
|
||||
rows, err := s.primaryDB.Query(`SELECT status, severity, linked_ticket_id FROM errors`)
|
||||
rows, err := s.primaryDB.Query(`SELECT status, severity, linked_ticket_id, is_draft FROM errors`)
|
||||
if err != nil {
|
||||
return stats
|
||||
}
|
||||
@@ -1429,7 +1580,12 @@ func (s *Store) GetErrorStats() map[string]int {
|
||||
|
||||
for rows.Next() {
|
||||
var st, sev, lk string
|
||||
if err := rows.Scan(&st, &sev, &lk); err == nil {
|
||||
var isDraft bool
|
||||
if err := rows.Scan(&st, &sev, &lk, &isDraft); err == nil {
|
||||
if isDraft {
|
||||
stats["drafts"]++
|
||||
continue
|
||||
}
|
||||
stats["total"]++
|
||||
switch strings.ToLower(st) {
|
||||
case "unresolved":
|
||||
|
||||
+428
-44
@@ -66,7 +66,7 @@ const PRI=[['P0','P0 · Critical'],['P1','P1 · High'],['P2','P2 · Medium'],['P
|
||||
const SEV=[['CRITICAL','Critical'],['HIGH','High'],['MEDIUM','Medium'],['LOW','Low']];
|
||||
const STAT={open:'Open',progress:'In progress',hold:'On hold',completed:'Completed'};
|
||||
const COLS=[['open','var(--out)'],['progress','var(--pri)'],['hold','var(--on-warn-c)'],['completed','var(--on-ter-c)']];
|
||||
const EL={unresolved:'Unresolved',escalated:'Escalated',resolved:'Resolved'};
|
||||
const EL={draft:'Drafts',unresolved:'Unresolved',escalated:'Escalated',resolved:'Resolved'};
|
||||
const EMOJIS=['⚡','👩💻','👨💻','🕵️♂️','👤','🚀','🛡️','🎨','🤖','🦊','🦉','🦁','🔥','💡','🎯','⚙️','🌟','💻'];
|
||||
|
||||
/* ── API ── */
|
||||
@@ -99,7 +99,7 @@ const priFull=t=>{
|
||||
return 'Low';
|
||||
};
|
||||
const st=t=>{const s=(t.status||'open').toLowerCase();return s==='in_progress'?'progress':s==='on_hold'?'hold':s};
|
||||
const ek=e=>e.status==='resolved'?'resolved':e.escalated_ticket_id?'escalated':'unresolved';
|
||||
const ek=e=>(e.is_draft||e.status==='draft')?'draft':e.status==='resolved'?'resolved':(e.escalated_ticket_id||e.linked_ticket_id)?'escalated':'unresolved';
|
||||
const isAdmin=u=>u&&(u.username==='admin'||u.role==='team_lead'||u.role==='lead');
|
||||
|
||||
const roleClass=u=>{
|
||||
@@ -290,7 +290,7 @@ async function refresh(anim){
|
||||
const [tr,ts,er,es,nr,ur]=await Promise.all([
|
||||
api('/khira/api/tickets?limit=100'),
|
||||
api('/khira/api/stats'),
|
||||
api('/khira/api/errors?limit=100'),
|
||||
api('/khira/api/errors?status=all_with_drafts&limit=100'),
|
||||
api('/khira/api/errors/stats'),
|
||||
api('/khira/api/notifications'),
|
||||
api('/khira/api/users')
|
||||
@@ -497,28 +497,91 @@ function initBoardDragDrop(){
|
||||
});
|
||||
}
|
||||
|
||||
const verFmt=v=>!v?'':(String(v).toLowerCase().startsWith('v')?' ':' v')+esc(v);
|
||||
|
||||
/* ── Errors View ── */
|
||||
function renderE(anim){
|
||||
const s=S.es;
|
||||
put('#estats',tile(s.total,'Total','et')+tile(s.unresolved,'Unresolved','eu')+tile(s.escalated,'Escalated','ee')+tile(s.resolved,'Resolved','er'));
|
||||
const archErrCount=S.e.filter(e=>e.archived).length;
|
||||
const eChips=[['','All'],...Object.entries(EL),['archived',`Archived (${archErrCount})`]];
|
||||
const draftCount=S.e.filter(e=>e.is_draft||e.status==='draft').length;
|
||||
put('#estats',tile(s.total,'Total','et')+tile(s.unresolved,'Unresolved','eu')+tile(draftCount,'Drafts','ed')+tile(s.resolved,'Resolved','er'));
|
||||
const archErrCount=S.e.filter(e=>e.archived&&!e.is_draft).length;
|
||||
const eChips=[['','All Published'],['draft',`Drafts (${draftCount})`],['unresolved','Unresolved'],['escalated','Escalated'],['resolved','Resolved'],['archived',`Archived (${archErrCount})`]];
|
||||
put('#eChips',chipRow(eChips,S.ef,'data-ef'));
|
||||
|
||||
const f=S.e.filter(e=>{
|
||||
if(S.ef==='archived'){
|
||||
if(!e.archived)return false;
|
||||
const isDr=e.is_draft||e.status==='draft';
|
||||
if(S.ef==='draft'){
|
||||
if(!isDr)return false;
|
||||
}else if(S.ef==='archived'){
|
||||
if(!e.archived||isDr)return false;
|
||||
}else if(!S.ef){
|
||||
if(e.archived||isDr)return false;
|
||||
}else{
|
||||
if(e.archived)return false;
|
||||
if(S.ef&&ek(e)!==S.ef)return false;
|
||||
if(e.archived||isDr||ek(e)!==S.ef)return false;
|
||||
}
|
||||
return!S.q||[e.id,e.exception_type,e.message,e.endpoint,e.app,e.app_name].join(' ').toLowerCase().includes(S.q);
|
||||
return!S.q||[e.id,e.exception_type,e.message,e.description,e.endpoint,e.app,e.app_name,e.feature_name,e.error_screen,e.platform,e.assigned_to].join(' ').toLowerCase().includes(S.q);
|
||||
});
|
||||
|
||||
const draftBannerHtml=(draftCount>0&&S.ef!=='draft')?`
|
||||
<div class="draft-banner">
|
||||
<span>📝 You have <b>${draftCount}</b> saved error draft(s) available to edit and send.</span>
|
||||
<button type="button" class="chip draft-btn" id="btnViewDrafts">View Drafts (${draftCount})</button>
|
||||
</div>`:'' ;
|
||||
|
||||
$('#elist').classList.toggle('anim',!!anim);
|
||||
put('#elist',f.length?f.map((e,i)=>{
|
||||
put('#elist',draftBannerHtml+(f.length?f.map((e,i)=>{
|
||||
const sev=(e.severity||'MEDIUM').toUpperCase(),k=ek(e);
|
||||
const isArch=!!e.archived;
|
||||
return`<div class="li" tabindex="0" role="button" data-e="${esc(e.id)}" style="--i:${Math.min(i,12)}"><span class="lead sv ${sev}">${ic('error',16)}</span><div class="ell"><h4 class="ell mono" style="font-size:14px">${esc(e.exception_type)}</h4><p class="ell">${esc(e.message)}</p><p class="ell">${esc(e.id)} · ${esc(e.app||e.app_name||'—')} · ${esc(e.endpoint||'—')}</p></div><div class="tl2"><span class="stt ${isArch?'archived':k}">${isArch?'Archived':EL[k]}</span><span>${e.events||e.occurrences||1} events · ${ago(e.last_seen)}</span></div></div>`;
|
||||
}).join(''):`<div class="big">${ic('bug_report',36)}<p>No errors tracked.</p></div>`);
|
||||
const isDr=e.is_draft||e.status==='draft';
|
||||
const platChip=`<span class="meta-chip ${e.platform==='Android'?'android':'ios'}">${e.platform==='Android'?'🤖 Android':'🍏 iOS'}</span>`;
|
||||
const typeChip=`<span class="meta-chip ${e.error_type==='Crash'?'crash':'bug'}">${esc(e.error_type||'Bug')}</span>`;
|
||||
const phaseChip=e.current_phase?`<span class="meta-chip">${esc(e.current_phase)}</span>`:'';
|
||||
|
||||
if(isDr){
|
||||
return`<div class="li" tabindex="0" role="button" data-e="${esc(e.id)}" style="--i:${Math.min(i,12)}">
|
||||
<span class="lead sv" style="background:rgba(245,158,11,0.2);color:#fbbf24">${ic('ticket',16)}</span>
|
||||
<div class="ell">
|
||||
<div style="display:flex;gap:6px;align-items:center;margin-bottom:3px">
|
||||
<span class="stt draft">Draft</span>
|
||||
${platChip}
|
||||
${typeChip}
|
||||
${phaseChip}
|
||||
</div>
|
||||
<h4 class="ell" style="font-size:14px">${esc(e.app_name||'Draft Application')}${verFmt(e.version)}${e.error_screen?' · '+esc(e.error_screen):''}</h4>
|
||||
<p class="ell">${esc(e.description||e.message||'(No description provided)')}</p>
|
||||
<p class="ell" style="font-size:11px;color:var(--on-sv)">${esc(e.id)}${e.assigned_to?' · Sent to @'+esc(e.assigned_to):' · Unassigned'}${e.image_url?' · 📷 Image attached':''}</p>
|
||||
</div>
|
||||
<div class="tl2">
|
||||
<button type="button" class="tn draft-btn" style="height:26px;font-size:11px" onclick="event.stopPropagation();reportErr(S.e.find(x=>x.id==='${esc(e.id)}'))">✏️ Edit & Send</button>
|
||||
<span>${ago(e.last_seen||e.created_at)}</span>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
return`<div class="li" tabindex="0" role="button" data-e="${esc(e.id)}" style="--i:${Math.min(i,12)}">
|
||||
<span class="lead sv ${sev}">${ic('error',16)}</span>
|
||||
<div class="ell">
|
||||
<div style="display:flex;gap:6px;align-items:center;margin-bottom:3px">
|
||||
${platChip}
|
||||
${typeChip}
|
||||
${phaseChip}
|
||||
</div>
|
||||
<h4 class="ell" style="font-size:14px">${esc(e.app_name||e.app||'Application')}${verFmt(e.version)}${e.error_screen?' · '+esc(e.error_screen):''}${e.feature_name?' ('+esc(e.feature_name)+')':''}</h4>
|
||||
<p class="ell">${esc(e.description||e.message)}</p>
|
||||
<p class="ell" style="font-size:11px;color:var(--on-sv)">${esc(e.id)}${e.assigned_to?' · Assigned to @'+esc(e.assigned_to):''}${e.image_url?' · 📷 Image attached':''}</p>
|
||||
</div>
|
||||
<div class="tl2">
|
||||
<span class="stt ${isArch?'archived':k}">${isArch?'Archived':EL[k]||k}</span>
|
||||
<span>${e.events||e.occurrences||1} events · ${ago(e.last_seen||e.created_at)}</span>
|
||||
</div>
|
||||
</div>`;
|
||||
}).join(''):`<div class="big">${ic('bug_report',36)}<p>No errors tracked.</p></div>`));
|
||||
|
||||
$('#btnViewDrafts')?.addEventListener('click',()=>{
|
||||
S.ef='draft';
|
||||
renderE(true);
|
||||
});
|
||||
|
||||
put('#title','Error Tracking');
|
||||
}
|
||||
|
||||
@@ -1275,14 +1338,44 @@ function newTicket(){
|
||||
|
||||
/* ── Error Details & Escalation ── */
|
||||
function errD(id){
|
||||
const e=S.e.find(x=>x.id===id);if(!e)return;const k=ek(e);
|
||||
const e=S.e.find(x=>x.id===id);if(!e)return;
|
||||
if(e.is_draft||e.status==='draft'){
|
||||
return reportErr(e);
|
||||
}
|
||||
const k=ek(e);
|
||||
const blk=(l,v)=>v?`<div><p class="lbl">${l}</p><pre class="code">${esc(v)}</pre></div>`:'';
|
||||
const appName=e.app||e.app_name||'';
|
||||
const appName=e.app_name||e.app||'';
|
||||
const isArch=!!e.archived;
|
||||
dlg({wide:1,title:esc(e.exception_type),sub:esc(`${e.id} · ${appName}${e.environment?' · '+e.environment:''}`),
|
||||
body:`<div class="r"><span class="sv ${(e.severity||'').toUpperCase()}">${esc(e.severity)}</span><span class="stt ${isArch?'archived':k}">${isArch?'Archived':EL[k]}</span><span class="id">${e.events||e.occurrences||1} events · ${ago(e.last_seen)}</span></div>
|
||||
${appName?`<div style="margin:10px 0"><button type="button" class="chip" id="btnLogMoreForApp" style="background:var(--sec-c);font-weight:500"><svg class="btn-ic" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;margin-right:6px"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/></svg>Log another error for ${esc(appName)}</button></div>`:''}
|
||||
<p>${esc(e.message)}</p>${blk('Endpoint',e.endpoint)}${blk('Stack trace',e.stack_trace)}${blk('Payload',e.payload||e.request_payload)}${e.escalated_ticket_id||e.linked_ticket_id?`<p class="sub">Escalated as ${esc(e.escalated_ticket_id||e.linked_ticket_id)}</p>`:''}${e.resolution_notes?`<p class="sub">Resolution: ${esc(e.resolution_notes)}</p>`:''}`,
|
||||
|
||||
const platChip=`<span class="meta-chip ${e.platform==='Android'?'android':'ios'}">${e.platform==='Android'?'🤖 Android':'🍏 iOS'}</span>`;
|
||||
const typeChip=`<span class="meta-chip ${e.error_type==='Crash'?'crash':'bug'}">${esc(e.error_type||'Bug')}</span>`;
|
||||
const phaseChip=e.current_phase?`<span class="meta-chip">${esc(e.current_phase)}</span>`:'';
|
||||
|
||||
const imgHtml=e.image_url?`<div style="margin:12px 0">
|
||||
<p class="lbl">Attached Image / Screenshot</p>
|
||||
<a href="${esc(e.image_url)}" target="_blank" rel="noopener">
|
||||
<img src="${esc(e.image_url)}" alt="Error attachment" style="max-width:100%;max-height:260px;border-radius:12px;border:1px solid rgba(255,255,255,0.15);box-shadow:0 4px 16px rgba(0,0,0,0.6)">
|
||||
</a>
|
||||
</div>`:'';
|
||||
|
||||
dlg({wide:1,title:esc(e.exception_type||e.error_type||'Application Error'),sub:esc(`${e.id} · ${appName}${verFmt(e.version)}${e.error_screen?' · Screen: '+e.error_screen:''}`),
|
||||
body:`<div class="r" style="gap:8px;align-items:center;margin-bottom:8px">
|
||||
<span class="sv ${(e.severity||'MEDIUM').toUpperCase()}">${esc(e.severity||'Medium')}</span>
|
||||
<span class="stt ${isArch?'archived':k}">${isArch?'Archived':EL[k]||k}</span>
|
||||
${platChip}
|
||||
${typeChip}
|
||||
${phaseChip}
|
||||
<span class="id" style="margin-left:auto">${e.events||e.occurrences||1} events · ${ago(e.last_seen||e.created_at)}</span>
|
||||
</div>
|
||||
${e.feature_name?`<p style="font-size:12px;color:var(--pri);margin-bottom:6px"><b>Feature:</b> ${esc(e.feature_name)}</p>`:''}
|
||||
${e.assigned_to?`<p style="font-size:12px;color:#a78bfa;margin-bottom:8px"><b>Assigned to Developer:</b> @${esc(e.assigned_to)}</p>`:''}
|
||||
<div style="font-size:14px;line-height:1.6;color:var(--on-s);margin:10px 0;white-space:pre-wrap"><b>Description:</b><br>${esc(e.description||e.message)}</div>
|
||||
${imgHtml}
|
||||
${blk('Additional Info & Reproduction',e.additional_info)}
|
||||
${blk('Endpoint / Route',e.endpoint)}
|
||||
${blk('Stack Trace / Logs',e.stack_trace)}
|
||||
${e.escalated_ticket_id||e.linked_ticket_id?`<p class="sub">Escalated as ${esc(e.escalated_ticket_id||e.linked_ticket_id)}</p>`:''}
|
||||
${e.resolution_notes?`<p class="sub">Resolution: ${esc(e.resolution_notes)}</p>`:''}`,
|
||||
ok:k==='resolved'?'Close':'Escalate to ticket',
|
||||
alt:k==='unresolved'?['Resolve',()=>resolveD(id)]:(k==='resolved'?[(isArch?'Restore':'Archive'),async()=>{
|
||||
const actName=isArch?'unarchive':'archive';
|
||||
@@ -1292,19 +1385,13 @@ function errD(id){
|
||||
$('#dlg').close();
|
||||
await refresh();
|
||||
}]:undefined),
|
||||
init:f=>{
|
||||
f.querySelector('#btnLogMoreForApp')?.addEventListener('click',()=>{
|
||||
$('#dlg').close();
|
||||
reportErr({app_name:appName,environment:e.environment,service:e.service,continue_app:true});
|
||||
});
|
||||
},
|
||||
go:()=>k!=='resolved'&&escD(id)});
|
||||
}
|
||||
|
||||
function escD(id){
|
||||
const e=S.e.find(x=>x.id===id);
|
||||
dlg({title:'Escalate error to ticket',sub:e.id,
|
||||
body:fld('title','Ticket title',{req:1,v:`[${e.app||e.app_name}] ${e.exception_type}: ${e.message.slice(0,60)}`})+fld('priority','Priority',{t:'select',opts:PRI,v:'P1'})+fld('assignee','Assign to',{t:'select',opts:usOpts(1),req:1}),
|
||||
body:fld('title','Ticket title',{req:1,v:`[${e.platform||'App'} · ${e.app||e.app_name}] ${e.exception_type||e.error_type}: ${e.message.slice(0,60)}`})+fld('priority','Priority',{t:'select',opts:PRI,v:'P1'})+fld('assignee','Assign to',{t:'select',opts:usOpts(1),req:1,v:e.assigned_to||''}),
|
||||
ok:'Escalate',go:async v=>{
|
||||
const r=await api(`/khira/api/errors/${encodeURIComponent(id)}/escalate`,'POST',{title:v.title,priority:v.priority,assigned_to:v.assignee});
|
||||
if(r._f){toast(r.error,'err');return false}
|
||||
@@ -1321,27 +1408,324 @@ function resolveD(id){
|
||||
}});
|
||||
}
|
||||
|
||||
/* ── Application-Oriented Error Reporting Form with Drafts ── */
|
||||
function reportErr(prefill={}){
|
||||
const currentApp=prefill.app_name||prefill.app||'';
|
||||
const continueMode=!!prefill.continue_app;
|
||||
const isEdit=!!prefill.id;
|
||||
const isDraft=!!(prefill.is_draft||prefill.status==='draft');
|
||||
const d=$('#dlg');
|
||||
d.className='wide';
|
||||
|
||||
dlg({title:continueMode&¤tApp?`Testing Phase: Assigning Errors for ${esc(currentApp)}`:'Report runtime error',
|
||||
sub:continueMode?'Log continuous errors for this application with automatic re-prompting.':'Simulate an exception from a service.',
|
||||
body:fld('app','Application',{t:'select',opts:EAPPS,req:1,v:currentApp})+fld('exception_type','Exception type',{req:1,v:'InternalServerError',opts:['CrashException','NetworkTimeoutException','AuthTokenExpiredException','TextureBindingException','ShaderCompileError','OutOfMemoryError']})+fld('message','Message',{t:'area',rows:2,req:1,v:'Unexpected fatal crash on render loop'})+fld('severity','Severity',{t:'select',opts:SEV,v:'HIGH'})+fld('environment','Environment',{req:1,v:prefill.environment||'Production'})+fld('endpoint','Endpoint',{v:prefill.endpoint||'/api/v1/render'})+fld('stack_trace','Stack trace',{t:'area',rows:3,mono:1,v:'Error at Engine.render (engine.js:42:15)'}),
|
||||
ok:continueMode?'Submit & Log Another':'Report error',
|
||||
alt:continueMode?['Submit & Done',null]:undefined,
|
||||
go:async v=>{
|
||||
const r=await api('/khira/api/errors','POST',{app_name:v.app,exception_type:v.exception_type,message:v.message,severity:v.severity.toLowerCase(),environment:v.environment,service:v.app,endpoint:v.endpoint,stack_trace:v.stack_trace});
|
||||
if(r._f){toast(r.error,'err');return false}
|
||||
toast('Error reported');
|
||||
await refresh();
|
||||
const curPlatform=prefill.platform||'iOS';
|
||||
const curPhase=prefill.current_phase||'development phase';
|
||||
const curErrorType=prefill.error_type||'Bug';
|
||||
const curAppName=prefill.app_name||prefill.app||'';
|
||||
const curVersion=prefill.version||'';
|
||||
const curScreen=prefill.error_screen||'';
|
||||
const curFeature=prefill.feature_name||prefill.service||'';
|
||||
const curDesc=prefill.description||prefill.message||'';
|
||||
const curAddInfo=prefill.additional_info||prefill.stack_trace||'';
|
||||
const curImg=prefill.image_url||'';
|
||||
const curAssignee=prefill.assigned_to||'';
|
||||
|
||||
if(continueMode){
|
||||
setTimeout(()=>{
|
||||
reportErr({app_name:v.app,environment:v.environment,endpoint:v.endpoint,continue_app:true});
|
||||
},150);
|
||||
const titleText=isEdit?(isDraft?`Edit Error Draft · ${esc(prefill.id)}`:`Edit Error · ${esc(prefill.id)}`):'Report Application Error';
|
||||
const subText=isDraft?'Edit draft fields and send to developer or save for later.':'Submit application bugs and crashes, or save as draft before final publishing.';
|
||||
|
||||
d.innerHTML=`<form class="dc" id="errReportForm" novalidate>
|
||||
<h3>${titleText}</h3>
|
||||
<p class="sub">${subText}</p>
|
||||
|
||||
<div class="db" style="padding-top:14px">
|
||||
<!-- Platform & Current Phase Selection -->
|
||||
<div class="err-form-grid">
|
||||
<div class="form-seg-group">
|
||||
<label class="form-seg-label">Platform *</label>
|
||||
<div class="seg-pills" id="platformPills">
|
||||
<button type="button" class="seg-pill ${curPlatform==='iOS'?'on':''}" data-v="iOS">
|
||||
<svg class="ic" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20.94c1.5 0 2.75 1.06 4 1.06 3 0 6-8 6-12.22A4.91 4.91 0 0 0 17 5c-2.22 0-4 1.44-5 2-1-.56-2.78-2-5-2a4.9 4.9 0 0 0-5 4.78C2 14 5 22 8 22c1.25 0 2.5-1.06 4-1.06Z"/><path d="M10 2c1 .5 2 2 2 5"/></svg>
|
||||
iOS
|
||||
</button>
|
||||
<button type="button" class="seg-pill ${curPlatform==='Android'?'on':''}" data-v="Android">
|
||||
<svg class="ic" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 18a5 5 0 0 0-10 0"/><line x1="12" y1="2" x2="12" y2="4"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="19.78" y1="4.22" x2="18.36" y2="5.64"/><circle cx="9" cy="9" r="1"/><circle cx="15" cy="9" r="1"/></svg>
|
||||
Android
|
||||
</button>
|
||||
</div>
|
||||
<input type="hidden" name="platform" id="inputPlatform" value="${esc(curPlatform)}">
|
||||
</div>
|
||||
|
||||
<div class="form-seg-group">
|
||||
<label class="form-seg-label">Current Phase *</label>
|
||||
<div class="seg-pills" id="phasePills">
|
||||
<button type="button" class="seg-pill ${curPhase==='development phase'?'on':''}" data-v="development phase">Development Phase</button>
|
||||
<button type="button" class="seg-pill ${curPhase==='ready to live'?'on':''}" data-v="ready to live">Ready to Live</button>
|
||||
</div>
|
||||
<input type="hidden" name="current_phase" id="inputPhase" value="${esc(curPhase)}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- App Name & Version -->
|
||||
<div class="err-form-grid">
|
||||
<label class="fld">
|
||||
<input name="app_name" id="errAppName" list="appNameSuggestions" placeholder=" " value="${esc(curAppName)}" required>
|
||||
<span>App name *</span>
|
||||
<datalist id="appNameSuggestions">
|
||||
<option value="Creator Suite iOS">
|
||||
<option value="Creator Suite Android">
|
||||
<option value="Image Manipulator Pro">
|
||||
<option value="Unified Dashboard Client">
|
||||
<option value="Khira Issue Tracker">
|
||||
<option value="FastAPI Backend">
|
||||
</datalist>
|
||||
</label>
|
||||
|
||||
<label class="fld">
|
||||
<input name="version" id="errVersion" placeholder=" " value="${esc(curVersion)}">
|
||||
<span>Version (e.g. 1.0.0)</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Error Screen & Feature Name -->
|
||||
<div class="err-form-grid">
|
||||
<label class="fld">
|
||||
<input name="error_screen" id="errScreen" placeholder=" " value="${esc(curScreen)}">
|
||||
<span>Error screen (e.g. Login, Canvas, Settings)</span>
|
||||
</label>
|
||||
|
||||
<label class="fld">
|
||||
<input name="feature_name" id="errFeature" placeholder=" " value="${esc(curFeature)}">
|
||||
<span>Feature name (e.g. Biometric Auth, Face Swap)</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Error Type -->
|
||||
<div class="form-seg-group">
|
||||
<label class="form-seg-label">Error Type *</label>
|
||||
<div class="seg-pills" id="errTypePills">
|
||||
<button type="button" class="seg-pill bug-pill ${curErrorType==='Bug'?'on':''}" data-v="Bug">
|
||||
${ic('bug', 15)} Bug
|
||||
</button>
|
||||
<button type="button" class="seg-pill crash-pill ${curErrorType==='Crash'?'on':''}" data-v="Crash">
|
||||
${ic('warning', 15)} Crash
|
||||
</button>
|
||||
</div>
|
||||
<input type="hidden" name="error_type" id="inputErrType" value="${esc(curErrorType)}">
|
||||
</div>
|
||||
|
||||
<!-- Description (Describe error) -->
|
||||
<label class="fld">
|
||||
<textarea name="description" id="errDesc" rows="3" placeholder=" " required>${esc(curDesc)}</textarea>
|
||||
<span>Description (Describe error) *</span>
|
||||
</label>
|
||||
|
||||
<!-- Attach image if you want to -->
|
||||
<div class="err-attach-group">
|
||||
<label class="form-seg-label">Attach image (Optional)</label>
|
||||
<div class="err-upload-box" id="errImgUploadBox">
|
||||
<input type="file" id="errImgFileInput" accept="image/*" style="display:none">
|
||||
<input type="hidden" name="image_url" id="errImgUrlInput" value="${esc(curImg)}">
|
||||
<div id="errImgPlaceholder" class="err-upload-placeholder" ${curImg?'hidden':''}>
|
||||
<svg class="ic" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
|
||||
<span>Click to attach screenshot or drag & drop</span>
|
||||
</div>
|
||||
<div id="errImgPreviewWrap" class="err-upload-preview" ${curImg?'':'hidden'}>
|
||||
<img id="errImgThumb" src="${esc(curImg)}" alt="Attached preview">
|
||||
<div class="err-upload-meta">
|
||||
<span id="errImgName" class="ell">${curImg?esc(curImg.split('/').pop()):''}</span>
|
||||
<button type="button" class="tn err-rm-img-btn" id="btnRmErrImg">× Remove image</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Any additional info -->
|
||||
<label class="fld">
|
||||
<textarea name="additional_info" id="errAddInfo" rows="2" placeholder=" ">${esc(curAddInfo)}</textarea>
|
||||
<span>Any additional info (Device model, OS build, reproduction steps)</span>
|
||||
</label>
|
||||
|
||||
<!-- Send to Developer or another person -->
|
||||
<label class="fld sel">
|
||||
<select name="assigned_to" id="errAssigneeSelect">
|
||||
<option value="">None (Unassigned)</option>
|
||||
${S.us.map(u=>`<option value="${esc(u.username)}"${u.username===curAssignee?' selected':''}>${esc(u.name)} · ${esc(u.role_display)}</option>`).join('')}
|
||||
</select>
|
||||
<span>Send / Assign to Developer (Optional)</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Actions Bar -->
|
||||
<div class="da" style="align-items:center;padding:12px 24px 0">
|
||||
<button type="button" class="tb" data-x>Cancel</button>
|
||||
${isEdit?`<button type="button" class="tb del-draft-btn" id="btnDeleteErr" style="color:#ef4444">${ic('delete',15)} Delete</button>`:''}
|
||||
<div style="flex:1"></div>
|
||||
<button type="button" class="tb draft-btn" id="btnSaveDraft">
|
||||
<svg class="ic" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;margin-right:4px"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg>
|
||||
Save as draft
|
||||
</button>
|
||||
<button type="submit" class="fb submit-err-btn" id="btnSubmitErr">
|
||||
<svg class="ic" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;margin-right:4px"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>
|
||||
${isEdit&&isDraft?'Publish & Send':'Submit'}
|
||||
</button>
|
||||
</div>
|
||||
</form>`;
|
||||
|
||||
const form=$('#errReportForm');
|
||||
|
||||
// Interactive Pill Switchers
|
||||
const bindPillGroup=(containerId, hiddenInputId)=>{
|
||||
const wrap=form.querySelector(containerId);
|
||||
const inp=form.querySelector(hiddenInputId);
|
||||
if(!wrap||!inp)return;
|
||||
wrap.querySelectorAll('.seg-pill').forEach(btn=>{
|
||||
btn.onclick=()=>{
|
||||
wrap.querySelectorAll('.seg-pill').forEach(b=>b.classList.remove('on'));
|
||||
btn.classList.add('on');
|
||||
inp.value=btn.dataset.v;
|
||||
};
|
||||
});
|
||||
};
|
||||
bindPillGroup('#platformPills','#inputPlatform');
|
||||
bindPillGroup('#phasePills','#inputPhase');
|
||||
bindPillGroup('#errTypePills','#inputErrType');
|
||||
|
||||
// Image Upload Binding
|
||||
const uploadBox=form.querySelector('#errImgUploadBox');
|
||||
const fileInput=form.querySelector('#errImgFileInput');
|
||||
const imgUrlInput=form.querySelector('#errImgUrlInput');
|
||||
const placeholder=form.querySelector('#errImgPlaceholder');
|
||||
const previewWrap=form.querySelector('#errImgPreviewWrap');
|
||||
const thumb=form.querySelector('#errImgThumb');
|
||||
const imgName=form.querySelector('#errImgName');
|
||||
const rmBtn=form.querySelector('#btnRmErrImg');
|
||||
|
||||
uploadBox.onclick=(e)=>{
|
||||
if(e.target.closest('#btnRmErrImg'))return;
|
||||
fileInput.click();
|
||||
};
|
||||
|
||||
fileInput.onchange=async()=>{
|
||||
const file=fileInput.files[0];
|
||||
if(!file)return;
|
||||
const fd=new FormData();
|
||||
fd.append('file',file);
|
||||
try{
|
||||
toast('Uploading image...');
|
||||
const res=await fetch('/khira/api/upload',{
|
||||
method:'POST',
|
||||
headers:{'X-Khira-User':S.u?.username||''},
|
||||
body:fd
|
||||
});
|
||||
const data=await res.json();
|
||||
if(data.status==='ok'&&data.attachment){
|
||||
imgUrlInput.value=data.attachment.url;
|
||||
thumb.src=data.attachment.url;
|
||||
imgName.textContent=file.name;
|
||||
placeholder.hidden=true;
|
||||
previewWrap.hidden=false;
|
||||
toast('Image attached');
|
||||
}else{
|
||||
toast(data.error||'Failed to upload image','err');
|
||||
}
|
||||
}catch(err){
|
||||
toast('Upload failed','err');
|
||||
}
|
||||
}});
|
||||
};
|
||||
|
||||
rmBtn.onclick=(e)=>{
|
||||
e.stopPropagation();
|
||||
imgUrlInput.value='';
|
||||
fileInput.value='';
|
||||
thumb.src='';
|
||||
imgName.textContent='';
|
||||
placeholder.hidden=false;
|
||||
previewWrap.hidden=true;
|
||||
};
|
||||
|
||||
// Helper to collect payload
|
||||
const getPayload=(asDraft)=>{
|
||||
const app=form.querySelector('#errAppName').value.trim()||(asDraft?'Draft Application':'');
|
||||
const desc=form.querySelector('#errDesc').value.trim()||(asDraft?'(Draft description)':'');
|
||||
const errType=form.querySelector('#inputErrType').value||'Bug';
|
||||
return {
|
||||
platform:form.querySelector('#inputPlatform').value||'iOS',
|
||||
current_phase:form.querySelector('#inputPhase').value||'development phase',
|
||||
app_name:app,
|
||||
version:form.querySelector('#errVersion').value.trim(),
|
||||
error_screen:form.querySelector('#errScreen').value.trim(),
|
||||
feature_name:form.querySelector('#errFeature').value.trim(),
|
||||
error_type:errType,
|
||||
exception_type:errType,
|
||||
description:desc,
|
||||
message:desc,
|
||||
image_url:imgUrlInput.value,
|
||||
additional_info:form.querySelector('#errAddInfo').value.trim(),
|
||||
assigned_to:form.querySelector('#errAssigneeSelect').value,
|
||||
is_draft:asDraft
|
||||
};
|
||||
};
|
||||
|
||||
// Save as draft handler
|
||||
form.querySelector('#btnSaveDraft')?.addEventListener('click',async()=>{
|
||||
const payload=getPayload(true);
|
||||
const saveBtn=form.querySelector('#btnSaveDraft');
|
||||
await busy(saveBtn,async()=>{
|
||||
let r;
|
||||
if(isEdit){
|
||||
r=await api(`/khira/api/errors/${encodeURIComponent(prefill.id)}`,'PUT',payload);
|
||||
}else{
|
||||
r=await api('/khira/api/errors','POST',payload);
|
||||
}
|
||||
if(r._f||typeof r.error==='string'){
|
||||
toast((typeof r.error==='string'?r.error:'')||'Failed to save draft','err');
|
||||
return;
|
||||
}
|
||||
toast('Draft saved successfully');
|
||||
d.close();
|
||||
await refresh();
|
||||
});
|
||||
});
|
||||
|
||||
// Submit handler (Publish)
|
||||
form.onsubmit=async(e)=>{
|
||||
e.preventDefault();
|
||||
const app=form.querySelector('#errAppName').value.trim();
|
||||
const desc=form.querySelector('#errDesc').value.trim();
|
||||
if(!app){toast('Please enter an app name','err');return}
|
||||
if(!desc){toast('Please describe the error','err');return}
|
||||
|
||||
const payload=getPayload(false);
|
||||
const submitBtn=form.querySelector('#btnSubmitErr');
|
||||
await busy(submitBtn,async()=>{
|
||||
let r;
|
||||
if(isEdit){
|
||||
r=await api(`/khira/api/errors/${encodeURIComponent(prefill.id)}`,'PUT',payload);
|
||||
}else{
|
||||
r=await api('/khira/api/errors','POST',payload);
|
||||
}
|
||||
if(r._f||typeof r.error==='string'){
|
||||
toast((typeof r.error==='string'?r.error:'')||'Failed to submit error','err');
|
||||
return;
|
||||
}
|
||||
const sentNotice=payload.assigned_to?` and sent to @${payload.assigned_to}`:'';
|
||||
toast(isEdit&&isDraft?`Draft published${sentNotice}`:`Error submitted${sentNotice}`);
|
||||
d.close();
|
||||
await refresh();
|
||||
});
|
||||
};
|
||||
|
||||
// Delete draft / error handler
|
||||
form.querySelector('#btnDeleteErr')?.addEventListener('click',async()=>{
|
||||
if(!confirm(`Are you sure you want to delete this ${isDraft?'draft':'error'}?`))return;
|
||||
const r=await api(`/khira/api/errors/${encodeURIComponent(prefill.id)}`,'DELETE');
|
||||
if(r._f||r.error){
|
||||
toast(r.error||'Delete failed','err');
|
||||
return;
|
||||
}
|
||||
toast('Error removed');
|
||||
d.close();
|
||||
await refresh();
|
||||
});
|
||||
|
||||
if(!d.open)d.showModal();
|
||||
}
|
||||
|
||||
/* ── Bulk Actions Management ── */
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto+Flex:wght@400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/khira/styles.css?v=4">
|
||||
<link rel="stylesheet" href="/khira/styles.css?v=5">
|
||||
<script>try{document.documentElement.dataset.theme=localStorage.khira_theme||'dark'}catch(e){}</script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -246,6 +246,6 @@
|
||||
<dialog id="sheet"></dialog>
|
||||
<dialog id="dlg"></dialog>
|
||||
<div class="snack" id="snack" role="status"></div>
|
||||
<script src="/khira/app.js?v=4" defer></script>
|
||||
<script src="/khira/app.js?v=6" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -2394,3 +2394,206 @@ dd { word-break: break-word; }
|
||||
border: 1px dashed rgba(56, 189, 248, 0.5) !important;
|
||||
border-radius: 18px !important;
|
||||
}
|
||||
|
||||
/* ── Application-Oriented Error Form & Drafts System ── */
|
||||
#dlg.wide {
|
||||
width: min(720px, calc(100% - 32px));
|
||||
}
|
||||
|
||||
.err-form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
.err-form-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
.err-form-full {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.form-seg-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.form-seg-label {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--on-sv);
|
||||
}
|
||||
.seg-pills {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
padding: 4px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
.seg-pill {
|
||||
flex: 1;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
padding: 8px 12px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--on-sv);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.seg-pill:hover {
|
||||
color: var(--on-s);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
.seg-pill.on {
|
||||
background: rgba(255, 255, 255, 0.14);
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
.seg-pill.bug-pill.on {
|
||||
background: linear-gradient(135deg, rgba(234, 179, 8, 0.35) 0%, rgba(202, 138, 4, 0.2) 100%);
|
||||
color: #fef08a;
|
||||
border: 1px solid rgba(250, 204, 21, 0.4);
|
||||
}
|
||||
.seg-pill.crash-pill.on {
|
||||
background: linear-gradient(135deg, rgba(239, 68, 68, 0.4) 0%, rgba(185, 28, 28, 0.25) 100%);
|
||||
color: #fca5a5;
|
||||
border: 1px solid rgba(248, 113, 113, 0.4);
|
||||
}
|
||||
|
||||
/* Image Attachment Dropzone */
|
||||
.err-attach-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.err-upload-box {
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px dashed rgba(255, 255, 255, 0.18);
|
||||
border-radius: 14px;
|
||||
padding: 14px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.err-upload-box:hover {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border-color: var(--pri);
|
||||
}
|
||||
.err-upload-placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
color: var(--on-sv);
|
||||
font-size: 13px;
|
||||
}
|
||||
.err-upload-placeholder svg {
|
||||
stroke: var(--pri);
|
||||
}
|
||||
.err-upload-preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
text-align: left;
|
||||
}
|
||||
.err-upload-preview img {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
object-fit: cover;
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.15);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.err-upload-meta {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
}
|
||||
.err-upload-meta span {
|
||||
font-size: 13px;
|
||||
color: var(--on-s);
|
||||
font-weight: 500;
|
||||
}
|
||||
.err-rm-img-btn {
|
||||
align-self: flex-start;
|
||||
color: #ef4444 !important;
|
||||
font-size: 11px !important;
|
||||
padding: 2px 8px !important;
|
||||
height: 24px !important;
|
||||
}
|
||||
|
||||
/* Draft Banner in Errors View */
|
||||
.draft-banner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px 18px;
|
||||
border-radius: 16px;
|
||||
background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.08) 100%);
|
||||
border: 1px solid rgba(245, 158, 11, 0.3);
|
||||
margin-bottom: 16px;
|
||||
font-size: 13px;
|
||||
color: #fde68a;
|
||||
}
|
||||
.draft-banner b {
|
||||
color: #fff;
|
||||
}
|
||||
.draft-btn {
|
||||
background: rgba(245, 158, 11, 0.16) !important;
|
||||
color: #fde68a !important;
|
||||
border: 1px solid rgba(245, 158, 11, 0.35) !important;
|
||||
}
|
||||
.draft-btn:hover {
|
||||
background: rgba(245, 158, 11, 0.28) !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
.stt.draft {
|
||||
background: rgba(245, 158, 11, 0.2);
|
||||
color: #fbbf24;
|
||||
border: 1px solid rgba(245, 158, 11, 0.4);
|
||||
}
|
||||
.meta-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 11px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 6px;
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
color: var(--on-sv);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
.meta-chip.ios {
|
||||
color: #38bdf8;
|
||||
border-color: rgba(56, 189, 248, 0.3);
|
||||
background: rgba(56, 189, 248, 0.1);
|
||||
}
|
||||
.meta-chip.android {
|
||||
color: #4ade80;
|
||||
border-color: rgba(74, 222, 128, 0.3);
|
||||
background: rgba(74, 222, 128, 0.1);
|
||||
}
|
||||
.meta-chip.crash {
|
||||
color: #f87171;
|
||||
border-color: rgba(248, 113, 113, 0.3);
|
||||
background: rgba(248, 113, 113, 0.1);
|
||||
}
|
||||
.meta-chip.bug {
|
||||
color: #facc15;
|
||||
border-color: rgba(250, 204, 21, 0.3);
|
||||
background: rgba(250, 204, 21, 0.1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user