Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add label fields #73

Merged
merged 10 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ message Label {
string id = 1;
string key = 2;
optional string created_by = 3;
kamaleshnneerasa marked this conversation as resolved.
Show resolved Hide resolved
optional string created_time = 4;
optional int64 created_time = 4;
kamaleshnneerasa marked this conversation as resolved.
Show resolved Hide resolved
optional string color = 5;
optional string rule_id = 6;
optional string created_by_application_rule_id = 6;
optional string description = 7;
}

message CreateLabel {
string key = 2;
optional string created_by = 3;
kamaleshnneerasa marked this conversation as resolved.
Show resolved Hide resolved
optional string color = 5;
optional string rule_id = 6;
optional string created_by_application_rule_id = 6;
optional string description = 7;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@
import io.grpc.Status;
import io.grpc.StatusRuntimeException;
import io.grpc.stub.StreamObserver;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
Expand Down Expand Up @@ -123,7 +119,7 @@ public void createLabel(
.setKey(createLabel.getKey())
.setCreatedBy(createLabel.getCreatedBy())
.setColor(createLabel.getColor())
kamaleshnneerasa marked this conversation as resolved.
Show resolved Hide resolved
.setRuleId(createLabel.getRuleId())
.setCreatedByApplicationRuleId(createLabel.getCreatedByApplicationRuleId())
.setDescription(createLabel.getDescription())
.build();
Label createdLabel =
Expand Down Expand Up @@ -258,11 +254,7 @@ private boolean isDuplicateKey(String key) {
}

private Label getLabelFromContextualObject(ContextualConfigObject<Label> labelObject) {
kamaleshnneerasa marked this conversation as resolved.
Show resolved Hide resolved
DateTimeFormatter formatter =
DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT)
.withLocale(Locale.US)
.withZone(ZoneId.systemDefault());
String createdTimestamp = formatter.format(labelObject.getCreationTimestamp());
long createdTimestamp = labelObject.getCreationTimestamp().toEpochMilli();
Label label = labelObject.getData();
return label.toBuilder().setCreatedTime(createdTimestamp).build();
}
Expand Down