Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

fix-issues/453 #457

Merged
merged 1 commit into from
Jun 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
https://github.com/topcoder-platform/topcoder-x-ui/issues/453
52cs committed Jun 2, 2022
commit 2d04d6a41a1bad7f62d799fdc121301eaa11244a
4 changes: 3 additions & 1 deletion src/front/src/app/upsertproject/upsertproject.controller.js
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ angular.module('topcoderX').controller('ProjectController', ['currentUser', '$sc
if ($rootScope.project) {
$scope.title = 'Manage a Project';
$scope.project = $rootScope.project;
$scope.project.tags = $rootScope.project.tags.split(',');
$scope.project.repoUrl = $rootScope.project.repoUrls.join(',');
$scope.editing = true;
if ($rootScope.project.tcDirectId) {
@@ -52,7 +53,8 @@ angular.module('topcoderX').controller('ProjectController', ['currentUser', '$sc
$scope.tags = [];
$scope.fetchTags = function() {
ProjectService.getTags().then(function (resp) {
$scope.tags = resp.data.map(tag => tag.name);
const s = new Set(resp.data.result.content.map(function(tag) { return tag.name; }));
$scope.tags = Array.from(s).sort();
});
}
$scope.fetchTags();
4 changes: 2 additions & 2 deletions src/models/Project.js
Original file line number Diff line number Diff line change
@@ -25,9 +25,9 @@ const schema = new Schema({
required: true
},
tags: {
type: Array,
type: String,
required: true,
default: []
default: ''
},
rocketChatWebhook: {type: String, required: false},
rocketChatChannelName: {type: String, required: false},
8 changes: 5 additions & 3 deletions src/services/ProjectService.js
Original file line number Diff line number Diff line change
@@ -212,6 +212,7 @@ async function create(project, currentUser) {
project.secretWebhookKey = guid.raw();
project.copilot = project.copilot ? project.copilot.toLowerCase() : null;
project.id = helper.generateIdentifier();
project.tags = project.tags.join(',');

const createdProject = await dbHelper.create(models.Project, project);

@@ -221,7 +222,7 @@ async function create(project, currentUser) {
try {
const challengeUUIDs = await _createOrMigrateRepository(repoUrl, project, currentUser);
if (!_.isEmpty(challengeUUIDs)) {
challengeUUIDsList.append(challengeUUIDs);
challengeUUIDsList.push(challengeUUIDs);
}
}
catch (err) {
@@ -278,6 +279,7 @@ async function update(project, currentUser) {
*/
project.owner = dbProject.owner;
project.copilot = project.copilot !== undefined ? project.copilot.toLowerCase() : null;
project.tags = project.tags.join(',');

// TODO: move the following logic into one dynamoose transaction
const repos = await dbHelper.queryRepositoriesByProjectId(project.id);
@@ -289,13 +291,13 @@ async function update(project, currentUser) {
await dbHelper.update(models.Repository, repoId, {archived: project.archived});
if (!_.isEqual(dbProject.tags, project.tags)) {
// NOTE: delay query of challengeUUIDs into topcoder-x-processor
challengeUUIDsList.append(repoUrl);
challengeUUIDsList.push(repoUrl);
}
} else {
try {
const challengeUUIDs = await _createOrMigrateRepository(repoUrl, project, currentUser);
if (!_.isEmpty(challengeUUIDs)) {
challengeUUIDsList.append(challengeUUIDs);
challengeUUIDsList.push(challengeUUIDs);
}
}
catch (err) {