mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 20:54:59 +00:00
feature: supports custom actions (#638)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
7c5de7e48c
commit
a36058ec51
17 changed files with 478 additions and 2 deletions
42
src/Models/CustomAction.cs
Normal file
42
src/Models/CustomAction.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace SourceGit.Models
|
||||
{
|
||||
public enum CustomActionScope
|
||||
{
|
||||
Repository,
|
||||
Commit,
|
||||
}
|
||||
|
||||
public class CustomAction : ObservableObject
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get => _name;
|
||||
set => SetProperty(ref _name, value);
|
||||
}
|
||||
|
||||
public CustomActionScope Scope
|
||||
{
|
||||
get => _scope;
|
||||
set => SetProperty(ref _scope, value);
|
||||
}
|
||||
|
||||
public string Executable
|
||||
{
|
||||
get => _executable;
|
||||
set => SetProperty(ref _executable, value);
|
||||
}
|
||||
|
||||
public string Arguments
|
||||
{
|
||||
get => _arguments;
|
||||
set => SetProperty(ref _arguments, value);
|
||||
}
|
||||
|
||||
private string _name = string.Empty;
|
||||
private CustomActionScope _scope = CustomActionScope.Repository;
|
||||
private string _executable = string.Empty;
|
||||
private string _arguments = string.Empty;
|
||||
}
|
||||
}
|
|
@ -100,6 +100,12 @@ namespace SourceGit.Models
|
|||
set;
|
||||
} = new AvaloniaList<IssueTrackerRule>();
|
||||
|
||||
public AvaloniaList<CustomAction> CustomActions
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new AvaloniaList<CustomAction>();
|
||||
|
||||
public bool EnableAutoFetch
|
||||
{
|
||||
get;
|
||||
|
@ -230,5 +236,22 @@ namespace SourceGit.Models
|
|||
if (rule != null)
|
||||
IssueTrackerRules.Remove(rule);
|
||||
}
|
||||
|
||||
public CustomAction AddNewCustomAction()
|
||||
{
|
||||
var act = new CustomAction()
|
||||
{
|
||||
Name = "Unnamed Custom Action",
|
||||
};
|
||||
|
||||
CustomActions.Add(act);
|
||||
return act;
|
||||
}
|
||||
|
||||
public void RemoveCustomAction(CustomAction act)
|
||||
{
|
||||
if (act != null)
|
||||
CustomActions.Remove(act);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue