Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
huserben committed Sep 23, 2020
1 parent dd7f1c0 commit 3ce9560
Show file tree
Hide file tree
Showing 17 changed files with 738 additions and 0 deletions.
25 changes: 25 additions & 0 deletions AzureArtifactManager.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30413.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureArtifactManager", "AzureArtifactManager\AzureArtifactManager.csproj", "{54A95BB7-F568-42C0-884B-9CD7C050BF31}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{54A95BB7-F568-42C0-884B-9CD7C050BF31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54A95BB7-F568-42C0-884B-9CD7C050BF31}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54A95BB7-F568-42C0-884B-9CD7C050BF31}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54A95BB7-F568-42C0-884B-9CD7C050BF31}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CC52D297-B189-4FE9-99AA-2A1E5A7D9E5C}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions AzureArtifactManager/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="PersonalAccessToken" value="" />
<add key="Organization" value="" />
<add key="Project" value="" />
</appSettings>
</configuration>
9 changes: 9 additions & 0 deletions AzureArtifactManager/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="AzureArtifactManager.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:AzureArtifactManager"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions AzureArtifactManager/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace AzureArtifactManager
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
10 changes: 10 additions & 0 deletions AzureArtifactManager/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
15 changes: 15 additions & 0 deletions AzureArtifactManager/AzureArtifactManager.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
<PackageReference Include="System.Text.Json" Version="4.7.2" />
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
</ItemGroup>

</Project>
121 changes: 121 additions & 0 deletions AzureArtifactManager/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<Window x:Class="AzureArtifactManager.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:model="clr-namespace:AzureArtifactManager.Model"
xmlns:viewmodel="clr-namespace:AzureArtifactManager.ViewModels"
mc:Ignorable="d"
Title="Azure Artifact Manager" Height="450" Width="800">

<Window.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
</Window.Resources>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>

<StackPanel Grid.RowSpan="2" Visibility="{Binding HasConfigurationError, Converter={StaticResource BoolToVisibilityConverter}}">
<TextBlock Text="Configuration Error" Foreground="Red" />
<TextBlock Text="Please configure your Organization and Personal Access Token in the app.config file" Foreground="Red" />
<TextBlock Text="Configuration of a Project is optional (not needed to see Organization Level Feeds)" />
<TextBlock Text="Just specify the organization name: MyOrg if your url is https://dev.azure.com/MyOrg" />
<Button Content="Open App Config" Command="{Binding OpenAppConfigCommand}" />
</StackPanel>

<Grid Grid.Row="0" Visibility="{Binding HasNoConfigurationError, Converter={StaticResource BoolToVisibilityConverter}}">
<DockPanel LastChildFill="True">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Connected to: " />
<TextBlock Text="{Binding Organization}" />
</StackPanel>
<TextBlock Text="Available Feeds:" />
<ComboBox ItemsSource="{Binding Feeds}" SelectedItem="{Binding SelectedFeed, Mode=TwoWay}" >
<ComboBox.ItemTemplate>
<DataTemplate DataType="{x:Type model:Feed}">
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
</DockPanel>
</Grid>

<Grid Grid.Row="1" Visibility="{Binding HasNoConfigurationError, Converter={StaticResource BoolToVisibilityConverter}}">
<DockPanel LastChildFill="True">
<DockPanel LastChildFill="True" DockPanel.Dock="Top">
<Button DockPanel.Dock="Right" Content="Add New Package" Command="{Binding AddNewPackageCommand}" />

<StackPanel Orientation="Horizontal">
<TextBlock Text="Available Packages for Feed" />
<TextBlock Margin="10 0 0 0" Text="{Binding SelectedFeed.Name}"/>
</StackPanel>

</DockPanel>

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<ListBox ItemsSource="{Binding AvailablePackages}" SelectedItem="{Binding SelectedPackage}" Grid.Column="0">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type viewmodel:PackageViewModel}">
<TextBlock Text="{Binding Name}" Grid.Column="0"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

<DockPanel Grid.Column="1" Visibility="{Binding ShowPackageDetails, Converter={StaticResource BoolToVisibilityConverter}}">

<GroupBox Header="Upload" DockPanel.Dock="Bottom">
<StackPanel>
<TextBlock Foreground="Red" Text="Make sure you know what you're doing!" />
<Button Content="Upload new Version" DockPanel.Dock="Right" Command="{Binding SelectedPackage.UploadNewVersionCommand}"/>
</StackPanel>
</GroupBox>

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<TextBlock Text="Name:" Grid.Column="0" Grid.Row="0"/>
<TextBox Text="{Binding SelectedPackage.Name, Mode=TwoWay}" IsEnabled="{Binding SelectedPackage.IsNewPackage}" Grid.Column="1" Grid.Row="0" />

<TextBlock Text="Version:" Grid.Column="0" Grid.Row="1"/>
<TextBox Text="{Binding SelectedPackage.Version, Mode=TwoWay}" Grid.Column="1" Grid.Row="1" />

<TextBlock Text="Description:" Grid.Column="0" Grid.Row="2"/>
<TextBox Text="{Binding SelectedPackage.Description, Mode=TwoWay}" Grid.Column="1" Grid.Row="2" />

<Button Content="Download" Command="{Binding SelectedPackage.DownloadSelectedPackageCommand}" Grid.ColumnSpan="2" Grid.Row="3"/>

<StackPanel Grid.ColumnSpan="2" Grid.Row="4" Margin="0 30 0 0 ">
<TextBlock Text="Name must be all lowercase and no spaces are allowed!" />
<TextBlock Text="Version only includes Major.Minor.Patch - upload will fail if format is not correct" />
</StackPanel>
</Grid>
</DockPanel>

</Grid>

</DockPanel>
</Grid>
</Grid>

</Window>
19 changes: 19 additions & 0 deletions AzureArtifactManager/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using AzureArtifactManager.ViewModels;
using Microsoft.WindowsAPICodePack.Dialogs;
using System.Windows;

namespace AzureArtifactManager
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();

DataContext = new MainWindowViewModel();
}
}
}
16 changes: 16 additions & 0 deletions AzureArtifactManager/Model/ApiResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;

namespace AzureArtifactManager.Model
{
public class ApiResponse<T>
{
[JsonPropertyName("count")]
public int Count { get; set; }

[JsonPropertyName("value")]
public IEnumerable<T> Value { get; set; }
}
}
19 changes: 19 additions & 0 deletions AzureArtifactManager/Model/ArtifactTool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Text.Json.Serialization;

namespace AzureArtifactManager.Model
{
public class ArtifactTool
{
[JsonPropertyName("name")]
public string Name{ get; set; }

[JsonPropertyName("version")]
public string Version { get; set; }

[JsonPropertyName("uri")]
public string Uri { get; set; }

[JsonPropertyName("rid")]
public string Os { get; set; }
}
}
16 changes: 16 additions & 0 deletions AzureArtifactManager/Model/Feed.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Text.Json.Serialization;

namespace AzureArtifactManager.Model
{
public class Feed
{
[JsonPropertyName("name")]
public string Name { get; set; }

[JsonPropertyName("id")]
public string Id { get; set; }

[JsonPropertyName("project")]
public Project Project{ get; set; }
}
}
27 changes: 27 additions & 0 deletions AzureArtifactManager/Model/Package.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;

namespace AzureArtifactManager.Model
{
public class Package
{
public Package()
{
AvailableVersions = new List<PackageVersion>();
}

[JsonPropertyName("id")]
public string Id { get; set; }

[JsonPropertyName("name")]
public string Name { get; set; }

public PackageVersion LatestVersion => AvailableVersions.FirstOrDefault(x => x.IsLatest);

[JsonPropertyName("versions")]
public IEnumerable<PackageVersion> AvailableVersions { get; set; }
}
}
20 changes: 20 additions & 0 deletions AzureArtifactManager/Model/PackageVersion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Text.Json.Serialization;

namespace AzureArtifactManager.Model
{
public class PackageVersion
{
[JsonPropertyName("version")]
public string Version { get; set; }

[JsonPropertyName("id")]
public string Id { get; set; }

[JsonPropertyName("isLatest")]
public bool IsLatest { get; set; }

[JsonPropertyName("packageDescription")]
public string Description { get; set; }

}
}
13 changes: 13 additions & 0 deletions AzureArtifactManager/Model/Project.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Text.Json.Serialization;

namespace AzureArtifactManager.Model
{
public class Project
{
[JsonPropertyName("id")]
public string Id { get; set; }

[JsonPropertyName("name")]
public string Name { get; set; }
}
}
Loading

0 comments on commit 3ce9560

Please sign in to comment.