Add project files.
This commit is contained in:
23
KTUSA PS/ClientApp/.gitignore
vendored
Normal file
23
KTUSA PS/ClientApp/.gitignore
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
24
KTUSA PS/ClientApp/README.md
Normal file
24
KTUSA PS/ClientApp/README.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# clientapp
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
5
KTUSA PS/ClientApp/babel.config.js
Normal file
5
KTUSA PS/ClientApp/babel.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
12169
KTUSA PS/ClientApp/package-lock.json
generated
Normal file
12169
KTUSA PS/ClientApp/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
46
KTUSA PS/ClientApp/package.json
Normal file
46
KTUSA PS/ClientApp/package.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "clientapp",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.20.0-0",
|
||||
"bootstrap": "^4.5.3",
|
||||
"core-js": "^3.7.0",
|
||||
"vue": "^3.0.2",
|
||||
"vue-loader-v16": "npm:vue-loader@^16.0.0-alpha.3",
|
||||
"vue-router": "^4.0.0-rc.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^4.5.9",
|
||||
"@vue/cli-plugin-eslint": "^4.5.9",
|
||||
"@vue/cli-service": "^4.5.9",
|
||||
"@vue/compiler-sfc": "^3.0.2",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-vue": "^7.1.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/vue3-essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint"
|
||||
},
|
||||
"rules": {}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead"
|
||||
]
|
||||
}
|
BIN
KTUSA PS/ClientApp/public/favicon.ico
Normal file
BIN
KTUSA PS/ClientApp/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
17
KTUSA PS/ClientApp/public/index.html
Normal file
17
KTUSA PS/ClientApp/public/index.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
26
KTUSA PS/ClientApp/src/App.vue
Normal file
26
KTUSA PS/ClientApp/src/App.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<nav-menu></nav-menu>
|
||||
<router-view />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NavMenu from './components/NavMenu.vue'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
NavMenu
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#app {
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
margin-top: 60px;
|
||||
}
|
||||
</style>
|
BIN
KTUSA PS/ClientApp/src/assets/logo.png
Normal file
BIN
KTUSA PS/ClientApp/src/assets/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
26
KTUSA PS/ClientApp/src/components/Counter.vue
Normal file
26
KTUSA PS/ClientApp/src/components/Counter.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<h1>Counter</h1>
|
||||
|
||||
<p>This is a simple example of an Vue component.</p>
|
||||
|
||||
<p aria-live="polite">Current count: <strong>{{ currentCount }}</strong></p>
|
||||
|
||||
<button class="btn btn-primary" @click="incrementCounter">Increment</button>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Counter",
|
||||
data() {
|
||||
return {
|
||||
currentCount: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
incrementCounter() {
|
||||
this.currentCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
53
KTUSA PS/ClientApp/src/components/FetchData.vue
Normal file
53
KTUSA PS/ClientApp/src/components/FetchData.vue
Normal file
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<h1 id="tableLabel">Weather forecast</h1>
|
||||
|
||||
<p>This component demonstrates fetching data from the server.</p>
|
||||
|
||||
<p v-if="!forecasts"><em>Loading...</em></p>
|
||||
|
||||
<table class='table table-striped' aria-labelledby="tableLabel" v-if="forecasts">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Temp. (C)</th>
|
||||
<th>Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="forecast of forecasts" v-bind:key="forecast">
|
||||
<td>{{ forecast.date }}</td>
|
||||
<td>{{ forecast.temperatureC }}</td>
|
||||
<td>{{ forecast.temperatureF }}</td>
|
||||
<td>{{ forecast.summary }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
export default {
|
||||
name: "FetchData",
|
||||
data() {
|
||||
return {
|
||||
forecasts: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getWeatherForecasts() {
|
||||
axios.get('/weatherforecast')
|
||||
.then((response) => {
|
||||
this.forecasts = response.data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
alert(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getWeatherForecasts();
|
||||
}
|
||||
}
|
||||
</script>
|
78
KTUSA PS/ClientApp/src/components/Home.vue
Normal file
78
KTUSA PS/ClientApp/src/components/Home.vue
Normal file
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
<img src="../assets/logo.png" />
|
||||
<p>
|
||||
Template for Vue JS 3.0 and .NET 5 applications developed by <b>Alexandre Malavasi.</b><br />
|
||||
In order to get more content on Vue JS and .NET platform, please follow on my social media profiles:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://medium.com/@alexandre.malavasi" target="_blank">Medium</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://twitter.com/alemalavasi" target="_blank">Twitter</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://www.youtube.com/channel/UC-KFGgYiot1eA8QFqIgLmqA" target="_blank">Youtube</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://www.facebook.com/alexandre.malavasi.dev" target="_blank">Facebook</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Vue Documentation</h3>
|
||||
<p>
|
||||
For a guide and recipes on how to configure / customize this project,<br>
|
||||
check out the
|
||||
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
|
||||
</p>
|
||||
<h3>Installed CLI Plugins</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
|
||||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
|
||||
</ul>
|
||||
<h3>Essential Links</h3>
|
||||
<ul>
|
||||
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
|
||||
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
|
||||
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
|
||||
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
|
||||
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
|
||||
</ul>
|
||||
<h3>Ecosystem</h3>
|
||||
<ul>
|
||||
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
|
||||
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
|
||||
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
|
||||
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
|
||||
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Home',
|
||||
props: {
|
||||
msg: String
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
h3 {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
</style>
|
75
KTUSA PS/ClientApp/src/components/NavMenu.vue
Normal file
75
KTUSA PS/ClientApp/src/components/NavMenu.vue
Normal file
@@ -0,0 +1,75 @@
|
||||
<template>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand">Vue JS Template for .NET 5</a>
|
||||
<button class="navbar-toggler"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target=".navbar-collapse"
|
||||
aria-label="Toggle navigation"
|
||||
@click="toggle">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse"
|
||||
v-bind:class="{show: isExpanded}">
|
||||
<ul class="navbar-nav flex-grow">
|
||||
<li class="nav-item">
|
||||
<router-link :to="{ name: 'Home' }" class="nav-link text-dark">Home</router-link>
|
||||
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<router-link :to="{ name: 'Counter' }" class="nav-link text-dark">Counter</router-link>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<router-link :to="{ name: 'FetchData' }" class="nav-link text-dark">Fetch Data</router-link>
|
||||
</li>
|
||||
<a href="https://login.microsoftonline.com/3415f2f7-f5a8-4092-b52a-003aaf844853/oauth2/v2.0/authorize?client_id=5931fda0-e9e0-4754-80c2-18bcb9d9561a&response_type=id_token&scope=openid email&nonce=aaaa">Login</a>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
|
||||
<style>
|
||||
a.navbar-brand {
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
html {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
export default {
|
||||
name: "NavMenu",
|
||||
data() {
|
||||
return {
|
||||
isExpanded: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
collapse() {
|
||||
this.isExpanded = false;
|
||||
},
|
||||
|
||||
toggle() {
|
||||
this.isExpanded = !this.isExpanded;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
6
KTUSA PS/ClientApp/src/main.js
Normal file
6
KTUSA PS/ClientApp/src/main.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'bootstrap/dist/css/bootstrap.css'
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
|
||||
createApp(App).use(router).mount('#app')
|
42
KTUSA PS/ClientApp/src/pages/OidcEndpoint.vue
Normal file
42
KTUSA PS/ClientApp/src/pages/OidcEndpoint.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<h1 @click="makeTestCall">OpenID connect return endpoint</h1>
|
||||
{{ response }}
|
||||
{{ openIdToken }}
|
||||
<hr />
|
||||
{{ $route }}
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const tokenRegex = /id_token=(.*\..*\..*)&/;
|
||||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
name: "OIDC",
|
||||
data() {
|
||||
return {
|
||||
response: "[empty]",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
makeTestCall() {
|
||||
axios
|
||||
.get("/test", {
|
||||
headers: { Authorization: `Bearer ${this.openIdToken}` }
|
||||
})
|
||||
.then((response) => {
|
||||
this.response = response.data;
|
||||
})
|
||||
.catch(function(error) {
|
||||
alert(error);
|
||||
});
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
openIdToken() {
|
||||
// return tokenRegex.test(this.$route.hash)
|
||||
return this.$route.hash.match(tokenRegex)[1];
|
||||
// return this.$route.hash;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
35
KTUSA PS/ClientApp/src/router/index.js
Normal file
35
KTUSA PS/ClientApp/src/router/index.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import { createWebHistory, createRouter } from "vue-router";
|
||||
import Home from "@/components/Home.vue";
|
||||
import Counter from "@/components/Counter.vue";
|
||||
import FetchData from "@/components/FetchData.vue";
|
||||
import OidcEndpoint from "@/pages/OidcEndpoint.vue";
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: "/",
|
||||
name: "Home",
|
||||
component: Home,
|
||||
},
|
||||
{
|
||||
path: "/Counter",
|
||||
name: "Counter",
|
||||
component: Counter,
|
||||
},
|
||||
{
|
||||
path: "/FetchData",
|
||||
name: "FetchData",
|
||||
component: FetchData,
|
||||
},
|
||||
{
|
||||
path: "/oidc",
|
||||
name: "OpenID connect endpoint",
|
||||
component: OidcEndpoint,
|
||||
},
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes,
|
||||
});
|
||||
|
||||
export default router;
|
Reference in New Issue
Block a user