mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-16 08:20:39 +08:00
Switch to published Radicle crates
This commit is contained in:
+3
-3
@@ -330,13 +330,13 @@ impl App {
|
||||
&mut self,
|
||||
title: String,
|
||||
description: String,
|
||||
tags: String,
|
||||
labels: String,
|
||||
assignees: String,
|
||||
) -> Result<IssueId> {
|
||||
let repository = self.context.repository();
|
||||
let signer = self.context.signer();
|
||||
|
||||
let tags = cob::parse_tags(tags)?;
|
||||
let labels = cob::parse_labels(labels)?;
|
||||
let assignees = cob::parse_assignees(assignees)?;
|
||||
|
||||
cob::issue::create(
|
||||
@@ -344,7 +344,7 @@ impl App {
|
||||
signer,
|
||||
title,
|
||||
description,
|
||||
tags.as_slice(),
|
||||
labels.as_slice(),
|
||||
assignees.as_slice(),
|
||||
)
|
||||
}
|
||||
|
||||
+12
-10
@@ -1,31 +1,33 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use anyhow::Result;
|
||||
use radicle::cob::{ActorId, Tag};
|
||||
|
||||
use radicle::cob::Label;
|
||||
use radicle::prelude::Did;
|
||||
|
||||
pub mod issue;
|
||||
pub mod patch;
|
||||
|
||||
pub fn parse_tags(input: String) -> Result<Vec<Tag>> {
|
||||
let mut tags = vec![];
|
||||
pub fn parse_labels(input: String) -> Result<Vec<Label>> {
|
||||
let mut labels = vec![];
|
||||
if !input.is_empty() {
|
||||
for name in input.split(',') {
|
||||
match Tag::new(name.trim()) {
|
||||
Ok(tag) => tags.push(tag),
|
||||
Err(err) => return Err(anyhow::anyhow!(err).context("Can't parse tags.")),
|
||||
match Label::new(name.trim()) {
|
||||
Ok(label) => labels.push(label),
|
||||
Err(err) => return Err(anyhow::anyhow!(err).context("Can't parse labels.")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(tags)
|
||||
Ok(labels)
|
||||
}
|
||||
|
||||
pub fn parse_assignees(input: String) -> Result<Vec<ActorId>> {
|
||||
pub fn parse_assignees(input: String) -> Result<Vec<Did>> {
|
||||
let mut assignees = vec![];
|
||||
if !input.is_empty() {
|
||||
for did in input.split(',') {
|
||||
match ActorId::from_str(did) {
|
||||
Ok(actor) => assignees.push(actor),
|
||||
match Did::from_str(did) {
|
||||
Ok(did) => assignees.push(did),
|
||||
Err(err) => return Err(anyhow::anyhow!(err).context("Can't parse assignees.")),
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
use anyhow::Result;
|
||||
use radicle::cob::issue::{Issue, IssueId, Issues};
|
||||
use radicle::cob::{ActorId, Tag};
|
||||
use radicle::prelude::Signer;
|
||||
use radicle::cob::Label;
|
||||
use radicle::prelude::{Did, Signer};
|
||||
use radicle::storage::git::Repository;
|
||||
|
||||
pub fn all(repository: &Repository) -> Result<Vec<(IssueId, Issue)>> {
|
||||
@@ -25,11 +25,11 @@ pub fn create<G: Signer>(
|
||||
signer: &G,
|
||||
title: String,
|
||||
description: String,
|
||||
tags: &[Tag],
|
||||
assignees: &[ActorId],
|
||||
labels: &[Label],
|
||||
assignees: &[Did],
|
||||
) -> Result<IssueId> {
|
||||
let mut issues = Issues::open(repository)?;
|
||||
let issue = issues.create(title, description.trim(), tags, assignees, signer)?;
|
||||
let issue = issues.create(title, description.trim(), labels, assignees, signer)?;
|
||||
|
||||
Ok(*issue.id())
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ impl IssueHeader {
|
||||
);
|
||||
|
||||
let labels = Property::new(
|
||||
common::label("Tags").foreground(theme.colors.property_name_fg),
|
||||
common::label("Labels").foreground(theme.colors.property_name_fg),
|
||||
common::label(&cob::format_labels(item.labels()))
|
||||
.foreground(theme.colors.browser_list_labels),
|
||||
);
|
||||
@@ -263,7 +263,7 @@ impl NewForm {
|
||||
use tuirealm::props::Layout;
|
||||
|
||||
let title = Widget::new(TextInput::new(theme.clone(), "Title"));
|
||||
let tags = Widget::new(TextInput::new(theme.clone(), "Tags (tag1, tag2, ...)"));
|
||||
let tags = Widget::new(TextInput::new(theme.clone(), "Labels (bug, ...)"));
|
||||
let assignees = Widget::new(TextInput::new(
|
||||
theme.clone(),
|
||||
"Assignees (z6MkvAdxCp1oLVVTsqYvev9YrhSN3gBQNUSM45hhy4pgkexk, ...)",
|
||||
|
||||
Reference in New Issue
Block a user