Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

[Swagger] Create Branding #3652

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

[Swagger] Create Branding #3652

wants to merge 18 commits into from

Conversation

imclint21
Copy link
Contributor

@imclint21 imclint21 commented May 24, 2019

Make a Swagger Branding

The idea is to have a custom Swagger with some branding details / style.

image

@codingupastorm
Copy link
Collaborator

Nice.

@@ -97,6 +98,12 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF

app.UseCors("CorsPolicy");

app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(@"C:\Users\me\Stratis\StratisBitcoinFullNode\src\Stratis.Bitcoin.Features.Api\wwwroot\"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need some help to found the Stratis.Bitcoin.Features.Api folder programatically, but for now I add it as raw string

Copy link
Contributor Author

@imclint21 imclint21 May 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally done in bc0580a

@imclint21 imclint21 changed the title Make a Swagger Branding [Swagger] Create Branding May 24, 2019
@imclint21
Copy link
Contributor Author

imclint21 commented May 24, 2019

Important thing: The feature Stratis.Bitcoin.Features.Api is used as a project reference, so in each projet that use it, like Stratis.StratisD, the DLL is copied into the output folder, the problem is my changes add a wwwroot folder with some assets.

So I added a copy feature in the .csproj of Stratis.Bitcoin.Features.Api to copy the wwwroot folder in the output, like this:

  <ItemGroup>
    <Content Update="wwwroot\**\*.*">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

My question is, does this will be a problem ? and also if I rename the wwwroot folder in swagger by example.

@imclint21
Copy link
Contributor Author

imclint21 commented May 24, 2019

About the Stratis Color codes, can have some precisions, I don't know if the color that I use is the good.

Fixed f8d062a

@imclint21
Copy link
Contributor Author

imclint21 commented May 27, 2019

Another point: Maybe we can display an information on the swagger about the network that is ran, if it's bitcoin network, stratis network etc

I said this because when I launch Stratis.StratisD or Bitcoin.BitcoinD I don't see any differences in the swagger.

Copy link
Contributor

@kogot kogot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks ok.

But I have issues with styles. I think the original swagger style easier to read and navigate compare to "Post" form with new style, where it's white on white. When you click "Try out" it's not obvious that form is ready for your input.

old look


newlookform

@kogot
Copy link
Contributor

kogot commented May 28, 2019

@clintnetwork top of the page looks great, but bottom part little bit confused me.

@noescape00 what do you think?

@imclint21
Copy link
Contributor Author

imclint21 commented May 28, 2019

Yes yes, you right, the try out design is not finished, for now its less readable it's true.

In fact I made this PR to have a base and discuss about the direction to take. 👍

@noescape00
Copy link
Contributor

@kogot I agree with you.
Let's see how it will look like once the design is done

@kogot
Copy link
Contributor

kogot commented May 30, 2019

Way better now from a readability perspective. Is it the final version?

@imclint21
Copy link
Contributor Author

No no, we had some ideas with @dangershony to create a multipages swagger with an embedded wallet maybe or other features.

I also opened this PR to brainstorm about that.

@dangershony
Copy link
Contributor

@clintnetwork multipage can be done in following PRs, if you find a good stable swagger customized UI I say we can consider pushing it.

@imclint21
Copy link
Contributor Author

imclint21 commented Jun 3, 2019

I create a ResourceFileProvider to serve assets from resources because I get some issues using
EmbeddedFileProvider, if someone can help me.

@MithrilMan
Copy link
Contributor

I had an old dashboard project for stratis and I was using EmbeddedFileProvider but a lot of time passed (more than 2 years!) here
https://github.com/MithrilMan/Stratis.Bitcoin.Dashboard/blob/56c98c199b2ea873c13b69ae123c3fe53a761ed5/Stratis.Bitcoin.Dashboard/Startup.cs

what kind of problem did you have? try to take a look at the code if it may help you, otherwise I'll try to remember how I was using it

@imclint21
Copy link
Contributor Author

Ha nice @MithrilMan just trying to use EmbeddedFileProvider to embed the wwwroot folder in resources and use it but I don't know why but it does not works, maybe you can fork my PR and try to implement EmbeddedFileProvider

@MithrilMan
Copy link
Contributor

@clintnetwork ok if I'll find the time I'll try that

@imclint21
Copy link
Contributor Author

@MithrilMan are you on the slack ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants