├── MicrofrontendTemplate
├── nginx
│ ├── .gitignore
│ ├── stop.bat
│ ├── contrib
│ │ ├── vim
│ │ │ ├── ftplugin
│ │ │ │ └── nginx.vim
│ │ │ ├── ftdetect
│ │ │ │ └── nginx.vim
│ │ │ └── indent
│ │ │ │ └── nginx.vim
│ │ ├── README
│ │ ├── unicode2nginx
│ │ │ └── unicode-to-nginx.pl
│ │ └── geo2nginx.pl
│ ├── docs
│ │ ├── README
│ │ ├── zlib.LICENSE
│ │ └── LICENSE
│ ├── run.bat
│ ├── nginx.exe
│ ├── html
│ │ ├── 50x.html
│ │ └── index.html
│ └── conf
│ │ ├── scgi_params
│ │ ├── uwsgi_params
│ │ ├── fastcgi_params
│ │ ├── fastcgi.conf
│ │ └── nginx.conf
├── global.json
├── Portal
│ ├── appsettings.json
│ ├── wwwroot
│ │ ├── landing.jpg
│ │ ├── 404.html
│ │ └── index.html
│ ├── run.bat
│ ├── server
│ │ ├── Program.cs
│ │ └── Controllers
│ │ │ └── LoginController.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── client
│ │ ├── components
│ │ │ ├── App.js
│ │ │ ├── Login.js
│ │ │ └── Portal.js
│ │ ├── auth.js
│ │ ├── index.js
│ │ └── loader.js
│ ├── package.json
│ ├── webpack.config.js
│ ├── tempkey.rsa
│ └── Portal.csproj
├── ReactFormApp
│ ├── appsettings.json
│ ├── README.md
│ ├── run.bat
│ ├── client
│ │ ├── index.js
│ │ └── components
│ │ │ ├── AddressForm.js
│ │ │ ├── BasicInfoForm.js
│ │ │ └── Form.js
│ ├── server
│ │ ├── Services
│ │ │ └── CustomerFormData.cs
│ │ ├── Program.cs
│ │ └── ViewModels
│ │ │ ├── NewCustomerForm.cs
│ │ │ ├── PhoneForm.cs
│ │ │ ├── AddressForm.cs
│ │ │ └── PersonForm.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── wwwroot
│ │ └── index.html
│ ├── webpack.config.js
│ └── package.json
├── ReactTodoApp
│ ├── appsettings.json
│ ├── README.md
│ ├── run.bat
│ ├── client
│ │ └── index.js
│ ├── server
│ │ ├── Program.cs
│ │ └── ViewModels
│ │ │ └── TodoList.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── webpack.config.js
│ ├── wwwroot
│ │ └── index.html
│ ├── package.json
│ └── ReactTodoApp.csproj
├── VueTodoApp
│ ├── appsettings.json
│ ├── README.md
│ ├── run.bat
│ ├── server
│ │ ├── Program.cs
│ │ └── ViewModels
│ │ │ └── TodoList.cs
│ ├── client
│ │ └── index.js
│ ├── package.json
│ ├── Properties
│ │ └── launchSettings.json
│ ├── wwwroot
│ │ └── index.html
│ ├── webpack.config.js
│ └── VueTodoApp.csproj
├── ReactDashboardApp
│ ├── appsettings.json
│ ├── README.md
│ ├── run.bat
│ ├── client
│ │ ├── index.js
│ │ └── components
│ │ │ ├── InfoCard.js
│ │ │ ├── ActivitiesCard.js
│ │ │ └── Dashboard.js
│ ├── server
│ │ └── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── wwwroot
│ │ └── index.html
│ ├── webpack.config.js
│ └── package.json
├── heroku-deploy
│ ├── Portal
│ │ ├── appsettings.json
│ │ ├── excludedfiles.txt
│ │ ├── deploy.bat
│ │ ├── Dockerfile
│ │ └── build.bat
│ ├── ReactDashboardApp
│ │ ├── appsettings.json
│ │ ├── excludedfiles.txt
│ │ ├── deploy.bat
│ │ ├── Dockerfile
│ │ └── build.bat
│ └── nginx
│ │ ├── deploy.bat
│ │ └── Dockerfile
├── .template.config
│ └── template.json
├── Shared
│ ├── IdentityServer
│ │ ├── IdentityServerSettings.cs
│ │ ├── IdentityServerConfig.cs
│ │ └── IdentityServerClient.cs
│ └── Shared.csproj
├── run.bat
└── README.md
├── ReactTemplate
├── screenshot.gif
├── content
│ ├── client
│ │ ├── favicon.ico
│ │ ├── images
│ │ │ └── material_bg.png
│ │ ├── app.tsx
│ │ ├── routes.tsx
│ │ ├── views
│ │ │ └── App.tsx
│ │ ├── styles
│ │ │ ├── styles.ts
│ │ │ ├── theme-default.ts
│ │ │ └── app.css
│ │ ├── components
│ │ │ ├── BasePage.tsx
│ │ │ ├── table
│ │ │ │ └── Pagination.tsx
│ │ │ ├── dashboard
│ │ │ │ ├── InfoBox.tsx
│ │ │ │ ├── Traffic.tsx
│ │ │ │ └── ServerUsage.tsx
│ │ │ └── Header.tsx
│ │ └── auth.ts
│ ├── wwwroot
│ │ ├── images
│ │ │ └── avatar.png
│ │ ├── 404.html
│ │ └── index.html
│ ├── .template.config
│ │ └── template.json
│ ├── .gitignore
│ ├── tsconfig.json
│ ├── webpack.config.js
│ ├── projectName.sln
│ ├── package.json
│ └── server
│ │ ├── Program.cs
│ │ ├── ViewModels
│ │ ├── AppLayout.cs
│ │ └── Dashboard.cs
│ │ └── Services
│ │ └── EmployeeService.cs
├── template.nuspec
└── README.md
├── _archive
├── ReactTemplateTS
│ ├── content
│ │ ├── images.d.ts
│ │ ├── .babelrc
│ │ ├── client
│ │ │ ├── favicon.ico
│ │ │ ├── images
│ │ │ │ └── material_bg.png
│ │ │ ├── app.tsx
│ │ │ ├── styles
│ │ │ │ ├── theme-default.ts
│ │ │ │ ├── styles.ts
│ │ │ │ └── app.css
│ │ │ ├── components
│ │ │ │ ├── BasePage.tsx
│ │ │ │ ├── table
│ │ │ │ │ └── Pagination.tsx
│ │ │ │ ├── dashboard
│ │ │ │ │ ├── ServerUsage.tsx
│ │ │ │ │ ├── Traffic.tsx
│ │ │ │ │ ├── InfoBox.tsx
│ │ │ │ │ └── RecentActivities.tsx
│ │ │ │ └── Header.tsx
│ │ │ ├── views
│ │ │ │ └── App.tsx
│ │ │ ├── auth.tsx
│ │ │ └── routes.tsx
│ │ ├── .template.config
│ │ │ └── template.json
│ │ ├── .gitignore
│ │ ├── tsconfig.json
│ │ ├── server
│ │ │ ├── Program.cs
│ │ │ ├── ViewModels
│ │ │ │ └── AppLayout.cs
│ │ │ └── Services
│ │ │ │ └── EmployeeService.cs
│ │ ├── wwwroot
│ │ │ └── index.html
│ │ ├── webpack.config.js
│ │ ├── package.json
│ │ ├── dotnetify_react_template.sln
│ │ └── dotnetify_react_template.csproj
│ ├── screenshot.gif
│ ├── .editorconfig
│ ├── template.nuspec
│ └── README.md
├── Routing
│ ├── wwwroot
│ │ ├── favicon.ico
│ │ ├── Index.html
│ │ └── Page3.html
│ ├── compilerconfig.json
│ ├── Program.cs
│ ├── package.json
│ ├── webpack.config.js
│ ├── Properties
│ │ └── launchSettings.json
│ ├── ViewModels
│ │ ├── Page1.cs
│ │ ├── Index.cs
│ │ └── Page2.cs
│ ├── Routing.csproj
│ ├── src
│ │ ├── app.js
│ │ └── Index.jsx
│ ├── Routing.sln
│ ├── compilerconfig.json.defaults
│ ├── Startup.cs
│ └── DotNetify.ServerSideRender.cs
├── LiveChart
│ ├── compilerconfig.json
│ ├── src
│ │ ├── app.js
│ │ └── LiveChart.jsx
│ ├── wwwroot
│ │ └── index.html
│ ├── webpack.config.js
│ ├── LiveChart.csproj
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── LiveChart.cs
│ ├── LiveChart.sln
│ ├── package.json
│ ├── compilerconfig.json.defaults
│ ├── IISPublishingSteps.md
│ └── Startup.cs
├── HelloWorld
│ ├── src
│ │ ├── app.js
│ │ └── HelloWorld.jsx
│ ├── webpack.config.js
│ ├── HelloWorld.csproj
│ ├── wwwroot
│ │ └── index.html
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── HelloWorld.cs
│ ├── HelloWorld.sln
│ ├── package.json
│ └── Startup.cs
└── README.md
└── README.md
/MicrofrontendTemplate/nginx/.gitignore:
--------------------------------------------------------------------------------
1 | logs
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/stop.bat:
--------------------------------------------------------------------------------
1 | nginx -s stop
2 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/contrib/vim/ftplugin/nginx.vim:
--------------------------------------------------------------------------------
1 | setlocal commentstring=#\ %s
2 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "3.1.201"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/docs/README:
--------------------------------------------------------------------------------
1 |
2 | Documentation is available at http://nginx.org
3 |
4 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/run.bat:
--------------------------------------------------------------------------------
1 | if not exist logs mkdir logs
2 | if not exist temp mkdir temp
3 | nginx
4 |
--------------------------------------------------------------------------------
/ReactTemplate/screenshot.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/ReactTemplate/screenshot.gif
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/images.d.ts:
--------------------------------------------------------------------------------
1 | declare module "*.svg";
2 | declare module "*.png";
3 | declare module "*.jpg";
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "IdentityServer": {
3 | "Uri": "http://localhost:5000"
4 | }
5 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "IdentityServer": {
3 | "Uri": "http://localhost:5000"
4 | }
5 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactTodoApp/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "IdentityServer": {
3 | "Uri": "http://localhost:5000"
4 | }
5 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/VueTodoApp/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "IdentityServer": {
3 | "Uri": "http://localhost:5000"
4 | }
5 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactDashboardApp/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "IdentityServer": {
3 | "Uri": "http://localhost:5000"
4 | }
5 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/nginx.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/MicrofrontendTemplate/nginx/nginx.exe
--------------------------------------------------------------------------------
/_archive/Routing/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/_archive/Routing/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/ReactTemplate/content/client/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/ReactTemplate/content/client/favicon.ico
--------------------------------------------------------------------------------
/_archive/LiveChart/compilerconfig.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "outputFile": "src/LiveChart.js",
4 | "inputFile": "src/LiveChart.jsx"
5 | }
6 | ]
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "es2015",
4 | "react",
5 | "stage-0"
6 | ]
7 | }
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/screenshot.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/_archive/ReactTemplateTS/screenshot.gif
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 | [*]
3 | indent_style = space
4 | indent_size = 4
5 | charset = utf-utf-8-bom
6 | end_of_line = crlf
--------------------------------------------------------------------------------
/MicrofrontendTemplate/heroku-deploy/Portal/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "IdentityServer": {
3 | "Uri": "http://dotnetify-mfe.herokuapp.com"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/wwwroot/landing.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/MicrofrontendTemplate/Portal/wwwroot/landing.jpg
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/README.md:
--------------------------------------------------------------------------------
1 | ## How to run:
2 |
3 | Start the Portal first (app requires an auth server), then execute `run.bat [dev|prod]`.
4 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactTodoApp/README.md:
--------------------------------------------------------------------------------
1 | ## How to run:
2 |
3 | Start the Portal first (app requires an auth server), then execute `run.bat [dev|prod]`.
4 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/VueTodoApp/README.md:
--------------------------------------------------------------------------------
1 | ## How to run:
2 |
3 | Start the Portal first (app requires an auth server), then execute `run.bat [dev|prod]`.
4 |
--------------------------------------------------------------------------------
/ReactTemplate/content/wwwroot/images/avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/ReactTemplate/content/wwwroot/images/avatar.png
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactDashboardApp/README.md:
--------------------------------------------------------------------------------
1 | ## How to run:
2 |
3 | Start the Portal first (app requires an auth server), then execute `run.bat [dev|prod]`.
4 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/heroku-deploy/ReactDashboardApp/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "IdentityServer": {
3 | "Uri": "http://dotnetify-mfe.herokuapp.com"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/.template.config/template.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/MicrofrontendTemplate/.template.config/template.json
--------------------------------------------------------------------------------
/ReactTemplate/content/.template.config/template.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/ReactTemplate/content/.template.config/template.json
--------------------------------------------------------------------------------
/ReactTemplate/content/client/images/material_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/ReactTemplate/content/client/images/material_bg.png
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/_archive/ReactTemplateTS/content/client/favicon.ico
--------------------------------------------------------------------------------
/MicrofrontendTemplate/heroku-deploy/nginx/deploy.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | call heroku container:push web -a dotnetify-mfe
4 | call heroku container:release web -a dotnetify-mfe
5 |
6 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/heroku-deploy/nginx/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM nginx:alpine
2 | COPY ./nginx.conf /etc/nginx
3 | CMD sed -i -e 's/$PORT/'"$PORT"'/g' /etc/nginx/nginx.conf && nginx -g 'daemon off;'
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/.template.config/template.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/_archive/ReactTemplateTS/content/.template.config/template.json
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/images/material_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsuryd/dotNetify-react-template/HEAD/_archive/ReactTemplateTS/content/client/images/material_bg.png
--------------------------------------------------------------------------------
/MicrofrontendTemplate/heroku-deploy/Portal/excludedfiles.txt:
--------------------------------------------------------------------------------
1 | .vssscc
2 | .vspscc
3 | .log
4 | .user
5 | \obj\
6 | \bin\
7 | \Properties\
8 | \node_modules\
9 | \coverage\
10 | \wwwroot\dist\
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/wwwroot/404.html:
--------------------------------------------------------------------------------
1 |
Page not found (404)
2 | Redirecting to home page...
3 |
4 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/heroku-deploy/ReactDashboardApp/excludedfiles.txt:
--------------------------------------------------------------------------------
1 | .vssscc
2 | .vspscc
3 | .log
4 | .user
5 | \obj\
6 | \bin\
7 | \Properties\
8 | \node_modules\
9 | \coverage\
10 | \wwwroot\dist\
--------------------------------------------------------------------------------
/_archive/LiveChart/src/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import LiveChart from './LiveChart.jsx';
4 |
5 | ReactDOM.render( , document.getElementById('Content'));
6 |
--------------------------------------------------------------------------------
/_archive/HelloWorld/src/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import HelloWorld from './HelloWorld.jsx';
4 |
5 | ReactDOM.render( , document.getElementById('Content'));
6 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/run.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | if not exist node_modules call npm i
3 | if "%1" == "prod" goto :prod
4 | call npm run build
5 | dotnet run
6 | exit
7 |
8 | :prod
9 | call npm run prod
10 | dotnet run --launch-profile prod
11 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/run.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | if not exist node_modules call npm i
3 | if "%1" == "prod" goto :prod
4 | call npm run build
5 | dotnet run
6 | exit
7 |
8 | :prod
9 | call npm run prod
10 | dotnet run --launch-profile prod
11 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactTodoApp/run.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | if not exist node_modules call npm i
3 | if "%1" == "prod" goto :prod
4 | call npm run build
5 | dotnet run
6 | exit
7 |
8 | :prod
9 | call npm run prod
10 | dotnet run --launch-profile prod
11 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/VueTodoApp/run.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | if not exist node_modules call npm i
3 | if "%1" == "prod" goto :prod
4 | call npm run build
5 | dotnet run
6 | exit
7 |
8 | :prod
9 | call npm run prod
10 | dotnet run --launch-profile prod
11 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactDashboardApp/run.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | if not exist node_modules call npm i
3 | if "%1" == "prod" goto :prod
4 | call npm run build
5 | dotnet run
6 | exit
7 |
8 | :prod
9 | call npm run prod
10 | dotnet run --launch-profile prod
11 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/contrib/vim/ftdetect/nginx.vim:
--------------------------------------------------------------------------------
1 | au BufRead,BufNewFile *.nginx set ft=nginx
2 | au BufRead,BufNewFile */etc/nginx/* set ft=nginx
3 | au BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx
4 | au BufRead,BufNewFile nginx.conf set ft=nginx
5 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Shared/IdentityServer/IdentityServerSettings.cs:
--------------------------------------------------------------------------------
1 | namespace Shared
2 | {
3 | public class IdentityServerSettings
4 | {
5 | public static readonly string SectionName = "IdentityServer";
6 |
7 | public string Uri { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/ReactTemplate/content/client/app.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './routes';
4 | import 'flexboxgrid/css/flexboxgrid.css';
5 | import './styles/app.css';
6 |
7 | ReactDOM.render( , document.getElementById('App'));
8 |
--------------------------------------------------------------------------------
/_archive/Routing/compilerconfig.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "outputFile": "wwwroot/Page1.js",
4 | "inputFile": "wwwroot/Page1.jsx",
5 | "sourceMap": false
6 | },
7 | {
8 | "outputFile": "wwwroot/Page2.js",
9 | "inputFile": "wwwroot/Page2.jsx",
10 | "sourceMap": false
11 | }
12 | ]
--------------------------------------------------------------------------------
/_archive/LiveChart/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | DotNetify-React
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/client/index.js:
--------------------------------------------------------------------------------
1 | import { createWebComponent } from 'dotnetify-elements/web-components/Core';
2 | import Form from './components/Form';
3 |
4 | const elementName = 'react-form-app';
5 | createWebComponent(Form, elementName);
6 |
7 | export default document.createElement(elementName);
8 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactTodoApp/client/index.js:
--------------------------------------------------------------------------------
1 | import { createWebComponent } from 'dotnetify-elements/web-components/Core';
2 | import TodoList from './components/TodoList';
3 |
4 | const elementName = 'react-todo-app';
5 | createWebComponent(TodoList, elementName);
6 |
7 | export default document.createElement(elementName);
8 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/app.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import * as ReactDOM from 'react-dom';
3 | import App from './routes';
4 | import 'flexboxgrid/css/flexboxgrid.css';
5 | import './styles/app.css';
6 |
7 | ReactDOM.render(
8 | ,
9 | document.getElementById('App'));
10 |
11 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactDashboardApp/client/index.js:
--------------------------------------------------------------------------------
1 | import { createWebComponent } from 'dotnetify-elements/web-components/Core';
2 | import Dashboard from './components/Dashboard';
3 |
4 | const elementName = 'react-dashboard-app';
5 | createWebComponent(Dashboard, elementName);
6 |
7 | export default document.createElement(elementName);
8 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/contrib/vim/indent/nginx.vim:
--------------------------------------------------------------------------------
1 | if exists("b:did_indent")
2 | finish
3 | endif
4 | let b:did_indent = 1
5 |
6 | setlocal indentexpr=
7 |
8 | " cindent actually works for nginx' simple file structure
9 | setlocal cindent
10 | " Just make sure that the comments are not reset as defs would be.
11 | setlocal cinkeys-=0#
12 |
--------------------------------------------------------------------------------
/ReactTemplate/content/client/routes.tsx:
--------------------------------------------------------------------------------
1 | import App from './views/App';
2 | import Dashboard from './views/Dashboard';
3 | import FormPage from './views/FormPage';
4 | import TablePage from './views/TablePage';
5 |
6 | // Import all the routeable views into the global window variable.
7 | Object.assign(window, {
8 | Dashboard,
9 | FormPage,
10 | TablePage
11 | });
12 |
13 | export default App;
14 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /bin
6 | /obj
7 |
8 | #Visual Studio
9 | .vs
10 | .vscode
11 | *.csproj.user
12 | /Properties/launchSettings.json
13 |
14 | # misc
15 | .DS_Store
16 | .env
17 | npm-debug.log*
18 | yarn-debug.log*
19 | yarn-error.log*
20 | wwwroot/dist
21 |
22 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Shared/Shared.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/_archive/HelloWorld/webpack.config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = {
4 | mode: 'development',
5 | entry: { bundle: './src/app.js' },
6 | output: {
7 | path: __dirname + '/wwwroot',
8 | publicPath: '/'
9 | },
10 | resolve: {
11 | modules: [ 'client', 'node_modules' ]
12 | },
13 | module: {
14 | rules: [ { test: /\.jsx?$/, use: 'babel-loader', exclude: /node_modules/ } ]
15 | }
16 | };
17 |
--------------------------------------------------------------------------------
/_archive/LiveChart/webpack.config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = {
4 | mode: 'development',
5 | entry: { bundle: './src/app.js' },
6 | output: {
7 | path: __dirname + '/wwwroot',
8 | publicPath: '/'
9 | },
10 | resolve: {
11 | modules: [ 'client', 'node_modules' ]
12 | },
13 | module: {
14 | rules: [ { test: /\.jsx?$/, use: 'babel-loader', exclude: /node_modules/ } ]
15 | }
16 | };
17 |
--------------------------------------------------------------------------------
/ReactTemplate/content/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /bin
6 | /obj
7 |
8 | #Visual Studio
9 | .vs
10 | .vscode
11 | *.csproj.user
12 | /Properties/launchSettings.json
13 |
14 | # misc
15 | .DS_Store
16 | .env
17 | npm-debug.log*
18 | yarn-debug.log*
19 | yarn-error.log*
20 | wwwroot/dist
21 |
22 | #Typescript
23 | /typings
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/server/Services/CustomerFormData.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace ReactFormApp
4 | {
5 | using StringDictionary = Dictionary;
6 |
7 | public class CustomerFormData
8 | {
9 | public StringDictionary Person { get; set; }
10 | public StringDictionary Phone { get; set; }
11 | public StringDictionary Address { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/_archive/HelloWorld/HelloWorld.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/heroku-deploy/Portal/deploy.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | echo --- Copy source code
4 | xcopy ..\..\Portal\*.* .\__tmp__\Portal\ /q /s /e /d /y /exclude:excludedfiles.txt
5 | xcopy ..\..\Shared\*.* .\__tmp__\Shared\ /q /s /e /d /y /exclude:excludedfiles.txt
6 |
7 | xcopy appsettings.json .\__tmp__\Portal\ /q /y
8 |
9 | call heroku container:push web -a dotnetify-portal
10 | call heroku container:release web -a dotnetify-portal
11 |
12 | rd __tmp__ /q /s
13 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": ".wwwroot/dist/",
4 | "noImplicitAny": false,
5 | "strict": false,
6 | "sourceMap": true,
7 | "lib": ["es6", "dom"],
8 | "module": "esnext",
9 | "target": "es5",
10 | "allowSyntheticDefaultImports": true,
11 | "jsx": "react",
12 | "allowJs": true,
13 | "moduleResolution": "node"
14 | },
15 | "exclude": ["wwwroot", "node_modules"]
16 | }
17 |
--------------------------------------------------------------------------------
/_archive/HelloWorld/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DotNetify-React
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ReactTemplate/content/client/views/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import LoginPage from './LoginPage';
3 | import AppLayout from './AppLayout';
4 | import auth from '../auth';
5 |
6 | export default function App() {
7 | const [authenticated, setAuthenticated] = React.useState(auth.hasAccessToken());
8 | const handleAuthenticated = () => setAuthenticated(true);
9 |
10 | return !authenticated ? : ;
11 | }
12 |
--------------------------------------------------------------------------------
/_archive/Routing/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore;
2 | using Microsoft.AspNetCore.Hosting;
3 |
4 | namespace Routing
5 | {
6 | public class Program
7 | {
8 | public static void Main(string[] args)
9 | {
10 | CreateWebHostBuilder(args).Build().Run();
11 | }
12 |
13 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
14 | WebHost.CreateDefaultBuilder(args)
15 | .UseStartup();
16 | }
17 | }
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/styles/theme-default.ts:
--------------------------------------------------------------------------------
1 | import getMuiTheme from "material-ui/styles/getMuiTheme";
2 | import { blue600, grey900 } from "material-ui/styles/colors";
3 |
4 | const themeDefault = getMuiTheme({
5 | palette: {},
6 | appBar: {
7 | height: 57,
8 | color: blue600
9 | },
10 | drawer: {
11 | width: 230,
12 | color: grey900
13 | },
14 | raisedButton: {
15 | primaryColor: blue600
16 | }
17 | });
18 |
19 | export default themeDefault;
20 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/VueTodoApp/server/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore;
2 | using Microsoft.AspNetCore.Hosting;
3 |
4 | namespace VueTodoApp
5 | {
6 | public class Program
7 | {
8 | public static void Main(string[] args)
9 | {
10 | BuildWebHost(args).Run();
11 | }
12 |
13 | public static IWebHost BuildWebHost(string[] args) =>
14 | WebHost.CreateDefaultBuilder(args)
15 | .UseStartup()
16 | .Build();
17 | }
18 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/server/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore;
2 | using Microsoft.AspNetCore.Hosting;
3 |
4 | namespace ReactFormApp
5 | {
6 | public class Program
7 | {
8 | public static void Main(string[] args)
9 | {
10 | BuildWebHost(args).Run();
11 | }
12 |
13 | public static IWebHost BuildWebHost(string[] args) =>
14 | WebHost.CreateDefaultBuilder(args)
15 | .UseStartup()
16 | .Build();
17 | }
18 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactTodoApp/server/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore;
2 | using Microsoft.AspNetCore.Hosting;
3 |
4 | namespace ReactTodoApp
5 | {
6 | public class Program
7 | {
8 | public static void Main(string[] args)
9 | {
10 | BuildWebHost(args).Run();
11 | }
12 |
13 | public static IWebHost BuildWebHost(string[] args) =>
14 | WebHost.CreateDefaultBuilder(args)
15 | .UseStartup()
16 | .Build();
17 | }
18 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactDashboardApp/server/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore;
2 | using Microsoft.AspNetCore.Hosting;
3 |
4 | namespace ReactDashboardApp
5 | {
6 | public class Program
7 | {
8 | public static void Main(string[] args)
9 | {
10 | BuildWebHost(args).Run();
11 | }
12 |
13 | public static IWebHost BuildWebHost(string[] args) =>
14 | WebHost.CreateDefaultBuilder(args)
15 | .UseStartup()
16 | .Build();
17 | }
18 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/heroku-deploy/ReactDashboardApp/deploy.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | echo --- Copy source code
4 | xcopy ..\..\ReactDashboardApp\*.* .\__tmp__\ReactDashboardApp\ /q /s /e /d /y /exclude:excludedfiles.txt
5 | xcopy ..\..\Shared\*.* .\__tmp__\Shared\ /q /s /e /d /y /exclude:excludedfiles.txt
6 |
7 | xcopy appsettings.json .\__tmp__\ReactDashboardApp\ /q /y
8 |
9 | call heroku container:push web -a dotnetify-dashboard
10 | call heroku container:release web -a dotnetify-dashboard
11 |
12 | rd __tmp__ /q /s
13 |
--------------------------------------------------------------------------------
/_archive/LiveChart/LiveChart.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/ReactTemplate/content/client/styles/styles.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const styles: { [name: string]: React.CSSProperties } = {
4 | navigation: {
5 | fontSize: 15,
6 | fontWeight: 'lighter',
7 | color: '#777',
8 | paddingBottom: 15,
9 | display: 'block'
10 | },
11 | title: {
12 | fontSize: 24,
13 | fontWeight: 'lighter',
14 | marginBottom: 20
15 | },
16 | paper: {
17 | padding: 30
18 | },
19 | clear: {
20 | clear: 'both'
21 | }
22 | };
23 |
24 | export default styles;
25 |
--------------------------------------------------------------------------------
/_archive/Routing/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "name": "routing",
4 | "private": true,
5 | "devDependencies": {
6 | "babel-core": "6.23.1",
7 | "babel-loader": "6.4.0",
8 | "babel-polyfill": "6.26.0",
9 | "babel-preset-es2015": "6.22.0",
10 | "babel-preset-react": "6.23.0",
11 | "dotnetify": "3.0.1",
12 | "jquery": "3.4.1",
13 | "jsdom": "9.12.0",
14 | "material-ui": "0.19.4",
15 | "react": "15.4.2",
16 | "react-dom": "15.4.2",
17 | "webpack": "2.2.1"
18 | }
19 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/VueTodoApp/client/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import vueCustomElement from 'vue-custom-element';
3 | import TodoList from './components/TodoList.vue';
4 |
5 | const elementName = 'vue-todo-app';
6 |
7 | Vue.use(vueCustomElement);
8 | Vue.customElement(elementName, TodoList, {
9 | shadow: false, // Don't use shadow-DOM so global css can affect the inner Vue component.
10 | destroyTimeout: 1 // Immediately destroy the Vue component when the custom element is detached.
11 | });
12 |
13 | export default document.createElement(elementName);
14 |
--------------------------------------------------------------------------------
/ReactTemplate/content/client/styles/theme-default.ts:
--------------------------------------------------------------------------------
1 | import { blue, pink, grey } from "@material-ui/core/colors";
2 | import { createTheme } from "@material-ui/core/styles";
3 |
4 | export const defaultTheme = createTheme({
5 | palette: {
6 | primary: blue,
7 | secondary: pink
8 | },
9 | // @ts-ignore
10 | appBar: {
11 | height: 57,
12 | color: blue[600]
13 | },
14 | drawer: {
15 | width: 230,
16 | color: grey[900]
17 | },
18 | raisedButton: {
19 | primaryColor: blue[600]
20 | }
21 | });
22 |
23 | export default defaultTheme;
24 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/styles/styles.ts:
--------------------------------------------------------------------------------
1 | import { typography } from "material-ui/styles";
2 | import { grey600 } from "material-ui/styles/colors";
3 | const styles = {
4 | navigation: {
5 | fontSize: 15,
6 | fontWeight: typography.fontWeightLight,
7 | color: grey600,
8 | paddingBottom: 15,
9 | display: "block"
10 | },
11 | title: {
12 | fontSize: 24,
13 | fontWeight: typography.fontWeightLight,
14 | marginBottom: 20
15 | },
16 | paper: {
17 | padding: 30
18 | }
19 | } as any;
20 |
21 | export default styles;
22 |
--------------------------------------------------------------------------------
/ReactTemplate/content/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "esnext",
4 | "moduleResolution": "node",
5 | "target": "es5",
6 | "noImplicitAny": false,
7 | "removeComments": true,
8 | "preserveConstEnums": true,
9 | "allowSyntheticDefaultImports": true,
10 | "sourceMap": true,
11 | "jsx": "react",
12 | "allowJs": true,
13 | "declaration": true,
14 | "declarationDir": "./typings",
15 | "lib": ["dom", "es7"]
16 | },
17 | "include": ["client/**/*"],
18 | "exclude": ["node_modules", "**/*.spec.ts"]
19 | }
20 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/run.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | if "%1" == "apps" goto :apps
3 |
4 | cd nginx
5 | start cmd /k run.bat
6 | cd ..
7 |
8 | cd Portal
9 | start cmd /k run prod
10 | cd ..
11 | @echo Wait until the portal app started, then type "run apps" to start the other apps.
12 | @echo Open the website at http://localhost:8080.
13 | pause
14 | goto :end
15 |
16 | :apps
17 | cd ReactDashboardApp
18 | start cmd /k run prod
19 |
20 | cd ../ReactFormApp
21 | start cmd /k run prod
22 |
23 | cd ../ReactTodoApp
24 | start cmd /k run prod
25 |
26 | cd ../VueTodoApp
27 | start cmd /k run prod
28 |
29 | cd ..
30 |
31 | :end
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/html/50x.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Error
5 |
12 |
13 |
14 | An error occurred.
15 | Sorry, the page you are looking for is currently unavailable.
16 | Please try again later.
17 | If you are the system administrator of this resource then you should check
18 | the error log for details.
19 | Faithfully yours, nginx.
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ReactTemplate/content/client/styles/app.css:
--------------------------------------------------------------------------------
1 | html {
2 | font-family: 'Roboto', sans-serif;
3 | -webkit-font-smoothing: antialiased;
4 | }
5 |
6 | body,
7 | h1,
8 | h2,
9 | h3,
10 | h4,
11 | h5,
12 | h6 {
13 | font-size: 15px;
14 | margin: 0;
15 | line-height: 24px;
16 | }
17 |
18 | body {
19 | margin: 0;
20 | background-color: #efefef;
21 | }
22 |
23 | body,
24 | html,
25 | #app,
26 | #app > div {
27 | height: 100%;
28 | }
29 |
30 | a {
31 | color: 'white';
32 | text-decoration: none;
33 | }
34 |
35 | a:hover {
36 | text-decoration: none;
37 | }
38 |
39 | .m-b-15 {
40 | margin-bottom: 15px;
41 | }
42 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/server/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.Extensions.Configuration;
4 |
5 | namespace Portal
6 | {
7 | public class Program
8 | {
9 | public static void Main(string[] args)
10 | {
11 | BuildWebHost(args).Run();
12 | }
13 |
14 | public static IWebHost BuildWebHost(string[] args) =>
15 | WebHost.CreateDefaultBuilder(args)
16 | .ConfigureAppConfiguration((_, config) => config.AddJsonFile("appsettings.json"))
17 | .UseStartup()
18 | .Build();
19 | }
20 | }
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/styles/app.css:
--------------------------------------------------------------------------------
1 | html {
2 | font-family: 'Roboto', sans-serif;
3 | -webkit-font-smoothing: antialiased;
4 | }
5 |
6 | body, h1, h2, h3, h4, h5, h6 {
7 | font-size: 15px;
8 | margin: 0;
9 | line-height: 24px;
10 | }
11 |
12 | body {
13 | margin: 0;
14 | background-color: #efefef;
15 | }
16 |
17 | body, html, #app, #app > div{
18 | height: 100%;
19 | }
20 |
21 | a {
22 | color: #ff4081;
23 | text-decoration: none;
24 | }
25 |
26 | a:hover {
27 | text-decoration: underline;
28 | }
29 |
30 | .m-b-15 {
31 | margin-bottom: 15px
32 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/contrib/README:
--------------------------------------------------------------------------------
1 |
2 | geo2nginx.pl by Andrei Nigmatulin
3 |
4 | The perl script to convert CSV geoip database ( free download
5 | at http://www.maxmind.com/app/geoip_country ) to format, suitable
6 | for use by the ngx_http_geo_module.
7 |
8 |
9 | unicode2nginx by Maxim Dounin
10 |
11 | The perl script to convert unicode mappings ( available
12 | at http://www.unicode.org/Public/MAPPINGS/ ) to the nginx
13 | configuration file format.
14 | Two generated full maps for windows-1251 and koi8-r.
15 |
16 |
17 | vim by Evan Miller
18 |
19 | Syntax highlighting of nginx configuration for vim, to be
20 | placed into ~/.vim/.
21 |
22 |
--------------------------------------------------------------------------------
/ReactTemplate/content/wwwroot/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Page not found
5 |
6 |
7 |
8 |
9 |
10 |
11 | Page not found (404)
12 | Redirecting to home page...
13 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/heroku-deploy/Portal/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
2 | LABEL stage=build
3 | WORKDIR /src
4 | COPY ./__tmp__ .
5 |
6 | # Install node.js
7 | RUN apt-get update -yq \
8 | && apt-get install curl gnupg -yq \
9 | && curl -sL https://deb.nodesource.com/setup_12.x | bash \
10 | && apt-get install nodejs -yq
11 |
12 | RUN dotnet publish ./Portal/Portal.csproj -c Release -o /app
13 |
14 | FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
15 | WORKDIR /app
16 | COPY --from=build /app .
17 | ARG aspnetenv=Production
18 |
19 | ENV ASPNETCORE_ENVIRONMENT ${aspnetenv}
20 | CMD ASPNETCORE_URLS=http://*:$PORT dotnet Portal.dll
--------------------------------------------------------------------------------
/MicrofrontendTemplate/heroku-deploy/ReactDashboardApp/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
2 | LABEL stage=build
3 | WORKDIR /src
4 | COPY ./__tmp__ .
5 |
6 | # Install node.js
7 | RUN apt-get update -yq \
8 | && apt-get install curl gnupg -yq \
9 | && curl -sL https://deb.nodesource.com/setup_12.x | bash \
10 | && apt-get install nodejs -yq
11 |
12 | RUN dotnet publish ./ReactDashboardApp/ReactDashboardApp.csproj -c Release -o /app
13 |
14 | FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
15 | WORKDIR /app
16 | COPY --from=build /app .
17 | ARG aspnetenv=Production
18 |
19 | ENV ASPNETCORE_ENVIRONMENT ${aspnetenv}
20 | CMD ASPNETCORE_URLS=http://*:$PORT dotnet ReactDashboardApp.dll
--------------------------------------------------------------------------------
/_archive/HelloWorld/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace HelloWorld
12 | {
13 | public class Program
14 | {
15 | public static void Main(string[] args)
16 | {
17 | CreateWebHostBuilder(args).Build().Run();
18 | }
19 |
20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21 | WebHost.CreateDefaultBuilder(args)
22 | .UseStartup();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/_archive/LiveChart/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace LiveChart
12 | {
13 | public class Program
14 | {
15 | public static void Main(string[] args)
16 | {
17 | CreateWebHostBuilder(args).Build().Run();
18 | }
19 |
20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21 | WebHost.CreateDefaultBuilder(args)
22 | .UseStartup();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/_archive/Routing/webpack.config.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | var webpack = require("webpack");
4 | module.exports = {
5 | entry: "./src/app.js",
6 | output: {
7 | filename: "./wwwroot/bundle.js",
8 | library: "bundle"
9 | },
10 | resolve: {
11 | modules: ["src", "node_modules"]
12 | },
13 | module: {
14 | loaders: [
15 | {
16 | test: /\.jsx?$/,
17 | loader: "babel-loader",
18 | exclude: /node_modules/,
19 | query: { presets: ["es2015", "react"] }
20 | }
21 | ]
22 | },
23 | plugins: [
24 | new webpack.ProvidePlugin({ jQuery: "jquery" }),
25 | new webpack.optimize.UglifyJsPlugin({ minimize: true })
26 | ]
27 | };
--------------------------------------------------------------------------------
/_archive/Routing/wwwroot/Index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DotNetify-React
5 |
6 |
10 |
11 |
12 |
13 |
14 |
15 |
20 |
21 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/heroku-deploy/Portal/build.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | set env=Production
3 | if "%1"=="" goto :next
4 | set env=%1
5 | :next
6 |
7 | echo --- Copy source code
8 | xcopy ..\..\Portal\*.* .\__tmp__\Portal\ /q /s /e /d /y /exclude:excludedfiles.txt
9 | xcopy ..\..\Shared\*.* .\__tmp__\Shared\ /q /s /e /d /y /exclude:excludedfiles.txt
10 |
11 | echo --- Remove any existing image
12 | docker rmi portal -f
13 |
14 | echo --- Build a new image
15 | docker build -t portal -f ./Dockerfile . --build-arg aspnetenv=%env%
16 |
17 | echo --- Remove build images
18 | docker image prune -f --filter label=stage=build
19 | rd __tmp__ /q /s
20 |
21 | echo --- Run a container on port 5000
22 | docker run -it --rm -p:5000:80 --name portal_5000 portal
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/conf/scgi_params:
--------------------------------------------------------------------------------
1 |
2 | scgi_param REQUEST_METHOD $request_method;
3 | scgi_param REQUEST_URI $request_uri;
4 | scgi_param QUERY_STRING $query_string;
5 | scgi_param CONTENT_TYPE $content_type;
6 |
7 | scgi_param DOCUMENT_URI $document_uri;
8 | scgi_param DOCUMENT_ROOT $document_root;
9 | scgi_param SCGI 1;
10 | scgi_param SERVER_PROTOCOL $server_protocol;
11 | scgi_param REQUEST_SCHEME $scheme;
12 | scgi_param HTTPS $https if_not_empty;
13 |
14 | scgi_param REMOTE_ADDR $remote_addr;
15 | scgi_param REMOTE_PORT $remote_port;
16 | scgi_param SERVER_PORT $server_port;
17 | scgi_param SERVER_NAME $server_name;
18 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/server/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace dotnetify_react_template
12 | {
13 | public class Program
14 | {
15 | public static void Main(string[] args)
16 | {
17 | BuildWebHost(args).Run();
18 | }
19 |
20 | public static IWebHost BuildWebHost(string[] args) =>
21 | WebHost.CreateDefaultBuilder(args)
22 | .UseStartup()
23 | .Build();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/html/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Welcome to nginx!
5 |
12 |
13 |
14 | Welcome to nginx!
15 | If you see this page, the nginx web server is successfully installed and
16 | working. Further configuration is required.
17 |
18 | For online documentation and support please refer to
19 | nginx.org .
20 | Commercial support is available at
21 | nginx.com .
22 |
23 | Thank you for using nginx.
24 |
25 |
26 |
--------------------------------------------------------------------------------
/_archive/HelloWorld/src/HelloWorld.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import dotnetify from 'dotnetify';
3 |
4 | class HelloWorld extends React.Component {
5 | constructor(props) {
6 | super(props);
7 | dotnetify.react.connect("HelloWorld", this);
8 |
9 | // *** Use below to initialize the user's name from the client. ***
10 | // dotnetify.react.connect("HelloWorld", this, { vmArg: { User: { Name: "Joe" } } });
11 |
12 | this.state = { Greetings: "", ServerTime: "" }
13 | }
14 |
15 | render() {
16 | return (
17 |
18 | {this.state.Greetings}
19 | Server time is: {this.state.ServerTime}
20 |
21 | );
22 | }
23 | }
24 |
25 | export default HelloWorld;
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/components/BasePage.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import PropTypes from 'prop-types';
3 | import Paper from 'material-ui/Paper';
4 | import Divider from 'material-ui/Divider';
5 | import globalStyles from '../styles/styles';
6 |
7 | const BasePage = (props) => {
8 |
9 | const { title, navigation } = props;
10 |
11 | return (
12 |
13 |
{navigation}
14 |
15 | {title}
16 |
17 | {props.children}
18 |
19 |
20 |
21 | );
22 | };
23 |
24 | export default BasePage;
25 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/conf/uwsgi_params:
--------------------------------------------------------------------------------
1 |
2 | uwsgi_param QUERY_STRING $query_string;
3 | uwsgi_param REQUEST_METHOD $request_method;
4 | uwsgi_param CONTENT_TYPE $content_type;
5 | uwsgi_param CONTENT_LENGTH $content_length;
6 |
7 | uwsgi_param REQUEST_URI $request_uri;
8 | uwsgi_param PATH_INFO $document_uri;
9 | uwsgi_param DOCUMENT_ROOT $document_root;
10 | uwsgi_param SERVER_PROTOCOL $server_protocol;
11 | uwsgi_param REQUEST_SCHEME $scheme;
12 | uwsgi_param HTTPS $https if_not_empty;
13 |
14 | uwsgi_param REMOTE_ADDR $remote_addr;
15 | uwsgi_param REMOTE_PORT $remote_port;
16 | uwsgi_param SERVER_PORT $server_port;
17 | uwsgi_param SERVER_NAME $server_name;
18 |
--------------------------------------------------------------------------------
/ReactTemplate/template.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DotNetify.React.Template
5 | 6.0.0
6 | DotNetify React Template
7 |
8 | DotNetify-React SPA template built with .NET 6 featuring real-time dashboard.
9 |
10 | Dicky Suryadi
11 | Dicky Suryadi
12 | https://github.com/dsuryd/dotNetify/blob/master/LICENSE.md
13 | http://dotnetify.net/react
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/views/App.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import dotnetify from "dotnetify";
3 | import LoginPage from "./LoginPage";
4 | import AppLayout from "./AppLayout";
5 | import auth from "../auth";
6 | type State = {
7 | authenticated: boolean;
8 | };
9 | type Props = {
10 | children: any;
11 | };
12 | export default class App extends React.Component {
13 | constructor(props) {
14 | super(props);
15 | this.state = { authenticated: auth.hasAccessToken() };
16 | }
17 |
18 | render(): JSX.Element {
19 | const handleAuthenticated = () => this.setState({ authenticated: true });
20 | return !this.state.authenticated ? : ;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/_archive/LiveChart/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:61201/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "LiveChart": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:61201"
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/heroku-deploy/ReactDashboardApp/build.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | set env=Production
3 | if "%1"=="" goto :next
4 | set env=%1
5 | :next
6 |
7 | echo --- Copy source code
8 | xcopy ..\..\ReactDashboardApp\*.* .\__tmp__\ReactDashboardApp\ /q /s /e /d /y /exclude:excludedfiles.txt
9 | xcopy ..\..\Shared\*.* .\__tmp__\Shared\ /q /s /e /d /y /exclude:excludedfiles.txt
10 |
11 | echo --- Remove any existing image
12 | docker rmi dashboard -f
13 |
14 | echo --- Build a new image
15 | docker build -t portal -f ./Dockerfile . --build-arg aspnetenv=%env%
16 |
17 | echo --- Remove build images
18 | docker image prune -f --filter label=stage=build
19 | rd __tmp__ /q /s
20 |
21 | echo --- Run a container on port 5060
22 | docker run -it --rm -p:5060:80 --name dashboard_5060 dashboard
--------------------------------------------------------------------------------
/_archive/HelloWorld/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:61200/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "HelloWorld": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:61201"
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/ReactTemplate/content/client/components/BasePage.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Paper from '@material-ui/core/Paper';
3 | import Divider from '@material-ui/core/Divider';
4 | import globalStyles from '../styles/styles';
5 |
6 | export interface IBasePageProps {
7 | title: string;
8 | navigation: string;
9 | children: React.ReactNode;
10 | }
11 |
12 | export default function BasePage({ title, navigation, children }: IBasePageProps) {
13 | return (
14 |
15 |
{navigation}
16 |
17 | {title}
18 |
19 | {children}
20 |
21 |
22 |
23 | );
24 | }
25 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/template.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DotNetify.ReactTypeScipt.Template
5 | 1.0.1
6 | DotNetify React TypeScript Template
7 |
8 | DotNetify-React SPA template for .NET Core featuring real-time dashboard.
9 |
10 | Dicky Suryadi
11 | Dicky Suryadi
12 | https://github.com/dsuryd/dotNetify/blob/master/LICENSE.md
13 | http://dotnetify.net/react
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/_archive/README.md:
--------------------------------------------------------------------------------
1 | #### HelloWorld
2 | This real-time "Hello World" demo is created with Visual Studio 2017 + WebPack.
3 |
4 | #### LiveChart
5 | Real-time chart demo using [ReactiveX](http://reactivex.io/) streams on the back-end.
6 |
7 | #### ReactTemplate (Typescript)
8 | Full SPA template for .NET Core 2.x featuring real-time dashboard, OpenID Connect/OAuth2 authentication, and more!
9 |
10 | #### Routing
11 | Isomorphic/universal routing demo, capable of both client-side and server-side rendering of deep-links.
12 | [NodeJS](https://nodejs.org/en/) is required. Read the details [here](https://hackernoon.com/server-side-rendering-of-deep-links-with-react-and-net-core-882830ca663).
13 |
14 | ### Documentation
15 | Visit [http://dotnetify.net/react](http://dotnetify.net/react) for documentation and live demo.
16 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/components/table/Pagination.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import Paper from 'material-ui/Paper';
3 | import FlatButton from 'material-ui/FlatButton';
4 |
5 | const Pagination = (props) => {
6 |
7 | const styles = {
8 | paper: {
9 | display: 'inline',
10 | padding: '.5em 0'
11 | },
12 | button: { minWidth: '1em'}
13 | };
14 |
15 | const pageButtons = props.pages.map(page =>
16 |
17 | props.onSelect(page)} />
21 |
22 | );
23 |
24 | return (
25 | {pageButtons}
26 | );
27 | }
28 |
29 | export default Pagination;
--------------------------------------------------------------------------------
/_archive/HelloWorld/HelloWorld.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using DotNetify;
3 | using System.Threading;
4 |
5 | namespace HelloWorld
6 | {
7 | public class HelloWorld : BaseVM
8 | {
9 | public class Person
10 | {
11 | public string Name { get; set; }
12 | }
13 |
14 | private Timer _timer;
15 | public Person User { get; set; } = new Person() { Name = "World" };
16 | public string Greetings => $"Hello {User.Name}!";
17 | public DateTime ServerTime => DateTime.Now;
18 |
19 | public HelloWorld()
20 | {
21 | _timer = new Timer(state =>
22 | {
23 | Changed(nameof(ServerTime));
24 | PushUpdates();
25 | }, null, 0, 1000);
26 | }
27 |
28 | public override void Dispose() => _timer.Dispose();
29 | }
30 | }
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | DotNetify Template
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/client/components/AddressForm.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Cell, DropdownList, Form, NumberField, Panel, TextField, VMContext } from 'dotnetify-elements';
3 |
4 | const AddressForm = () => (
5 |
6 |
7 |
8 |
17 | s
18 | |
19 |
20 | );
21 |
22 | export default AddressForm;
23 |
--------------------------------------------------------------------------------
/ReactTemplate/content/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DotNetify Template
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/_archive/Routing/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:61201",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "routing": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:61201"
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/_archive/Routing/ViewModels/Page1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using DotNetify;
4 | using DotNetify.Routing;
5 |
6 | namespace Routing
7 | {
8 | public class Page1 : BaseVM, IRoutable
9 | {
10 | public string Title => "Page 1";
11 |
12 | public RoutingState RoutingState { get; set; }
13 | public Route LinkPage1A => this.GetRoute("Page1A");
14 | public Route LinkPage1B => this.GetRoute("Page1B");
15 |
16 | public Page1()
17 | {
18 | this.RegisterRoutes("Page1", new List
19 | {
20 | new RouteTemplate("Page1Home") { UrlPattern = "", ViewUrl = "Page1A" },
21 | new RouteTemplate("Page1A") { UrlPattern = "Page1A" },
22 | new RouteTemplate("Page1B") { UrlPattern = "Page1B" }
23 | });
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/_archive/Routing/Routing.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ReactTemplate/content/webpack.config.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const MiniCssExtractPlugin = require("mini-css-extract-plugin");
4 |
5 | module.exports = {
6 | mode: "development",
7 | entry: {
8 | app: "./client/app"
9 | },
10 | output: {
11 | path: __dirname + "/wwwroot/dist",
12 | publicPath: "/dist/"
13 | },
14 | resolve: {
15 | modules: ["client", "node_modules"],
16 | extensions: [".js", ".jsx", ".ts", ".tsx"]
17 | },
18 | devtool: "source-map",
19 | module: {
20 | rules: [
21 | { test: /\.tsx?$/, use: "ts-loader", exclude: /node_modules/ },
22 | { test: /\.css$/, use: [MiniCssExtractPlugin.loader, "css-loader?minimize"] },
23 | { test: /\.svg$/, use: "svg-url-loader?noquotes=true" },
24 | { test: /\.(png|jpg|jpeg|gif)$/, use: "url-loader?limit=25000" }
25 | ]
26 | },
27 | plugins: [new MiniCssExtractPlugin()]
28 | };
29 |
--------------------------------------------------------------------------------
/_archive/Routing/src/app.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | React: require('react'),
3 | ReactDOM: require('react-dom'),
4 | dotnetify: require('dotnetify'),
5 | RouteLink: require('dotnetify/dist/dotnetify-react.router').RouteLink,
6 | RouteTarget: require('dotnetify/dist/dotnetify-react.router').RouteTarget,
7 |
8 | MuiThemeProvider: require('material-ui/styles/MuiThemeProvider').default,
9 | AppBar: require('material-ui/AppBar').default,
10 | Drawer: require('material-ui/Drawer').default,
11 | MenuItem: require('material-ui/MenuItem').default,
12 | Paper: require('material-ui/Paper').default,
13 | Tabs: require('material-ui/Tabs').Tabs,
14 | Tab: require('material-ui/Tabs').Tab,
15 |
16 | Index: require('./Index.jsx').default,
17 | Home: require('./Index.jsx').Home
18 | }
19 |
20 | // Export the library modules into global scope for the components that will be loaded on-demand by the router.
21 | Object.assign(window, module.exports);
--------------------------------------------------------------------------------
/_archive/Routing/wwwroot/Page3.html:
--------------------------------------------------------------------------------
1 |
2 |
This is the content of Page3.html
3 |
4 | At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## DotNetify React Templates
4 |
5 | DotNetify is a [free, open source project](https://github.com/dsuryd/dotNetify) that lets you create real-time, reactive, cross-platform apps with React, React Native, or Knockout front-end on C# .NET back-end via WebSocket.
6 |
7 | ### React Template
8 |
9 | This is a full React SPA template for ASP.NET 6 featuring:
10 | - Reactive, real-time dashboard page.
11 | - Edit form + CRUD table pages.
12 | - Login page with JWT bearer token authentication.
13 | - UI components from [Material-UI](https://material-ui.com/).
14 | - Routing with deep links.
15 | - [OpenID Connect/OAuth2](https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server) authentication server.
16 |
17 | ### Micro-Frontend Template
18 |
19 | Reference implementation of micro-frontend [as described here](https://dotnetify.net/core/mfe).
20 |
21 |
22 |
--------------------------------------------------------------------------------
/_archive/LiveChart/LiveChart.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reactive.Linq;
3 | using Rx = System.Reactive.Linq;
4 | using DotNetify;
5 |
6 | namespace LiveChart
7 | {
8 | public class LiveChart : BaseVM
9 | {
10 | private IDisposable _subscription;
11 | public int NextValue { get; set; }
12 |
13 | public LiveChart()
14 | {
15 | var sineStream = Rx.Observable.Interval(TimeSpan.FromSeconds(.1)).Select(t => Math.Sin(2 * Math.PI * .06 * t));
16 | var ampStream = Rx.Observable.Interval(TimeSpan.FromSeconds(.1)).Select(a => a % 50 + 1);
17 |
18 | _subscription = Rx.Observable
19 | .Zip(sineStream, ampStream, (sine, amp) => (int) Math.Abs( sine * amp))
20 | .Subscribe(value =>
21 | {
22 | NextValue = value;
23 | Changed(nameof(NextValue));
24 | PushUpdates();
25 | });
26 | }
27 |
28 | public override void Dispose() => _subscription.Dispose();
29 | }
30 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/VueTodoApp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "name": "vue-todo-app",
4 | "private": true,
5 | "scripts": {
6 | "build": "webpack",
7 | "prod": "webpack --mode production"
8 | },
9 | "dependencies": {
10 | "dotnetify": "^4.0.0",
11 | "dotnetify-elements": "^1.1.0",
12 | "vue": "^2.5.22",
13 | "vue-custom-element": "^3.2.9"
14 | },
15 | "devDependencies": {
16 | "aspnet-webpack": "~3.0.0",
17 | "babel-core": "~6.26.3",
18 | "babel-loader": "~7.1.4",
19 | "babel-preset-env": "~1.7.0",
20 | "copy-webpack-plugin": "^5.0.4",
21 | "css-loader": "^3.2.0",
22 | "node-sass": "~4.9.4",
23 | "sass-loader": "~7.1.0",
24 | "url-loader": "~1.0.1",
25 | "vue-loader": "^15.4.2",
26 | "vue-template-compiler": "^2.5.22",
27 | "webpack": "~4.12.0",
28 | "webpack-bundle-analyzer": "^3.0.3",
29 | "webpack-cli": "~3.0.8",
30 | "webpack-dev-middleware": "~3.1.3",
31 | "webpack-hot-middleware": "~2.22.2"
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:5000/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "dev": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:5000/"
25 | },
26 | "prod": {
27 | "commandName": "Project",
28 | "launchBrowser": true,
29 | "environmentVariables": {
30 | "ASPNETCORE_ENVIRONMENT": "Production"
31 | },
32 | "applicationUrl": "http://localhost:5000/"
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:5070/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "dev": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:5070/"
25 | },
26 | "prod": {
27 | "commandName": "Project",
28 | "launchBrowser": true,
29 | "environmentVariables": {
30 | "ASPNETCORE_ENVIRONMENT": "Production"
31 | },
32 | "applicationUrl": "http://localhost:5070/"
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactTodoApp/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:5010/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "dev": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:5010/"
25 | },
26 | "prod": {
27 | "commandName": "Project",
28 | "launchBrowser": true,
29 | "environmentVariables": {
30 | "ASPNETCORE_ENVIRONMENT": "Production"
31 | },
32 | "applicationUrl": "http://localhost:5010/"
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/VueTodoApp/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:5020/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "dev": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:5020/"
25 | },
26 | "prod": {
27 | "commandName": "Project",
28 | "launchBrowser": true,
29 | "environmentVariables": {
30 | "ASPNETCORE_ENVIRONMENT": "Production"
31 | },
32 | "applicationUrl": "http://localhost:5020/"
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactDashboardApp/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:5060/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "dev": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:5060/"
25 | },
26 | "prod": {
27 | "commandName": "Project",
28 | "launchBrowser": true,
29 | "environmentVariables": {
30 | "ASPNETCORE_ENVIRONMENT": "Production"
31 | },
32 | "applicationUrl": "http://localhost:5060/"
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/server/ViewModels/NewCustomerForm.cs:
--------------------------------------------------------------------------------
1 | using DotNetify;
2 | using DotNetify.Elements;
3 | using DotNetify.Security;
4 | using System.Linq;
5 | using System.Reactive.Linq;
6 |
7 | namespace ReactFormApp
8 | {
9 | [Authorize]
10 | public class NewCustomerForm : BaseVM
11 | {
12 | private readonly ICustomerRepository _customerRepository;
13 |
14 | public ReactiveProperty NewCustomer { get; } = new ReactiveProperty();
15 |
16 | public NewCustomerForm(ICustomerRepository customerRepository)
17 | {
18 | _customerRepository = customerRepository;
19 |
20 | AddInternalProperty("Submit")
21 | .SubscribedBy(NewCustomer, formData => Save(formData));
22 | }
23 |
24 | public override void Dispose()
25 | {
26 | base.Dispose();
27 | }
28 |
29 | public Customer Save(CustomerFormData formData)
30 | {
31 | return _customerRepository.Add(formData);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/_archive/Routing/Routing.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26228.4
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Routing", "Routing.csproj", "{0E13DA94-8C28-402D-A209-C8166D3FA8A4}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {0E13DA94-8C28-402D-A209-C8166D3FA8A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {0E13DA94-8C28-402D-A209-C8166D3FA8A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {0E13DA94-8C28-402D-A209-C8166D3FA8A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {0E13DA94-8C28-402D-A209-C8166D3FA8A4}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/_archive/LiveChart/LiveChart.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26228.4
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveChart", "LiveChart.csproj", "{0E13DA94-8C28-402D-A209-C8166D3FA8A4}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {0E13DA94-8C28-402D-A209-C8166D3FA8A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {0E13DA94-8C28-402D-A209-C8166D3FA8A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {0E13DA94-8C28-402D-A209-C8166D3FA8A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {0E13DA94-8C28-402D-A209-C8166D3FA8A4}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/_archive/HelloWorld/HelloWorld.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26228.4
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloWorld", "HelloWorld.csproj", "{0E13DA94-8C28-402D-A209-C8166D3FA8A4}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {0E13DA94-8C28-402D-A209-C8166D3FA8A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {0E13DA94-8C28-402D-A209-C8166D3FA8A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {0E13DA94-8C28-402D-A209-C8166D3FA8A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {0E13DA94-8C28-402D-A209-C8166D3FA8A4}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/ReactTemplate/content/client/components/table/Pagination.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { makeStyles } from '@material-ui/core/styles';
3 | import Paper from '@material-ui/core/Paper';
4 | import Button from '@material-ui/core/Button';
5 |
6 | const useStyles = makeStyles({
7 | paper: {
8 | display: 'inline',
9 | padding: '.5em 0',
10 | borderRadius: 0
11 | },
12 | button: { minWidth: '2.5em' }
13 | });
14 |
15 | export interface IPaginationProps {
16 | pages: number[];
17 | select: number;
18 | style: React.CSSProperties;
19 | onSelect: (page: any) => void;
20 | }
21 |
22 | export default function Pagination(props: IPaginationProps) {
23 | const classes = useStyles({});
24 | const pageButtons = props.pages.map(page => (
25 |
26 | props.onSelect(page)}>
27 | {page}
28 |
29 |
30 | ));
31 |
32 | return {pageButtons}
;
33 | }
34 |
--------------------------------------------------------------------------------
/ReactTemplate/content/client/auth.ts:
--------------------------------------------------------------------------------
1 | class Auth {
2 | url = '/token';
3 |
4 | signIn(username: string, password: string): Promise {
5 | return fetch(this.url, {
6 | method: 'post',
7 | mode: 'no-cors',
8 | body: 'username=' + username + '&password=' + password + '&grant_type=password&client_id=dotnetifydemo',
9 | headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' },
10 | })
11 | .then(response => {
12 | if (!response.ok) throw new Error(`${response.status}`);
13 | return response.json();
14 | })
15 | .then(token => {
16 | window.sessionStorage.setItem('access_token', token.access_token);
17 | });
18 | }
19 |
20 | signOut() {
21 | window.sessionStorage.removeItem('access_token');
22 | window.location.href = '/';
23 | }
24 |
25 | getAccessToken(): string {
26 | return window.sessionStorage.getItem('access_token');
27 | }
28 |
29 | hasAccessToken(): boolean {
30 | return this.getAccessToken() != null;
31 | }
32 | }
33 |
34 | export default new Auth();
35 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/docs/zlib.LICENSE:
--------------------------------------------------------------------------------
1 | (C) 1995-2017 Jean-loup Gailly and Mark Adler
2 |
3 | This software is provided 'as-is', without any express or implied
4 | warranty. In no event will the authors be held liable for any damages
5 | arising from the use of this software.
6 |
7 | Permission is granted to anyone to use this software for any purpose,
8 | including commercial applications, and to alter it and redistribute it
9 | freely, subject to the following restrictions:
10 |
11 | 1. The origin of this software must not be misrepresented; you must not
12 | claim that you wrote the original software. If you use this software
13 | in a product, an acknowledgment in the product documentation would be
14 | appreciated but is not required.
15 | 2. Altered source versions must be plainly marked as such, and must not be
16 | misrepresented as being the original software.
17 | 3. This notice may not be removed or altered from any source distribution.
18 |
19 | Jean-loup Gailly Mark Adler
20 | jloup@gzip.org madler@alumni.caltech.edu
21 |
--------------------------------------------------------------------------------
/_archive/HelloWorld/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "livechart",
3 | "private": true,
4 | "scripts": {
5 | "build": "webpack"
6 | },
7 | "babel": {
8 | "presets": [
9 | "env",
10 | "react"
11 | ],
12 | "plugins": [
13 | "babel-plugin-styled-components",
14 | "babel-plugin-transform-object-rest-spread",
15 | "babel-plugin-transform-class-properties"
16 | ]
17 | },
18 | "dependencies": {
19 | "dotnetify": "~3.2.0",
20 | "react": "~16.6.0",
21 | "react-dom": "~16.6.0"
22 | },
23 | "devDependencies": {
24 | "aspnet-webpack": "^3.0.0",
25 | "babel-core": "~6.26.3",
26 | "babel-loader": "~7.1.4",
27 | "babel-plugin-styled-components": "^1.7.1",
28 | "babel-plugin-transform-class-properties": "~6.24.1",
29 | "babel-plugin-transform-object-rest-spread": "~6.26.0",
30 | "babel-preset-env": "~1.7.0",
31 | "babel-preset-react": "~6.24.1",
32 | "webpack": "^4.18.0",
33 | "webpack-cli": "^3.1.0",
34 | "webpack-dev-middleware": "^3.3.0",
35 | "webpack-hot-middleware": "^2.23.1"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactDashboardApp/client/components/InfoCard.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import styled from 'styled-components';
3 | import { Card, CardImage, Element } from 'dotnetify-elements';
4 |
5 | const InfoIcon = styled.i.attrs(props => ({
6 | className: 'material-icons'
7 | }))`
8 | font-size: 3rem;
9 | padding: 1.5rem;
10 | color: white;
11 | background: ${props => props.color};
12 | opacity: .8;
13 | `;
14 |
15 | const cardCss = `
16 | .card-body { padding: .5rem 1.5rem }
17 | h3 { font: 600 2rem Helvetica; }
18 | @media (max-width: 1550px) and (min-width: 1280px) {
19 | h3 { font-size: 1.25rem }
20 | }
21 | `;
22 |
23 | export default class InfoCard extends Element {
24 | render() {
25 | const { color, icon, label } = this.attrs;
26 | return (
27 |
28 |
29 | {icon}
30 |
31 | {label}
32 | {this.value}
33 |
34 | );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/webpack.config.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const webpack = require("webpack");
4 | const ExtractTextPlugin = require('extract-text-webpack-plugin');
5 |
6 | module.exports = {
7 | entry: {
8 | main: "./client/app.tsx"
9 | },
10 | devtool: 'inline-source-map',
11 | output: {
12 | filename: './wwwroot/dist/bundle.js',
13 | publicPath: 'dist/'
14 | },
15 | resolve: {
16 | modules: ["client", "node_modules"],
17 | extensions: [".ts", ".tsx", ".js", ".jsx"]
18 | },
19 | module: {
20 | rules: [
21 | { test: /\.jsx?$/, use: 'babel-loader', exclude: /node_modules/ },
22 | { test: /\.tsx?$/, use: 'awesome-typescript-loader?silent=true' },
23 | { test: /\.css$/, use: ExtractTextPlugin.extract({ use: 'css-loader?minimize' }) },
24 | { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' }
25 | ]
26 | },
27 | plugins: [
28 | // new webpack.optimize.UglifyJsPlugin(),
29 | new ExtractTextPlugin('./wwwroot/dist/app.css')
30 | ]
31 | };
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | React Form App
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactDashboardApp/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | React Dashboard App
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/auth.tsx:
--------------------------------------------------------------------------------
1 | class Auth {
2 | url = "/token";
3 |
4 | signIn(username, password) {
5 | return fetch(this.url, {
6 | method: 'post',
7 | mode: 'no-cors',
8 | body: "username=" + username + "&password=" + password + "&grant_type=password&client_id=dotnetifydemo",
9 | headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }
10 | })
11 | .then(response => {
12 | if (!response.ok) throw new Error(response.status.toString());
13 | return response.json();
14 | })
15 | .then(token => {
16 | window.localStorage.setItem("access_token", token.access_token);
17 | });
18 | }
19 |
20 | signOut() {
21 | window.localStorage.removeItem("access_token");
22 | window.location.href = "/";
23 | }
24 |
25 | getAccessToken() {
26 | return window.localStorage.getItem("access_token");
27 | }
28 |
29 | hasAccessToken() {
30 | return this.getAccessToken() != null;
31 | }
32 | }
33 |
34 | export default new Auth();
--------------------------------------------------------------------------------
/_archive/Routing/ViewModels/Index.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using DotNetify;
4 | using DotNetify.Routing;
5 |
6 | namespace Routing
7 | {
8 | public class Index : BaseVM, IRoutable
9 | {
10 | public RoutingState RoutingState { get; set; }
11 |
12 | public List Links => new List()
13 | {
14 | new { Title = "Page 1", Route = this.GetRoute("Page1") },
15 | new { Title = "Page 2", Route = this.GetRoute("Page2") },
16 | new { Title = "Page 3", Route = this.GetRoute("Page3") }
17 | };
18 |
19 | public Index()
20 | {
21 | this.RegisterRoutes("", new List
22 | {
23 | new RouteTemplate("Home") { UrlPattern = "" },
24 | new RouteTemplate("Page1", "/page1.js") { UrlPattern = "Page1", VMType = typeof(Page1) },
25 | new RouteTemplate("Page2", "/page2.js") { UrlPattern = "Page2", VMType = typeof(Page2) },
26 | new RouteTemplate("Page3") { UrlPattern = "Page3", ViewUrl = "/page3.html" },
27 | });
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/conf/fastcgi_params:
--------------------------------------------------------------------------------
1 |
2 | fastcgi_param QUERY_STRING $query_string;
3 | fastcgi_param REQUEST_METHOD $request_method;
4 | fastcgi_param CONTENT_TYPE $content_type;
5 | fastcgi_param CONTENT_LENGTH $content_length;
6 |
7 | fastcgi_param SCRIPT_NAME $fastcgi_script_name;
8 | fastcgi_param REQUEST_URI $request_uri;
9 | fastcgi_param DOCUMENT_URI $document_uri;
10 | fastcgi_param DOCUMENT_ROOT $document_root;
11 | fastcgi_param SERVER_PROTOCOL $server_protocol;
12 | fastcgi_param REQUEST_SCHEME $scheme;
13 | fastcgi_param HTTPS $https if_not_empty;
14 |
15 | fastcgi_param GATEWAY_INTERFACE CGI/1.1;
16 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
17 |
18 | fastcgi_param REMOTE_ADDR $remote_addr;
19 | fastcgi_param REMOTE_PORT $remote_port;
20 | fastcgi_param SERVER_ADDR $server_addr;
21 | fastcgi_param SERVER_PORT $server_port;
22 | fastcgi_param SERVER_NAME $server_name;
23 |
24 | # PHP only, required if PHP was built with --enable-force-cgi-redirect
25 | fastcgi_param REDIRECT_STATUS 200;
26 |
--------------------------------------------------------------------------------
/_archive/LiveChart/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "livechart",
3 | "private": true,
4 | "scripts": {
5 | "build": "webpack"
6 | },
7 | "babel": {
8 | "presets": [
9 | "env",
10 | "react"
11 | ],
12 | "plugins": [
13 | "babel-plugin-styled-components",
14 | "babel-plugin-transform-object-rest-spread",
15 | "babel-plugin-transform-class-properties"
16 | ]
17 | },
18 | "dependencies": {
19 | "chart.js": "^2.7.2",
20 | "dotnetify": "~3.2.0",
21 | "react": "~16.6.0",
22 | "react-chartjs-2": "^2.7.4",
23 | "react-dom": "~16.6.0"
24 | },
25 | "devDependencies": {
26 | "aspnet-webpack": "^3.0.0",
27 | "babel-core": "~6.26.3",
28 | "babel-loader": "~7.1.4",
29 | "babel-plugin-styled-components": "^1.7.1",
30 | "babel-plugin-transform-class-properties": "~6.24.1",
31 | "babel-plugin-transform-object-rest-spread": "~6.26.0",
32 | "babel-preset-env": "~1.7.0",
33 | "babel-preset-react": "~6.24.1",
34 | "webpack": "^4.18.0",
35 | "webpack-cli": "^3.1.0",
36 | "webpack-dev-middleware": "^3.3.0",
37 | "webpack-hot-middleware": "^2.23.1"
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "name": "dotnetify_react_template",
4 | "private": true,
5 | "devDependencies": {
6 | "@types/node": "^10.1.2",
7 | "@types/react": "^16.3.14",
8 | "@types/react-dom": "^16.0.5",
9 | "@types/webpack-env": "^1.13.6",
10 | "aspnet-webpack": "2.0.1",
11 | "aspnet-webpack-react": "3.0.0",
12 | "awesome-typescript-loader": "3.2.1",
13 | "babel-core": "6.26.0",
14 | "babel-loader": "7.1.2",
15 | "babel-preset-es2015": "6.24.1",
16 | "babel-preset-react": "6.24.1",
17 | "babel-preset-stage-0": "6.24.1",
18 | "chart.js": "^2.7.1",
19 | "css-loader": "0.28.7",
20 | "dotnetify": "3.0.1",
21 | "extract-text-webpack-plugin": "2.1.2",
22 | "file-loader": "0.11.2",
23 | "flexboxgrid": "6.3.1",
24 | "material-ui": "^0.19.4",
25 | "react-chartjs-2": "^2.6.4",
26 | "react-hot-loader": "3.1.1",
27 | "style-loader": "0.19.0",
28 | "url-loader": "0.6.2",
29 | "webpack": "2.5.1",
30 | "webpack-hot-middleware": "2.18.2"
31 | },
32 | "dependencies": {
33 | "react": "^16.3.2",
34 | "react-dom": "^16.3.3"
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## DotNetify - Micro-Frontend Demo
4 |
5 | ### How to Run
6 |
7 | If on Windows, type `run` from the command prompt to start the portal and the nginx API gateway. Wait until the portal app started, then type `run apps` to start all the apps. Alternatively, you can start them one at a time by going to an app's folder and type `run prod`. Open the website at http://localhost:8080.
8 |
9 | If not on Windows, you can't use the Windows-based nginx from this repo. Either install one for your system and copy the configuration `conf/nginx.conf`, or just run the portal and the apps in development mode below.
10 |
11 | ### Running In Dev Mode
12 |
13 | Go the the Portal folder and type `npm i` followed by `dotnet run`. Then go to each app's folder and do the same thing. They will start in development mode. Open the website at http://localhost:5000.
14 |
15 | In development mode, authentication is disabled so you can run the app as stand-alone, and hot module reload is also enabled. The app's port is specified in `Properties/launchsettings.json`.
16 |
--------------------------------------------------------------------------------
/_archive/LiveChart/compilerconfig.json.defaults:
--------------------------------------------------------------------------------
1 | {
2 | "compilers": {
3 | "less": {
4 | "autoPrefix": "",
5 | "cssComb": "none",
6 | "ieCompat": true,
7 | "strictMath": false,
8 | "strictUnits": false,
9 | "relativeUrls": true,
10 | "rootPath": "",
11 | "sourceMapRoot": "",
12 | "sourceMapBasePath": "",
13 | "sourceMap": false
14 | },
15 | "sass": {
16 | "includePath": "",
17 | "indentType": "space",
18 | "indentWidth": 2,
19 | "outputStyle": "nested",
20 | "Precision": 5,
21 | "relativeUrls": true,
22 | "sourceMapRoot": "",
23 | "sourceMap": false
24 | },
25 | "stylus": {
26 | "sourceMap": false
27 | },
28 | "babel": {
29 | "sourceMap": false
30 | },
31 | "coffeescript": {
32 | "bare": false,
33 | "runtimeMode": "node",
34 | "sourceMap": false
35 | }
36 | },
37 | "minifiers": {
38 | "css": {
39 | "enabled": true,
40 | "termSemicolons": true,
41 | "gzip": false
42 | },
43 | "javascript": {
44 | "enabled": true,
45 | "termSemicolons": true,
46 | "gzip": false
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/_archive/Routing/compilerconfig.json.defaults:
--------------------------------------------------------------------------------
1 | {
2 | "compilers": {
3 | "less": {
4 | "autoPrefix": "",
5 | "cssComb": "none",
6 | "ieCompat": true,
7 | "strictMath": false,
8 | "strictUnits": false,
9 | "relativeUrls": true,
10 | "rootPath": "",
11 | "sourceMapRoot": "",
12 | "sourceMapBasePath": "",
13 | "sourceMap": false
14 | },
15 | "sass": {
16 | "includePath": "",
17 | "indentType": "space",
18 | "indentWidth": 2,
19 | "outputStyle": "nested",
20 | "Precision": 5,
21 | "relativeUrls": true,
22 | "sourceMapRoot": "",
23 | "sourceMap": false
24 | },
25 | "stylus": {
26 | "sourceMap": false
27 | },
28 | "babel": {
29 | "sourceMap": false
30 | },
31 | "coffeescript": {
32 | "bare": false,
33 | "runtimeMode": "node",
34 | "sourceMap": false
35 | }
36 | },
37 | "minifiers": {
38 | "css": {
39 | "enabled": true,
40 | "termSemicolons": true,
41 | "gzip": false
42 | },
43 | "javascript": {
44 | "enabled": true,
45 | "termSemicolons": true,
46 | "gzip": false
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Shared/IdentityServer/IdentityServerConfig.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using IdentityServer4.Models;
3 |
4 | namespace Shared
5 | {
6 | public class IdentityServerConfig
7 | {
8 | public static readonly string MyClientId = "dotNetifyDemo";
9 | public static readonly string MyClientSecret = "secret";
10 | public static readonly string MyApiResource = "demo";
11 |
12 | public static IEnumerable GetClients()
13 | {
14 | return new List
15 | {
16 | new Client
17 | {
18 | ClientId = MyClientId,
19 | AllowedGrantTypes = GrantTypes.ClientCredentials,
20 | ClientSecrets = { new Secret(MyClientSecret.Sha256()) },
21 | AllowedScopes = { MyApiResource }
22 | }
23 | };
24 | }
25 |
26 | public static IEnumerable GetApiResources()
27 | {
28 | return new List
29 | {
30 | new ApiResource(MyApiResource, "DotNetify Demo") { ApiSecrets = { new Secret(MyClientSecret.Sha256()) } }
31 | };
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/conf/fastcgi.conf:
--------------------------------------------------------------------------------
1 |
2 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
3 | fastcgi_param QUERY_STRING $query_string;
4 | fastcgi_param REQUEST_METHOD $request_method;
5 | fastcgi_param CONTENT_TYPE $content_type;
6 | fastcgi_param CONTENT_LENGTH $content_length;
7 |
8 | fastcgi_param SCRIPT_NAME $fastcgi_script_name;
9 | fastcgi_param REQUEST_URI $request_uri;
10 | fastcgi_param DOCUMENT_URI $document_uri;
11 | fastcgi_param DOCUMENT_ROOT $document_root;
12 | fastcgi_param SERVER_PROTOCOL $server_protocol;
13 | fastcgi_param REQUEST_SCHEME $scheme;
14 | fastcgi_param HTTPS $https if_not_empty;
15 |
16 | fastcgi_param GATEWAY_INTERFACE CGI/1.1;
17 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
18 |
19 | fastcgi_param REMOTE_ADDR $remote_addr;
20 | fastcgi_param REMOTE_PORT $remote_port;
21 | fastcgi_param SERVER_ADDR $server_addr;
22 | fastcgi_param SERVER_PORT $server_port;
23 | fastcgi_param SERVER_NAME $server_name;
24 |
25 | # PHP only, required if PHP was built with --enable-force-cgi-redirect
26 | fastcgi_param REDIRECT_STATUS 200;
27 |
--------------------------------------------------------------------------------
/ReactTemplate/content/projectName.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26730.16
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "projectName", "projectName.csproj", "{338DE673-32B6-4C59-8E23-E4C2965ACA55}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {338DE673-32B6-4C59-8E23-E4C2965ACA55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {338DE673-32B6-4C59-8E23-E4C2965ACA55}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {338DE673-32B6-4C59-8E23-E4C2965ACA55}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {338DE673-32B6-4C59-8E23-E4C2965ACA55}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {CC910A34-349D-4C85-AB3B-C366D361C442}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/routes.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import * as ReactDOM from 'react-dom';
3 | import App from './views/App';
4 | import Dashboard from './views/Dashboard';
5 | import FormPage from './views/FormPage';
6 | import TablePage from './views/TablePage';
7 |
8 | // Import all the routeable views into the global window variable.
9 | Object.assign(window, {
10 | Dashboard,
11 | FormPage,
12 | TablePage
13 | });
14 |
15 | // Hot module replacement.
16 | if (module.hot) {
17 | const render = (react, elemId) => {
18 | ReactDOM.unmountComponentAtNode(document.getElementById(elemId));
19 | ReactDOM.render(React.createElement(react), document.getElementById(elemId));
20 | }
21 |
22 | module.hot.accept('./views/App.tsx',()=>render(require('./views/App').default, 'App'));
23 | module.hot.accept('./views/Dashboard.tsx', () => render(require('./views/Dashboard').default, 'Content'));
24 | module.hot.accept('./views/FormPage.tsx', () => render(require('./views/FormPage').default, 'Content'));
25 | module.hot.accept('./views/TablePage.tsx', () => render(require('./views/TablePage').default, 'Content'));
26 | }
27 |
28 | export default App;
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/client/components/App.js:
--------------------------------------------------------------------------------
1 | import { Fragment, useState, useEffect } from 'react';
2 | import { getAccessToken, validateToken } from '../auth';
3 | import Portal from './Portal';
4 | import Landing from './Landing';
5 |
6 | export const CompanyLogo = styled.a`
7 | display: flex;
8 | align-items: center;
9 | margin-left: 1rem;
10 | background-image: url(https://dotnetify.net/content/images/dotnetify-logo.png);
11 | background-size: 100% 100%;
12 | width: 200px;
13 | height: 39px;
14 | `;
15 |
16 | const App = _ => {
17 | const [ accessToken ] = useState(getAccessToken());
18 | const [ validatingToken, setValidatingToken ] = useState(null);
19 | const [ loggedIn, setLoggedIn ] = useState(false);
20 |
21 | useEffect(() => {
22 | if (validatingToken === null) {
23 | setValidatingToken(!!accessToken);
24 | if (accessToken) {
25 | validateToken(accessToken).then(valid => {
26 | setLoggedIn(valid);
27 | setValidatingToken(false);
28 | });
29 | }
30 | }
31 | });
32 |
33 | if (validatingToken !== false) return ;
34 | return loggedIn ? : setLoggedIn(true)} />;
35 | };
36 |
37 | export default App;
38 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/client/auth.js:
--------------------------------------------------------------------------------
1 | const url = '/api/login';
2 |
3 | export const signIn = (username, password) => {
4 | return fetch(url, {
5 | method: 'post',
6 | body: 'username=' + username + '&password=' + password,
7 | headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }
8 | })
9 | .then(response => {
10 | if (!response.ok) throw new Error(response.status);
11 | return response.json();
12 | })
13 | .then(token => window.sessionStorage.setItem('access_token', token.access_token));
14 | };
15 |
16 | export const signOut = () => {
17 | window.sessionStorage.removeItem('access_token');
18 | window.location.href = '/';
19 | };
20 |
21 | export const validateToken = token => {
22 | return fetch(url + '/validate', {
23 | method: 'post',
24 | body: 'token=' + token,
25 | headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }
26 | }).then(response => response.ok);
27 | };
28 |
29 | export const getAccessToken = () => {
30 | return window.sessionStorage.getItem('access_token');
31 | };
32 |
33 | export const getAuthHeaders = _ => ({
34 | headers: { Authorization: 'Bearer ' + getAccessToken() },
35 | exceptionHandler: _ => signOut()
36 | });
37 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/dotnetify_react_template.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26730.16
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnetify_react_template", "dotnetify_react_template.csproj", "{338DE673-32B6-4C59-8E23-E4C2965ACA55}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {338DE673-32B6-4C59-8E23-E4C2965ACA55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {338DE673-32B6-4C59-8E23-E4C2965ACA55}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {338DE673-32B6-4C59-8E23-E4C2965ACA55}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {338DE673-32B6-4C59-8E23-E4C2965ACA55}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {CC910A34-349D-4C85-AB3B-C366D361C442}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/VueTodoApp/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | VueTodoApp
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/_archive/LiveChart/IISPublishingSteps.md:
--------------------------------------------------------------------------------
1 | ## IIS Publishing Steps
2 |
3 | ### Prerequisite:
4 |
5 | Install ASP.NET Core Module for IIS. You can download it here:
6 | https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.0-download.md#windows-server-hosting
7 |
8 | ### Steps
9 |
10 | 1. Set __base href__ in index.html:
11 | ```html
12 |
13 |
14 | DotNetify-React
15 |
16 |
17 | ...
18 | ```
19 |
20 | 2. Set __dotNetify.hubServerUrl__ in LiveChart.jsx:
21 | ```jsx
22 | import React from 'react';
23 | import dotnetify from 'dotnetify';
24 | import { Bar } from 'react-chartjs';
25 |
26 | dotnetify.hubServerUrl = "//";
27 |
28 | export default class LiveChart extends React.Component {
29 | ...
30 | ```
31 |
32 | 3. Rebuild the bundle with Webpack.
33 |
34 | 4. On Visual Studio menu, select __Build > Publish Live Chart__ option. Choose Folder profile.
35 |
36 | 5. Copy the __bin/release/PublishOutput__ folder to your IIS /inetpub/wwwroot. Rename the folder.
37 |
38 | 6. From IIS Manager, create an Application Pool for the new folder.
39 |
40 | 7. Run it: http:/localhost/.
41 |
--------------------------------------------------------------------------------
/_archive/LiveChart/src/LiveChart.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import dotnetify from 'dotnetify';
3 | import { Bar } from 'react-chartjs-2';
4 |
5 | export default class LiveChart extends React.Component {
6 | constructor(props) {
7 | super(props);
8 | this.vm = dotnetify.react.connect('LiveChart', this);
9 | this.state = { data: Array(10) };
10 | }
11 |
12 | componentWillUnmount() {
13 | this.vm.$destroy();
14 | }
15 |
16 | shouldComponentUpdate(_, nextState) {
17 | const value = nextState.NextValue;
18 | if (value !== this.state.NextValue) {
19 | this.setState({ data: [ ...this.state.data.slice(1), value ] });
20 | }
21 | return true;
22 | }
23 |
24 | render() {
25 | return ;
26 | }
27 | }
28 |
29 | const BarChart = ({ data }) => {
30 | let chartData = {
31 | labels: Array(10).fill(''),
32 | datasets: [
33 | {
34 | label: '',
35 | data: data,
36 | backgroundColor: 'rgba(75, 192, 192, 0.2)',
37 | borderColor: [ 'rgba(75, 192, 192, 1)' ]
38 | }
39 | ]
40 | };
41 |
42 | const chartOptions = {
43 | responsive: true,
44 | legend: { display: false },
45 | scaleOverride: true,
46 | scaleSteps: 5,
47 | scaleStepWidth: 10
48 | };
49 |
50 | return ;
51 | };
52 |
--------------------------------------------------------------------------------
/_archive/Routing/ViewModels/Page2.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Collections.Generic;
4 | using DotNetify;
5 | using DotNetify.Routing;
6 |
7 | namespace Routing
8 | {
9 | public class Page2 : BaseVM, IRoutable
10 | {
11 | public string Title => "Page 2";
12 | public RoutingState RoutingState { get; set; }
13 | public IEnumerable Links => Enumerable.Range(1, 12).Select(i => new
14 | {
15 | Title = $"Item {i}",
16 | Route = this.GetRoute("Page2Item", $"item/{i}")
17 | });
18 |
19 | public Page2()
20 | {
21 | this.RegisterRoutes("Page2", new List
22 | {
23 | new RouteTemplate("Page2Home") { UrlPattern = "" },
24 | new RouteTemplate("Page2Item") { UrlPattern = "item(/:id)", VMType = typeof(Page2Item) }
25 | });
26 | }
27 | }
28 |
29 | public class Page2Item : BaseVM, IRoutable
30 | {
31 | public string Title { get; set; }
32 | public RoutingState RoutingState { get; set; }
33 |
34 | public Page2Item()
35 | {
36 | this.OnRouted((sender, e) =>
37 | {
38 | Title = $"Item {e.From.Replace("item/", "")}";
39 | Changed(nameof(Title));
40 | });
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/contrib/unicode2nginx/unicode-to-nginx.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl -w
2 |
3 | # Convert unicode mappings to nginx configuration file format.
4 |
5 | # You may find useful mappings in various places, including
6 | # unicode.org official site:
7 | #
8 | # http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT
9 | # http://www.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT
10 |
11 | # Needs perl 5.6 or later.
12 |
13 | # Written by Maxim Dounin, mdounin@mdounin.ru
14 |
15 | ###############################################################################
16 |
17 | require 5.006;
18 |
19 | while (<>) {
20 | # Skip comments and empty lines
21 |
22 | next if /^#/;
23 | next if /^\s*$/;
24 | chomp;
25 |
26 | # Convert mappings
27 |
28 | if (/^\s*0x(..)\s*0x(....)\s*(#.*)/) {
29 | # Mapping "#"
30 | my $cs_code = $1;
31 | my $un_code = $2;
32 | my $un_name = $3;
33 |
34 | # Produce UTF-8 sequence from character code;
35 |
36 | my $un_utf8 = join('',
37 | map { sprintf("%02X", $_) }
38 | unpack("U0C*", pack("U", hex($un_code)))
39 | );
40 |
41 | print " $cs_code $un_utf8 ; $un_name\n";
42 |
43 | } else {
44 | warn "Unrecognized line: '$_'";
45 | }
46 | }
47 |
48 | ###############################################################################
49 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactTodoApp/webpack.config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const webpack = require('webpack');
4 | const CopyPlugin = require('copy-webpack-plugin');
5 |
6 | module.exports = {
7 | mode: 'development',
8 | entry: {
9 | app: './client/index.js'
10 | },
11 | output: {
12 | filename: '[name].js',
13 | path: __dirname + '/wwwroot/dist',
14 | publicPath: '/dist/',
15 | libraryTarget: 'umd'
16 | },
17 | resolve: {
18 | modules: [ 'client', 'node_modules' ],
19 | extensions: [ '.js', '.jsx' ]
20 | },
21 | module: {
22 | rules: [
23 | { test: /\.jsx?$/, use: 'babel-loader', exclude: /node_modules/ },
24 | { test: /\.css$/, use: [ 'css-loader?minimize' ] },
25 | { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader' }
26 | ]
27 | },
28 | externals: {
29 | dotnetify: 'dotnetify',
30 | 'dotnetify-elements': 'dotNetifyElements',
31 | 'styled-components': 'styled'
32 | },
33 | devtool: 'source-map',
34 | plugins: [
35 | new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/),
36 | new CopyPlugin([
37 | { from: 'node_modules/dotnetify/dist/dotnetify-react.min.js' },
38 | { from: 'node_modules/dotnetify-elements/lib/basic-elements.bundle.js' },
39 | { from: 'node_modules/styled-components/dist/styled-components.min.js' }
40 | ])
41 | ]
42 | };
43 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/webpack.config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const webpack = require('webpack');
4 | const CopyPlugin = require('copy-webpack-plugin');
5 |
6 | module.exports = {
7 | mode: 'development',
8 | entry: {
9 | app: './client/index.js'
10 | },
11 | output: {
12 | filename: '[name].js',
13 | path: __dirname + '/wwwroot/dist',
14 | publicPath: '/dist/',
15 | libraryTarget: 'umd'
16 | },
17 | resolve: {
18 | modules: [ 'client', 'node_modules' ],
19 | extensions: [ '.js', '.jsx' ]
20 | },
21 | module: {
22 | rules: [
23 | { test: /\.jsx?$/, use: 'babel-loader', exclude: /node_modules/ },
24 | { test: /\.css$/, use: [ 'css-loader?minimize' ] },
25 | { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader' }
26 | ]
27 | },
28 | externals: {
29 | dotnetify: 'dotnetify',
30 | 'dotnetify-elements': 'dotNetifyElements',
31 | 'styled-components': 'styled'
32 | },
33 | devtool: 'source-map',
34 | plugins: [
35 | new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/),
36 | new CopyPlugin([
37 | { from: 'node_modules/dotnetify/dist/dotnetify-react.min.js' },
38 | { from: 'node_modules/dotnetify-elements/lib/dotnetify-elements.bundle.js' },
39 | { from: 'node_modules/styled-components/dist/styled-components.min.js' }
40 | ])
41 | ]
42 | };
43 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactDashboardApp/webpack.config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const webpack = require('webpack');
4 | const CopyPlugin = require('copy-webpack-plugin');
5 |
6 | module.exports = {
7 | mode: 'development',
8 | entry: {
9 | app: './client/index.js'
10 | },
11 | output: {
12 | filename: '[name].js',
13 | path: __dirname + '/wwwroot/dist',
14 | publicPath: '/dist/',
15 | libraryTarget: 'umd'
16 | },
17 | resolve: {
18 | modules: [ 'client', 'node_modules' ],
19 | extensions: [ '.js', '.jsx' ]
20 | },
21 | module: {
22 | rules: [
23 | { test: /\.jsx?$/, use: 'babel-loader', exclude: /node_modules/ },
24 | { test: /\.css$/, use: [ 'css-loader?minimize' ] },
25 | { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader' }
26 | ]
27 | },
28 | externals: {
29 | dotnetify: 'dotnetify',
30 | 'dotnetify-elements': 'dotNetifyElements',
31 | 'styled-components': 'styled'
32 | },
33 | devtool: 'source-map',
34 | plugins: [
35 | new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/),
36 | new CopyPlugin([
37 | { from: 'node_modules/dotnetify/dist/dotnetify-react.min.js' },
38 | { from: 'node_modules/dotnetify-elements/lib/dotnetify-elements.bundle.js' },
39 | { from: 'node_modules/styled-components/dist/styled-components.min.js' }
40 | ])
41 | ]
42 | };
43 |
--------------------------------------------------------------------------------
/ReactTemplate/content/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "6.0.0",
3 | "name": "projectName__lower",
4 | "private": true,
5 | "scripts": {
6 | "build": "webpack",
7 | "build:Debug": "webpack --mode=development",
8 | "build:Release": "webpack --mode=production",
9 | "prod": "webpack -p --progress && dotnet publish -c Release",
10 | "analyze": "source-map-explorer 'wwwroot/dist/*.js'"
11 | },
12 | "dependencies": {
13 | "@material-ui/core": "^4.12.3",
14 | "@material-ui/icons": "^4.11.2",
15 | "chart.js": "^3.7.0",
16 | "dotnetify": "^5.2.2",
17 | "flexboxgrid": "~6.3.1",
18 | "react": "^17.0.2",
19 | "react-chartjs-2": "^4.0.0",
20 | "react-dom": "^17.0.2"
21 | },
22 | "devDependencies": {
23 | "@types/material-ui": "^0.21.12",
24 | "@types/node": "~14.0.5",
25 | "@types/react": "^17.0.38",
26 | "@types/react-dom": "^17.0.11",
27 | "aspnet-webpack": "^3.0.0",
28 | "css-loader": "~0.28.7",
29 | "mini-css-extract-plugin": "~0.4.0",
30 | "source-map-explorer": "^2.5.2",
31 | "style-loader": "~0.19.0",
32 | "svg-url-loader": "~2.3.2",
33 | "ts-loader": "^9.2.6",
34 | "typescript": "^4.5.4",
35 | "url-loader": "~0.6.2",
36 | "webpack": "^5.65.0",
37 | "webpack-cli": "^3.3.12",
38 | "webpack-dev-middleware": "^3.7.3",
39 | "webpack-hot-middleware": "~2.23.1"
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/_archive/Routing/src/Index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import dotnetify from 'dotnetify';
3 | import { RouteLink, RouteTarget } from 'dotnetify/dist/dotnetify-react.router'
4 |
5 | export default class Index extends React.Component {
6 | constructor(props) {
7 | super(props);
8 | this.vm = dotnetify.react.connect("Index", this);
9 | this.vm.onRouteEnter = (path, template) => template.Target = "Panel";
10 |
11 | this.state = dotnetify.react.router.ssrState("Index") || { Links: []};
12 | }
13 | componentWillUnmount() {
14 | this.vm.$destroy();
15 | }
16 | render() {
17 | const links = this.state.Links.map((link, idx) =>
18 | {link.Title}
19 | );
20 | return (
21 |
22 |
23 |
24 | {links}
25 |
26 |
27 |
28 |
29 | );
30 | }
31 | }
32 |
33 | export class Home extends React.Component {
34 | render() {
35 | return (
36 |
37 |
38 |
39 | );
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/VueTodoApp/webpack.config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const webpack = require('webpack');
4 | const CopyPlugin = require('copy-webpack-plugin');
5 | const { VueLoaderPlugin } = require('vue-loader');
6 |
7 | module.exports = {
8 | mode: 'development',
9 | entry: {
10 | app: './client/index.js'
11 | },
12 | output: {
13 | filename: '[name].js',
14 | path: __dirname + '/wwwroot/dist',
15 | publicPath: '/dist/',
16 | libraryTarget: 'umd'
17 | },
18 | resolve: {
19 | modules: [ 'client', 'node_modules' ],
20 | alias: { vue$: 'vue/dist/vue.esm.js' }
21 | },
22 | module: {
23 | rules: [
24 | { test: /\.vue$/, use: 'vue-loader' },
25 | { test: /\.js?$/, loader: 'babel-loader', query: { presets: [ 'env' ] } },
26 | { test: /\.scss$/, use: [ 'vue-style-loader', 'css-loader', 'sass-loader' ] },
27 | { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader' }
28 | ]
29 | },
30 | externals: {
31 | 'dotnetify-elements': 'dotNetifyElements'
32 | },
33 | devtool: 'source-map',
34 | plugins: [
35 | new VueLoaderPlugin(),
36 | new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/),
37 | new CopyPlugin([
38 | { from: 'node_modules/dotnetify/dist/dotnetify-vue.min.js' },
39 | { from: 'node_modules/dotnetify-elements/lib/basic-web-components.bundle.js' }
40 | ])
41 | ]
42 | };
43 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactTodoApp/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ReactTodoApp
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/client/index.js:
--------------------------------------------------------------------------------
1 | import { createWebComponent } from 'dotnetify-elements/web-components/Core';
2 | import loader from './loader';
3 | import App from './components/App';
4 |
5 | let useApiGateway = process.env.NODE_ENV !== 'development';
6 |
7 | loader(
8 | [
9 | {
10 | id: 'react-dashboard-app',
11 | label: 'React Dashboard',
12 | routePath: 'dashboard',
13 | baseUrl: useApiGateway ? 'http://localhost:8080/app1' : 'http://localhost:5060',
14 | moduleUrl: '/dist/app.js'
15 | },
16 | {
17 | id: 'react-form-app',
18 | label: 'React Form',
19 | routePath: 'form',
20 | baseUrl: useApiGateway ? 'http://localhost:8080/app2' : 'http://localhost:5070',
21 | moduleUrl: '/dist/app.js'
22 | },
23 | {
24 | id: 'react-todo-app',
25 | label: 'React Todo',
26 | routePath: 'react-todo',
27 | baseUrl: useApiGateway ? 'http://localhost:8080/app3' : 'http://localhost:5010',
28 | moduleUrl: '/dist/app.js'
29 | },
30 | {
31 | id: 'vue-todo-app',
32 | label: 'Vue Todo',
33 | routePath: 'vue-todo',
34 | baseUrl: useApiGateway ? 'http://localhost:8080/app4' : 'http://localhost:5020',
35 | moduleUrl: '/dist/app.js'
36 | }
37 | ],
38 | // External dependencies from script tags.
39 | ['dotnetify', 'dotNetifyElements', 'styled']
40 | );
41 |
42 | createWebComponent(App, 'my-portal');
43 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/client/components/BasicInfoForm.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Cell, DropdownList, Form, Panel, TextField, VMContext } from 'dotnetify-elements';
3 |
4 | const BasicInfoForm = () => (
5 |
6 |
7 |
8 |
9 |
19 |
20 | |
21 |
22 |
23 |
31 |
32 | |
33 |
34 |
35 | );
36 |
37 | export default BasicInfoForm;
38 |
--------------------------------------------------------------------------------
/_archive/HelloWorld/Startup.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Collections.Generic;
3 | using Microsoft.AspNetCore.Builder;
4 | using Microsoft.AspNetCore.Hosting;
5 | using Microsoft.AspNetCore.Http;
6 | using Microsoft.AspNetCore.SpaServices.Webpack;
7 | using Microsoft.Extensions.DependencyInjection;
8 | using DotNetify;
9 |
10 | namespace HelloWorld
11 | {
12 | public class Startup
13 | {
14 | public void ConfigureServices(IServiceCollection services)
15 | {
16 | services.AddMemoryCache();
17 | services.AddSignalR();
18 | services.AddDotNetify();
19 | }
20 |
21 | public void Configure(IApplicationBuilder app)
22 | {
23 | app.UseWebSockets();
24 | app.UseSignalR(routes => routes.MapDotNetifyHub());
25 | app.UseDotNetify();
26 |
27 | app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
28 | {
29 | HotModuleReplacement = true,
30 | HotModuleReplacementClientOptions = new Dictionary { { "reload", "true" } },
31 | });
32 |
33 | app.UseStaticFiles();
34 | app.Run(async (context) =>
35 | {
36 | using (var reader = new StreamReader(File.OpenRead("wwwroot/index.html")))
37 | await context.Response.WriteAsync(reader.ReadToEnd());
38 | });
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/_archive/LiveChart/Startup.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Collections.Generic;
3 | using Microsoft.AspNetCore.Builder;
4 | using Microsoft.AspNetCore.Hosting;
5 | using Microsoft.AspNetCore.Http;
6 | using Microsoft.AspNetCore.SpaServices.Webpack;
7 | using Microsoft.Extensions.DependencyInjection;
8 | using DotNetify;
9 |
10 | namespace LiveChart
11 | {
12 | public class Startup
13 | {
14 | public void ConfigureServices(IServiceCollection services)
15 | {
16 | services.AddMemoryCache();
17 | services.AddSignalR();
18 | services.AddDotNetify();
19 | }
20 |
21 | public void Configure(IApplicationBuilder app)
22 | {
23 | app.UseWebSockets();
24 | app.UseSignalR(routes => routes.MapDotNetifyHub());
25 | app.UseDotNetify();
26 |
27 | app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
28 | {
29 | HotModuleReplacement = true,
30 | HotModuleReplacementClientOptions = new Dictionary { { "reload", "true" } },
31 | });
32 |
33 | app.UseStaticFiles();
34 | app.Run(async (context) =>
35 | {
36 | using (var reader = new StreamReader(File.OpenRead("wwwroot/index.html")))
37 | await context.Response.WriteAsync(reader.ReadToEnd());
38 | });
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "name": "react-form-app",
4 | "private": true,
5 | "scripts": {
6 | "build": "webpack",
7 | "prod": "webpack --mode production"
8 | },
9 | "babel": {
10 | "presets": [
11 | "env",
12 | "react"
13 | ],
14 | "plugins": [
15 | "babel-plugin-styled-components",
16 | "babel-plugin-transform-class-properties",
17 | "babel-plugin-transform-object-rest-spread"
18 | ]
19 | },
20 | "dependencies": {
21 | "dotnetify": "^4.0.0",
22 | "dotnetify-elements": "^1.1.0",
23 | "react": "^16.9.0",
24 | "react-dom": "^16.9.0",
25 | "styled-components": "^4.3.2"
26 | },
27 | "devDependencies": {
28 | "aspnet-webpack": "~3.0.0",
29 | "babel-core": "~6.26.3",
30 | "babel-loader": "~7.1.4",
31 | "babel-plugin-styled-components": "~1.5.1",
32 | "babel-plugin-transform-class-properties": "~6.24.1",
33 | "babel-plugin-transform-object-rest-spread": "~6.26.0",
34 | "babel-preset-env": "~1.7.0",
35 | "babel-preset-react": "~6.24.1",
36 | "copy-webpack-plugin": "^5.0.4",
37 | "css-loader": "~0.28.11",
38 | "file-loader": "~1.1.11",
39 | "style-loader": "~0.21.0",
40 | "url-loader": "~1.0.1",
41 | "webpack": "~4.12.0",
42 | "webpack-bundle-analyzer": "^3.4.1",
43 | "webpack-cli": "~3.0.8",
44 | "webpack-dev-middleware": "~3.1.3",
45 | "webpack-hot-middleware": "~2.22.2"
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactTodoApp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "name": "react-todo-app",
4 | "private": true,
5 | "scripts": {
6 | "build": "webpack",
7 | "prod": "webpack --mode production"
8 | },
9 | "babel": {
10 | "presets": [
11 | "env",
12 | "react"
13 | ],
14 | "plugins": [
15 | "babel-plugin-styled-components",
16 | "babel-plugin-transform-class-properties",
17 | "babel-plugin-transform-object-rest-spread"
18 | ]
19 | },
20 | "dependencies": {
21 | "dotnetify": "^4.0.0",
22 | "dotnetify-elements": "^1.1.0",
23 | "react": "^16.9.0",
24 | "react-dom": "^16.9.0",
25 | "styled-components": "^4.3.2"
26 | },
27 | "devDependencies": {
28 | "aspnet-webpack": "~3.0.0",
29 | "babel-core": "~6.26.3",
30 | "babel-loader": "~7.1.4",
31 | "babel-plugin-styled-components": "~1.5.1",
32 | "babel-plugin-transform-class-properties": "~6.24.1",
33 | "babel-plugin-transform-object-rest-spread": "~6.26.0",
34 | "babel-preset-env": "~1.7.0",
35 | "babel-preset-react": "~6.24.1",
36 | "copy-webpack-plugin": "^5.0.4",
37 | "css-loader": "~0.28.11",
38 | "file-loader": "~1.1.11",
39 | "style-loader": "~0.21.0",
40 | "url-loader": "~1.0.1",
41 | "webpack": "~4.12.0",
42 | "webpack-bundle-analyzer": "^3.0.3",
43 | "webpack-cli": "~3.0.8",
44 | "webpack-dev-middleware": "~3.1.3",
45 | "webpack-hot-middleware": "~2.22.2"
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactDashboardApp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "name": "react-dashboard-app",
4 | "private": true,
5 | "scripts": {
6 | "build": "webpack",
7 | "prod": "webpack --mode production"
8 | },
9 | "babel": {
10 | "presets": [
11 | "env",
12 | "react"
13 | ],
14 | "plugins": [
15 | "babel-plugin-styled-components",
16 | "babel-plugin-transform-class-properties",
17 | "babel-plugin-transform-object-rest-spread"
18 | ]
19 | },
20 | "dependencies": {
21 | "dotnetify": "^4.0.0",
22 | "dotnetify-elements": "^1.1.0",
23 | "react": "^16.9.0",
24 | "react-dom": "^16.9.0",
25 | "styled-components": "^4.3.2"
26 | },
27 | "devDependencies": {
28 | "aspnet-webpack": "~3.0.0",
29 | "babel-core": "~6.26.3",
30 | "babel-loader": "~7.1.4",
31 | "babel-plugin-styled-components": "~1.5.1",
32 | "babel-plugin-transform-class-properties": "~6.24.1",
33 | "babel-plugin-transform-object-rest-spread": "~6.26.0",
34 | "babel-preset-env": "~1.7.0",
35 | "babel-preset-react": "~6.24.1",
36 | "copy-webpack-plugin": "^5.0.4",
37 | "css-loader": "~0.28.11",
38 | "file-loader": "~1.1.11",
39 | "style-loader": "~0.21.0",
40 | "url-loader": "~1.0.1",
41 | "webpack": "~4.12.0",
42 | "webpack-bundle-analyzer": "^3.4.1",
43 | "webpack-cli": "~3.0.8",
44 | "webpack-dev-middleware": "~3.1.3",
45 | "webpack-hot-middleware": "~2.22.2"
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "name": "portal",
4 | "private": true,
5 | "scripts": {
6 | "build": "webpack",
7 | "prod": "webpack --mode production"
8 | },
9 | "babel": {
10 | "presets": [
11 | "env",
12 | "react"
13 | ],
14 | "plugins": [
15 | "babel-plugin-styled-components",
16 | "babel-plugin-transform-class-properties",
17 | "babel-plugin-transform-object-rest-spread"
18 | ]
19 | },
20 | "dependencies": {
21 | "dotnetify": "^4.0.0",
22 | "dotnetify-elements": "^1.1.0",
23 | "react": "^16.9.0",
24 | "react-dom": "^16.9.0",
25 | "styled-components": "^4.3.2",
26 | "systemjs": "~0.21.6"
27 | },
28 | "devDependencies": {
29 | "aspnet-webpack": "~3.0.0",
30 | "babel-core": "~6.26.3",
31 | "babel-loader": "~7.1.4",
32 | "babel-plugin-styled-components": "~1.5.1",
33 | "babel-plugin-transform-class-properties": "~6.24.1",
34 | "babel-plugin-transform-object-rest-spread": "~6.26.0",
35 | "babel-preset-env": "~1.7.0",
36 | "babel-preset-react": "~6.24.1",
37 | "copy-webpack-plugin": "^5.0.4",
38 | "css-loader": "~0.28.11",
39 | "file-loader": "~1.1.11",
40 | "style-loader": "~0.21.0",
41 | "url-loader": "~1.0.1",
42 | "webpack": "~4.12.0",
43 | "webpack-bundle-analyzer": "^3.0.3",
44 | "webpack-cli": "~3.0.8",
45 | "webpack-dev-middleware": "~3.1.3",
46 | "webpack-hot-middleware": "~2.22.2"
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/contrib/geo2nginx.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl -w
2 |
3 | # (c) Andrei Nigmatulin, 2005
4 | #
5 | # this script provided "as is", without any warranties. use it at your own risk.
6 | #
7 | # special thanx to Andrew Sitnikov for perl port
8 | #
9 | # this script converts CSV geoip database (free download at http://www.maxmind.com/app/geoip_country)
10 | # to format, suitable for use with nginx_http_geo module (http://sysoev.ru/nginx)
11 | #
12 | # for example, line with ip range
13 | #
14 | # "62.16.68.0","62.16.127.255","1041253376","1041268735","RU","Russian Federation"
15 | #
16 | # will be converted to four subnetworks:
17 | #
18 | # 62.16.68.0/22 RU;
19 | # 62.16.72.0/21 RU;
20 | # 62.16.80.0/20 RU;
21 | # 62.16.96.0/19 RU;
22 |
23 |
24 | use warnings;
25 | use strict;
26 |
27 | while( ){
28 | if (/"[^"]+","[^"]+","([^"]+)","([^"]+)","([^"]+)"/){
29 | print_subnets($1, $2, $3);
30 | }
31 | }
32 |
33 | sub print_subnets {
34 | my ($a1, $a2, $c) = @_;
35 | my $l;
36 | while ($a1 <= $a2) {
37 | for ($l = 0; ($a1 & (1 << $l)) == 0 && ($a1 + ((1 << ($l + 1)) - 1)) <= $a2; $l++){};
38 | print long2ip($a1) . "/" . (32 - $l) . " " . $c . ";\n";
39 | $a1 += (1 << $l);
40 | }
41 | }
42 |
43 | sub long2ip {
44 | my $ip = shift;
45 |
46 | my $str = 0;
47 |
48 | $str = ($ip & 255);
49 |
50 | $ip >>= 8;
51 | $str = ($ip & 255).".$str";
52 |
53 | $ip >>= 8;
54 | $str = ($ip & 255).".$str";
55 |
56 | $ip >>= 8;
57 | $str = ($ip & 255).".$str";
58 | }
59 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/docs/LICENSE:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2002-2019 Igor Sysoev
3 | * Copyright (C) 2011-2019 Nginx, Inc.
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions
8 | * are met:
9 | * 1. Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | * 2. Redistributions in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in the
13 | * documentation and/or other materials provided with the distribution.
14 | *
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 | * SUCH DAMAGE.
26 | */
27 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/components/dashboard/ServerUsage.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import PropTypes from "prop-types";
3 | import { Bar } from "react-chartjs-2";
4 | import Paper from "material-ui/Paper";
5 | import { white, pink600, pink500, pink400 } from "material-ui/styles/colors";
6 | import GlobalStyles from "../../styles/styles";
7 |
8 | const ServerUsage = props => {
9 | const styles = {
10 | paper: {
11 | backgroundColor: pink600,
12 | height: 150
13 | },
14 | div: {
15 | marginLeft: "auto",
16 | marginRight: "auto",
17 | width: "95%",
18 | height: 85
19 | },
20 | header: {
21 | color: white,
22 | backgroundColor: pink500,
23 | padding: 10
24 | }
25 | };
26 |
27 | const data = {
28 | labels: props.label,
29 | datasets: [
30 | {
31 | data: props.data,
32 | backgroundColor: pink400,
33 | borderColor: pink500
34 | }
35 | ]
36 | };
37 |
38 | const options = {
39 | legend: { display: false },
40 | scales: { xAxes: [{ ticks: { fontColor: white }, display: true, gridLines: { display: false } }], yAxes: [{ display: false }] },
41 | layout: { padding: { bottom: 5 } },
42 | maintainAspectRatio: false
43 | };
44 |
45 | return (
46 |
47 | Server Usage
48 |
49 |
50 |
51 |
52 | );
53 | };
54 |
55 | export default ServerUsage;
56 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/server/ViewModels/PhoneForm.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Reactive.Linq;
3 | using DotNetify;
4 | using DotNetify.Elements;
5 | using DotNetify.Security;
6 |
7 | namespace ReactFormApp
8 | {
9 | [Authorize]
10 | public class PhoneForm : BaseVM
11 | {
12 | public ReactiveProperty Customer { get; } = new ReactiveProperty();
13 |
14 | public PhoneForm()
15 | {
16 | AddProperty(nameof(PhoneInfo.Work))
17 | .WithAttribute(new TextFieldAttribute { Label = "Work:", Mask = "(999) 999-9999" })
18 | .WithPatternValidation(Pattern.USPhoneNumber)
19 | .SubscribeTo(Customer.Select(x => x.Phone.Work));
20 |
21 | AddProperty(nameof(PhoneInfo.Home))
22 | .WithAttribute(new TextFieldAttribute { Label = "Home:", Mask = "(999) 999-9999" })
23 | .WithPatternValidation(Pattern.USPhoneNumber)
24 | .SubscribeTo(Customer.Select(x => x.Phone.Home));
25 |
26 | AddProperty(nameof(PhoneInfo.Mobile))
27 | .WithAttribute(new TextFieldAttribute { Label = "Mobile:", Mask = "(999) 999-9999" })
28 | .WithPatternValidation(Pattern.USPhoneNumber)
29 | .SubscribeTo(Customer.Select(x => x.Phone.Mobile));
30 |
31 | AddProperty(nameof(PhoneInfo.Primary))
32 | .WithAttribute(new DropdownListAttribute { Label = "Primary Phone:", Options = typeof(PrimaryPhone).ToDescriptions() })
33 | .SubscribeTo(Customer.Select(x => x.Phone.Primary));
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/components/dashboard/Traffic.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import PropTypes from 'prop-types';
3 | import { Line } from 'react-chartjs-2';
4 | import Paper from 'material-ui/Paper';
5 | import { white, purple600, purple500 } from 'material-ui/styles/colors';
6 |
7 | const Traffic = (props) => {
8 |
9 | const styles = {
10 | paper: {
11 | backgroundColor: purple500,
12 | height: 150
13 | },
14 | div: {
15 | height: 95,
16 | padding: '5px 15px 0 15px',
17 | },
18 | header: {
19 | fontSize: 24,
20 | color: white,
21 | backgroundColor: purple600,
22 | padding: 10,
23 | }
24 | };
25 |
26 | const data = {
27 | labels: new Array(props.data.length),
28 | datasets: [
29 | {
30 | data: props.data,
31 | fill: false,
32 | backgroundColor: 'white',
33 | borderColor: '#8884d8',
34 | borderWidth: 2,
35 | pointBorderWidth: 2,
36 | cubicInterpolationMode: 'monotone'
37 | }
38 | ]
39 | };
40 |
41 | const options = {
42 | legend: { display: false },
43 | scales: { xAxes: [{ display: false }], yAxes: [{ display: false }] },
44 | layout: { padding: { left: 5, right: 5, top: 5, bottom: 5 } },
45 | maintainAspectRatio: false
46 | }
47 |
48 | return (
49 |
50 | Traffic
51 |
52 |
53 |
54 |
55 | );
56 | };
57 |
58 | export default Traffic;
59 |
--------------------------------------------------------------------------------
/ReactTemplate/content/client/components/dashboard/InfoBox.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { makeStyles } from "@material-ui/core/styles";
3 | import Card from "@material-ui/core/Card";
4 | import grey from "@material-ui/core/colors/grey";
5 |
6 | const useStyles = makeStyles({
7 | content: {
8 | padding: "5px 10px",
9 | marginLeft: 90,
10 | height: 80
11 | },
12 | number: {
13 | display: "block",
14 | fontWeight: "bold",
15 | fontSize: 18,
16 | paddingTop: 10,
17 | color: grey[800]
18 | },
19 | text: {
20 | fontSize: 18,
21 | fontWeight: "lighter",
22 | color: grey[600]
23 | },
24 | iconBox: {
25 | float: "left",
26 | height: 90,
27 | width: 90,
28 | textAlign: "center",
29 | color: "white",
30 | backgroundColor: (props: any) => props.color
31 | },
32 | icon: {
33 | height: 48,
34 | width: 48,
35 | marginTop: 20,
36 | maxWidth: "100%"
37 | }
38 | });
39 |
40 | export interface IInfoBoxProps {
41 | icon: React.ComponentType;
42 | color: string;
43 | title: string;
44 | value: any;
45 | }
46 |
47 | export default function InfoBox({ icon, color, title, value }: IInfoBoxProps) {
48 | const classes = useStyles({ color });
49 | const Icon: any = icon;
50 |
51 | return (
52 |
53 |
54 |
55 |
56 |
57 |
58 | {title}
59 | {value}
60 |
61 |
62 | );
63 | }
64 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/server/ViewModels/AddressForm.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Reactive.Linq;
3 | using DotNetify;
4 | using DotNetify.Elements;
5 | using DotNetify.Security;
6 |
7 | namespace ReactFormApp
8 | {
9 | [Authorize]
10 | public class AddressForm : BaseVM
11 | {
12 | public ReactiveProperty Customer { get; } = new ReactiveProperty();
13 |
14 | public AddressForm()
15 | {
16 | AddProperty(nameof(AddressInfo.Address1))
17 | .WithAttribute(new TextFieldAttribute { Label = "Address 1:" })
18 | .SubscribeTo(Customer.Select(x => x.Address.Address1));
19 |
20 | AddProperty(nameof(AddressInfo.Address2))
21 | .WithAttribute(new TextFieldAttribute { Label = "Address 2:" })
22 | .SubscribeTo(Customer.Select(x => x.Address.Address2));
23 |
24 | AddProperty(nameof(AddressInfo.City))
25 | .WithAttribute(new TextFieldAttribute { Label = "City:" })
26 | .SubscribeTo(Customer.Select(x => x.Address.City));
27 |
28 | AddProperty(nameof(AddressInfo.State))
29 | .WithAttribute(new DropdownListAttribute
30 | {
31 | Label = "State:",
32 | Options = typeof(State).ToDescriptions()
33 | })
34 | .SubscribeTo(Customer.Select(x => x.Address.State));
35 |
36 | AddProperty(nameof(AddressInfo.ZipCode))
37 | .WithAttribute(new TextFieldAttribute { Label = "Zip Code:" })
38 | .SubscribeTo(Customer.Select(x => x.Address.ZipCode));
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/webpack.config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const path = require('path');
4 | const webpack = require('webpack');
5 | const CopyPlugin = require('copy-webpack-plugin');
6 |
7 | module.exports = {
8 | mode: 'development',
9 | entry: {
10 | app: './client/index.js'
11 | },
12 | output: {
13 | filename: '[name].js',
14 | path: __dirname + '/wwwroot/dist',
15 | publicPath: '/dist/',
16 | libraryTarget: 'umd'
17 | },
18 | resolve: {
19 | modules: [ 'client', 'node_modules' ],
20 | extensions: [ '.js', '.jsx' ]
21 | },
22 | module: {
23 | rules: [
24 | { test: /\.jsx?$/, use: 'babel-loader', exclude: /node_modules/ },
25 | { test: /\.css$/, use: [ 'css-loader?minimize' ] },
26 | { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader' }
27 | ]
28 | },
29 | externals: {
30 | dotnetify: 'dotnetify',
31 | 'dotnetify-elements': 'dotNetifyElements',
32 | react: 'React',
33 | 'react-dom': 'ReactDOM',
34 | 'styled-components': 'styled'
35 | },
36 | devtool: 'source-map',
37 | plugins: [
38 | new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/),
39 | new CopyPlugin([
40 | { from: 'node_modules/dotnetify/dist/dotnetify-react.min.js' },
41 | { from: 'node_modules/dotnetify/dist/dotnetify-vue.min.js' },
42 | { from: 'node_modules/dotnetify-elements/lib', to: 'lib/' },
43 | { from: 'node_modules/dotnetify-elements/web-components', to: 'web-components/' },
44 | { from: 'node_modules/styled-components/dist/styled-components.min.js' },
45 | { from: 'node_modules/systemjs/dist/system.js' }
46 | ])
47 | ]
48 | };
49 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/tempkey.rsa:
--------------------------------------------------------------------------------
1 | {"KeyId":"0ba2028548bfe91576a5940388a7cdbb","Parameters":{"D":"UkWCmbhxnXgJc4SiqAk+6xS0V48iNAt7n/TBICboACMdc+ocGvcR5mqBnRVbRg6S8W+an8JpccDYZtf734TPjV2eRtH2udHlsSeOGlGaa/Mbs1uohglSqwC4i6YMIZQL2E0hRcRpR/YFAK2pYhf3NBI7LQojbmg7ghcsybjK1KFrNTFgI28bkk3f87sf1oJX91Le13tVXpf0mdwP7eEj+cJ+8YK/mV42KEeAHbuQpr920nWy5vi1fO+tqDJvoeq4hyyW21FXlwjxhC0rVI/lcED3dgzok5qXMJniqzyiw7X1noLwtc08QvpqOtoNOaDQALOV2mBWgJmBcloHTHqEUQ==","DP":"W1kMQ859BP9u5Ngu3uz3shu+vVAXIUsjviMe3Pfnj9HlDzZ2zaUEpaQAbvzbaOvwn1vwXwKFvyO7cTpykwi0gYTj9RSYdmRj36CQWQfc9bkiWpOYTPSt5pNusATMDVgQWrmE63MMZg2dpVd5kxWRYebMoQO0lW+YRvACibLPap0=","DQ":"bte4YhkaV6cJdi4UlQBsDreW55EvrwTd982iuxYZ00sleZoSoIgjE7Wesnt1x8gwzWycmJ469ExsblZ4sXSFgB+/51nXi6axTjTbo4mJDgePypMf84fzBGsQmf7b+yMhB1gHdzfpngZ9JCbTv9LZGTuM1mKSY6vGKvpLrzbjvcs=","Exponent":"AQAB","InverseQ":"fZl7/xHyDdh9PH/paje6da8nOXvV7EY4oeI4mjoX/fSq/Eu2/3GNOPBUpHqGHszNNxjDL3hv/E+wep/HI3m6XwingH7AS9DUPRDnBsjVUG+kSuOSCruWzfVLIzMK5xhE+pMVsLn9dBL/pgm5rLBOaq/TSz8KS0gF3K9ONUXmYz4=","Modulus":"uTw8FFxFAOTeA0o/XSdtRRbBhhlYOPhc+Vq8rLsVxIEEP4ev1fQU8dyKHEZuokNpksFhnfbdLIWhS2SH/7l+ERKATYmQlcyQQxkTin+aGWC0dNwvt9QIMxw1uNriRSoEQn9c7yD0ZONfXBZ2aVa6fGgfy7MsJ6TnAgdgt0NWjb8S/s7ehGNE+2PixKZsp7KqX0wIRTzh2hy0qafzY2o3yT5NMajxXJSCEUTZtmgfZxOKVAtIK1YsYGCzimVoCyPemUSY43etvjv9MsHQ3X/WnsHkQ8wYyzyU24O7aj/HHalekKoPM4Ckd9vVy6ebjflkye8A8UGn8BcwXwF62HDMuQ==","P":"y09WRKLTgBCWRHcIvQDo2U6v3ndaewVP8VCZ2QGEcK9zPQJvNos58RZByVgXAIiKyHNzz4xO9HMy7+XhwhfjBDzEAxCnS9XfLAwIOIv9IJ7JI5wUhbhsCoOIMYz2k7o4ZTaK1RHAZ7fWksMvghrrmXu8ZQ+BorvNfkFJVstFyhs=","Q":"6T27LxHMkV33tUvdeFXSTuv/oaO4bN16PUx0fo5a1pbegt55XAIqsQHJeM4VnIJvBwXgj9VrOrDxBZrf0dDTxonosr3hazoUV7zPwybPR1wMzqpILHNspEcoSwY0o257MxPCJj+95bbrtgXvCkE41t27pSbktGOaoBsD3g7FMbs="}}
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/wwwroot/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DotNetify Micro-Frontend Demo
5 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## dotNetify-React template
4 |
5 | DotNetify is a [free, open source project](https://github.com/dsuryd/dotNetify) that lets you create real-time, reactive, cross-platform apps with React, React Native, or Knockout front-end with TypeScript on C# .NET back-end via WebSocket.
6 |
7 | This is a full React SPA template for ASP.NET Core 2.0 featuring:
8 | - Reactive, real-time dashboard page.
9 | - Edit form + CRUD table pages.
10 | - Login page with JWT bearer token authentication.
11 | - UI components from [Material-UI](http://www.material-ui.com/#/).
12 | - Routing with deep links.
13 | - Webpack hot module replacement + [dotnet watch](https://docs.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch).
14 | - [OpenID Connect/OAuth2](https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server) authentication server.
15 |
16 | 
17 |
18 | ### How to make it work with IE 11
19 |
20 | Add the following scripts in `index.html`:
21 | ```
22 |
23 |
24 |
25 | ```
26 |
27 | ### Documentation
28 |
29 | Documentation and live demo are available at [http://dotnetify.net/react](http://dotnetify.net/react).
30 |
31 | ### Credits
32 |
33 | The UI layout was adapted from the [work by @rafaelhz](https://github.com/rafaelhz/react-material-admin-template).
34 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/components/dashboard/InfoBox.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import Paper from "material-ui/Paper";
3 | import { white, grey800 } from "material-ui/styles/colors";
4 | import { typography } from "material-ui/styles";
5 |
6 | type Props = {
7 | color: string;
8 | title: string;
9 | value: number;
10 | Icon: any;
11 | };
12 | class InfoBox extends React.Component {
13 | render() {
14 | const { color, title, value, Icon } = this.props;
15 |
16 | const styles = {
17 | content: {
18 | padding: "5px 10px",
19 | marginLeft: 90,
20 | height: 80
21 | },
22 | number: {
23 | display: "block",
24 | fontWeight: "bold",
25 | fontSize: 18,
26 | paddingTop: 10,
27 | color: grey800
28 | },
29 | text: {
30 | fontSize: 18,
31 | fontWeight: typography.fontWeightLight,
32 | color: grey800
33 | },
34 | iconSpan: {
35 | float: "left",
36 | height: 90,
37 | width: 90,
38 | textAlign: "center",
39 | backgroundColor: color
40 | },
41 | icon: {
42 | height: 48,
43 | width: 48,
44 | marginTop: 20,
45 | maxWidth: "100%"
46 | }
47 | } as any;
48 |
49 | return (
50 |
51 |
52 |
53 |
54 |
55 |
56 | {title}
57 | {value}
58 |
59 |
60 | );
61 | }
62 | }
63 |
64 | export default InfoBox;
65 |
--------------------------------------------------------------------------------
/ReactTemplate/content/server/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using BrunoLau.SpaServices.Webpack;
3 | using DotNetify;
4 | using DotNetify.Security;
5 | using Microsoft.IdentityModel.Tokens;
6 | using projectName;
7 |
8 | var builder = WebApplication.CreateBuilder(args);
9 |
10 | var services = builder.Services;
11 |
12 | // Add OpenID Connect server to produce JWT access tokens.
13 | services.AddAuthenticationServer();
14 |
15 | services.AddSignalR();
16 | services.AddDotNetify();
17 |
18 | services.AddTransient();
19 | services.AddSingleton();
20 |
21 | var app = builder.Build();
22 |
23 | app.UseAuthentication();
24 |
25 | app.UseWebSockets();
26 | app.UseDotNetify(config =>
27 | {
28 | // Middleware to do authenticate token in incoming request headers.
29 | config.UseJwtBearerAuthentication(new TokenValidationParameters
30 | {
31 | IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(AuthServer.SecretKey)),
32 | ValidateIssuerSigningKey = true,
33 | ValidateAudience = false,
34 | ValidateIssuer = false,
35 | ValidateLifetime = true,
36 | ClockSkew = TimeSpan.FromSeconds(0)
37 | });
38 |
39 | // Filter to check whether user has permission to access view models with [Authorize] attribute.
40 | config.UseFilter();
41 | });
42 |
43 | if (app.Environment.IsDevelopment())
44 | app.UseWebpackDevMiddlewareEx(new WebpackDevMiddlewareOptions { HotModuleReplacement = true });
45 |
46 | app.UseFileServer();
47 | app.UseRouting();
48 | app.UseEndpoints(endpoints =>
49 | {
50 | endpoints.MapHub("/dotnetify");
51 | endpoints.MapFallbackToFile("index.html");
52 | });
53 |
54 | app.Run();
--------------------------------------------------------------------------------
/ReactTemplate/content/server/ViewModels/AppLayout.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Claims;
2 | using DotNetify;
3 | using DotNetify.Routing;
4 | using DotNetify.Security;
5 |
6 | namespace projectName;
7 |
8 | [Authorize]
9 | public class AppLayout : BaseVM, IRoutable
10 | {
11 | private enum Route
12 | {
13 | Home,
14 | Dashboard,
15 | FormPage,
16 | TablePage
17 | };
18 |
19 | public static string FormPagePath => "Form";
20 |
21 | public RoutingState RoutingState { get; set; }
22 |
23 | public object Menus => new List()
24 | {
25 | new { Title = "Dashboard", Icon = "assessment", Route = this.GetRoute(nameof(Route.Dashboard)) },
26 | new { Title = "Form Page", Icon = "web", Route = this.GetRoute(nameof(Route.FormPage), $"{FormPagePath}/1") },
27 | new { Title = "Table Page", Icon = "grid_on", Route = this.GetRoute(nameof(Route.TablePage)) }
28 | };
29 |
30 | public string UserName { get; set; }
31 | public string UserAvatar { get; set; }
32 |
33 | public AppLayout(IPrincipalAccessor principalAccessor)
34 | {
35 | var userIdentity = principalAccessor.Principal.Identity as ClaimsIdentity;
36 |
37 | UserName = userIdentity.Name;
38 | UserAvatar = userIdentity.Claims.FirstOrDefault(i => i.Type == ClaimTypes.Uri)?.Value;
39 |
40 | this.RegisterRoutes("/", new List
41 | {
42 | new RouteTemplate(nameof(Route.Home)) { UrlPattern = "", ViewUrl = nameof(Route.Dashboard) },
43 | new RouteTemplate(nameof(Route.Dashboard)),
44 | new RouteTemplate(nameof(Route.FormPage)) { UrlPattern = $"{FormPagePath}(/:id)" },
45 | new RouteTemplate(nameof(Route.TablePage))
46 | });
47 | }
48 | }
--------------------------------------------------------------------------------
/_archive/Routing/Startup.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using Microsoft.AspNetCore.Builder;
3 | using Microsoft.AspNetCore.Hosting;
4 | using Microsoft.AspNetCore.Http;
5 | using Microsoft.AspNetCore.NodeServices;
6 | using Microsoft.Extensions.DependencyInjection;
7 | using DotNetify;
8 | using DotNetify.Routing;
9 |
10 | namespace Routing
11 | {
12 | public class Startup
13 | {
14 | public void ConfigureServices(IServiceCollection services)
15 | {
16 | services.AddNodeServices();
17 | services.AddMemoryCache();
18 | services.AddSignalR();
19 | services.AddDotNetify();
20 | }
21 |
22 | public void Configure(IApplicationBuilder app, INodeServices nodeServices)
23 | {
24 | app.UseStaticFiles();
25 | app.UseWebSockets();
26 | app.UseSignalR(routes => routes.MapDotNetifyHub());
27 | app.UseDotNetify();
28 |
29 | app.Run(async (context) =>
30 | {
31 | if (context.Request.Query["ssr"] == "false")
32 | {
33 | // Client-side rendering.
34 | using (var reader = new StreamReader(File.OpenRead("wwwroot/index.html")))
35 | await context.Response.WriteAsync(reader.ReadToEnd());
36 | }
37 | else
38 | {
39 | // Server-side rendering.
40 | var path = context.Request.Path.Value;
41 | path = path == "/" ? "/index" : path;
42 | var ssrStates = ServerSideRender.GetInitialStates(ref path, typeof(Index));
43 |
44 | var result = await nodeServices.InvokeAsync("./src/app.server", path, ssrStates);
45 | await context.Response.WriteAsync(result);
46 | }
47 | });
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactDashboardApp/client/components/ActivitiesCard.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import styled from 'styled-components';
3 | import { Card, Cell, Element, Panel } from 'dotnetify-elements';
4 |
5 | const panelCss = `
6 | overflow-x: hidden;
7 | .cell { border: none; }
8 | .cell-body { padding: .5rem 0 }
9 | `;
10 |
11 | const statusColors = [ '', 'silver', 'limegreen', 'red', 'gray', 'orange' ];
12 | const userIconColors = [ '#00ce6f', '#a95df0', '#2ea7eb' ];
13 |
14 | const UserIcon = styled.span`
15 | width: 25px;
16 | height: 25px;
17 | border-radius: 50%;
18 | color: white;
19 | background: ${props => props.color};
20 | font-weight: bold;
21 | margin-right: 1rem;
22 | text-align: center;
23 | `;
24 |
25 | const StatusIcon = styled.span`
26 | height: 14px;
27 | width: 14px;
28 | margin-left: 1rem;
29 | background-color: ${props => statusColors[props.status]};
30 | border-radius: 50%;
31 | display: inline-block;
32 | `;
33 |
34 | const Activity = ({ person }) => {
35 | const initial = person.PersonName[0].toUpperCase();
36 | const iconColor = userIconColors[initial.charCodeAt(0) % 3];
37 | return (
38 |
39 |
40 | {initial}
41 | {person.PersonName}
42 | |
43 |
44 | {person.Status}
45 |
46 | |
47 |
48 | );
49 | };
50 |
51 | export default class ActivitiesCard extends Element {
52 | render() {
53 | const activities = this.value || [];
54 | return (
55 |
56 | Activities
57 | {activities.map((person, idx) => )}
58 |
59 | );
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/client/loader.js:
--------------------------------------------------------------------------------
1 | import dotnetify from 'dotnetify';
2 | import { getAccessToken } from './auth';
3 | import { updatePortal } from './components/Portal';
4 |
5 | //dotnetify.debug = true;
6 |
7 | export default (apps, externalDeps) => {
8 | // Intercept initial view model connection to override which hub server it should connect with.
9 | // ***IMPORTANT***: Each app module would need to set the 'appId' option on its VM connect.
10 | // For example: dotnetify.react.connect("MyVM", { appId: 'my-app' })
11 | dotnetify.connectHandler = vmConnectArgs => {
12 | const appId = vmConnectArgs.options && vmConnectArgs.options.appId;
13 | if (!appId) {
14 | console.error(`'${vmConnectArgs.vmId}' needs 'appId' option to participate in the Portal.`);
15 | return;
16 | }
17 |
18 | const app = apps.find(x => x.id === appId);
19 | if (app) {
20 | app.hub = app.hub || dotnetify.createHub(app.baseUrl);
21 | return {
22 | ...vmConnectArgs,
23 | hub: app.hub,
24 | options: { ...vmConnectArgs.options, headers: { Authorization: 'Bearer ' + getAccessToken() } }
25 | };
26 | }
27 | };
28 |
29 | // Register the external dependencies from the script tags to SystemJS.
30 | externalDeps.forEach(x => SystemJS.set(x, SystemJS.newModule({ ...window[x] })));
31 |
32 | // Use SystemJS to import the app modules.
33 | function importApp(app) {
34 | const appUrl = app.baseUrl + app.moduleUrl;
35 | return SystemJS.import(appUrl)
36 | .then(module => {
37 | if (module.default) updatePortal({ ...app, rootComponent: module.default });
38 | })
39 | .catch(err => {
40 | SystemJS.delete(appUrl);
41 | console.error(`${err}. Retrying in 5 seconds...`);
42 | setTimeout(() => importApp(app), 5000);
43 | });
44 | }
45 |
46 | apps.map(app => importApp(app));
47 | };
48 |
--------------------------------------------------------------------------------
/ReactTemplate/content/client/components/dashboard/Traffic.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Chart as ChartJS, CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend } from "chart.js";
3 | import { Line } from "react-chartjs-2";
4 | import { makeStyles } from "@material-ui/core/styles";
5 | import Card from "@material-ui/core/Card";
6 | import purple from "@material-ui/core/colors/purple";
7 |
8 | ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend);
9 |
10 | const useStyles = makeStyles({
11 | card: {
12 | backgroundColor: purple[500],
13 | height: 150
14 | },
15 | header: {
16 | fontSize: 24,
17 | color: "white",
18 | backgroundColor: purple[600],
19 | padding: 10
20 | },
21 | body: {
22 | height: 95,
23 | padding: "5px 15px 0 15px"
24 | }
25 | });
26 |
27 | const chartOptions = {
28 | plugins: {
29 | legend: { display: false }
30 | },
31 | scales: { xAxis: { ticks: { display: false } }, yAxis: { ticks: { display: false } } },
32 | layout: { padding: { left: 5, right: 5, top: 5, bottom: 5 } },
33 | maintainAspectRatio: false
34 | };
35 |
36 | export interface ITrafficProps {
37 | data: number[];
38 | }
39 |
40 | export default function Traffic(props: ITrafficProps) {
41 | const classes = useStyles({});
42 | const data = {
43 | labels: props.data.map(_ => ""),
44 | datasets: [
45 | {
46 | data: props.data,
47 | fill: false,
48 | backgroundColor: "white",
49 | borderColor: "#8884d8",
50 | borderWidth: 2,
51 | pointBorderWidth: 2
52 | }
53 | ]
54 | };
55 |
56 | return (
57 |
58 | Traffic
59 |
60 |
61 |
62 |
63 | );
64 | }
65 |
--------------------------------------------------------------------------------
/ReactTemplate/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## DotNetify React Template
4 |
5 | DotNetify is a [free, open source project](https://github.com/dsuryd/dotNetify) that lets you create real-time, reactive, cross-platform apps with React, React Native, or Knockout front-end on C# .NET back-end via WebSocket.
6 |
7 | This is a full React SPA template for ASP.NET Core featuring:
8 |
9 | - Reactive, real-time dashboard page.
10 | - Edit form + CRUD table pages.
11 | - Login page with JWT bearer token authentication.
12 | - UI components from [Material-UI](https://material-ui.com/).
13 | - Routing with deep links.
14 | - Webpack hot module replacement + [dotnet watch](https://docs.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch).
15 | - [OpenID Connect/OAuth2](https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server) authentication server.
16 |
17 | ### How to install from NuGet
18 |
19 | ```
20 | dotnet new -i DotNetify.React.Template
21 |
22 | dotnet new dotnetify -o MyApp
23 | cd MyApp
24 | npm i
25 | dotnet watch
26 | ```
27 |
28 | Open http://localhost:5000.
29 |
30 | 
31 |
32 | ### How to make it work with IE 11
33 |
34 | Add the following scripts in `index.html`:
35 |
36 | ```
37 |
38 |
39 |
40 | ```
41 |
42 | ### Documentation
43 |
44 | Documentation and live demo are available at [http://dotnetify.net/react](http://dotnetify.net/react).
45 |
46 | ### Credits
47 |
48 | The UI layout was adapted from the [work by @rafaelhz](https://github.com/rafaelhz/react-material-admin-template).
49 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/server/ViewModels/AppLayout.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Security.Claims;
4 | using DotNetify;
5 | using DotNetify.Routing;
6 | using DotNetify.Security;
7 |
8 | namespace dotnetify_react_template
9 | {
10 | [Authorize]
11 | public class AppLayout : BaseVM, IRoutable
12 | {
13 | private enum Route
14 | {
15 | Home,
16 | Dashboard,
17 | FormPage,
18 | TablePage
19 | };
20 |
21 | public static string FormPagePath => "Form";
22 |
23 | public RoutingState RoutingState { get; set; }
24 |
25 | public object Menus => new List()
26 | {
27 | new { Title = "Dashboard", Icon = "assessment", Route = this.GetRoute(nameof(Route.Dashboard)) },
28 | new { Title = "Form Page", Icon = "web", Route = this.GetRoute(nameof(Route.FormPage), $"{FormPagePath}/1") },
29 | new { Title = "Table Page", Icon = "grid_on", Route = this.GetRoute(nameof(Route.TablePage)) }
30 | };
31 |
32 | public string UserName { get; set; }
33 | public string UserAvatar { get; set; }
34 |
35 | public AppLayout(IPrincipalAccessor principalAccessor)
36 | {
37 | var userIdentity = principalAccessor.Principal.Identity as ClaimsIdentity;
38 |
39 | UserName = userIdentity.Name;
40 | UserAvatar = userIdentity.Claims.FirstOrDefault(i => i.Type == ClaimTypes.Uri)?.Value;
41 |
42 | this.RegisterRoutes("/", new List
43 | {
44 | new RouteTemplate(nameof(Route.Home)) { UrlPattern = "", ViewUrl = nameof(Route.Dashboard) },
45 | new RouteTemplate(nameof(Route.Dashboard)),
46 | new RouteTemplate(nameof(Route.FormPage)) { UrlPattern = $"{FormPagePath}(/:id)" },
47 | new RouteTemplate(nameof(Route.TablePage))
48 | });
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/server/ViewModels/PersonForm.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Reactive.Linq;
3 | using DotNetify;
4 | using DotNetify.Elements;
5 | using DotNetify.Security;
6 |
7 | namespace ReactFormApp
8 | {
9 | [Authorize]
10 | public class PersonForm : BaseVM
11 | {
12 | public ReactiveProperty Customer { get; } = new ReactiveProperty();
13 |
14 | public PersonForm()
15 | {
16 | AddProperty(nameof(NameInfo.FullName))
17 | .WithAttribute(new TextFieldAttribute { Label = "Name:" })
18 | .SubscribeTo(Customer.Select(x => x.Name.FullName));
19 |
20 | AddProperty(nameof(NameInfo.Prefix))
21 | .WithAttribute(new DropdownListAttribute { Label = "Prefix:", Options = typeof(NamePrefix).ToDescriptions() })
22 | .SubscribeTo(Customer.Select(x => x.Name.Prefix));
23 |
24 | AddProperty(nameof(NameInfo.FirstName))
25 | .WithAttribute(new TextFieldAttribute { Label = "First Name:", MaxLength = 35 })
26 | .WithRequiredValidation()
27 | .SubscribeTo(Customer.Select(x => x.Name.FirstName));
28 |
29 | AddProperty(nameof(NameInfo.MiddleName))
30 | .WithAttribute(new TextFieldAttribute { Label = "Middle Name:", MaxLength = 35 })
31 | .SubscribeTo(Customer.Select(x => x.Name.MiddleName));
32 |
33 | AddProperty(nameof(NameInfo.LastName))
34 | .WithAttribute(new TextFieldAttribute { Label = "Last Name:", MaxLength = 35 })
35 | .WithRequiredValidation()
36 | .SubscribeTo(Customer.Select(x => x.Name.LastName));
37 |
38 | AddProperty(nameof(NameInfo.Suffix))
39 | .WithAttribute(new DropdownListAttribute { Label = "Suffix:", Options = typeof(NameSuffix).ToDescriptions() })
40 | .SubscribeTo(Customer.Select(x => x.Name.Suffix));
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/VueTodoApp/server/ViewModels/TodoList.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reactive.Linq;
5 | using DotNetify;
6 | using DotNetify.Security;
7 |
8 | namespace VueTodoApp
9 | {
10 | [Authorize]
11 | public class TodoList : MulticastVM
12 | {
13 | private static List _todos = new List();
14 |
15 | public class Todo
16 | {
17 | public int Id { get; set; }
18 | public string Text { get; set; }
19 | public bool Done { get; set; }
20 | }
21 |
22 | public List Todos => _todos;
23 |
24 | public string Todos_itemKey => nameof(Todo.Id);
25 |
26 | public int ItemsLeft => Todos.Count(x => !x.Done);
27 |
28 | public Action Add => text =>
29 | {
30 | var todo = new Todo { Id = text.GetHashCode(), Text = text };
31 | if (!Todos.Any(x => x.Id == todo.Id))
32 | {
33 | Todos.Add(todo);
34 | this.AddList(nameof(Todos), todo);
35 | Changed(nameof(ItemsLeft));
36 | }
37 | };
38 |
39 | public Action Update => update =>
40 | {
41 | var todo = Todos.Find(x => x.Id == update.Id);
42 | if (todo != null)
43 | {
44 | if (string.IsNullOrWhiteSpace(update.Text))
45 | Remove(update.Id);
46 | else
47 | {
48 | todo.Text = update.Text;
49 | todo.Done = update.Done;
50 | this.UpdateList(nameof(Todos), todo);
51 | Changed(nameof(ItemsLeft));
52 | }
53 | }
54 | };
55 |
56 | public Action Remove => id =>
57 | {
58 | var todo = Todos.Find(x => x.Id == id);
59 | if (todo != null)
60 | {
61 | Todos.Remove(todo);
62 | this.RemoveList(nameof(Todos), id);
63 | Changed(nameof(ItemsLeft));
64 | }
65 | };
66 | }
67 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactTodoApp/server/ViewModels/TodoList.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reactive.Linq;
5 | using DotNetify;
6 | using DotNetify.Security;
7 |
8 | namespace ReactTodoApp
9 | {
10 | [Authorize]
11 | public class TodoList : MulticastVM
12 | {
13 | private static List _todos = new List();
14 |
15 | public class Todo
16 | {
17 | public int Id { get; set; }
18 | public string Text { get; set; }
19 | public bool Done { get; set; }
20 | }
21 |
22 | public List Todos => _todos;
23 |
24 | public string Todos_itemKey => nameof(Todo.Id);
25 |
26 | public int ItemsLeft => Todos.Count(x => !x.Done);
27 |
28 | public Action Add => text =>
29 | {
30 | var todo = new Todo { Id = text.GetHashCode(), Text = text };
31 | if(!Todos.Any(x => x.Id == todo.Id))
32 | {
33 | Todos.Add(todo);
34 | this.AddList(nameof(Todos), todo);
35 | Changed(nameof(ItemsLeft));
36 | }
37 | };
38 |
39 | public Action Update => update =>
40 | {
41 | var todo = Todos.Find(x => x.Id == update.Id);
42 | if(todo != null)
43 | {
44 | if(string.IsNullOrWhiteSpace(update.Text))
45 | Remove(update.Id);
46 | else
47 | {
48 | todo.Text = update.Text;
49 | todo.Done = update.Done;
50 | this.UpdateList(nameof(Todos), todo);
51 | Changed(nameof(ItemsLeft));
52 | }
53 | }
54 | };
55 |
56 | public Action Remove => id =>
57 | {
58 | var todo = Todos.Find(x => x.Id == id);
59 | if(todo != null)
60 | {
61 | Todos.Remove(todo);
62 | this.RemoveList(nameof(Todos), id);
63 | Changed(nameof(ItemsLeft));
64 | }
65 | };
66 | }
67 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/server/Controllers/LoginController.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc;
2 | using Microsoft.Extensions.Options;
3 | using Shared;
4 | using System;
5 | using System.Net.Http;
6 | using System.Threading.Tasks;
7 |
8 | namespace Portal
9 | {
10 | [Route("api/[controller]")]
11 | [ApiController]
12 | public class LoginController : ControllerBase
13 | {
14 | private readonly IHttpClientFactory _httpClientFactory;
15 | private readonly IdentityServerSettings _identityServerSettings;
16 |
17 | public LoginController(IHttpClientFactory httpClientFactory, IOptions identityServerOptions)
18 | {
19 | _httpClientFactory = httpClientFactory;
20 | _identityServerSettings = identityServerOptions.Value;
21 | }
22 |
23 | [HttpPost]
24 | public async Task Post([FromForm] string username, [FromForm] string password)
25 | {
26 | if (username != "guest" || password != "dotnetify")
27 | return Unauthorized();
28 |
29 | using (var client = _httpClientFactory.CreateClient())
30 | {
31 | var tokenResponse = await IdentityServerClient.RequestClientCredentialsTokenAsync(client, _identityServerSettings);
32 | return new
33 | {
34 | access_token = tokenResponse.AccessToken,
35 | expires_in = tokenResponse.ExpiresIn
36 | };
37 | }
38 | }
39 |
40 | [HttpPost]
41 | [Route("[action]")]
42 | public async Task Validate([FromForm]string token)
43 | {
44 | using (var client = _httpClientFactory.CreateClient())
45 | {
46 | var response = await IdentityServerClient.IntrospectTokenAsync(client, _identityServerSettings, token);
47 | if (response.IsError)
48 | throw new Exception(response.Error);
49 |
50 | return response.IsActive ? new OkResult() : (IActionResult)Unauthorized();
51 | }
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/ReactTemplate/content/client/components/dashboard/ServerUsage.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Chart as ChartJS, CategoryScale, LinearScale, ArcElement, BarElement, Title, Tooltip, Legend } from "chart.js";
3 | import { Bar } from "react-chartjs-2";
4 | import { makeStyles } from "@material-ui/core/styles";
5 | import Card from "@material-ui/core/Card";
6 | import pink from "@material-ui/core/colors/pink";
7 | import globalStyles from "../../styles/styles";
8 |
9 | ChartJS.register(CategoryScale, LinearScale, ArcElement, BarElement, Title, Tooltip, Legend);
10 |
11 | const useStyles = makeStyles({
12 | card: {
13 | backgroundColor: pink[600],
14 | height: 150
15 | },
16 | header: {
17 | color: "white",
18 | backgroundColor: pink[500],
19 | padding: 10
20 | },
21 | body: {
22 | marginLeft: "auto",
23 | marginRight: "auto",
24 | width: "95%",
25 | height: 85
26 | }
27 | });
28 |
29 | const chartOptions = {
30 | plugins: {
31 | legend: { display: false },
32 | tooltips: { enabled: false }
33 | },
34 | scales: {
35 | x: { ticks: { color: "white" }, grid: { display: false } },
36 | y: { ticks: { display: false } }
37 | },
38 | layout: { padding: { bottom: 5 } },
39 | maintainAspectRatio: false
40 | };
41 |
42 | export interface IServerUsageProps {
43 | labels: string[];
44 | data: number[];
45 | }
46 |
47 | export default function ServerUsage(props: IServerUsageProps) {
48 | const classes = useStyles({});
49 | const data = {
50 | labels: props.labels,
51 | datasets: [
52 | {
53 | data: props.data,
54 | backgroundColor: pink[400],
55 | borderColor: pink[500]
56 | }
57 | ]
58 | };
59 |
60 | const titleStyle = { ...globalStyles.title };
61 |
62 | return (
63 |
64 |
65 | Server Usage
66 |
67 |
68 |
69 |
70 |
71 | );
72 | }
73 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/client/components/Login.js:
--------------------------------------------------------------------------------
1 | import { useState } from 'react';
2 | import { signIn } from '../auth';
3 | import { Alert, Button, Form, Panel, PasswordField, TextField, VMContext, withTheme } from 'dotnetify-elements';
4 |
5 | const outerPanelCss = `
6 | width: 25rem;
7 | padding: 3rem;
8 | background-color: #f5f5f5;
9 | border-radius: 5px;
10 | box-shadow: 0 20px 40px -20px rgba(0,0,0,.5);
11 | `;
12 |
13 | const Login = ({ onAuthenticated }) => {
14 | const [ loginError, setLoginError ] = useState();
15 |
16 | const handleLogin = ({ User, Password }) => {
17 | setLoginError(null);
18 | signIn(User, Password)
19 | .then(_ => {
20 | onAuthenticated();
21 | })
22 | .catch(error => {
23 | if (error.message == '401') setLoginError('Invalid username and/or password');
24 | else setLoginError(`Unexpected error: ${error.message}`);
25 | });
26 | };
27 |
28 | return (
29 |
30 |
31 | Sign In To Get Started
32 |
40 |
41 |
42 | );
43 | };
44 |
45 | window.LoginVM = {
46 | onConnect() {
47 | return {
48 | User: 'guest',
49 | User__validation: [
50 | {
51 | Type: 'Required',
52 | Message: 'Username is required',
53 | Category: 'Error'
54 | }
55 | ],
56 | Password: '',
57 | Password__attr: { Placeholder: 'Type dotnetify' },
58 | Password__validation: [
59 | {
60 | Type: 'Required',
61 | Message: 'Password is required',
62 | Category: 'Error'
63 | }
64 | ]
65 | };
66 | }
67 | };
68 |
69 | export default withTheme(Login);
70 |
--------------------------------------------------------------------------------
/ReactTemplate/content/server/Services/EmployeeService.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using Newtonsoft.Json;
3 |
4 | namespace projectName;
5 |
6 | public interface IEmployeeService
7 | {
8 | IList GetAll();
9 |
10 | EmployeeModel GetById(int id);
11 |
12 | int Add(EmployeeModel record);
13 |
14 | void Update(EmployeeModel record);
15 |
16 | void Delete(int id);
17 | }
18 |
19 | public class EmployeeModel
20 | {
21 | public int Id { get; set; }
22 | public string FirstName { get; set; }
23 | public string LastName { get; set; }
24 | public int ReportTo { get; set; }
25 | public string FullName => $"{FirstName} {LastName}";
26 | }
27 |
28 | public class EmployeeService : IEmployeeService
29 | {
30 | private List _employees;
31 | private int _newId;
32 |
33 | public EmployeeService()
34 | {
35 | _employees = JsonConvert.DeserializeObject>(this.GetEmbeddedResource("employees.json"));
36 | _newId = _employees.Count;
37 | }
38 |
39 | public IList GetAll() => _employees;
40 |
41 | public EmployeeModel GetById(int id) => _employees.FirstOrDefault(i => i.Id == id);
42 |
43 | public int Add(EmployeeModel record)
44 | {
45 | record.Id = ++_newId;
46 | _employees.Add(record);
47 | return record.Id;
48 | }
49 |
50 | public void Update(EmployeeModel record)
51 | {
52 | var idx = _employees.FindIndex(i => i.Id == record.Id);
53 | if (idx >= 0)
54 | _employees[idx] = record;
55 | }
56 |
57 | public void Delete(int id) => _employees.Remove(_employees.FirstOrDefault(i => i.Id == id));
58 |
59 | private string GetEmbeddedResource(string resourceName)
60 | {
61 | var assembly = GetType().Assembly;
62 | var name = assembly.GetManifestResourceNames().Where(i => i.EndsWith(resourceName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
63 | if (string.IsNullOrEmpty(name))
64 | throw new FileNotFoundException();
65 |
66 | using (var reader = new StreamReader(assembly.GetManifestResourceStream(name), Encoding.UTF8))
67 | return reader.ReadToEnd();
68 | }
69 | }
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/Portal.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netcoreapp3.1
4 | Portal
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | %(DistFiles.Identity)
39 | PreserveNewest
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/components/dashboard/RecentActivities.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import { RouteLink } from "dotnetify/dist/dotnetify-react.router";
3 | import PropTypes from "prop-types";
4 | import Avatar from "material-ui/Avatar";
5 | import { List, ListItem } from "material-ui/List";
6 | import Subheader from "material-ui/Subheader";
7 | import Divider from "material-ui/Divider";
8 | import Paper from "material-ui/Paper";
9 | import IconButton from "material-ui/IconButton";
10 | import MoreVertIcon from "material-ui/svg-icons/navigation/more-vert";
11 | import IconMenu from "material-ui/IconMenu";
12 | import MenuItem from "material-ui/MenuItem";
13 | import { grey400, cyan600, white } from "material-ui/styles/colors";
14 | import { typography } from "material-ui/styles";
15 | import Wallpaper from "material-ui/svg-icons/device/wallpaper";
16 |
17 | const RecentActivities = props => {
18 | const styles = {
19 | subheader: {
20 | fontSize: 24,
21 | fontWeight: typography.fontWeightLight,
22 | backgroundColor: cyan600,
23 | color: white
24 | }
25 | } as any;
26 |
27 | const iconButtonElement = (
28 |
29 |
30 |
31 | );
32 |
33 | const handleMenuClick = route => props.vm.$routeTo(route);
34 |
35 | return (
36 |
37 |
38 | Recent Activities
39 | {props.data.map((item, idx) => (
40 |
41 |
} />}
43 | primaryText={item.PersonName}
44 | secondaryText={item.Status}
45 | rightIconButton={
46 |
47 | handleMenuClick(item.Route)}>View
48 |
49 | }
50 | />
51 |
52 |
53 | ))}
54 |
55 |
56 | );
57 | };
58 |
59 | export default RecentActivities;
60 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/client/components/Header.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import PropTypes from "prop-types";
3 | import { RouteLink } from "dotnetify/dist/dotnetify-react.router";
4 | import AppBar from "material-ui/AppBar";
5 | import Menu from "material-ui/svg-icons/navigation/menu";
6 | import MenuItem from "material-ui/MenuItem";
7 | import IconButton from "material-ui/IconButton";
8 | import IconMenu from "material-ui/IconMenu";
9 | import MoreVertIcon from "material-ui/svg-icons/navigation/more-vert";
10 | import ViewModule from "material-ui/svg-icons/action/view-module";
11 | import { white } from "material-ui/styles/colors";
12 | import FontIcon from "material-ui/FontIcon";
13 | import auth from "../auth";
14 |
15 | type Props = {
16 | styles: any;
17 | handleChangeRequestNavDrawer: void;
18 | onSidebarToggle(event: any): void;
19 | };
20 | const Header = props => {
21 | const { styles, onSidebarToggle }: Props = props;
22 |
23 | const style = {
24 | appBar: {
25 | position: "fixed",
26 | top: 0,
27 | overflow: "hidden",
28 | maxHeight: 57
29 | },
30 | menuButton: { marginLeft: 10 },
31 | iconsRightContainer: { marginLeft: 20 }
32 | } as any;
33 |
34 | const handleSignout = _ => auth.signOut();
35 |
36 | return (
37 |
38 |
42 |
43 |
44 | }
45 | iconElementRight={
46 |
47 |
50 |
51 |
52 | }
53 | targetOrigin={{ horizontal: "right", vertical: "top" }}
54 | anchorOrigin={{ horizontal: "right", vertical: "top" }}
55 | >
56 |
57 |
58 |
59 | }
60 | />
61 |
62 | );
63 | };
64 |
65 | export default Header;
66 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactDashboardApp/client/components/Dashboard.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Card, Frame, Panel, VMContext, withTheme } from 'dotnetify-elements';
3 | import { BarChart, LineChart, PieChart } from 'dotnetify-elements';
4 | import InfoCard from './InfoCard';
5 | import ActivitiesCard from './ActivitiesCard';
6 |
7 | const infoPanelCss = `
8 | flex: 1 1 20%;
9 | @media (max-width: 1280px) { flex: 1 1 40%; }
10 | @media (max-width: 880px) { flex: 1 1 100%; }
11 | `;
12 |
13 | /* You can access the 'vm' object from VMContext by handling the 'onConnected' event. */
14 | const handleConnected = (vm, initialState) => console.log(vm, initialState);
15 |
16 | const Dashboard = _ => (
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | Network Traffic
38 |
39 |
40 |
41 | Utilization
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | Server Usage
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | );
61 |
62 | export default withTheme(Dashboard);
63 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Portal/client/components/Portal.js:
--------------------------------------------------------------------------------
1 | import {
2 | Main,
3 | Header,
4 | Nav,
5 | NavDrawerButton,
6 | NavMenu,
7 | NavMenuTarget,
8 | Button,
9 | Panel,
10 | Section,
11 | VMContext,
12 | withTheme
13 | } from 'dotnetify-elements';
14 | import { CompanyLogo } from './App';
15 | import { signOut } from '../auth';
16 |
17 | const Portal = _ => (
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 | signOut()} />
29 |
30 |
31 |
32 |
35 |
36 |
37 | );
38 |
39 | window.PortalVM = new class {
40 | apps = [];
41 | initialState = { NavMenu: [] };
42 |
43 | onConnect() {
44 | return this.initialState;
45 | }
46 |
47 | addApp(newApp) {
48 | if (this.apps.find(x => x.id === newApp.id)) return;
49 |
50 | this.apps.push(newApp);
51 |
52 | // Set the root component to global window variable to be discovered by dotNetify routing.
53 | // Note that the component can be React component, Vue component, or web component.
54 | window[newApp.id] = newApp.rootComponent;
55 |
56 | const homeTemplate = this.apps.length > 0 ? { Id: 'Home', UrlPattern: '', ViewUrl: this.apps[0].id } : {};
57 | const templates = this.apps.map(app => ({ Id: app.id, UrlPattern: app.routePath, ViewUrl: app.id }));
58 | const NavMenu = this.apps.map(app => ({ Route: { TemplateId: app.id, Path: app.routePath }, Label: app.label }));
59 | const state = {
60 | RoutingState: {
61 | Templates: [ homeTemplate, ...templates ],
62 | Root: '/'
63 | },
64 | NavMenu
65 | };
66 |
67 | if (this.$pushUpdate) this.$pushUpdate(state);
68 | else this.initialState = state;
69 | }
70 | }();
71 |
72 | export function updatePortal(app) {
73 | window.PortalVM.addApp(app);
74 | }
75 | export default withTheme(Portal);
76 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/VueTodoApp/VueTodoApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netcoreapp2.1
4 | VueTodoApp
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | %(DistFiles.Identity)
41 | PreserveNewest
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactTodoApp/ReactTodoApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netcoreapp2.1
4 | ReactTodoApp
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | %(DistFiles.Identity)
41 | PreserveNewest
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/ReactTemplate/content/client/components/Header.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { makeStyles } from '@material-ui/core/styles';
3 | import AppBar from '@material-ui/core/AppBar';
4 | import Toolbar from '@material-ui/core/Toolbar';
5 | import IconButton from '@material-ui/core/IconButton';
6 | import Menu from '@material-ui/core/Menu';
7 | import MenuItem from '@material-ui/core/MenuItem';
8 | import MoreVertIcon from '@material-ui/icons/MoreVert';
9 | import MenuIcon from '@material-ui/icons/Menu';
10 | import blue from '@material-ui/core/colors/blue';
11 | import auth from '../auth';
12 |
13 | const useStyles = makeStyles({
14 | root: {
15 | flexGrow: 1
16 | },
17 | appBar: {
18 | backgroundColor: blue[600],
19 | overflow: 'hidden',
20 | position: 'fixed',
21 | top: 0,
22 | maxHeight: 56
23 | },
24 | menuButton: {
25 | marginLeft: -24
26 | },
27 | morebutton: {
28 | color: 'white'
29 | },
30 | title: {
31 | flexGrow: 1
32 | }
33 | });
34 |
35 | export interface IHeaderProps {
36 | styles: React.CSSProperties;
37 | onSidebarToggle: (event: React.MouseEvent) => void;
38 | }
39 |
40 | export default function Header({ styles, onSidebarToggle }: IHeaderProps) {
41 | const [anchorEl, setAnchorEl] = React.useState(null);
42 | const classes = useStyles({});
43 |
44 | const handleIconClick = (event: React.MouseEvent) => setAnchorEl(event.currentTarget);
45 | const handleMenuClose = () => setAnchorEl(null);
46 | const handleMenuClick = () => auth.signOut();
47 |
48 | return (
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | Logout
62 |
63 |
64 |
65 |
66 |
67 | );
68 | }
69 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/ReactFormApp/client/components/Form.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import BasicInfoForm from './BasicInfoForm';
3 | import AddressForm from './AddressForm';
4 | import NewCustomerDialog from './NewCustomerDialog';
5 | import { Button, DataGrid, Form, Frame, Panel, Tab, TabItem, VMContext, withTheme } from 'dotnetify-elements';
6 |
7 | class CustomerForm extends React.Component {
8 | state = { editable: false, edit: false, openDialog: false };
9 |
10 | handleSelect = value => this.setState({ editable: value ? true : false });
11 | toggleEdit = _ => this.setState({ edit: !this.state.edit });
12 | toggleDialog = _ => this.setState({ openDialog: !this.state.openDialog });
13 |
14 | render() {
15 | const { editable, edit, openDialog } = this.state;
16 | const canEdit = editable && !edit;
17 | return (
18 |
19 |
20 |
21 |
45 |
46 |
47 |
48 | );
49 | }
50 | }
51 |
52 | export default withTheme(CustomerForm);
53 |
--------------------------------------------------------------------------------
/_archive/Routing/DotNetify.ServerSideRender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text.RegularExpressions;
5 | using Newtonsoft.Json;
6 |
7 | namespace DotNetify.Routing
8 | {
9 | public static class ServerSideRender
10 | {
11 | public static string GetInitialStates(ref string path, Type entryVMType)
12 | {
13 | try
14 | {
15 | // Traverse the routing path to get initial states of all the view models involved.
16 | var vmStates = new List();
17 | if (path.Trim('/').Length > 0)
18 | {
19 | var viewData = new RoutingViewData(path, null, entryVMType);
20 | RoutableExtension.Route(ref viewData, out IRoutable vm);
21 | while (vm != null)
22 | {
23 | // If at the end of the path and the view model has a default route template (blank url pattern),
24 | // append a slash to the path to ensure it's correctly routed.
25 | if (string.Compare(viewData.UrlPath, viewData.Root, true) == 0 && vm.RoutingState.Templates.Any(i => i.UrlPattern == ""))
26 | path += "/";
27 |
28 | // Determine the "RoutingState.Origin" property value and pass it as argument to the view model
29 | // associated with the current path to set its initial state correctly.
30 | object vmArgs = null;
31 | var args = vm.InitArgs(viewData);
32 | var match = Regex.Match(args, "'RoutingState.Origin':\\s*'(.*?)'");
33 | if (match.Success)
34 | vmArgs = JsonConvert.DeserializeObject($"{{{match.Value}}}");
35 |
36 | var vmName = vm.GetType().Name;
37 | vmStates.Add($"\"{vmName}\":{VMController.GetInitialState(vmName, vmArgs)}");
38 |
39 | // Traverse the next path.
40 | RoutableExtension.Route(ref viewData, out vm);
41 | }
42 | }
43 |
44 | return $"{{{string.Join(",", vmStates)}}}";
45 |
46 | }
47 | catch (Exception ex)
48 | {
49 | System.Diagnostics.Trace.Fail( ex.ToString() );
50 | return null;
51 | }
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/dotnetify_react_template.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netcoreapp2.1
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | %(DistFiles.Identity)
37 | PreserveNewest
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/nginx/conf/nginx.conf:
--------------------------------------------------------------------------------
1 |
2 | worker_processes 1;
3 |
4 | events {
5 | worker_connections 1024;
6 | }
7 |
8 | http {
9 | log_format main '$remote_addr - $remote_user [$time_local] "$request" '
10 | '$status $body_bytes_sent "$http_referer" '
11 | '"$http_user_agent" "$http_x_forwarded_for"';
12 |
13 | server {
14 | listen 8080;
15 | server_name localhost;
16 |
17 | location / {
18 | proxy_pass http://localhost:5000;
19 | proxy_http_version 1.1;
20 | proxy_set_header Upgrade $http_upgrade;
21 | proxy_set_header Connection $http_connection;
22 | proxy_set_header Host $host;
23 | proxy_cache_bypass $http_upgrade;
24 | }
25 |
26 | location /app1 {
27 | rewrite ^/app1/(.*) /$1 break;
28 | proxy_pass http://localhost:5060;
29 | proxy_http_version 1.1;
30 | proxy_set_header Upgrade $http_upgrade;
31 | proxy_set_header Connection $http_connection;
32 | proxy_set_header Host $host;
33 | proxy_cache_bypass $http_upgrade;
34 | }
35 |
36 | location /app2 {
37 | rewrite ^/app2/(.*) /$1 break;
38 | proxy_pass http://localhost:5070;
39 | proxy_http_version 1.1;
40 | proxy_set_header Upgrade $http_upgrade;
41 | proxy_set_header Connection $http_connection;
42 | proxy_set_header Host $host;
43 | proxy_cache_bypass $http_upgrade;
44 | }
45 |
46 | location /app3 {
47 | rewrite ^/app3/(.*) /$1 break;
48 | proxy_pass http://localhost:5010;
49 | proxy_http_version 1.1;
50 | proxy_set_header Upgrade $http_upgrade;
51 | proxy_set_header Connection $http_connection;
52 | proxy_set_header Host $host;
53 | proxy_cache_bypass $http_upgrade;
54 | }
55 |
56 | location /app4 {
57 | rewrite ^/app4/(.*) /$1 break;
58 | proxy_pass http://localhost:5020;
59 | proxy_http_version 1.1;
60 | proxy_set_header Upgrade $http_upgrade;
61 | proxy_set_header Connection $http_connection;
62 | proxy_set_header Host $host;
63 | proxy_cache_bypass $http_upgrade;
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/_archive/ReactTemplateTS/content/server/Services/EmployeeService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using Newtonsoft.Json;
7 |
8 | namespace dotnetify_react_template
9 | {
10 | public interface IEmployeeService
11 | {
12 | IList GetAll();
13 | EmployeeModel GetById(int id);
14 | int Add(EmployeeModel record);
15 | void Update(EmployeeModel record);
16 | void Delete(int id);
17 | }
18 |
19 | public class EmployeeModel
20 | {
21 | public int Id { get; set; }
22 | public string FirstName { get; set; }
23 | public string LastName { get; set; }
24 | public int ReportTo { get; set; }
25 | public string FullName => $"{FirstName} {LastName}";
26 | }
27 |
28 | public class EmployeeService : IEmployeeService
29 | {
30 | private List _employees;
31 | private int _newId;
32 |
33 | public EmployeeService()
34 | {
35 | _employees = JsonConvert.DeserializeObject>(this.GetEmbeddedResource("employees.json"));
36 | _newId = _employees.Count;
37 | }
38 |
39 | public IList GetAll() => _employees;
40 |
41 | public EmployeeModel GetById(int id) => _employees.FirstOrDefault(i => i.Id == id);
42 |
43 | public int Add(EmployeeModel record)
44 | {
45 | record.Id = ++_newId;
46 | _employees.Add(record);
47 | return record.Id;
48 | }
49 |
50 | public void Update(EmployeeModel record)
51 | {
52 | var idx = _employees.FindIndex(i => i.Id == record.Id);
53 | if (idx >= 0)
54 | _employees[idx] = record;
55 | }
56 |
57 | public void Delete(int id) => _employees.Remove(_employees.FirstOrDefault(i => i.Id == id));
58 |
59 | private string GetEmbeddedResource(string resourceName)
60 | {
61 | var assembly = GetType().Assembly;
62 | var name = assembly.GetManifestResourceNames().Where(i => i.EndsWith(resourceName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
63 | if (string.IsNullOrEmpty(name))
64 | throw new FileNotFoundException();
65 |
66 | using (var reader = new StreamReader(assembly.GetManifestResourceStream(name), Encoding.UTF8))
67 | return reader.ReadToEnd();
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/MicrofrontendTemplate/Shared/IdentityServer/IdentityServerClient.cs:
--------------------------------------------------------------------------------
1 | using IdentityModel;
2 | using IdentityModel.Client;
3 | using Microsoft.IdentityModel.Tokens;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Net.Http;
7 | using System.Security.Cryptography;
8 | using System.Threading.Tasks;
9 |
10 | namespace Shared
11 | {
12 | public class IdentityServerClient
13 | {
14 | public static async Task RequestClientCredentialsTokenAsync(HttpClient client, IdentityServerSettings settings)
15 | {
16 | var disco = await client.GetDiscoveryDocumentAsync(settings.Uri);
17 | return await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
18 | {
19 | Address = disco.TokenEndpoint,
20 | ClientId = IdentityServerConfig.MyClientId,
21 | ClientSecret = IdentityServerConfig.MyClientSecret,
22 | Scope = IdentityServerConfig.MyApiResource
23 | });
24 | }
25 |
26 | public static async Task IntrospectTokenAsync(HttpClient client, IdentityServerSettings settings, string token)
27 | {
28 | var disco = await client.GetDiscoveryDocumentAsync(settings.Uri);
29 | return await client.IntrospectTokenAsync(new TokenIntrospectionRequest
30 | {
31 | Address = disco.IntrospectionEndpoint,
32 | Token = token,
33 | ClientId = IdentityServerConfig.MyApiResource,
34 | ClientSecret = IdentityServerConfig.MyClientSecret
35 | });
36 | }
37 |
38 | public static async Task> GetIssuerSigningKeysAsync(HttpClient client, IdentityServerSettings settings)
39 | {
40 | var disco = await client.GetDiscoveryDocumentAsync(settings.Uri);
41 | if(disco?.KeySet == null)
42 | throw new Exception("Failed to get signing keys. Make sure the Portal is running.");
43 |
44 | var keys = new List();
45 | foreach(var webKey in disco.KeySet.Keys)
46 | {
47 | var key = new RsaSecurityKey(new RSAParameters
48 | {
49 | Exponent = Base64Url.Decode(webKey.E),
50 | Modulus = Base64Url.Decode(webKey.N)
51 | });
52 |
53 | key.KeyId = webKey.Kid;
54 | keys.Add(key);
55 | }
56 |
57 | return keys;
58 | }
59 | }
60 | }
--------------------------------------------------------------------------------
/ReactTemplate/content/server/ViewModels/Dashboard.cs:
--------------------------------------------------------------------------------
1 | using System.Reactive.Linq;
2 | using DotNetify;
3 | using DotNetify.Routing;
4 | using DotNetify.Security;
5 |
6 | namespace projectName;
7 |
8 | [Authorize]
9 | public class Dashboard : BaseVM, IRoutable
10 | {
11 | private IDisposable _subscription;
12 |
13 | public class Activity
14 | {
15 | public string PersonName { get; set; }
16 | public DotNetify.Routing.Route Route { get; set; }
17 | public string Status { get; set; }
18 | }
19 |
20 | public RoutingState RoutingState { get; set; }
21 |
22 | public string[] ServerUsageLabel => new string[] { "dns", "sql", "nethst", "w2k", "ubnt", "uat", "ftp", "smtp", "exch", "demo" };
23 | public string[] UtilizationLabel => new string[] { "Memory", "Disk", "Network" };
24 |
25 | public Dashboard(ILiveDataService liveDataService)
26 | {
27 | AddProperty("Download").SubscribeTo(liveDataService.Download);
28 | AddProperty("Upload").SubscribeTo(liveDataService.Upload);
29 | AddProperty("Latency").SubscribeTo(liveDataService.Latency);
30 | AddProperty("Users").SubscribeTo(liveDataService.Users);
31 | AddProperty("Traffic").SubscribeTo(liveDataService.Traffic);
32 | AddProperty("ServerUsage").SubscribeTo(liveDataService.ServerUsage);
33 | AddProperty("Utilization").SubscribeTo(liveDataService.Utilization);
34 |
35 | AddProperty("RecentActivities").SubscribeTo(liveDataService.RecentActivity.Select(value =>
36 | {
37 | var activities = new Queue(Get("RecentActivities")?.Reverse() ?? new Activity[] { });
38 | activities.Enqueue(new Activity
39 | {
40 | PersonName = value.PersonName,
41 | Status = value.Status,
42 | Route = this.Redirect(AppLayout.FormPagePath, value.Id.ToString())
43 | });
44 |
45 | if (activities.Count > 4)
46 | activities.Dequeue();
47 |
48 | return activities.Reverse().ToArray();
49 | }));
50 |
51 | // Regulate data update interval to no less than every 200 msecs.
52 | _subscription = Observable
53 | .Interval(TimeSpan.FromMilliseconds(200))
54 | .StartWith(0)
55 | .Subscribe(_ => PushUpdates());
56 | }
57 |
58 | public override void Dispose()
59 | {
60 | _subscription?.Dispose();
61 | base.Dispose();
62 | }
63 | }
--------------------------------------------------------------------------------