mirror of
https://github.com/dnwSilver/tld.git
synced 2024-11-25 16:42:07 +00:00
✨ Add title for project dependency
This commit is contained in:
parent
11e9fee9c3
commit
f80a78f8cb
@ -9,35 +9,52 @@
|
||||
be nice SEO site
|
||||
too old VCS api
|
||||
|
||||
wait build release
|
||||
reopen testing hotfix
|
||||
in progress done publish
|
||||
releases Fact 2023
|
||||
releases Fact
|
||||
releases Planned
|
||||
releases Planned 2024-12-31 xfirm
|
||||
competencies
|
||||
growth zone
|
||||
dependencies
|
||||
tools
|
||||
|
||||
|
||||
|
||||
wait build
|
||||
reopen testing
|
||||
in progress done
|
||||
review cancel
|
||||
|
||||
releases Fact 2023
|
||||
releases Fact
|
||||
releases Planned
|
||||
releases Planned 2024-12-31 xfirm
|
||||
competencies
|
||||
growth zone
|
||||
dependencies
|
||||
|
||||
┌──────────────────────────────────────────────────────────────────────── Planned release ─────────────────────────────────────────────────────────────────┐
|
||||
│ 2024-12-31 4/11 xfirm [############# ] //green - done, blue - test, pink review/build, orange WIP
|
||||
│ 4/11 xfirm [###############.......] //green - done, blue - test, pink review/build
|
||||
│ 2024-12-31 4/11 xfirm [###############.......] //green - done, blue - test, pink review/build
|
||||
│ 2024-12-31 xfirm 4/11 [############..........] //green - done, blue - test, pink review/build
|
||||
│ 2024-12-31 xfirm 4/11 [############..........] //green - done, blue - test, pink review/build
|
||||
│ 2024-12-31 xfirm 4/11 [############..........] //green - done, blue - test, pink review/build
|
||||
│ 2024-12-31 xfirm 4/11 [############..........] //green - done, blue - test, pink review/build
|
||||
│ 2024-12-31 xfirm 4/11 [############..........] //green - done, blue - test, pink review/build
|
||||
│ Planned application Tasks
|
||||
│ 2024-12-31 1d elk-site 4/11
|
||||
│ elk-site 2/5
|
||||
│ elk-site 22/22
|
||||
│ 2024-12-31 12d xfirm 4/12
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
|
||||
|
||||
|
||||
show stopper wait build feature
|
||||
first of all reopen testing bug
|
||||
just do it in progress done
|
||||
doesn't rush review cancel
|
||||
|
||||
┌──────────────────────────────────────────────────────────────────────── checkperson-site ────────────────────────────────────────────────────────────────┐
|
||||
│ ELK-3628 Create new menu. Anna P. Petrov A. Ivanov I.
|
||||
│ XF-12 Change input hover. Alex K. Ivanov I. Petrov A., Petrov B.
|
||||
│ ELK-3628 Crete new project with menu, profile, issues and # Anna P. Ivanov I. Petrov A., Petrov B.
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
|
||||
|
||||
|
||||
publish
|
||||
release
|
||||
hotfix
|
||||
release candidate
|
||||
|
||||
┌─────────────────────────────────────────────────────────────────────────── Actual releases 2023 ─────────────────────────────────────────────────────────┐
|
||||
│ Jan Feb Mar Apl May Jun Jul Aug Sep Oct Nov Dec
|
||||
│ ├─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
|
||||
@ -48,5 +65,12 @@
|
||||
|
||||
|
||||
|
||||
GA4 Jaeger Fallback Screenshots Connected Auth
|
||||
Я YM Prometheus Renovate End2End Disconnected WWW
|
||||
Husky Sentry Lighthouse Unit Not implemented SEO
|
||||
Probs Grafana Kibana Coverage No need
|
||||
|
||||
|
||||
┌─────────────────────────────────────────────────────────────────────────── Tools ──────────────────────────────────┐
|
||||
│ Я
|
||||
│ elk-site
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
@ -1,3 +1,4 @@
|
||||
using System.Text;
|
||||
using TUI.Engine.Attributes;
|
||||
|
||||
namespace TUI.Engine.Components;
|
||||
@ -8,6 +9,8 @@ public sealed class Sketch : IEnumerable<string>
|
||||
|
||||
public Sketch(string content) => ContentRows = content.Split(Symbols.LineBreak);
|
||||
|
||||
public Sketch(StringBuilder builder) => ContentRows = builder.ToString().Split(Symbols.LineBreak);
|
||||
|
||||
public IEnumerator<string> GetEnumerator() => ContentRows.GetEnumerator();
|
||||
|
||||
public IEnumerable<string> Crop(Size maxSize) => ContentRows
|
||||
|
@ -18,7 +18,7 @@ public static class SymbolExtensions
|
||||
{ Symbols.Api, "7F52FF" },
|
||||
{ Symbols.DockerImage, "086DD7" },
|
||||
{ Symbols.NpmPackage, "CB0000" },
|
||||
{ Symbols.SEO, "4285F4" },
|
||||
{ Symbols.Seo, "4285F4" },
|
||||
{ Symbols.Auth, "FFD700" },
|
||||
};
|
||||
}
|
@ -15,7 +15,7 @@ public static class Symbols
|
||||
public const string Api = "";
|
||||
public const string DockerImage = "";
|
||||
public const string NpmPackage = "";
|
||||
public const string SEO = "";
|
||||
public const string Seo = "";
|
||||
public const string Auth = "";
|
||||
public const string NotFound = "";
|
||||
|
||||
|
47
src/TUI/Controls/Components/ProjectTitle.cs
Normal file
47
src/TUI/Controls/Components/ProjectTitle.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using System.Text;
|
||||
using TUI.Domain;
|
||||
using TUI.Engine;
|
||||
using TUI.Engine.Attributes;
|
||||
using TUI.Engine.Components;
|
||||
using TUI.Engine.Theme;
|
||||
using TUI.UserInterface;
|
||||
using static TUI.Engine.Symbols;
|
||||
|
||||
namespace TUI.Controls.Components;
|
||||
|
||||
public class ProjectTitle : ComponentBase
|
||||
{
|
||||
private readonly Project _project;
|
||||
|
||||
public ProjectTitle(Project project)
|
||||
{
|
||||
_project = project;
|
||||
}
|
||||
|
||||
protected override Sketch DrawComponent(Size minSize)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
builder.Append(GetHub().Colorized());
|
||||
builder.Append(Space);
|
||||
builder.Append((_project.IsPublicNetwork ? NetworkPublic : NetworkPrivate).Colorized());
|
||||
builder.Append(Space);
|
||||
builder.Append(_project.SeoDependent ? Seo.Colorized() : Seo.Disable());
|
||||
builder.Append(Space);
|
||||
builder.Append(_project.HasAuth ? Auth.Colorized() : Auth.Disable());
|
||||
builder.Append(Space);
|
||||
builder.Append(GetApplicationType().Colorized());
|
||||
builder.Append(Space);
|
||||
builder.Append(_project.Name.Disable());
|
||||
return new Sketch(builder);
|
||||
}
|
||||
|
||||
private string GetHub() => _project.Hub == "gitlab" ? GitLab : GitHub;
|
||||
|
||||
private string GetApplicationType()
|
||||
{
|
||||
foreach (var application in Icons.Applications.Where(application => _project.Tags.Have(application.Value)))
|
||||
return application.Key;
|
||||
|
||||
return Undefined.Hint();
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
using System.Text;
|
||||
using TUI.Engine;
|
||||
using TUI.Engine.Attributes;
|
||||
using TUI.Engine.Attributes.Alignments;
|
||||
using TUI.Engine.Components;
|
||||
using TUI.Engine.Theme;
|
||||
using TUI.UserInterface;
|
||||
|
||||
namespace TUI.Controls.Components;
|
||||
|
||||
public class Tag : ComponentBase
|
||||
{
|
||||
private IEnumerable<string> _tags;
|
||||
private string _gitType;
|
||||
|
||||
public void Bind(IEnumerable<string> tags, string gitType)
|
||||
{
|
||||
_tags = tags;
|
||||
_gitType = gitType;
|
||||
}
|
||||
|
||||
public void Render(Horizontal horizontal, Size size)
|
||||
{
|
||||
var tagBuilder = new StringBuilder();
|
||||
|
||||
tagBuilder.Append(GetGitTypeImage(_gitType));
|
||||
tagBuilder.Append(Symbols.Space);
|
||||
tagBuilder.Append(_tags.Have("public") ? Symbols.NetworkPublic : Symbols.NetworkPrivate);
|
||||
tagBuilder.Append(Symbols.Space);
|
||||
tagBuilder.Append(_tags.Have("seo") ? Symbols.SEO : Symbols.SEO.Disable());
|
||||
tagBuilder.Append(Symbols.Space);
|
||||
tagBuilder.Append(_tags.Have("auth") ? Symbols.Auth : Symbols.Auth.Disable());
|
||||
tagBuilder.Append(Symbols.Space);
|
||||
tagBuilder.Append(GetApplicationType());
|
||||
tagBuilder.Append(Symbols.Space);
|
||||
|
||||
// base.Render(tagBuilder, position, size);
|
||||
}
|
||||
|
||||
private string GetApplicationType()
|
||||
{
|
||||
foreach (var application in Icons.Applications)
|
||||
if (_tags.Have(application.Value))
|
||||
return application.Key;
|
||||
|
||||
return Symbols.Undefined;
|
||||
}
|
||||
|
||||
private static string GetGitTypeImage(string gitType) =>
|
||||
gitType switch
|
||||
{
|
||||
"gitlab" => Symbols.GitLab,
|
||||
"github" => Symbols.GitHub,
|
||||
_ => Symbols.Git
|
||||
};
|
||||
|
||||
protected override Sketch DrawComponent(Size minSize)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -13,8 +13,7 @@ public class DashboardContainer : ContainerBase
|
||||
|
||||
public DashboardContainer()
|
||||
{
|
||||
// var panel = new PanelComponent("Dependencies ".Info() + Symbols.Node.Colorized());
|
||||
var panel = new PanelComponent("Dependencies".Info());
|
||||
var panel = new PanelComponent(" ".Info() + "Dependencies".Main());
|
||||
_content = new ContentContainer();
|
||||
_content.SetOrientationVertical();
|
||||
SetOrientationVertical();
|
||||
|
@ -14,7 +14,7 @@ namespace TUI.Controls.Containers;
|
||||
public class DependenciesContainer : ContainerBase
|
||||
{
|
||||
private const int VersionColumnWidth = 10;
|
||||
private const int TitleColumnWidth = 20;
|
||||
private const int TitleColumnWidth = 25;
|
||||
|
||||
private readonly Nodes _dependencies = new();
|
||||
|
||||
@ -31,6 +31,7 @@ public class DependenciesContainer : ContainerBase
|
||||
{
|
||||
title.SetPadding(Level.Normal);
|
||||
title.SetFixed(Orientation.Horizontal, TitleColumnWidth);
|
||||
title.SetAlignment(Horizontal.Left);
|
||||
|
||||
_dependencies.Add(title);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public class TagHints : StaticComponentBase
|
||||
{
|
||||
{ Symbols.Auth, "Auth" },
|
||||
{ Symbols.NetworkPublic, "WWW" },
|
||||
{ Symbols.SEO, "SEO" },
|
||||
{ Symbols.Seo, "SEO" },
|
||||
{ Symbols.Git, "VCS" }
|
||||
};
|
||||
|
||||
|
6
src/TUI/Domain/Hub.cs
Normal file
6
src/TUI/Domain/Hub.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace TUI.Domain;
|
||||
|
||||
public record Hub
|
||||
{
|
||||
|
||||
}
|
12
src/TUI/Domain/Project.cs
Normal file
12
src/TUI/Domain/Project.cs
Normal file
@ -0,0 +1,12 @@
|
||||
namespace TUI.Domain;
|
||||
|
||||
public record Project(int Id, string Name, IEnumerable<string> Tags, string Hub)
|
||||
{
|
||||
private IEnumerable<Dependency> Dependencies => new List<Dependency>();
|
||||
|
||||
public bool IsPublicNetwork => Tags.Contains("public");
|
||||
|
||||
public bool HasAuth => Tags.Contains("auth");
|
||||
|
||||
public bool SeoDependent => Tags.Contains("seo");
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
using System.Diagnostics;
|
||||
using TUI.Controls.Components;
|
||||
using TUI.Controls.Containers;
|
||||
using TUI.Controls.Layouts;
|
||||
using TUI.Controls.Statics;
|
||||
using TUI.Domain;
|
||||
using TUI.Engine.Rendering.Canvas;
|
||||
using TUI.Providers.Dependencies;
|
||||
using TUI.Store;
|
||||
|
||||
namespace TUI.Pages;
|
||||
|
||||
@ -31,7 +33,7 @@ public abstract class PageBase : IPage
|
||||
|
||||
public class DependenciesPage : PageBase
|
||||
{
|
||||
private IEnumerable<Dependency> ConventionDependencies;
|
||||
private DependenciesStore _store;
|
||||
|
||||
public override void Render()
|
||||
{
|
||||
@ -43,23 +45,31 @@ public class DependenciesPage : PageBase
|
||||
var dependenciesHeader = new DependenciesContainer();
|
||||
dependenciesHeader.AddTitleStub();
|
||||
|
||||
foreach (var conventionDependency in ConventionDependencies)
|
||||
foreach (var conventionDependency in _store.ConventionDependencies)
|
||||
{
|
||||
dependenciesHeader.AddDependency(conventionDependency);
|
||||
}
|
||||
|
||||
dashboard.AddChildren(dependenciesHeader);
|
||||
// CommandLine = new CommandLine();
|
||||
// DependenciesView = new DependenciesView();
|
||||
|
||||
foreach (var project in _store.Projects)
|
||||
{
|
||||
var projectDependencies = new DependenciesContainer();
|
||||
projectDependencies.AddTitle(new ProjectTitle(project));
|
||||
dashboard.AddChildren(projectDependencies);
|
||||
}
|
||||
|
||||
var layout = new DashboardLayout(header, dashboard, copyright);
|
||||
canvas.Draw(layout);
|
||||
|
||||
// CommandLine = new CommandLine();
|
||||
// DependenciesView = new DependenciesView();
|
||||
}
|
||||
|
||||
public override void Bind()
|
||||
{
|
||||
var repo = new DependencyRepository();
|
||||
ConventionDependencies = repo.Read("javascript");
|
||||
_store = new DependenciesStore();
|
||||
_store.Bind();
|
||||
}
|
||||
|
||||
// private bool _commandLineInDisplay;
|
||||
|
@ -29,7 +29,7 @@ public class DependencyRepository
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Dependency> Read(string stackName)
|
||||
public IEnumerable<Dependency> ReadConventions(string stackName)
|
||||
{
|
||||
return DependenciesDto.Stacks
|
||||
.Single(stack => stack.Name == stackName)
|
||||
@ -40,4 +40,22 @@ public class DependencyRepository
|
||||
return new Dependency(convention.Version, brand);
|
||||
});
|
||||
}
|
||||
|
||||
public IEnumerable<Project> ReadProjects(string stackName)
|
||||
{
|
||||
var projects = new List<Project>();
|
||||
|
||||
var hubs = DependenciesDto.Stacks
|
||||
.Single(stack => stack.Name == stackName)
|
||||
.Hubs;
|
||||
|
||||
foreach (var hub in hubs)
|
||||
{
|
||||
projects.AddRange(hub
|
||||
.Projects
|
||||
.Select(proj => new Project(proj.Id, proj.Name, proj.Tags, hub.Type)));
|
||||
}
|
||||
|
||||
return projects;
|
||||
}
|
||||
}
|
@ -1,30 +1,41 @@
|
||||
using System.Text.Json;
|
||||
using TUI.Domain;
|
||||
using TUI.Providers.Dependencies;
|
||||
|
||||
namespace TUI.Store;
|
||||
|
||||
public static class DependenciesStore
|
||||
public class DependenciesStore
|
||||
{
|
||||
private readonly static Dictionary<string, Package> Packages = new();
|
||||
public IEnumerable<Dependency> ConventionDependencies;
|
||||
|
||||
private static Package DownloadPackage(ProjectDto projectDto)
|
||||
public IEnumerable<Project> Projects;
|
||||
|
||||
public void Bind()
|
||||
{
|
||||
// var endpoint = projectDto.Tags.Have("gitlab") ? GetGitlabEndpoint(projectDto) : projectDto.Repo;
|
||||
var endpoint = "";
|
||||
if (Packages.TryGetValue(endpoint, out var downloadPackage)) return downloadPackage;
|
||||
|
||||
using HttpClient client = new();
|
||||
var json = client.GetStringAsync(endpoint).GetAwaiter().GetResult();
|
||||
var package = JsonSerializer.Deserialize<Package>(json);
|
||||
Packages.Add(endpoint, package);
|
||||
return package;
|
||||
var repo = new DependencyRepository();
|
||||
ConventionDependencies = repo.ReadConventions("javascript");
|
||||
Projects = repo.ReadProjects("javascript");
|
||||
}
|
||||
|
||||
private static string GetGitlabEndpoint(ProjectDto projectDto)
|
||||
{
|
||||
var token = Environment.GetEnvironmentVariable("TLD_GITLAB_PAT");
|
||||
// return $"{projectDto.Repo}/api/v4/projects/{projectDto.ProjectId}/repository/files/package.json/raw?" +
|
||||
// $"private_token={token}&ref=dev";
|
||||
return "";
|
||||
}
|
||||
// private readonly static Dictionary<string, Package> Packages = new();
|
||||
//
|
||||
// private static Package DownloadPackage(ProjectDto projectDto)
|
||||
// {
|
||||
// // var endpoint = projectDto.Tags.Have("gitlab") ? GetGitlabEndpoint(projectDto) : projectDto.Repo;
|
||||
// var endpoint = "";
|
||||
// if (Packages.TryGetValue(endpoint, out var downloadPackage)) return downloadPackage;
|
||||
//
|
||||
// using HttpClient client = new();
|
||||
// var json = client.GetStringAsync(endpoint).GetAwaiter().GetResult();
|
||||
// var package = JsonSerializer.Deserialize<Package>(json);
|
||||
// Packages.Add(endpoint, package);
|
||||
// return package;
|
||||
// }
|
||||
//
|
||||
// private static string GetGitlabEndpoint(ProjectDto projectDto)
|
||||
// {
|
||||
// var token = Environment.GetEnvironmentVariable("TLD_GITLAB_PAT");
|
||||
// // return $"{projectDto.Repo}/api/v4/projects/{projectDto.ProjectId}/repository/files/package.json/raw?" +
|
||||
// // $"private_token={token}&ref=dev";
|
||||
// return "";
|
||||
// }
|
||||
}
|
@ -30,8 +30,5 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TUI.Engine\TUI.Engine.csproj"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Settings\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -10,7 +10,7 @@ public static class Icons
|
||||
{
|
||||
{ Symbols.NpmPackage.Colorized(), "package" },
|
||||
{ Symbols.DockerImage.Colorized(), "image" },
|
||||
{ Symbols.Site.Pastel("666666"), "site" },
|
||||
{ Symbols.Site.Colorized(), "site" },
|
||||
{ Symbols.Api, "api" }
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user