Skip to content

Commit f0616b6

Browse files
committed
2 parents b24963a + 819196d commit f0616b6

File tree

10 files changed

+133
-0
lines changed

10 files changed

+133
-0
lines changed

.DS_Store

6 KB
Binary file not shown.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Azure Static Web Apps CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened, closed]
9+
branches:
10+
- main
11+
12+
jobs:
13+
build_and_deploy_job:
14+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
15+
runs-on: ubuntu-latest
16+
name: Build and Deploy Job
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
submodules: true
21+
lfs: false
22+
- name: Build And Deploy
23+
id: builddeploy
24+
uses: Azure/static-web-apps-deploy@v1
25+
with:
26+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ASHY_BUSH_008B90A10 }}
27+
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
28+
action: "upload"
29+
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
30+
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
31+
app_location: "/src" # App source code path
32+
api_location: "api" # Api source code path - optional
33+
output_location: "build" # Built app content directory - optional
34+
###### End of Repository/Build Configurations ######
35+
36+
close_pull_request_job:
37+
if: github.event_name == 'pull_request' && github.event.action == 'closed'
38+
runs-on: ubuntu-latest
39+
name: Close Pull Request Job
40+
steps:
41+
- name: Close Pull Request
42+
id: closepullrequest
43+
uses: Azure/static-web-apps-deploy@v1
44+
with:
45+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ASHY_BUSH_008B90A10 }}
46+
action: "close"

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"githubPullRequests.ignoredPullRequestBranches": [
3+
"main"
4+
]
5+
}

app.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
import os, uuid
22
import pandas as pd
33

4+
<<<<<<< HEAD
45
import pymssql
56
from azure.identity import DefaultAzureCredential
67
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
78
import datetime
9+
=======
10+
from azure.identity import DefaultAzureCredential
11+
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
12+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
813

914
from flask import (Flask, redirect, render_template, request,
1015
send_from_directory, url_for, session)
1116

1217
app = Flask(__name__)
1318
app.secret_key = os.urandom(24)
1419

20+
<<<<<<< HEAD
1521
conn = pymssql.connect(host='sinong.database.windows.net' ,user='sinong' ,password = 'Wang1997h',database='cse6332')
1622
cur = conn.cursor()
23+
=======
24+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
1725
#================================================================================================
1826
# # Create a blob client using the local simulator
1927
# try:
@@ -36,6 +44,7 @@ def index():
3644
return render_template('index.html')
3745

3846

47+
<<<<<<< HEAD
3948
@app.route('/test')
4049
def test():
4150
SQL_QUERY = """
@@ -58,6 +67,8 @@ def test():
5867
return render_template('test.html', data=data)
5968

6069

70+
=======
71+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
6172
@app.route('/assignment1')
6273
def assignment1():
6374
data_file_path = os.path.join(app.root_path, 'static', 'data', 'people.csv')
@@ -67,6 +78,7 @@ def assignment1():
6778
return render_template('assignment1.html', contain_content=False, table_content=list(data.values.tolist()), titles=data.columns.values)
6879

6980

81+
<<<<<<< HEAD
7082
@app.route('/assignment2')
7183
def assignment2():
7284

@@ -76,11 +88,14 @@ def assignment2():
7688
return render_template('assignment2.html', contain_content=False, table_content=data, titles=headers)
7789

7890

91+
=======
92+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
7993
@app.route('/a1-upload', methods = ['POST'])
8094
def upload():
8195
if request.method == 'POST':
8296
f = request.files['file']
8397
file_path = os.path.join(app.root_path, 'uploads', f.filename)
98+
<<<<<<< HEAD
8499
session['file_path'] = file_path
85100
f.save(file_path)
86101

@@ -99,12 +114,18 @@ def upload():
99114
cur.execute(sql_query)
100115

101116
conn.commit()
117+
=======
118+
f.save(file_path)
119+
120+
data = pd.read_csv(file_path)
121+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
102122
return render_template('assignment1.html', contain_content=False, table_content=list(data.values.tolist()), titles=data.columns.values)
103123

104124

105125
@app.route('/a1-searchbyname', methods = ['POST', 'GET'])
106126
def a1_searchbyname():
107127
name = request.form.get('queryName')
128+
<<<<<<< HEAD
108129
data_file_path = session.get('file_path')
109130
data = pd.read_csv(data_file_path)
110131
query_data = data.loc[data['name'] == name]
@@ -160,6 +181,15 @@ def a2_searchbymag():
160181
return render_template('assignment2.html', contain_content=True, table_content=data, titles=headers)
161182

162183

184+
=======
185+
data_file_path = os.path.join(app.root_path, 'static', 'data', 'people.csv')
186+
data = pd.read_csv(data_file_path)
187+
query_data = data.loc[data['Name'] == name]
188+
print(name, query_data)
189+
return render_template('assignment1.html', contain_content=True, table_content=list(query_data.values.tolist()), titles=query_data.columns.values)
190+
191+
192+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
163193
@app.route('/favicon.ico')
164194
def favicon():
165195
return send_from_directory(os.path.join(app.root_path, 'static'),

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
Flask==2.2.2
22
gunicorn
33
Werkzeug==2.2.2
4+
Pandas==2.2.2
5+
azure-storage-blob==12.20.2
6+
azure-identity==1.16.0

static/data/people.csv

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
Name,State,Salary,Grade,Room,Telnum,Picture,Keywords
23
Dhruvi,TX,99099,100,550,1000010,dhru.jpg,Dhruvi is nice
34
Chuck,TX,1000,98,420,,chuck.jpg,Chuck is amazing
@@ -10,3 +11,17 @@ Sue,NN, ,79,0,2723785,upset.jpg,Sue isn't Susan
1011
Susan,OK,255000,84,101,911, ,Susan is very smart
1112
Darwin,TN,25,100,,1009,dar.jpg,Darwin is very creative
1213
Sriya,TX,111001,100,221,,sriya.jpg,Sriya is great
14+
=======
15+
Name,State,Salary,Grade,Room,Telnum,Picture,Keywords
16+
Dhruvi,TX,99099,100,550,1000010,dhru.jpg,Dhruvi is nice
17+
Chuck,TX,1000,98,420,,chuck.jpg,Chuck is amazing
18+
Meena,TX,125000,99,,, ,Meena is outa here
19+
Dave,NN,20,40,525,0,dave.jpg,Who is this
20+
Tuan,CA,,80,-1,, ,Tuan is gone
21+
Tavo,CA,220200, ,,,tavo.jpg,Tavo works very hard
22+
Nora,TX,-1,80,520,808, ,
23+
Sue,NN, ,79,0,2723785,upset.jpg,Sue isn't Susan
24+
Susan,OK,255000,84,101,911, ,Susan is very smart
25+
Darwin,TN,25,100,,1009,dar.jpg,Darwin is very creative
26+
Sriya,TX,111001,100,221,,sriya.jpg,Sriya is great
27+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659

static/images/apple.jpg

42.7 KB
Loading

static/images/carl.jpg

82.2 KB
Loading

static/images/sinong.jpg

6.74 KB
Loading

templates/assignment1.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<!doctype html>
22
<head>
3+
<<<<<<< HEAD
34
<title>Assignment 1 - Sinong - cse6332</title>
5+
=======
6+
<title>Assignment 1 - Zheng - cse6332</title>
7+
<h1> Zheng Zhang 177455</h1>
8+
<img src="\static\images\sinong.jpg" alt="My Picture">
9+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
410
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap/css/bootstrap.min.css') }}">
511
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
612
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
@@ -12,12 +18,15 @@
1218
<main>
1319
<div class="container">
1420
<h1 style="color: blue; font-size: 24px; text-align: center;">Assignment 1 for CSE 6332 - Sinong</h1>
21+
<<<<<<< HEAD
1522

1623
<!------------------------------------------>
1724
<!-------------- upload module ------------->
1825
<!------------------------------------------>
1926
<!------------------------------------------>
2027

28+
=======
29+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
2130
<div class="mb-3" style="margin-top: 20px;">
2231
<label for="formFile" class="form-label">Please upload your meta info file</label>
2332
<form action="/a1-upload" method="post" enctype="multipart/form-data">
@@ -28,21 +37,29 @@ <h1 style="color: blue; font-size: 24px; text-align: center;">Assignment 1 for C
2837
</form>
2938
</div>
3039

40+
<<<<<<< HEAD
3141
<!------------------------------------------>
3242
<!-------------- Search by name ------------>
3343
<!------------------------------------------>
3444
<!------------------------------------------>
3545

46+
=======
47+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
3648
<div class="mb-3" style="margin-top: 20px;">
3749
<label for="formFile" class="form-label">Show basic info for(person):</label>
3850
<form action="/a1-searchbyname" method="post" enctype="multipart/form-data">
3951
<div class="input-group">
52+
<<<<<<< HEAD
4053
<input class="form-control" type="text" name="queryName" placeholder="Name (Case Sensetive)">
54+
=======
55+
<input type="text" name="queryName" class="form-control" id="formFile" name="file" style="border-radius: 0;">
56+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
4157
<button type="submit" class="btn btn-primary" style="border-radius: 0;">Query</button>
4258
</div>
4359
</form>
4460
</div>
4561

62+
<<<<<<< HEAD
4663
<!------------------------------------------>
4764
<!----------- Search by cost range --------->
4865
<!------------------------------------------>
@@ -54,6 +71,13 @@ <h1 style="color: blue; font-size: 24px; text-align: center;">Assignment 1 for C
5471
<div class="input-group">
5572
<input class="form-control" type="text" name="minCost" placeholder="Min cost">
5673
<input class="form-control" type="text" name="maxCost" placeholder="Max cost">
74+
=======
75+
<div class="mb-3" style="margin-top: 20px;">
76+
<label for="formFile" class="form-label">Show whose salary lower than:</label>
77+
<form action="/a1-searchbys" method="post" enctype="multipart/form-data">
78+
<div class="input-group">
79+
<input type="text" class="form-control" id="formFile" name="file" style="border-radius: 0;">
80+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
5781
<button type="submit" class="btn btn-primary" style="border-radius: 0;">Query</button>
5882
</div>
5983
</form>
@@ -114,11 +138,16 @@ <h1 style="color: blue; font-size: 24px; text-align: center;">Assignment 1 for C
114138
for (var i = 0; i < cells.length; i++) {
115139
var cell = cells[i];
116140
var span = cell.getElementsByTagName("span")[0];
141+
<<<<<<< HEAD
117142
if (span) {
118143
span.style.backgroundColor = "orange";
119144
span.style.color = "red";
120145
span.contentEditable = true;
121146
}
147+
=======
148+
span.style = "background-color: orange"; "color: #red";
149+
span.contentEditable = true;
150+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
122151
}
123152
}
124153

@@ -128,9 +157,14 @@ <h1 style="color: blue; font-size: 24px; text-align: center;">Assignment 1 for C
128157
for (var i = 0; i < cells.length - 1; i++) {
129158
var cell = cells[i];
130159
var span = cell.getElementsByTagName("span")[0];
160+
<<<<<<< HEAD
131161
if (span) {
132162
span.contentEditable = false;
133163
span.style = "background-color: white"; "color: black";}
164+
=======
165+
span.contentEditable = false;
166+
span.style = "background-color: white"; "color: black";
167+
>>>>>>> 819196df4b034b220112190ae0cd93812ce6c659
134168
}
135169
}
136170

0 commit comments

Comments
 (0)