From 03153c4d392e744f3f88a6b7d7d1846e01962be4 Mon Sep 17 00:00:00 2001 From: simon987 Date: Sat, 16 Feb 2019 09:56:44 -0500 Subject: [PATCH] revert accidental search&replace fail --- api/git.go | 4 +- api/main.go | 20 ++++----- api/project.go | 36 ++++++++-------- api/task.go | 4 +- api/worker.go | 4 +- storage/auth.go | 2 +- storage/monitoring.go | 18 ++++---- storage/project.go | 42 +++++++++---------- storage/task.go | 16 +++---- storage/worker.go | 16 +++---- test/api_project_test.go | 6 +-- test/api_task_test.go | 6 +-- web/angular/e2e/src/app.e2e-spec.ts | 2 +- web/angular/src/app/logs/logs.component.html | 3 +- .../project-dashboard.component.html | 4 +- .../project-dashboard.component.ts | 6 ++- .../project-list/project-list.component.ts | 4 ++ .../project-perms/project-perms.component.css | 4 -- .../project-perms/project-perms.component.ts | 2 +- web/angular/src/styles.css | 5 +++ 20 files changed, 108 insertions(+), 96 deletions(-) diff --git a/api/git.go b/api/git.go index e37b578..866ea3a 100644 --- a/api/git.go +++ b/api/git.go @@ -134,8 +134,8 @@ func (api *WebAPI) getAssociatedProject(payload *GitPayload) *storage.Project { project := api.Database.GetProjectWithRepoName(payload.Repository.FullName) logrus.WithFields(logrus.Fields{ - "projectChange": project, - }).Trace("Found projectChange associated with WebHook") + "project": project, + }).Trace("Found project associated with WebHook") return project } diff --git a/api/main.go b/api/main.go index 38a928f..0d0f813 100644 --- a/api/main.go +++ b/api/main.go @@ -83,18 +83,18 @@ func New() *WebAPI { api.router.POST("/access/grant", LogRequestMiddleware(api.WorkerGrantAccess)) api.router.POST("/access/remove", LogRequestMiddleware(api.WorkerRemoveAccess)) - api.router.POST("/projectChange/create", LogRequestMiddleware(api.ProjectCreate)) - api.router.GET("/projectChange/get/:id", LogRequestMiddleware(api.ProjectGet)) - api.router.POST("/projectChange/update/:id", LogRequestMiddleware(api.ProjectUpdate)) - api.router.GET("/projectChange/list", LogRequestMiddleware(api.ProjectGetAllProjects)) - api.router.GET("/projectChange/monitoring-between/:id", LogRequestMiddleware(api.GetSnapshotsBetween)) - api.router.GET("/projectChange/monitoring/:id", LogRequestMiddleware(api.GetNSnapshots)) - api.router.GET("/projectChange/assignees/:id", LogRequestMiddleware(api.ProjectGetAssigneeStats)) - api.router.GET("/projectChange/requests/:id", LogRequestMiddleware(api.ProjectGetAccessRequests)) - api.router.GET("/projectChange/request_access/:id", LogRequestMiddleware(api.WorkerRequestAccess)) + api.router.POST("/project/create", LogRequestMiddleware(api.ProjectCreate)) + api.router.GET("/project/get/:id", LogRequestMiddleware(api.ProjectGet)) + api.router.POST("/project/update/:id", LogRequestMiddleware(api.ProjectUpdate)) + api.router.GET("/project/list", LogRequestMiddleware(api.ProjectGetAllProjects)) + api.router.GET("/project/monitoring-between/:id", LogRequestMiddleware(api.GetSnapshotsBetween)) + api.router.GET("/project/monitoring/:id", LogRequestMiddleware(api.GetNSnapshots)) + api.router.GET("/project/assignees/:id", LogRequestMiddleware(api.ProjectGetAssigneeStats)) + api.router.GET("/project/requests/:id", LogRequestMiddleware(api.ProjectGetAccessRequests)) + api.router.GET("/project/request_access/:id", LogRequestMiddleware(api.WorkerRequestAccess)) api.router.POST("/task/create", LogRequestMiddleware(api.TaskCreate)) - api.router.GET("/task/get/:projectChange", LogRequestMiddleware(api.TaskGetFromProject)) + api.router.GET("/task/get/:project", LogRequestMiddleware(api.TaskGetFromProject)) api.router.GET("/task/get", LogRequestMiddleware(api.TaskGet)) api.router.POST("/task/release", LogRequestMiddleware(api.TaskRelease)) diff --git a/api/project.go b/api/project.go index 4f4368d..88c4049 100644 --- a/api/project.go +++ b/api/project.go @@ -44,7 +44,7 @@ type CreateProjectResponse struct { type GetProjectResponse struct { Ok bool `json:"ok"` Message string `json:"message,omitempty"` - Project *storage.Project `json:"projectChange,omitempty"` + Project *storage.Project `json:"project,omitempty"` } type GetAllProjectsResponse struct { @@ -98,24 +98,24 @@ func (api *WebAPI) ProjectCreate(r *Request) { if !isValidProject(project) { logrus.WithFields(logrus.Fields{ - "projectChange": project, - }).Warn("Invalid projectChange") + "project": project, + }).Warn("Invalid project") r.Json(CreateProjectResponse{ Ok: false, - Message: "Invalid projectChange", + Message: "Invalid project", }, 400) return } if !isProjectCreationAuthorized(project, manager) { logrus.WithFields(logrus.Fields{ - "projectChange": project, - }).Warn("Unauthorized projectChange creation") + "project": project, + }).Warn("Unauthorized project creation") r.Json(CreateProjectResponse{ Ok: false, - Message: "You are not permitted to create a projectChange with this configuration", + Message: "You are not permitted to create a project with this configuration", }, 400) return } @@ -133,8 +133,8 @@ func (api *WebAPI) ProjectCreate(r *Request) { Id: id, }) logrus.WithFields(logrus.Fields{ - "projectChange": project, - }).Debug("Created projectChange") + "project": project, + }).Debug("Created project") } func (api *WebAPI) ProjectUpdate(r *Request) { @@ -143,7 +143,7 @@ func (api *WebAPI) ProjectUpdate(r *Request) { if err != nil || id <= 0 { r.Json(CreateProjectResponse{ Ok: false, - Message: "Invalid projectChange id", + Message: "Invalid project id", }, 400) return } @@ -179,26 +179,26 @@ func (api *WebAPI) ProjectUpdate(r *Request) { }, 500) logrus.WithError(err).WithFields(logrus.Fields{ - "projectChange": project, - }).Warn("Error during projectChange update") + "project": project, + }).Warn("Error during project update") } else { r.OkJson(UpdateProjectResponse{ Ok: true, }) logrus.WithFields(logrus.Fields{ - "projectChange": project, - }).Debug("Updated projectChange") + "project": project, + }).Debug("Updated project") } } else { logrus.WithFields(logrus.Fields{ - "projectChange": project, - }).Warn("Invalid projectChange") + "project": project, + }).Warn("Invalid project") r.Json(CreateProjectResponse{ Ok: false, - Message: "Invalid projectChange", + Message: "Invalid project", }, 400) } } @@ -353,7 +353,7 @@ func (api *WebAPI) WorkerRequestAccess(r *Request) { r.Json(WorkerRequestAccessResponse{ Ok: false, Message: "Project is public, you already have " + - "an active request or you already have access to this projectChange", + "an active request or you already have access to this project", }, 400) } } diff --git a/api/task.go b/api/task.go index d9a59a3..9208014 100644 --- a/api/task.go +++ b/api/task.go @@ -14,7 +14,7 @@ import ( ) type CreateTaskRequest struct { - Project int64 `json:"projectChange"` + Project int64 `json:"project"` MaxRetries int64 `json:"max_retries"` Recipe string `json:"recipe"` Priority int64 `json:"priority"` @@ -123,7 +123,7 @@ func (api *WebAPI) TaskGetFromProject(r *Request) { return } - project, err := strconv.ParseInt(r.Ctx.UserValue("projectChange").(string), 10, 64) + project, err := strconv.ParseInt(r.Ctx.UserValue("project").(string), 10, 64) handleErr(err, r) task := api.Database.GetTaskFromProject(worker, project) diff --git a/api/worker.go b/api/worker.go index 15ac642..83492d5 100644 --- a/api/worker.go +++ b/api/worker.go @@ -146,7 +146,7 @@ func (api *WebAPI) WorkerGrantAccess(r *Request) { } else { r.OkJson(WorkerAccessResponse{ Ok: false, - Message: "Worker already has access to this projectChange", + Message: "Worker already has access to this project", }) } } @@ -171,7 +171,7 @@ func (api *WebAPI) WorkerRemoveAccess(r *Request) { } else { r.OkJson(WorkerAccessResponse{ Ok: false, - Message: "Worker did not have access to this projectChange", + Message: "Worker did not have access to this project", }) } } diff --git a/storage/auth.go b/storage/auth.go index dab9b96..1a5f3f4 100644 --- a/storage/auth.go +++ b/storage/auth.go @@ -131,7 +131,7 @@ func (database *Database) ManagerHasRoleOn(manager *Manager, projectId int64) Ma db := database.getDB() row := db.QueryRow(`SELECT role FROM manager_has_role_on_project - WHERE projectChange=$1 AND manager=$2`, projectId, manager.Id) + WHERE project=$1 AND manager=$2`, projectId, manager.Id) var role ManagerRole err := row.Scan(&role) diff --git a/storage/monitoring.go b/storage/monitoring.go index 35b173f..978bdac 100644 --- a/storage/monitoring.go +++ b/storage/monitoring.go @@ -22,19 +22,19 @@ func (database *Database) MakeProjectSnapshots() { insertRes, err := db.Exec(` INSERT INTO project_monitoring_snapshot - (projectChange, new_task_count, failed_task_count, closed_task_count, worker_access_count, + (project, new_task_count, failed_task_count, closed_task_count, worker_access_count, awaiting_verification_task_count, timestamp) SELECT id, (SELECT COUNT(*) FROM task LEFT JOIN worker_verifies_task wvt on task.id = wvt.task - WHERE task.projectChange = projectChange.id AND status = 1 AND wvt.task IS NULL), - (SELECT COUNT(*) FROM task WHERE task.projectChange = projectChange.id AND status = 2), + WHERE task.project = project.id AND status = 1 AND wvt.task IS NULL), + (SELECT COUNT(*) FROM task WHERE task.project = project.id AND status = 2), closed_task_count, - (SELECT COUNT(*) FROM worker_has_access_to_project wa WHERE wa.projectChange = projectChange.id), + (SELECT COUNT(*) FROM worker_has_access_to_project wa WHERE wa.project = project.id), (SELECT COUNT(*) FROM worker_verifies_task INNER JOIN task t on worker_verifies_task.task = t.id - WHERE t.projectChange = projectChange.id), + WHERE t.project = project.id), extract(epoch from now() at time zone 'utc') - FROM projectChange`) + FROM project`) handleErr(err) inserted, _ := insertRes.RowsAffected() @@ -47,7 +47,7 @@ func (database *Database) MakeProjectSnapshots() { "took": time.Now().Sub(startTime), "add": inserted, "remove": deleted, - }).Trace("Took projectChange monitoring snapshot") + }).Trace("Took project monitoring snapshot") } func (database *Database) GetMonitoringSnapshotsBetween(pid int64, from int, to int) (ss *[]ProjectMonitoringSnapshot) { @@ -58,7 +58,7 @@ func (database *Database) GetMonitoringSnapshotsBetween(pid int64, from int, to rows, err := db.Query(`SELECT new_task_count, failed_task_count, closed_task_count, worker_access_count, awaiting_verification_task_count, timestamp FROM project_monitoring_snapshot - WHERE projectChange=$1 AND timestamp BETWEEN $2 AND $3 ORDER BY TIMESTAMP DESC `, pid, from, to) + WHERE project=$1 AND timestamp BETWEEN $2 AND $3 ORDER BY TIMESTAMP DESC `, pid, from, to) handleErr(err) for rows.Next() { @@ -89,7 +89,7 @@ func (database *Database) GetNMonitoringSnapshots(pid int64, count int) (ss *[]P rows, err := db.Query(`SELECT new_task_count, failed_task_count, closed_task_count, worker_access_count, awaiting_verification_task_count, timestamp FROM project_monitoring_snapshot - WHERE projectChange=$1 ORDER BY TIMESTAMP DESC LIMIT $2`, pid, count) + WHERE project=$1 ORDER BY TIMESTAMP DESC LIMIT $2`, pid, count) handleErr(err) for rows.Next() { diff --git a/storage/project.go b/storage/project.go index f4722f3..84e9d73 100644 --- a/storage/project.go +++ b/storage/project.go @@ -27,7 +27,7 @@ type AssignedTasks struct { func (database *Database) SaveProject(project *Project) (int64, error) { db := database.getDB() - row := db.QueryRow(`INSERT INTO projectChange (name, git_repo, clone_url, version, priority, + row := db.QueryRow(`INSERT INTO project (name, git_repo, clone_url, version, priority, motd, public, hidden, chain) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,NULLIF($9, 0)) RETURNING id`, project.Name, project.GitRepo, project.CloneUrl, project.Version, project.Priority, project.Motd, @@ -38,17 +38,17 @@ func (database *Database) SaveProject(project *Project) (int64, error) { if err != nil { logrus.WithError(err).WithFields(logrus.Fields{ - "projectChange": project, - }).Warn("Database.saveProject INSERT projectChange ERROR") + "project": project, + }).Warn("Database.saveProject INSERT project ERROR") return -1, err } project.Id = id logrus.WithFields(logrus.Fields{ - "id": id, - "projectChange": project, - }).Trace("Database.saveProject INSERT projectChange") + "id": id, + "project": project, + }).Trace("Database.saveProject INSERT project") return id, nil } @@ -58,20 +58,20 @@ func (database *Database) GetProject(id int64) *Project { db := database.getDB() row := db.QueryRow(`SELECT id, priority, name, clone_url, git_repo, version, motd, public, hidden, COALESCE(chain, 0) - FROM projectChange WHERE id=$1`, id) + FROM project WHERE id=$1`, id) project, err := scanProject(row) if err != nil { logrus.WithError(err).WithFields(logrus.Fields{ "id": id, - }).Warn("Database.getProject SELECT projectChange NOT FOUND") + }).Warn("Database.getProject SELECT project NOT FOUND") return nil } logrus.WithFields(logrus.Fields{ - "id": id, - "projectChange": project, - }).Trace("Database.saveProject SELECT projectChange") + "id": id, + "project": project, + }).Trace("Database.saveProject SELECT project") return project } @@ -89,14 +89,14 @@ func (database *Database) GetProjectWithRepoName(repoName string) *Project { db := database.getDB() row := db.QueryRow(`SELECT id, priority, name, clone_url, git_repo, version, - motd, public, hidden, COALESCE(chain, 0) FROM projectChange WHERE LOWER(git_repo)=$1`, + motd, public, hidden, COALESCE(chain, 0) FROM project WHERE LOWER(git_repo)=$1`, strings.ToLower(repoName)) project, err := scanProject(row) if err != nil { logrus.WithError(err).WithFields(logrus.Fields{ "repoName": repoName, - }).Warn("Database.getProjectWithRepoName SELECT projectChange NOT FOUND") + }).Warn("Database.getProjectWithRepoName SELECT project NOT FOUND") return nil } @@ -107,7 +107,7 @@ func (database *Database) UpdateProject(project *Project) error { db := database.getDB() - res, err := db.Exec(`UPDATE projectChange + res, err := db.Exec(`UPDATE project SET (priority, name, clone_url, git_repo, version, motd, public, hidden, chain) = ($1,$2,$3,$4,$5,$6,$7,$8,NULLIF($9, 0)) WHERE id=$10`, @@ -120,9 +120,9 @@ func (database *Database) UpdateProject(project *Project) error { rowsAffected, _ := res.RowsAffected() logrus.WithFields(logrus.Fields{ - "projectChange": project, - "rowsAffected": rowsAffected, - }).Trace("Database.updateProject UPDATE projectChange") + "project": project, + "rowsAffected": rowsAffected, + }).Trace("Database.updateProject UPDATE project") return nil } @@ -136,14 +136,14 @@ func (database Database) GetAllProjects(workerId int64) *[]Project { if workerId == 0 { rows, err = db.Query(`SELECT Id, priority, name, clone_url, git_repo, version, motd, public, hidden, COALESCE(chain,0) - FROM projectChange + FROM project WHERE NOT hidden ORDER BY name`) } else { rows, err = db.Query(`SELECT Id, priority, name, clone_url, git_repo, version, motd, public, hidden, COALESCE(chain,0) - FROM projectChange - LEFT JOIN worker_has_access_to_project whatp ON whatp.projectChange = id + FROM project + LEFT JOIN worker_has_access_to_project whatp ON whatp.project = id WHERE NOT hidden OR whatp.worker = $1 ORDER BY name`, workerId) } @@ -171,7 +171,7 @@ func (database *Database) GetAssigneeStats(pid int64, count int64) *[]AssignedTa assignees := make([]AssignedTasks, 0) rows, err := db.Query(`SELECT worker.alias, COUNT(*) as wc FROM TASK - LEFT JOIN worker ON TASK.assignee = worker.id WHERE projectChange=$1 + LEFT JOIN worker ON TASK.assignee = worker.id WHERE project=$1 GROUP BY worker.id ORDER BY wc LIMIT $2`, pid, count) handleErr(err) diff --git a/storage/task.go b/storage/task.go index 2891ec0..0ddbc4e 100644 --- a/storage/task.go +++ b/storage/task.go @@ -9,7 +9,7 @@ import ( type Task struct { Id int64 `json:"id"` Priority int64 `json:"priority"` - Project *Project `json:"projectChange"` + Project *Project `json:"project"` Assignee int64 `json:"assignee"` Retries int64 `json:"retries"` MaxRetries int64 `json:"max_retries"` @@ -41,7 +41,7 @@ func (database *Database) SaveTask(task *Task, project int64, hash64 int64) erro //TODO: For some reason it refuses to insert the 64-bit value unless I do that... res, err := db.Exec(fmt.Sprintf(` - INSERT INTO task (projectChange, max_retries, recipe, priority, max_assign_time, hash64,verification_count) + INSERT INTO task (project, max_retries, recipe, priority, max_assign_time, hash64,verification_count) VALUES ($1,$2,$3,$4,$5,NULLIF(%d, 0),$6)`, hash64), project, task.MaxRetries, task.Recipe, task.Priority, task.MaxAssignTime, task.VerificationCount) if err != nil { @@ -73,11 +73,11 @@ func (database *Database) GetTask(worker *Worker) *Task { ( SELECT task.id FROM task - INNER JOIN projectChange project on task.projectChange = project.id + INNER JOIN project project on task.project = project.id LEFT JOIN worker_verifies_task wvt on task.id = wvt.task AND wvt.worker=$1 WHERE assignee IS NULL AND task.status=1 AND (project.public OR EXISTS ( - SELECT 1 FROM worker_has_access_to_project a WHERE a.worker=$1 AND a.projectChange=project.id + SELECT 1 FROM worker_has_access_to_project a WHERE a.worker=$1 AND a.project=project.id )) AND wvt.task IS NULL ORDER BY project.priority DESC, task.priority DESC @@ -107,10 +107,10 @@ func (database *Database) GetTask(worker *Worker) *Task { func getTaskById(id int64, db *sql.DB) *Task { row := db.QueryRow(` - SELECT task.id, task.priority, task.projectChange, assignee, retries, max_retries, + SELECT task.id, task.priority, task.project, assignee, retries, max_retries, status, recipe, max_assign_time, assign_time, verification_count, project.priority, project.name, project.clone_url, project.git_repo, project.version, project.motd, project.public, COALESCE(project.chain,0) FROM task - INNER JOIN projectChange project ON task.projectChange = project.id + INNER JOIN project project ON task.project = project.id WHERE task.id=$1`, id) project := &Project{} task := &Task{} @@ -176,11 +176,11 @@ func (database *Database) GetTaskFromProject(worker *Worker, projectId int64) *T ( SELECT task.id FROM task - INNER JOIN projectChange project on task.projectChange = project.id + INNER JOIN project project on task.project = project.id LEFT JOIN worker_verifies_task wvt on task.id = wvt.task AND wvt.worker=$1 WHERE assignee IS NULL AND project.id=$2 AND status=1 AND (project.public OR EXISTS ( - SELECT 1 FROM worker_has_access_to_project a WHERE a.worker=$1 AND a.projectChange=$2 + SELECT 1 FROM worker_has_access_to_project a WHERE a.worker=$1 AND a.project=$2 )) AND wvt.task IS NULL ORDER BY task.priority DESC diff --git a/storage/worker.go b/storage/worker.go index 86942db..100c950 100644 --- a/storage/worker.go +++ b/storage/worker.go @@ -56,7 +56,7 @@ func (database *Database) GetWorker(id int64) *Worker { func (database *Database) GrantAccess(workerId int64, projectId int64) bool { db := database.getDB() - res, err := db.Exec(`INSERT INTO worker_has_access_to_project (worker, projectChange) VALUES ($1,$2) + res, err := db.Exec(`INSERT INTO worker_has_access_to_project (worker, project) VALUES ($1,$2) ON CONFLICT DO NOTHING`, workerId, projectId) if err != nil { @@ -81,7 +81,7 @@ func (database *Database) GrantAccess(workerId int64, projectId int64) bool { func (database *Database) RemoveAccess(workerId int64, projectId int64) bool { db := database.getDB() - res, err := db.Exec(`DELETE FROM worker_has_access_to_project WHERE worker=$1 AND projectChange=$2`, + res, err := db.Exec(`DELETE FROM worker_has_access_to_project WHERE worker=$1 AND project=$2`, workerId, projectId) handleErr(err) @@ -118,8 +118,8 @@ func (database *Database) SaveAccessRequest(worker *Worker, projectId int64) boo db := database.getDB() res, err := db.Exec(`INSERT INTO worker_requests_access_to_project - SELECT $1, id FROM projectChange WHERE id=$2 AND NOT projectChange.public - AND NOT EXISTS(SELECT * FROM worker_has_access_to_project WHERE worker=$1 AND projectChange=$2)`, + SELECT $1, id FROM project WHERE id=$2 AND NOT project.public + AND NOT EXISTS(SELECT * FROM worker_has_access_to_project WHERE worker=$1 AND project=$2)`, worker.Id, projectId) if err != nil { return false @@ -139,13 +139,13 @@ func (database *Database) AcceptAccessRequest(worker *Worker, projectId int64) b db := database.getDB() res, err := db.Exec(`DELETE FROM worker_requests_access_to_project - WHERE worker=$1 AND projectChange=$2`) + WHERE worker=$1 AND project=$2`) handleErr(err) rowsAffected, _ := res.RowsAffected() if rowsAffected == 1 { _, err := db.Exec(`INSERT INTO worker_has_access_to_project - (worker, projectChange) VALUES ($1,$2)`, + (worker, project) VALUES ($1,$2)`, worker.Id, projectId) handleErr(err) } @@ -162,7 +162,7 @@ func (database *Database) RejectAccessRequest(worker *Worker, projectId int64) b db := database.getDB() res, err := db.Exec(`DELETE FROM worker_requests_access_to_project - WHERE worker=$1 AND projectChange=$2`, worker.Id, projectId) + WHERE worker=$1 AND project=$2`, worker.Id, projectId) handleErr(err) rowsAffected, _ := res.RowsAffected() @@ -180,7 +180,7 @@ func (database *Database) GetAllAccessRequests(projectId int64) *[]Worker { rows, err := db.Query(`SELECT id, alias, created FROM worker_requests_access_to_project INNER JOIN worker w on worker_requests_access_to_project.worker = w.id - WHERE projectChange=$1`, + WHERE project=$1`, projectId) handleErr(err) diff --git a/test/api_project_test.go b/test/api_project_test.go index 3e52ed5..cac4703 100644 --- a/test/api_project_test.go +++ b/test/api_project_test.go @@ -245,7 +245,7 @@ func TestUpdateProjectConstraintFail(t *testing.T) { func createProject(req api.CreateProjectRequest) *api.CreateProjectResponse { - r := Post("/projectChange/create", req, nil) + r := Post("/project/create", req, nil) var resp api.CreateProjectResponse data, _ := ioutil.ReadAll(r.Body) @@ -257,7 +257,7 @@ func createProject(req api.CreateProjectRequest) *api.CreateProjectResponse { func getProject(id int64) (*api.GetProjectResponse, *http.Response) { - r := Get(fmt.Sprintf("/projectChange/get/%d", id), nil) + r := Get(fmt.Sprintf("/project/get/%d", id), nil) var getResp api.GetProjectResponse data, _ := ioutil.ReadAll(r.Body) @@ -269,7 +269,7 @@ func getProject(id int64) (*api.GetProjectResponse, *http.Response) { func updateProject(request api.UpdateProjectRequest, pid int64) *api.UpdateProjectResponse { - r := Post(fmt.Sprintf("/projectChange/update/%d", pid), request, nil) + r := Post(fmt.Sprintf("/project/update/%d", pid), request, nil) var resp api.UpdateProjectResponse data, _ := ioutil.ReadAll(r.Body) diff --git a/test/api_task_test.go b/test/api_task_test.go index 8506a5e..9e5b04f 100644 --- a/test/api_task_test.go +++ b/test/api_task_test.go @@ -11,7 +11,7 @@ import ( func TestCreateTaskValid(t *testing.T) { - //Make sure there is always a projectChange for id:1 + //Make sure there is always a project for id:1 createProject(api.CreateProjectRequest{ Name: "Some Test name", Version: "Test Version", @@ -132,9 +132,9 @@ func TestCreateTaskInvalidRecipe(t *testing.T) { func TestCreateGetTask(t *testing.T) { - //Make sure there is always a projectChange for id:1 + //Make sure there is always a project for id:1 resp := createProject(api.CreateProjectRequest{ - Name: "My projectChange", + Name: "My project", Version: "1.0", CloneUrl: "http://github.com/test/test", GitRepo: "myrepo", diff --git a/web/angular/e2e/src/app.e2e-spec.ts b/web/angular/e2e/src/app.e2e-spec.ts index c1b437e..3c41391 100755 --- a/web/angular/e2e/src/app.e2e-spec.ts +++ b/web/angular/e2e/src/app.e2e-spec.ts @@ -1,7 +1,7 @@ import {AppPage} from './app.po'; import {browser, logging} from 'protractor'; -describe('workspace-projectChange App', () => { +describe('workspace-project App', () => { let page: AppPage; beforeEach(() => { diff --git a/web/angular/src/app/logs/logs.component.html b/web/angular/src/app/logs/logs.component.html index 8fe3a45..f19f1bc 100644 --- a/web/angular/src/app/logs/logs.component.html +++ b/web/angular/src/app/logs/logs.component.html @@ -42,7 +42,8 @@ {{"logs.message" | translate}} - {{entry.message}} + {{entry.message}} {{"logs.data" | translate}} diff --git a/web/angular/src/app/project-dashboard/project-dashboard.component.html b/web/angular/src/app/project-dashboard/project-dashboard.component.html index df3b7d1..cd73769 100644 --- a/web/angular/src/app/project-dashboard/project-dashboard.component.html +++ b/web/angular/src/app/project-dashboard/project-dashboard.component.html @@ -12,7 +12,9 @@

{{"project.git_repo" | translate}}: - {{project.git_repo}} + {{project.git_repo}} + {{project['git_repo']}}

{{"project.motd" | translate}}:

{{project.motd}}
diff --git a/web/angular/src/app/project-dashboard/project-dashboard.component.ts b/web/angular/src/app/project-dashboard/project-dashboard.component.ts index ef8673f..c52b083 100644 --- a/web/angular/src/app/project-dashboard/project-dashboard.component.ts +++ b/web/angular/src/app/project-dashboard/project-dashboard.component.ts @@ -44,13 +44,17 @@ export class ProjectDashboardComponent implements OnInit { constructor(private apiService: ApiService, private route: ActivatedRoute) { } - ngOnInit(): void { this.route.params.subscribe(params => { this.projectId = params["id"]; this.getProject(); }); + } + public isSafeUrl(url: string) { + if (url.substr(0, "http".length) == "http") { + return true + } } public refresh() { diff --git a/web/angular/src/app/project-list/project-list.component.ts b/web/angular/src/app/project-list/project-list.component.ts index 9213fa1..432e3d6 100755 --- a/web/angular/src/app/project-list/project-list.component.ts +++ b/web/angular/src/app/project-list/project-list.component.ts @@ -20,6 +20,10 @@ export class ProjectListComponent implements OnInit { this.getProjects() } + refresh() { + this.getProjects(); + } + getProjects() { this.apiService.getProjects().subscribe(data => this.projects = data["projects"]); } diff --git a/web/angular/src/app/project-perms/project-perms.component.css b/web/angular/src/app/project-perms/project-perms.component.css index 8c169ea..f94e490 100644 --- a/web/angular/src/app/project-perms/project-perms.component.css +++ b/web/angular/src/app/project-perms/project-perms.component.css @@ -1,7 +1,3 @@ -.text-mono { - font-family: Hack, Courier, "Courier New", monospace; - color: #ff4081; -} button { margin-left: 15px; diff --git a/web/angular/src/app/project-perms/project-perms.component.ts b/web/angular/src/app/project-perms/project-perms.component.ts index 3be1d7c..48fd1c9 100644 --- a/web/angular/src/app/project-perms/project-perms.component.ts +++ b/web/angular/src/app/project-perms/project-perms.component.ts @@ -38,7 +38,7 @@ export class ProjectPermsComponent implements OnInit { private getProject() { this.apiService.getProject(this.projectId).subscribe(data => { - this.project = data["projectChange"] + this.project = data["project"] }) } diff --git a/web/angular/src/styles.css b/web/angular/src/styles.css index e7c1faf..b6ac0cd 100644 --- a/web/angular/src/styles.css +++ b/web/angular/src/styles.css @@ -94,3 +94,8 @@ pre { margin-top: 2em !important; } +.text-mono { + font-family: Hack, Courier, "Courier New", monospace; + color: #ff4081; +} +