LoopBack4 generate uml model diagram - javascript

I'm thinking of generate a uml model for all models in my project. I tried the following packages but they didn't work for LoopBack4.
loopback-component-model-diagram
loopback-component-explorer
I added mountPath to component-config.json file. But it did not work!
I only see the swagger page, I can't see any uml model generated page.
{ "mountPath": "/modeldiagram" }
What should I do other than add mountpath or do you know of any package that generates uml model for the models?

Related

Migration in nestjs/ORM

I am creating backend application in nestjs. I had many entities. for MVP we created project with some fields in entity class. now due to change in functionalities we added more columns in the entity class. I had my legacy migration file. now to add addtional column what should be my approach.
Should I delete existing migration file and create new one?
can I generate only incremental file because I dont want to lose existing data. I mean for additional column alter command.
How can I generate migration for incremental changes? I know how to crearte migration file for entirte entity.
thanks in advance.

Forge Model Properties Excel

Currently I was following these steps to get the Forge Viewer into PowerBi. I was able to successfully get that to work but now I am attempting to get the properties out of the revit models.
I am following these steps found here
by editing this package forge-model-properties-excel
I am putting in a revit model that shows up as a 3D model in Forge viewer, and I know it has the material properties that I need. But when i run it i get the error that reads
this model has no {3D} view
I'm not sure why I am receiving this error if the model does have a 3D view.
Many thanks in advance.
The sample application is looking for a 3D view that is actually called "{3D}": https://github.com/xiaodongliang/forgeviewer_embed_in_powerbi_report/blob/70c58ab3217cdf4b10c475abf2721871984ed4e0/forge-model-properties-excel/index.js#L27.
Is it possible that the 3D views in your Revit model are named differently? If they are, make sure to update that line of code with the expected name.

Integrate React components into an existing NET Core app

I have an existing application build with .Net Core Framework. I would like to integrate React components for re-usability purposes which at this point will only be app specific. I have gone through numerous "Hello World!!" tutorials but that doesn't satisfy my need. I have also looked at reactjs.net but that also is not going to help me as the components gets rendered on the View
Scenario
Application has lots of Modals with a form which gets rendered on numerous pages. Currently it is being handled with JavaScript. The JavaScript code gets duplicated a lot to achieve it.
Goal
Would like to have a react component to replace above mentioned functionality to reduce code getting duplicated.
The problem I am facing is I am not sure how will I be able to interact with the component from a jQuery/JavaScript point of view.
Example
I have a DataTable and one of the actions is to click on a certain button to display the Modal. The code is in a separate .js file so it is separate from the View. So in this case if I click on a button I would like to render the react component. I would need to pass props through to the components and that is where I am uncertain how would I handle it :-(
Any suggestion or guidance would be appreciated.
Thanks in advance
Using react in Asp.Net Core application is easy. At first you need to know your back-end will be API based to communicate with react. So if you have not set up your Core application to an API based, it won't work. Also make sure you have installed nodeJs and other dependencies.
To get started with react, create a new folder in your Asp.Net project solution.
Open the folder in your Command line and execute:
npx create-react-app [your--folder--name]
To view your created app, run
npm start
To get started with asp.net, you need to add spa dependencies in your project.
Then you have to set up your ConfigureService method to include:
services.AddSpaStaticFiles(configuration => { configuration.RootPath = "[your--folder--name]/build"; });
Finally set up your Configure method to include:
app.UseSpaStaticFiles();
app.UseRouting();
app.UseEndpoints( ... );
app.UseSpa(spa => {
spa.Options.SourcePath = "[your--folder--name]";
if (env.IsDevelopment()) {
spa.UseReactDevelopmentServer(npmScript: "start");
}
});

Integrate a D3.js tree into a angular 4 project

I'm working on a webpage and I want to visualize a certain tree structure.
I bumped into this beautiful D3.js tree (http://bl.ocks.org/robschmuecker/7880033), but I'm having trouble importing it into my project since there are several ways (dg3-ng2 for example).
D3.js is a javascript-libary - and Angular works with typescript.
How do I integrate that certain tree into my project so that I also can modify it without any trouble afterwards?
I do have several questions like:
Where do I import the .js and the .json file?
Do I have to convert the javascript code into typescript manually?
Should I write the .js code into a .ts file?
Should I make a reference in my index.html?
Should I make use of a D3-Service?
As you can see I'm quiet confused.
If you use Angular, it's simple)
Istall d3 from npm.
Import d3 in component like that:
import * as d3 from 'd3';
And write you logic, use d3 syntaxis, example:
constructor(private element: ElementRef) {
this.htmlElement = this.element.nativeElement;
this.host = d3.select(this.element.nativeElement);
}
You graphic is a component, in you component descrite functions to build svg, draw axis and etc.
Then on init of component call methods that you describe, example:
ngOnInit(): void {
this.setup();
this.buildSVG();
this.drawFirstPlanRects();
this.drawSecondPlanRects();
this.drawXAxis();
this.drawYAxis();
this.drawCrossLines();
}
I'd strongly recommend using angular-cli since when you install the d3 library you won't have to deal with the boiler plate of hooking it into the app properly. You'd just need to import it into your ts document like the above example shows. On importing the json there are several different ways that it could be handled. You could just store the json in a variable in the .ts file, you could store it in a static json document that you then host along with the app and there a many examples of pulling files and loading json data out there already.
You don't have to convert any of the js code you have since ts is essentially js with types, though you might have to declare an any type for some things, but if you want ts code you will have to manually convert or find a ts example. I'd strongly recommend a good IDE that is compatible with ts. It'll do a lot of the heavy lifting of finding mistakes.
It's rather difficult to answer that question since I don't know the specs of your project. Generally if you are doing a one off thing that does't need angular I'd just keep it simple with js and drop the usage of angular. If this is part of a larger app though I'd recommend writing it in ts since angular2+ is written in ts and most examples you find online will be in ts.
If you are using angular-cli you won't need to make a reference in your index.html file
I'm not sure what you are asking here.
From the questions you are asking I'd strongly recommend really looking at angular and learning how to properly create an app with it and then figure out how to integrate d3 int the project, since some of the questions you are asking aren't related to just working with d3 in angular.

Laravel 4: How would you integrate user definable templates?

I am building an application in Laravel 4. This application needs to be skinnable by the client. In essence, the owner of the app needs to be able to create his own template / styling / layout for his version, and upload it (ideally in a zip). Could you suggest any ideas / best practices / tips for building in functionality where this is possible?
Where should I locate the templates? Would you use the app/views folder or would you create a writable folder in the public folder?
Any ideas or suggestions or even links to a tutorial would be appreciated.
In a nutshell the way this is handled in Laravel is to use cascading views and a view namespace. Creating a namespace is easy, just pick a name and add the paths you want it to search in in the order of priority.
View::addNamespace('template', ['path/to/public/views', 'path/to/app/views']);
Now, when using View::make you can prefix with your namespace and it'll first search in path/to/public/views, if the view is not there it will then look in path/to/app/views. This is extremely handy when you want to provide a sort of base template and simply allow them to provide their own templates that overwrite the base.
Here is how you reference the namespaced views.
return View::make('template::example.view');

Categories