Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
AutoJira
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile
AutoJira
Commits
cfbc45c8
Commit
cfbc45c8
authored
Mar 26, 2019
by
汪洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
任务拆分第二阶段OK
parent
8809db87
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
43 deletions
+66
-43
Breakpoints_v2.xcbkptlist
...wangyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+1
-1
Main.storyboard
AutoJira/Base.lproj/Main.storyboard
+2
-1
RepeatdWork.swift
AutoJira/RepeatdWork.swift
+2
-4
Story.swift
AutoJira/Story.swift
+5
-4
ViewController.swift
AutoJira/ViewController.swift
+56
-33
No files found.
AutoJira.xcworkspace/xcuserdata/wangyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
View file @
cfbc45c8
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
ignoreCount =
"0"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
continueAfterRunningActions =
"No"
filePath =
"AutoJira/Page.swift"
filePath =
"AutoJira/Page.swift"
timestampString =
"574
068187.2949851
"
timestampString =
"574
140957.231858
"
startingColumnNumber =
"9223372036854775807"
startingColumnNumber =
"9223372036854775807"
endingColumnNumber =
"9223372036854775807"
endingColumnNumber =
"9223372036854775807"
startingLineNumber =
"89"
startingLineNumber =
"89"
...
...
AutoJira/Base.lproj/Main.storyboard
View file @
cfbc45c8
...
@@ -721,7 +721,7 @@
...
@@ -721,7 +721,7 @@
<color
key=
"textColor"
name=
"textColor"
catalog=
"System"
colorSpace=
"catalog"
/>
<color
key=
"textColor"
name=
"textColor"
catalog=
"System"
colorSpace=
"catalog"
/>
<color
key=
"backgroundColor"
name=
"textBackgroundColor"
catalog=
"System"
colorSpace=
"catalog"
/>
<color
key=
"backgroundColor"
name=
"textBackgroundColor"
catalog=
"System"
colorSpace=
"catalog"
/>
<size
key=
"minSize"
width=
"677"
height=
"135"
/>
<size
key=
"minSize"
width=
"677"
height=
"135"
/>
<size
key=
"maxSize"
width=
"6
77
"
height=
"10000000"
/>
<size
key=
"maxSize"
width=
"6
92
"
height=
"10000000"
/>
<color
key=
"insertionPointColor"
name=
"textColor"
catalog=
"System"
colorSpace=
"catalog"
/>
<color
key=
"insertionPointColor"
name=
"textColor"
catalog=
"System"
colorSpace=
"catalog"
/>
</textView>
</textView>
</subviews>
</subviews>
...
@@ -844,6 +844,7 @@
...
@@ -844,6 +844,7 @@
</view>
</view>
<connections>
<connections>
<outlet
property=
"logTextView"
destination=
"oWH-27-6AA"
id=
"HNL-mY-PU6"
/>
<outlet
property=
"logTextView"
destination=
"oWH-27-6AA"
id=
"HNL-mY-PU6"
/>
<outlet
property=
"segment"
destination=
"Odk-md-Lt7"
id=
"rC3-jS-ysv"
/>
<outlet
property=
"urlTextField"
destination=
"pLx-ea-hpy"
id=
"5IN-61-bR6"
/>
<outlet
property=
"urlTextField"
destination=
"pLx-ea-hpy"
id=
"5IN-61-bR6"
/>
<outlet
property=
"versionPopup"
destination=
"Ajo-Dg-gTt"
id=
"Nus-dW-6QJ"
/>
<outlet
property=
"versionPopup"
destination=
"Ajo-Dg-gTt"
id=
"Nus-dW-6QJ"
/>
</connections>
</connections>
...
...
AutoJira/RepeatdWork.swift
View file @
cfbc45c8
...
@@ -10,10 +10,8 @@ import Foundation
...
@@ -10,10 +10,8 @@ import Foundation
import
Kanna
import
Kanna
import
ReactiveCocoa
import
ReactiveCocoa
struct
RepeatedWork
{
struct
RepeatedWork
{
static
var
sprint
:
Sprint
?
static
var
jira
:
JIRA
?
// url是“开发与测试资源安排”中的迭代文件
// url是“开发与测试资源安排”中的迭代文件
static
func
fuckit
(
on
sprintUrl
:
String
)
{
static
func
fuckit
(
on
sprintUrl
:
String
)
{
...
@@ -56,7 +54,7 @@ struct RepeatedWork {
...
@@ -56,7 +54,7 @@ struct RepeatedWork {
continue
continue
}
}
if
let
story
=
Story
.
createStory
(
with
:
page
.
title
)
{
if
let
story
=
Story
.
createStory
(
with
:
page
.
title
,
jiraProjectId
:
RepeatedWork
.
jira
!.
jiraProjectId
)
{
page
.
story
=
story
page
.
story
=
story
}
else
{
}
else
{
Log
.
append
(
"
\(
node
.
toHTML
!
)
story创建出错"
)
Log
.
append
(
"
\(
node
.
toHTML
!
)
story创建出错"
)
...
...
AutoJira/Story.swift
View file @
cfbc45c8
...
@@ -28,13 +28,14 @@ class Story: NSObject {
...
@@ -28,13 +28,14 @@ class Story: NSObject {
///
///
/// - Parameter page: Page实例
/// - Parameter page: Page实例
/// - Returns: storyKey
/// - Returns: storyKey
static
func
createStory
(
with
title
:
String
)
->
Story
?
{
static
func
createStory
(
with
title
:
String
,
jiraProjectId
:
String
)
->
Story
?
{
Log
.
append
(
"创建story"
)
Log
.
append
(
"创建story"
)
let
url
=
URL
(
string
:
"http://wiki.wanmeizhensuo.com/rest/jira-integration/1.0/issues?applicationId=54ed5447-b029-3ef0-b638-681b4647313b"
)
!
let
url
=
URL
(
string
:
"http://wiki.wanmeizhensuo.com/rest/jira-integration/1.0/issues?applicationId=54ed5447-b029-3ef0-b638-681b4647313b"
)
!
var
request
=
URLRequest
(
url
:
url
)
var
request
=
URLRequest
(
url
:
url
)
request
.
httpMethod
=
"POST"
request
.
httpMethod
=
"POST"
request
.
setValue
(
"application/json"
,
forHTTPHeaderField
:
"Content-Type"
)
request
.
setValue
(
"application/json"
,
forHTTPHeaderField
:
"Content-Type"
)
let
jsonDic
=
[
"issues"
:
[[
"fields"
:[
"project"
:[
"id"
:
"10108"
],
"issuetype"
:[
"id"
:
"10001"
],
"summary"
:
title
]]]]
let
jsonDic
=
[
"issues"
:
[[
"fields"
:[
"project"
:[
"id"
:
RepeatedWork
.
jira
!.
jiraProjectId
],
"issuetype"
:[
"id"
:
"10001"
],
"summary"
:
title
]]]]
request
.
httpBody
=
try
?
JSONSerialization
.
data
(
withJSONObject
:
jsonDic
,
options
:
[])
request
.
httpBody
=
try
?
JSONSerialization
.
data
(
withJSONObject
:
jsonDic
,
options
:
[])
var
story
:
Story
?
var
story
:
Story
?
request
.
sync
{
(
data
,
response
,
error
)
in
request
.
sync
{
(
data
,
response
,
error
)
in
...
@@ -43,7 +44,7 @@ class Story: NSObject {
...
@@ -43,7 +44,7 @@ class Story: NSObject {
return
return
}
}
if
let
json
=
(
try
?
JSONSerialization
.
jsonObject
(
with
:
data
!
,
options
:
JSONSerialization
.
ReadingOptions
.
allowFragments
))
as?
[
String
:
Any
],
if
let
json
=
(
try
?
JSONSerialization
.
jsonObject
(
with
:
data
!
,
options
:
JSONSerialization
.
ReadingOptions
.
allowFragments
))
as?
[
String
:
Any
],
let
issues
=
json
[
"issues"
]
as?
[
Any
],
let
issues
=
json
[
"issues"
]
as?
[
Any
],
issues
.
count
>
0
,
let
issueInfo
=
issues
[
0
]
as?
[
String
:
Any
],
let
issueInfo
=
issues
[
0
]
as?
[
String
:
Any
],
let
issue
=
issueInfo
[
"issue"
]
as?
[
String
:
Any
],
let
issue
=
issueInfo
[
"issue"
]
as?
[
String
:
Any
],
let
key
=
issue
[
"key"
]
as?
String
,
let
key
=
issue
[
"key"
]
as?
String
,
...
@@ -141,7 +142,7 @@ class Story: NSObject {
...
@@ -141,7 +142,7 @@ class Story: NSObject {
return
nil
return
nil
}
}
let
formData
=
"id=
\(
storyId
)
&atl_token=
\(
atl_token
)
&formToken=
\(
formToken
)
&assignee=
\(
assignee
)
&customfield_10005=
\(
RepeatedWork
.
s
print
!.
id
)
&isCreateIssue=false&isEditIssue=true&summary=
\(
summary
)
&issuetype=10001&reporter=wangyang&description=开始时间%2B开发人员%2B任务名称%2B预计开发时间"
let
formData
=
"id=
\(
storyId
)
&atl_token=
\(
atl_token
)
&formToken=
\(
formToken
)
&assignee=
\(
assignee
)
&customfield_10005=
\(
RepeatedWork
.
jira
!.
currentS
print
!.
id
)
&isCreateIssue=false&isEditIssue=true&summary=
\(
summary
)
&issuetype=10001&reporter=wangyang&description=开始时间%2B开发人员%2B任务名称%2B预计开发时间"
return
formData
return
formData
}
}
...
...
AutoJira/ViewController.swift
View file @
cfbc45c8
...
@@ -19,6 +19,7 @@ struct Sprint {
...
@@ -19,6 +19,7 @@ struct Sprint {
let
name
:
String
let
name
:
String
let
id
:
Int
let
id
:
Int
let
stateKey
:
SprintState
let
stateKey
:
SprintState
init
(
dic
:
[
String
:
Any
])
{
init
(
dic
:
[
String
:
Any
])
{
if
let
name
=
dic
[
"name"
]
as?
String
,
if
let
name
=
dic
[
"name"
]
as?
String
,
let
id
=
dic
[
"id"
]
as?
Int
,
let
id
=
dic
[
"id"
]
as?
Int
,
...
@@ -35,47 +36,39 @@ struct Sprint {
...
@@ -35,47 +36,39 @@ struct Sprint {
}
}
}
}
class
JIRA
:
NSObject
{
var
jiraProjectId
:
String
=
""
var
sprints
:
[
Sprint
]
=
[]
var
currentSprint
:
Sprint
?
convenience
init
(
jiraProjectId
:
String
,
sprints
:
[
Sprint
])
{
self
.
init
()
self
.
jiraProjectId
=
jiraProjectId
self
.
sprints
=
sprints
}
}
class
ViewController
:
NSViewController
{
class
ViewController
:
NSViewController
{
@IBOutlet
var
logTextView
:
NSTextView
!
@IBOutlet
var
logTextView
:
NSTextView
!
@IBOutlet
weak
var
urlTextField
:
NSTextField
!
@IBOutlet
weak
var
urlTextField
:
NSTextField
!
@IBOutlet
weak
var
versionPopup
:
NSPopUpButton
!
@IBOutlet
weak
var
versionPopup
:
NSPopUpButton
!
var
gengmeiSprints
:
[
Sprint
]
=
[]
@IBOutlet
weak
var
segment
:
NSSegmentedControl
!
var
likeSprints
:
[
Sprint
]
=
[]
var
allSprints
:
[
Sprint
]
=
[]
var
jiraProjects
:
[
Int
:
JIRA
]
=
[:]
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
Login
.
loginWiki
()
Login
.
loginWiki
()
Login
.
loginJira
()
Login
.
loginJira
()
fetchSprintList
()
fetchJiraProjects
()
for
sprint
in
allSprints
{
segment
.
selectedSegment
=
0
versionPopup
.
addItem
(
withTitle
:
sprint
.
name
)
switchProject
(
segment
)
print
(
"
\(
sprint
.
name
)
\(
sprint
.
id
)
"
)
}
}
@IBAction
func
OKAction
(
_
sender
:
Any
)
{
if
RepeatedWork
.
sprint
==
nil
{
Log
.
append
(
"先选择版本号"
)
return
}
if
urlTextField
.
stringValue
.
count
==
0
||
urlTextField
.
stringValue
.
count
==
0
{
Log
.
append
(
"需求列表地址没有填写"
)
return
}
RepeatedWork
.
fuckit
(
on
:
urlTextField
.
stringValue
)
}
@IBAction
func
versionSelectionAction
(
_
sender
:
NSPopUpButton
)
{
if
sender
.
indexOfSelectedItem
>
0
{
RepeatedWork
.
sprint
=
allSprints
[
sender
.
indexOfSelectedItem
-
1
]
}
else
{
RepeatedWork
.
sprint
=
nil
}
}
}
// 参考"获取迭代列表.md"
// 参考"获取迭代列表.md"
func
fetchSprintList
()
{
func
fetchJiraProjects
()
{
var
gengmeiSprints
:
[
Sprint
]
=
[]
var
likeSprints
:
[
Sprint
]
=
[]
let
url
=
URL
(
string
:
"http://jira.wanmeizhensuo.com/rest/greenhopper/1.0/sprint/picker?query=&_=1552128647090"
)
!
let
url
=
URL
(
string
:
"http://jira.wanmeizhensuo.com/rest/greenhopper/1.0/sprint/picker?query=&_=1552128647090"
)
!
var
request
=
URLRequest
(
url
:
url
)
var
request
=
URLRequest
(
url
:
url
)
request
.
httpMethod
=
"GET"
request
.
httpMethod
=
"GET"
...
@@ -97,9 +90,11 @@ class ViewController: NSViewController {
...
@@ -97,9 +90,11 @@ class ViewController: NSViewController {
for
sprintDic
in
sprints
{
for
sprintDic
in
sprints
{
if
let
boardName
=
sprintDic
[
"boardName"
]
as?
String
{
if
let
boardName
=
sprintDic
[
"boardName"
]
as?
String
{
if
boardName
==
"Alpha"
{
if
boardName
==
"Alpha"
{
self
?
.
allSprints
.
append
(
Sprint
(
dic
:
sprintDic
))
let
sprint
=
Sprint
(
dic
:
sprintDic
)
likeSprints
.
append
(
sprint
)
}
else
if
boardName
==
"USER board"
{
}
else
if
boardName
==
"USER board"
{
self
?
.
allSprints
.
append
(
Sprint
(
dic
:
sprintDic
))
let
sprint
=
Sprint
(
dic
:
sprintDic
)
gengmeiSprints
.
append
(
sprint
)
}
}
}
}
}
}
...
@@ -107,13 +102,41 @@ class ViewController: NSViewController {
...
@@ -107,13 +102,41 @@ class ViewController: NSViewController {
Log
.
append
(
"获取迭代列表失败:
\n\(
response
.
debugDescription
)
"
)
Log
.
append
(
"获取迭代列表失败:
\n\(
response
.
debugDescription
)
"
)
}
}
}
}
// project AL: 10500
// project USER: 10108
jiraProjects
=
[
0
:
JIRA
(
jiraProjectId
:
"10108"
,
sprints
:
gengmeiSprints
),
1
:
JIRA
(
jiraProjectId
:
"10500"
,
sprints
:
likeSprints
)]
}
}
@IBAction
func
switchProject
(
_
sender
:
NSSegmentedControl
)
{
@IBAction
func
switchProject
(
_
sender
:
NSSegmentedControl
)
{
versionPopup
.
removeAllItems
()
versionPopup
.
addItem
(
withTitle
:
"未选择版本号"
)
RepeatedWork
.
jira
=
jiraProjects
[
sender
.
indexOfSelectedItem
]
!
versionPopup
.
addItems
(
withTitles
:
RepeatedWork
.
jira
!.
sprints
.
map
{
return
$0
.
name
})
}
@IBAction
func
versionSelectionAction
(
_
sender
:
NSPopUpButton
)
{
if
sender
.
indexOfSelectedItem
>
0
{
RepeatedWork
.
jira
?
.
currentSprint
=
RepeatedWork
.
jira
!.
sprints
[
sender
.
indexOfSelectedItem
-
1
]
}
else
{
RepeatedWork
.
jira
=
nil
}
}
}
}
@IBAction
func
OKAction
(
_
sender
:
Any
)
{
if
RepeatedWork
.
jira
==
nil
{
Log
.
append
(
"先选择版本号"
)
return
}
if
urlTextField
.
stringValue
.
count
==
0
||
urlTextField
.
stringValue
.
count
==
0
{
Log
.
append
(
"需求列表地址没有填写"
)
return
}
RepeatedWork
.
fuckit
(
on
:
urlTextField
.
stringValue
)
}
}
class
Log
:
NSObject
{
class
Log
:
NSObject
{
static
func
append
(
_
logText
:
String
)
{
static
func
append
(
_
logText
:
String
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment