-
Notifications
You must be signed in to change notification settings - Fork 557
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat(jira): collector account from issue changelog items as much as possible * fix(jira): fix migration scripts * feat(jira): add `_tool_jira_issue_fields`, collect account field from the new table * fix(jira): fix testes * fix(jira): fix `reporter` field in issue change log items * fix(jira): fix account id when there is no from/to values * fix(jira): fix OriginalToValue in issue_changelogs * fix(jira): don't use `tmpFromAccountId` and `tmpToAccountId` in issue changelogs * fix(jira): remove all usage of `tmpFromAccountId` and `tmpToAccountId` * refactor(jira): remove some codes * fix(jira): fix e2e test * fix(jira): fix wrong key in `issueFieldMap`
- Loading branch information
Showing
20 changed files
with
791 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
backend/plugins/jira/e2e/raw_tables/_raw_jira_api_issue_fields.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
"id","params","data","url","input","created_at" | ||
70,"{""ConnectionId"":2,""BoardId"":8}","{""id"":""customfield_10315"",""name"":""cu用户单选"",""custom"":true,""orderable"":true,""navigable"":true,""searchable"":true,""clauseNames"":[""cf[10315]"",""user_single""],""schema"":{""type"":""user"",""custom"":""com.atlassian.jira.plugin.system.customfieldtypes:userpicker"",""customId"":10315}}","http://172.26.129.92:8092/rest/api/2/field","null","2024-07-11 06:49:14.517" | ||
66,"{""ConnectionId"":2,""BoardId"":8}","{""id"":""customfield_10400"",""name"":""gitBranch"",""custom"":true,""orderable"":true,""navigable"":true,""searchable"":true,""clauseNames"":[""cf[10400]"",""gitBranch""],""schema"":{""type"":""any"",""custom"":""com.xiplink.jira.git.jira_git_plugin:gitbranches"",""customId"":10400}}","http://172.26.129.92:8092/rest/api/2/field","null","2024-07-11 06:49:14.517" |
564 changes: 282 additions & 282 deletions
564
backend/plugins/jira/e2e/snapshot_tables/_tool_jira_issue_changelog_items_extractor.csv
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
backend/plugins/jira/e2e/snapshot_tables/_tool_jira_issue_fields.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
connection_id,board_id,id,name,custom,orderable,navigable,searchable,schema_type,schema_items,schema_custom,schema_custom_id,sche_custom_system,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark | ||
2,8,customfield_10315,cu用户单选,1,1,1,1,user,,com.atlassian.jira.plugin.system.customfieldtypes:userpicker,10315,,"{""ConnectionId"":2,""BoardId"":8}",_raw_jira_api_issue_fields,70, | ||
2,8,customfield_10400,gitBranch,1,1,1,1,any,,com.xiplink.jira.git.jira_git_plugin:gitbranches,10400,,"{""ConnectionId"":2,""BoardId"":8}",_raw_jira_api_issue_fields,66, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package models | ||
|
||
import "github.com/apache/incubator-devlake/core/models/common" | ||
|
||
type JiraIssueField struct { | ||
common.NoPKModel | ||
ConnectionId uint64 `gorm:"primaryKey"` | ||
BoardId uint64 `gorm:"primaryKey"` | ||
|
||
ID string `json:"id" gorm:"primaryKey"` | ||
Name string `json:"name"` | ||
Custom bool `json:"custom"` | ||
Orderable bool `json:"orderable"` | ||
Navigable bool `json:"navigable"` | ||
Searchable bool `json:"searchable"` | ||
//ClauseNames []string `json:"clauseNames"` | ||
SchemaType string `json:"schema_type"` | ||
SchemaItems string `json:"schema_items"` | ||
SchemaCustom string `json:"schema_custom"` | ||
SchemaCustomID int `json:"schema_custom_id"` | ||
ScheCustomSystem string `json:"sche_custom_system"` | ||
} | ||
|
||
func (JiraIssueField) TableName() string { | ||
return "_tool_jira_issue_fields" | ||
} |
49 changes: 49 additions & 0 deletions
49
...ugins/jira/models/migrationscripts/20240709_add_tmp_account_id_to_issue_changelog_item.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package migrationscripts | ||
|
||
import ( | ||
"github.com/apache/incubator-devlake/core/context" | ||
"github.com/apache/incubator-devlake/core/errors" | ||
"github.com/apache/incubator-devlake/core/plugin" | ||
) | ||
|
||
var _ plugin.MigrationScript = (*addTmpAccountIdToJiraIssueChangelogItem)(nil) | ||
|
||
type jiraIssueChangelogItems20240709 struct { | ||
TmpFromAccountId string | ||
TmpToAccountId string | ||
} | ||
|
||
func (jiraIssueChangelogItems20240709) TableName() string { | ||
return "_tool_jira_issue_changelog_items" | ||
} | ||
|
||
type addTmpAccountIdToJiraIssueChangelogItem struct{} | ||
|
||
func (script *addTmpAccountIdToJiraIssueChangelogItem) Up(basicRes context.BasicRes) errors.Error { | ||
return basicRes.GetDal().AutoMigrate(&jiraIssueChangelogItems20240709{}) | ||
} | ||
|
||
func (*addTmpAccountIdToJiraIssueChangelogItem) Version() uint64 { | ||
return 20240709134200 | ||
} | ||
|
||
func (*addTmpAccountIdToJiraIssueChangelogItem) Name() string { | ||
return "add TmpFromAccountId and TmpToAccountId to _tool_jira_issue_changelog_items" | ||
} |
41 changes: 41 additions & 0 deletions
41
backend/plugins/jira/models/migrationscripts/20240710_add_issue_field_table.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package migrationscripts | ||
|
||
import ( | ||
"github.com/apache/incubator-devlake/core/context" | ||
"github.com/apache/incubator-devlake/core/errors" | ||
"github.com/apache/incubator-devlake/core/plugin" | ||
"github.com/apache/incubator-devlake/plugins/jira/models/migrationscripts/archived" | ||
) | ||
|
||
var _ plugin.MigrationScript = (*addIssueFieldTable)(nil) | ||
|
||
type addIssueFieldTable struct{} | ||
|
||
func (script *addIssueFieldTable) Up(basicRes context.BasicRes) errors.Error { | ||
return basicRes.GetDal().AutoMigrate(&archived.JiraIssueField{}) | ||
} | ||
|
||
func (*addIssueFieldTable) Version() uint64 { | ||
return 20240710100000 | ||
} | ||
|
||
func (*addIssueFieldTable) Name() string { | ||
return "init table _tool_jira_issue_fields" | ||
} |
42 changes: 42 additions & 0 deletions
42
backend/plugins/jira/models/migrationscripts/archived/issue_field.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package archived | ||
|
||
import "github.com/apache/incubator-devlake/core/models/migrationscripts/archived" | ||
|
||
type JiraIssueField struct { | ||
archived.NoPKModel | ||
ConnectionId uint64 `gorm:"primaryKey"` | ||
BoardId uint64 `gorm:"primaryKey"` | ||
|
||
ID string `json:"id" gorm:"primaryKey"` | ||
Name string `json:"name"` | ||
Custom bool `json:"custom"` | ||
Orderable bool `json:"orderable"` | ||
Navigable bool `json:"navigable"` | ||
Searchable bool `json:"searchable"` | ||
SchemaType string `json:"schema_type"` | ||
SchemaItems string `json:"schema_items"` | ||
SchemaCustom string `json:"schema_custom"` | ||
SchemaCustomID int `json:"schema_custom_id"` | ||
ScheCustomSystem string `json:"sche_custom_system"` | ||
} | ||
|
||
func (JiraIssueField) TableName() string { | ||
return "_tool_jira_issue_fields" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.