Implement a variant of the clone repo dialog for re-cloning from the Start Page

The Start Page re-acquisition code path needs to clone repositories, but it
already knows which repo to clone, so we need a variant of the clone dialog
for this purpose.
This commit is contained in:
Andreia Gaita 2016-11-07 13:52:00 +01:00
Родитель 79b7f32b3f
Коммит 8c89ef0133
10 изменённых файлов: 37 добавлений и 12 удалений

Просмотреть файл

@ -366,6 +366,12 @@ namespace GitHub.Controllers
.PermitDynamic(Trigger.Cancel, () => Go(Trigger.Cancel))
.PermitDynamic(Trigger.Finish, () => Go(Trigger.Finish));
uiStateMachine.Configure(UIViewType.StartPageClone)
.OnEntry(tr => RunView(UIViewType.StartPageClone, CalculateDirection(tr)))
.PermitDynamic(Trigger.Next, () => Go(Trigger.Next))
.PermitDynamic(Trigger.Cancel, () => Go(Trigger.Cancel))
.PermitDynamic(Trigger.Finish, () => Go(Trigger.Finish));
uiStateMachine.Configure(UIViewType.End)
.OnEntryFrom(Trigger.Cancel, () => End(false))
.OnEntryFrom(Trigger.Next, () => End(true))
@ -558,6 +564,19 @@ namespace GitHub.Controllers
logic.Configure(UIViewType.End)
.Permit(Trigger.Next, UIViewType.None);
machines.Add(UIControllerFlow.LogoutRequired, logic);
// start page clone flow
logic = new StateMachine<UIViewType, Trigger>(UIViewType.None);
logic.Configure(UIViewType.None)
.Permit(Trigger.Next, UIViewType.StartPageClone)
.Permit(Trigger.Finish, UIViewType.End);
logic.Configure(UIViewType.StartPageClone)
.Permit(Trigger.Next, UIViewType.End)
.Permit(Trigger.Cancel, UIViewType.End)
.Permit(Trigger.Finish, UIViewType.End);
logic.Configure(UIViewType.End)
.Permit(Trigger.Next, UIViewType.None);
machines.Add(UIControllerFlow.StartPageClone, logic);
}
UIControllerFlow SelectActiveFlow()

Просмотреть файл

@ -217,6 +217,7 @@
<Compile Include="ViewModels\PullRequestCreationViewModel.cs" />
<Compile Include="ViewModels\PullRequestDetailViewModel.cs" />
<Compile Include="ViewModels\PullRequestListViewModel.cs" />
<Compile Include="ViewModels\StartPageCloneViewModel.cs" />
<Compile Include="ViewModels\RepositoryCreationViewModel.cs" />
<Compile Include="ViewModels\RepositoryCloneViewModel.cs" />
<Compile Include="ViewModels\LoginControlViewModel.cs" />

Просмотреть файл

@ -359,7 +359,7 @@ namespace GitHub.SampleData
private set;
}
public IRepositoryModel SelectedRepository { get; set; }
public ISimpleRepositoryModel SelectedRepository { get; set; }
public ObservableCollection<IRepositoryModel> Repositories
{

Просмотреть файл

@ -279,12 +279,12 @@ namespace GitHub.ViewModels
private set { this.RaiseAndSetIfChanged(ref repositories, (TrackingCollection<IRepositoryModel>)value); }
}
IRepositoryModel selectedRepository;
ISimpleRepositoryModel selectedRepository;
/// <summary>
/// Selected repository to clone
/// </summary>
[AllowNull]
public IRepositoryModel SelectedRepository
public ISimpleRepositoryModel SelectedRepository
{
[return: AllowNull]
get { return selectedRepository; }

Просмотреть файл

@ -117,6 +117,7 @@
<Compile Include="ViewModels\IPullRequestDetailViewModel.cs" />
<Compile Include="ViewModels\IPullRequestListViewModel.cs" />
<Compile Include="ViewModels\IReactiveViewModel.cs" />
<Compile Include="ViewModels\IBaseCloneViewModel.cs" />
<Compile Include="ViewModels\IRepositoryCreationTarget.cs" />
<Compile Include="ViewModels\IRepositoryForm.cs" />
<Compile Include="ViewModels\IRepositoryPublishViewModel.cs" />

Просмотреть файл

@ -9,20 +9,14 @@ namespace GitHub.ViewModels
/// <summary>
/// ViewModel for the the Clone Repository dialog
/// </summary>
public interface IRepositoryCloneViewModel : IViewModel, IRepositoryCreationTarget
public interface IRepositoryCloneViewModel : IBaseCloneViewModel, IRepositoryCreationTarget
{
/// <summary>
/// Command to clone the currently selected repository.
/// </summary>
IReactiveCommand<Unit> CloneCommand { get; }
/// <summary>
/// The list of repositories the current user may clone from the specified host.
/// </summary>
ObservableCollection<IRepositoryModel> Repositories { get; }
IRepositoryModel SelectedRepository { get; set; }
bool FilterTextIsEnabled { get; }
/// <summary>

Просмотреть файл

@ -28,6 +28,8 @@ namespace GitHub.Exports
LoggedOut,
NotAGitRepository,
NotAGitHubRepository,
StartPageClone,
}
public enum MenuType

Просмотреть файл

@ -31,7 +31,8 @@ namespace GitHub.UI
PullRequests,
Gist,
LogoutRequired,
Home
Home,
StartPageClone
}
public class ViewWithData

Просмотреть файл

@ -326,6 +326,9 @@
<Compile Include="UI\Settings\OptionsControl.xaml.cs">
<DependentUpon>OptionsControl.xaml</DependentUpon>
</Compile>
<Compile Include="UI\Views\Controls\StartPageCloneView.xaml.cs">
<DependentUpon>StartPageCloneView.xaml</DependentUpon>
</Compile>
<Compile Include="UI\Views\Controls\RepositoryCloneControl.xaml.cs">
<DependentUpon>RepositoryCloneControl.xaml</DependentUpon>
</Compile>
@ -461,6 +464,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UI\Views\Controls\StartPageCloneView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UI\Views\Controls\RepositoryCloneControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

@ -1 +1 @@
Subproject commit a2cd5ea267d6247549876531584178f3b069ce19
Subproject commit f774eeb58246dd83e46abc4f23a074d6ace44ee5