From d996d6121375ae19eb782ac001138d1edc2727f2 Mon Sep 17 00:00:00 2001 From: leedongmyung Date: Wed, 13 Dec 2023 08:31:58 +0900 Subject: [PATCH] buf fixed, merged --- lib/oto/commands/util/slack.dart | 12 ++++++------ lib/oto/data/command_data.dart | 4 ++-- lib/oto/data/command_data.g.dart | 12 ++++-------- lib/oto/pipeline/pipeline_exe.dart | 15 ++++++++++----- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/lib/oto/commands/util/slack.dart b/lib/oto/commands/util/slack.dart index 350679d..c98437d 100644 --- a/lib/oto/commands/util/slack.dart +++ b/lib/oto/commands/util/slack.dart @@ -15,17 +15,16 @@ class Slack extends Command { var data = DataSlackSender.fromJson(command.param); var sender = SlackSender(data.token); DataSlack? message = null; - if(data.property != null) { + if (data.property != null) { var value = replaceSingleTag(data.property!); - if(value != null) - { + if (value != null) { message = value as DataSlack; } - } else if(data.message != null) { + } else if (data.message != null) { message = data.message; } - if(message != null) { + if (message != null) { await sender.send(message); } else { throw Exception('property or message field should not be null'); @@ -40,10 +39,11 @@ class SlackBuild extends Command { Future execute(DataCommand command) async { var data = DataSlackBuild.fromJson(command.param); + var token = replaceTag(data.token); var version = replaceTag(data.version); var download = replaceTag(data.downloadURL); var color = Color.hex(data.color); - var sender = SlackSender(data.token); + var sender = SlackSender(token); await sender.sendBuild(data.appName, data.type, color, version, download); diff --git a/lib/oto/data/command_data.dart b/lib/oto/data/command_data.dart index 418673e..ddd2cbd 100644 --- a/lib/oto/data/command_data.dart +++ b/lib/oto/data/command_data.dart @@ -268,9 +268,9 @@ class DataRename extends DataFile { class DataSlackSender extends DataParam { DataSlackSender(); - late String? token; + late String token; late String? property; - late DataSlack? message; + late DataSlack message; factory DataSlackSender.fromJson(Map json) => _$DataSlackSenderFromJson(json); diff --git a/lib/oto/data/command_data.g.dart b/lib/oto/data/command_data.g.dart index 311f9de..229a1f8 100644 --- a/lib/oto/data/command_data.g.dart +++ b/lib/oto/data/command_data.g.dart @@ -306,11 +306,9 @@ Map _$DataRenameToJson(DataRename instance) => DataSlackSender _$DataSlackSenderFromJson(Map json) => DataSlackSender() ..workspace = json['workspace'] as String? - ..token = json['token'] as String? + ..token = json['token'] as String ..property = json['property'] as String? - ..message = json['message'] == null - ? null - : DataSlack.fromJson(json['message'] as Map); + ..message = DataSlack.fromJson(json['message'] as Map); Map _$DataSlackSenderToJson(DataSlackSender instance) => { @@ -323,11 +321,9 @@ Map _$DataSlackSenderToJson(DataSlackSender instance) => DataSlackBuild _$DataSlackBuildFromJson(Map json) => DataSlackBuild() ..workspace = json['workspace'] as String? - ..token = json['token'] as String? + ..token = json['token'] as String ..property = json['property'] as String? - ..message = json['message'] == null - ? null - : DataSlack.fromJson(json['message'] as Map) + ..message = DataSlack.fromJson(json['message'] as Map) ..appName = json['appName'] as String ..type = $enumDecode(_$SlackBuildTypeEnumMap, json['type']) ..color = json['color'] as String diff --git a/lib/oto/pipeline/pipeline_exe.dart b/lib/oto/pipeline/pipeline_exe.dart index ee5f206..d9d6a2b 100644 --- a/lib/oto/pipeline/pipeline_exe.dart +++ b/lib/oto/pipeline/pipeline_exe.dart @@ -26,13 +26,18 @@ class PipelineExe extends PipelineExecutor { @override PipelineValidateResult initialize(Map set) { var result = PipelineValidateResult(); - commandID = set.values.first as String; - if (!Application.instance.dataCommandMap.containsKey(commandID)) { + if (set.values.first == null) { result.enable = false; - result.message = - 'The "$commandID" command does not exist in the command list.'; + result.message = 'Pipeline Workflow\'s "Command ID" is (null)'; + } else { + commandID = set.values.first as String; + if (!Application.instance.dataCommandMap.containsKey(commandID)) { + result.enable = false; + result.message = + 'The "$commandID" command does not exist in the command list.'; + } + updateState(CommandState.ready); } - updateState(CommandState.ready); return result; }