Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
i-am-gizm0 committed Feb 13, 2024
2 parents 5b243e8 + dded3f5 commit bf80554
Show file tree
Hide file tree
Showing 119 changed files with 50,113 additions and 5 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/azuretesting_soucting2024.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy Node.js app to Azure Web App - Soucting2024

on:
push:
branches:
- AzureTesting
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '20.x'

- name: npm install, build, and test
run: |
npm install
npm run build --if-present
npm run test --if-present
- name: Zip artifact for deployment
run: zip release.zip ./* -r

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: node-app
path: release.zip

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: node-app

- name: Unzip artifact for deployment
run: unzip release.zip

- name: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_6D62EEE4CFF84CD5A0E1F91362BBB5D0 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_FEB49CC9B4964DA69540746FE4DAE8C5 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_2364481ABFED4DA885CAE62591999CF3 }}

- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'Soucting2024'
slot-name: 'Production'
package: .

66 changes: 66 additions & 0 deletions .github/workflows/main_scouting7127.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy PHP app to Azure Web App - Scouting7127

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

- name: Check if composer.json exists
id: check_files
uses: andstor/file-existence-action@v1
with:
files: 'composer.json'

- name: Run composer install if composer.json exists
if: steps.check_files.outputs.files_exists == 'true'
run: composer validate --no-check-publish && composer install --prefer-dist --no-progress

- name: Zip artifact for deployment
run: zip release.zip ./* -r

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: php-app
path: release.zip

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: php-app

- name: Unzip artifact for deployment
run: unzip release.zip

- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v2
id: deploy-to-webapp
with:
app-name: 'Scouting7127'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_EC691B8978674A549C7C7DD389A10940 }}
package: .
71 changes: 71 additions & 0 deletions .github/workflows/main_soucting2024.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy Node.js app to Azure Web App - Soucting2024

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '20.x'

- name: npm install, build, and test
run: |
npm install
npm run build --if-present
npm run test --if-present
- name: Zip artifact for deployment
run: zip release.zip ./* -r

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: node-app
path: release.zip

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: node-app

- name: Unzip artifact for deployment
run: unzip release.zip

- name: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_11BB77DD6BF74296BF3323527201B43E }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_2BB5126B64474337AC450F6772CF20CC }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_4FCA4753EC994801A4E837E9E0E8D822 }}

- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'Soucting2024'
slot-name: 'Production'
package: .

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ignore ALL .log files
*.log

# ignore ALL files in ANY directory named temp
temp/
phpMyAdmin/
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# scouting2024
scouting app for competitions written with xcode (vscode?)
scouting app for competitions written with xcode/vscode
//
current HTML page references the link below for experimental purposes
https://blog.openreplay.com/building-a-mobile-app-using-html-css-and-js/#:~:text=Cheap%20and%20Fast%20Development%3A%20PWAs,are%20required%20for%20a%20PWA.

https://scouting7127.azurewebsites.net/

https://scouting7127.azurewebsites.net/phpmyadmin/

https://stackoverflow.com/questions/22342836/syncing-indexeddb-with-sql-server

10 changes: 10 additions & 0 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
--teamlist: #cfedff;
--text: #2d3875;
--deletebutton: #de4e4e;
--navbar: #565f90
}

* {
Expand All @@ -18,6 +19,15 @@
font-family: "Fira sans", sans-serif;
}

nav {
display: flex;
justify-content: space-around;
align-items: center;
min-height: 8vh;
background-color: var(--navbar);
font-family: "Montserrat", sans-serif;
}

body {
display: flex;
flex-direction: column;
Expand Down
40 changes: 39 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<title>Teams</title>
<link rel="stylesheet" href="index.css" />
<script src="https://unpkg.com/dexie/dist/dexie.js"></script>

<script>
// Check that service workers are supported
if ("serviceWorker" in navigator) {
Expand All @@ -23,7 +24,8 @@

<nav>
<div class = "heading">
<h1> Longmetal Scouting RAWR </h1>
<h1> Longmetal 7127 test 7:36 PM jmm 2-10</h1>
<h1> Longmetal 7127</h1>
</div>
<ul class = "nav-links">
<li> <a class="active" href="pages/aboutus.html"> About Us </a> </li>
Expand Down Expand Up @@ -55,4 +57,40 @@ <h2>Teams</h2>
<script src="index.js"></script>
</body>

<!-- <script>
const express = require('express');
const bodyParser = require('body-parser');
const mysql = require('mysql');
const app = express();
app.use(bodyParser.json());
// MySQL database connection configuration
const connection = mysql.createConnection({
host: 'localhost',
user: 'jamesmur_scout',
password: 'Longmetal7127',
database: 'jamesmur_scouting'
});
// API endpoint for syncing data from client to server
app.post('/sync', (req, res) => {
const teamName = req.body.teamName;
connection.query('INSERT INTO teams (name) VALUES (?)', [teamName], (error, results) => {
if (error) {
console.error(error);
res.status(500).send('Error syncing data');
} else {
res.status(200).send('Data synced successfully');
}
});
});
// Start the server
const port = 3000;
app.listen(port, () => {
console.log(`Server is listening on port ${port}`);
});
</script> -->

</html>
29 changes: 28 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,31 @@ window.onload = getTodos;
const deleteTodo = async (event, id) => {
await db.todos.delete(id);
await getTodos();
};
};

// CHATGPT CODE TO CONNECT TO MYSQL SERVER

function saveTeam(teamName) {
db.teams.add({ name: teamName }).then(() => {
syncTeamWithServer(teamName);
});
}

function syncTeamWithServer(teamName) {
fetch('/sync', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ teamName: teamName })
})
.then(response => {
if (!response.ok) {
throw new Error('Failed to sync data');
}
return response.json();
})
.catch(error => {
console.error(error);
});
}
12 changes: 12 additions & 0 deletions node_modules/.bin/loose-envify

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/loose-envify.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bf80554

Please sign in to comment.