From 102033e5e9bb1b118cf4efe4ac35866ae459224f Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Sun, 17 Jan 2021 19:41:58 +1100 Subject: [PATCH] Production issues fixes --- README.md | 7 +++++++ src/config.js | 12 ++++++------ src/front/src/app/projects/projects.controller.js | 2 +- src/front/src/app/projects/projects.html | 2 +- .../app/upsertproject/upsertproject.controller.js | 7 ++++++- src/front/src/app/upsertproject/upsertproject.html | 4 ++-- src/models/Issue.js | 2 +- src/models/Project.js | 3 ++- src/services/ProjectService.js | 3 ++- 9 files changed, 28 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 280b813..7e1bb89 100644 --- a/README.md +++ b/README.md @@ -87,3 +87,10 @@ Note: heroku domain should match subdomain of topcoder-dev or topcoder depending - click get link button to get the shareable link which can be used by topcoder member to self assign to the repository. Click to icon next to url to copy to clipboard. - normal member cannot use the application, allowed roles are configured in API, if normal user tries to access the app, error is shown in login page. +## Topcoder Direct ID to Connect ID migration + +Direct ID migration can be done with script located in **topcoder-x-processor** codebase called direct-connect-migration +```shell +npm run direct-connect-migration +``` +By default it takes 15 projects at time, but you can change this by specifying BATCH_SIZE environment variable. \ No newline at end of file diff --git a/src/config.js b/src/config.js index 7bcc55b..343ca06 100644 --- a/src/config.js +++ b/src/config.js @@ -78,7 +78,7 @@ const frontendConfigs = { API_URL: 'https://127.0.0.1:8443', ADMIN_TOOL_URL: 'http://localhost:8080/api/v2', ACCOUNTS_CONNECTOR_URL: 'https://accounts.topcoder-dev.com/connector.html', - DIRECT_URL_BASE: 'https://www.topcoder-dev/direct/projectOverview?formData.projectId=', + CONNECT_URL_BASE: 'https://connect.topcoder-dev/projects/', OWNER_LOGIN_GITHUB_URL: '/api/v1/github/owneruser/login', OWNER_LOGIN_GITLAB_URL: '/api/v1/gitlab/owneruser/login', TOPCODER_URL: 'https://topcoder-dev.com', @@ -93,7 +93,7 @@ const frontendConfigs = { API_URL: 'https://api.topcoder-dev.com', ADMIN_TOOL_URL: 'https://api.topcoder-dev.com/v2', ACCOUNTS_CONNECTOR_URL: 'https://accounts.topcoder-dev.com/connector.html', - DIRECT_URL_BASE: 'https://www.topcoder-dev.com/direct/projectOverview?formData.projectId=', + CONNECT_URL_BASE: 'https://connect.topcoder-dev.com/projects/', OWNER_LOGIN_GITHUB_URL: '/api/v1/github/owneruser/login', OWNER_LOGIN_GITLAB_URL: '/api/v1/gitlab/owneruser/login', TOPCODER_URL: 'https://topcoder-dev.com', @@ -108,7 +108,7 @@ const frontendConfigs = { API_URL: 'https://api.topcoder-dev.com', ADMIN_TOOL_URL: 'https://api.topcoder-dev.com/v2', ACCOUNTS_CONNECTOR_URL: 'https://accounts.topcoder-dev.com/connector.html', - DIRECT_URL_BASE: 'https://www.topcoder-dev.com/direct/projectOverview?formData.projectId=', + CONNECT_URL_BASE: 'https://connect.topcoder-dev.com/projects/', OWNER_LOGIN_GITHUB_URL: '/api/v1/github/owneruser/login', OWNER_LOGIN_GITLAB_URL: '/api/v1/gitlab/owneruser/login', TOPCODER_URL: 'https://topcoder-dev.com', @@ -123,7 +123,7 @@ const frontendConfigs = { API_URL: 'https://api.topcoder-qa.com', ADMIN_TOOL_URL: 'https://api.topcoder-qa.com/v2', ACCOUNTS_CONNECTOR_URL: 'https://accounts.topcoder-qa.com/connector.html', - DIRECT_URL_BASE: 'https://www.topcoder-dev.com/direct/projectOverview?formData.projectId=', + CONNECT_URL_BASE: 'https://connect.topcoder-dev.com/projects/', OWNER_LOGIN_GITHUB_URL: '/api/v1/github/owneruser/login', OWNER_LOGIN_GITLAB_URL: '/api/v1/gitlab/owneruser/login', TOPCODER_URL: 'https://topcoder-dev.com', @@ -138,7 +138,7 @@ const frontendConfigs = { API_URL: 'https://api.topcoder.com', ADMIN_TOOL_URL: 'https://api.topcoder.com/v2', ACCOUNTS_CONNECTOR_URL: 'https://accounts.topcoder.com/connector.html', - DIRECT_URL_BASE: 'https://www.topcoder.com/direct/projectOverview?formData.projectId=', + CONNECT_URL_BASE: 'https://connect.topcoder.com/projects/', OWNER_LOGIN_GITHUB_URL: '/api/v1/github/owneruser/login', OWNER_LOGIN_GITLAB_URL: '/api/v1/gitlab/owneruser/login', TOPCODER_URL: 'https://topcoder-dev.com', @@ -159,7 +159,7 @@ module.exports.frontendConfigs = { API_URL: process.env.API_URL || frontendConfigs[activeEnv].API_URL, ADMIN_TOOL_URL: process.env.ADMIN_TOOL_URL || frontendConfigs[activeEnv].ADMIN_TOOL_URL, ACCOUNTS_CONNECTOR_URL: process.env.ACCOUNTS_CONNECTOR_URL || frontendConfigs[activeEnv].ACCOUNTS_CONNECTOR_URL, - DIRECT_URL_BASE: process.env.DIRECT_URL_BASE || frontendConfigs[activeEnv].DIRECT_URL_BASE, + CONNECT_URL_BASE: process.env.CONNECT_URL_BASE || frontendConfigs[activeEnv].CONNECT_URL_BASE, OWNER_LOGIN_GITHUB_URL: process.env.OWNER_LOGIN_GITHUB_URL || frontendConfigs[activeEnv].OWNER_LOGIN_GITHUB_URL, OWNER_LOGIN_GITLAB_URL: process.env.OWNER_LOGIN_GITLAB_URL || frontendConfigs[activeEnv].OWNER_LOGIN_GITLAB_URL, TOPCODER_URL: process.env.TOPCODER_URL || frontendConfigs[activeEnv].TOPCODER_URL, diff --git a/src/front/src/app/projects/projects.controller.js b/src/front/src/app/projects/projects.controller.js index e9a0fbc..7d111f0 100644 --- a/src/front/src/app/projects/projects.controller.js +++ b/src/front/src/app/projects/projects.controller.js @@ -7,7 +7,7 @@ angular.module('topcoderX') $scope.title = 'Project Management'; //direct base - $scope.directUrlBase = $rootScope.appConfig.DIRECT_URL_BASE; + $scope.connectUrlBase = $rootScope.appConfig.CONNECT_URL_BASE; $scope.isAdminUser = Helper.isAdminUser(currentUser); $scope.filter = { showAll: $scope.isAdminUser, diff --git a/src/front/src/app/projects/projects.html b/src/front/src/app/projects/projects.html index 79eabc5..231d661 100644 --- a/src/front/src/app/projects/projects.html +++ b/src/front/src/app/projects/projects.html @@ -69,7 +69,7 @@

You don't have active projects right now. Please ng-class-odd="'footable-odd'"> {{project.title}} - {{project.tcDirectId}} diff --git a/src/front/src/app/upsertproject/upsertproject.controller.js b/src/front/src/app/upsertproject/upsertproject.controller.js index 1755c48..afa7865 100644 --- a/src/front/src/app/upsertproject/upsertproject.controller.js +++ b/src/front/src/app/upsertproject/upsertproject.controller.js @@ -86,9 +86,14 @@ angular.module('topcoderX').controller('ProjectController', ['currentUser', '$sc if ($scope.editing) { ProjectService.update($scope.project).then(function () { Alert.info('Project Updated Successfully', $scope); - $state.go('app.projects'); + setTimeout(function() { + $state.go('app.projects'); + }, 3000); }).catch(function (error) { Alert.error(error.data.message, $scope); + setTimeout(function() { + $state.go('app.projects'); + }, 3000); }); } else { ProjectService.create($scope.project).then(function () { diff --git a/src/front/src/app/upsertproject/upsertproject.html b/src/front/src/app/upsertproject/upsertproject.html index d3da60b..72731b2 100644 --- a/src/front/src/app/upsertproject/upsertproject.html +++ b/src/front/src/app/upsertproject/upsertproject.html @@ -55,10 +55,10 @@

{{title}}

project Title is required.

- + The Topcoder Connect Project ID of the project. You can obtain this through the URL to the - project in Topcoder Direct. For example: + project in Topcoder Connect. For example: "https://connect.topcoder.com/projects/16598" - Enter ID "16598" The TC Connect Project ID is required. diff --git a/src/models/Issue.js b/src/models/Issue.js index 5994f12..16109f9 100644 --- a/src/models/Issue.js +++ b/src/models/Issue.js @@ -48,7 +48,7 @@ const schema = new Schema({ }, }, labels: { - type: [String], + type: Array, required: false, }, assignee: {type: String, required: false}, diff --git a/src/models/Project.js b/src/models/Project.js index 60ee024..03f4613 100644 --- a/src/models/Project.js +++ b/src/models/Project.js @@ -43,7 +43,8 @@ const schema = new Schema({ type: Date, default: Date.now, }, - createCopilotPayments: {type: String, required: false} + createCopilotPayments: {type: String, required: false}, + isConnect: {type: Boolean, required: false, default: true} }); module.exports = schema; diff --git a/src/services/ProjectService.js b/src/services/ProjectService.js index 6eafe48..f9aa483 100644 --- a/src/services/ProjectService.js +++ b/src/services/ProjectService.js @@ -46,7 +46,8 @@ const projectSchema = { registeredWebhookId: Joi.string().allow(null), createdAt: Joi.date(), updatedAt: Joi.date(), - createCopilotPayments: Joi.boolean() + createCopilotPayments: Joi.boolean(), + isConnect: Joi.boolean().allow(null) }, currentUser: currentUserSchema, };