Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Switch to published Radicle crates
Erik Kundt committed 2 years ago
commit 39cbd159195d47b962ffde7e9a319e63ad0c6545
parent 935e7acb4f90e5b465cf74ac7638af764e1d56e0
4 files changed +22 -20
modified src/app.rs
@@ -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(),
        )
    }
modified src/cob.rs
@@ -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.")),
            }
        }
modified src/cob/issue.rs
@@ -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())
}
modified src/ui/widget/issue.rs
@@ -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, ...)",