jira contents가 없을 경우에도 동작되도록 수정
This commit is contained in:
parent
2fadba29c2
commit
23a3ed4170
6 changed files with 56 additions and 42 deletions
|
|
@ -170,9 +170,12 @@ abstract class Command {
|
|||
|
||||
String getAbs(String path) {
|
||||
path = getPathNormal(path);
|
||||
if (path == '.' || path.startsWith('./')) {
|
||||
if (path == '.' || path.startsWith('./') || path.startsWith('.\\')) {
|
||||
path = path.replaceFirst('.', getPathNormal(pathlib.current));
|
||||
}
|
||||
if (path == '..' || path.startsWith('../') || path.startsWith('..\\')) {
|
||||
path = path.replaceFirst('..', '${getPathNormal(pathlib.current)}/..');
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,49 +42,55 @@ class Jira extends Command {
|
|||
|
||||
if(slackID.isNotEmpty) {
|
||||
var arr = issue.fields?.description?.content;
|
||||
if(arr != null && arr.isNotEmpty) {
|
||||
arr = arr.first.content;
|
||||
if(arr != null && arr.isNotEmpty)
|
||||
var summary = issue.fields?.summary;
|
||||
if((arr != null && arr.isNotEmpty) || summary != null) {
|
||||
var content = '';
|
||||
if(arr != null)
|
||||
{
|
||||
var browseUrl = 'https://${data.domain}/browse/${data.issue}';
|
||||
DataSlack Function(String) getData = (channel) {
|
||||
var slackData = DataSlack(channel);
|
||||
content = arr.first.content!.first.text!;
|
||||
}
|
||||
else
|
||||
{
|
||||
content = summary!;
|
||||
}
|
||||
var browseUrl = 'https://${data.domain}/browse/${data.issue}';
|
||||
DataSlack Function(String) getData = (channel) {
|
||||
var slackData = DataSlack(channel);
|
||||
|
||||
slackData.attachments = [];
|
||||
var attachment = SlackAttachment();
|
||||
slackData.blocks = [];
|
||||
var blockSection = SlackBlockSection();
|
||||
blockSection.text = SlackBlockText();
|
||||
blockSection.text!.text = ':jira: 새 Jira 업무가 할당되었습니다.';
|
||||
slackData.blocks!.add(blockSection);
|
||||
slackData.attachments = [];
|
||||
var attachment = SlackAttachment();
|
||||
slackData.blocks = [];
|
||||
var blockSection = SlackBlockSection();
|
||||
blockSection.text = SlackBlockText();
|
||||
blockSection.text!.text = ':jira: 새 Jira 업무가 할당되었습니다.';
|
||||
slackData.blocks!.add(blockSection);
|
||||
|
||||
attachment.blocks = [];
|
||||
attachment.blocks = [];
|
||||
|
||||
blockSection = SlackBlockSection();
|
||||
blockSection.text = SlackBlockText();
|
||||
blockSection.text!.type = SlackTextType.mrkdwn;
|
||||
blockSection.text!.text = '*<$browseUrl|${data.issue}> ${issue.fields?.summary}*';
|
||||
attachment.blocks!.add(blockSection);
|
||||
blockSection = SlackBlockSection();
|
||||
blockSection.text = SlackBlockText();
|
||||
blockSection.text!.type = SlackTextType.mrkdwn;
|
||||
blockSection.text!.text = '*<$browseUrl|${data.issue}> ${issue.fields?.summary}*';
|
||||
attachment.blocks!.add(blockSection);
|
||||
|
||||
blockSection = SlackBlockSection();
|
||||
blockSection.text = SlackBlockText();
|
||||
blockSection.text!.text = arr!.first.text;
|
||||
blockSection.accessory = SlackAccessory();
|
||||
blockSection.accessory!.type = SlackActionType.button;
|
||||
blockSection.accessory!.url = browseUrl;
|
||||
blockSection.accessory!.text = SlackBlockText();
|
||||
blockSection.accessory!.text!.type = SlackTextType.plain_text;
|
||||
blockSection.accessory!.text!.text = 'Open';
|
||||
attachment.blocks!.add(blockSection);
|
||||
|
||||
slackData.attachments!.add(attachment);
|
||||
return slackData;
|
||||
};
|
||||
setReturn(data.return_slack_data, getData(slackID));
|
||||
blockSection = SlackBlockSection();
|
||||
blockSection.text = SlackBlockText();
|
||||
blockSection.text!.text = content;
|
||||
blockSection.accessory = SlackAccessory();
|
||||
blockSection.accessory!.type = SlackActionType.button;
|
||||
blockSection.accessory!.url = browseUrl;
|
||||
blockSection.accessory!.text = SlackBlockText();
|
||||
blockSection.accessory!.text!.type = SlackTextType.plain_text;
|
||||
blockSection.accessory!.text!.text = 'Open';
|
||||
attachment.blocks!.add(blockSection);
|
||||
|
||||
slackData.attachments!.add(attachment);
|
||||
return slackData;
|
||||
};
|
||||
setReturn(data.return_slack_data, getData(slackID));
|
||||
|
||||
if(data.sub_channel != null) {
|
||||
setReturn(data.return_slack_channel, getData(data.sub_channel!));
|
||||
}
|
||||
if(data.sub_channel != null) {
|
||||
setReturn(data.return_slack_channel, getData(data.sub_channel!));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class JsonReader extends Command {
|
|||
@override
|
||||
Future execute(DataCommand command) async {
|
||||
var data = DataJsonReader.fromJson(command.param);
|
||||
var workspace = getWorkspace(data.workspace);
|
||||
var path = getAbs(data.path);
|
||||
var file = File(path);
|
||||
if (file.existsSync()) {
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ class DataSlackSender extends DataParam {
|
|||
|
||||
late String token;
|
||||
late String? property;
|
||||
late DataSlack message;
|
||||
late DataSlack? message;
|
||||
|
||||
factory DataSlackSender.fromJson(Map<String, dynamic> json) =>
|
||||
_$DataSlackSenderFromJson(json);
|
||||
|
|
|
|||
|
|
@ -308,7 +308,9 @@ DataSlackSender _$DataSlackSenderFromJson(Map<String, dynamic> json) =>
|
|||
..workspace = json['workspace'] as String?
|
||||
..token = json['token'] as String
|
||||
..property = json['property'] as String?
|
||||
..message = DataSlack.fromJson(json['message'] as Map<String, dynamic>);
|
||||
..message = json['message'] == null
|
||||
? null
|
||||
: DataSlack.fromJson(json['message'] as Map<String, dynamic>);
|
||||
|
||||
Map<String, dynamic> _$DataSlackSenderToJson(DataSlackSender instance) =>
|
||||
<String, dynamic>{
|
||||
|
|
@ -323,7 +325,9 @@ DataSlackBuild _$DataSlackBuildFromJson(Map<String, dynamic> json) =>
|
|||
..workspace = json['workspace'] as String?
|
||||
..token = json['token'] as String
|
||||
..property = json['property'] as String?
|
||||
..message = DataSlack.fromJson(json['message'] as Map<String, dynamic>)
|
||||
..message = json['message'] == null
|
||||
? null
|
||||
: DataSlack.fromJson(json['message'] as Map<String, dynamic>)
|
||||
..appName = json['appName'] as String
|
||||
..type = $enumDecode(_$SlackBuildTypeEnumMap, json['type'])
|
||||
..color = json['color'] as String
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ commands:
|
|||
id: leedongmyung@lguplus.co.kr
|
||||
token: ATATT3xFfGF0mklis_51fqVtxqIatXsuUoOsgu6HXdWXh6nTnQOE964iSZnh0QhgUFZejaljlqsZVBA6OlG8hg74lnmyYKPB7M2Et2mAq3TsvvQskT6VwnG4mGXQ1ff-KIhPvfMvGmGzrQ7UeefC5muJusEcmy1nknxZC8CK4OhYQjAc07GnRmg=B6CBDA6F
|
||||
domain: lgu-cto.atlassian.net
|
||||
issue: M3-1
|
||||
issue: M3-21
|
||||
sub-channel: build-test
|
||||
users:
|
||||
- mail: leedongmyung@lguplus.co.kr
|
||||
|
|
|
|||
Loading…
Reference in a new issue