Skip to content

( NEW ) Menambahkan diagram UML dan update README #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ Open a browser and go to URL
http://<IP>:5000 => Welcome
http://<IP>:5000/how%20are%20you => I am good, how about you?
```
- Diagram UML ditambahkan ke folder docs/uml
80 changes: 73 additions & 7 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,80 @@
import os
from flask import Flask
from flask import Flask, render_template, request, redirect, url_for, session

app = Flask(__name__)
app.secret_key = 'rahasia' # Digunakan untuk menyimpan session login

# Akun pengguna (dummy)
USER_CREDENTIALS = {
'admin': 'admin'
}

# ========================
# ROUTE: Halaman Login
# ========================
@app.route("/")
def main():
return "Welcome!"
def index():
return render_template("login.html")

# ========================
# ROUTE: Proses Login
# ========================
@app.route("/login", methods=["POST"])
def login():
username = request.form.get("username")
password = request.form.get("password")

if username in USER_CREDENTIALS and USER_CREDENTIALS[username] == password:
session['user'] = username
return redirect(url_for('dashboard'))
else:
return """
<h3>Login gagal!</h3>
<p>Username atau password salah.</p>
<a href='/'>Kembali ke login</a>
"""

# ========================
# ROUTE: Dashboard
# ========================
@app.route("/dashboard")
def dashboard():
if 'user' not in session:
return redirect(url_for('index'))
return render_template("dashboard.html")

# ========================
# ROUTE: Tambah Data
# ========================
@app.route("/create", methods=["GET", "POST"])
def create():
if 'user' not in session:
return redirect(url_for('index'))

if request.method == "POST":
nama = request.form.get("nama")
jumlah = request.form.get("jumlah")

if nama and jumlah:
print(f"Data disimpan: {nama}, jumlah: {jumlah}") # Log ke terminal
return render_template("success.html")
else:
return """
<h3>Data tidak lengkap!</h3>
<a href='/create'>Coba lagi</a>
"""

return render_template("create.html")

@app.route('/how are you')
def hello():
return 'I am good, how about you?'
# ========================
# ROUTE: Logout
# ========================
@app.route("/logout")
def logout():
session.pop('user', None)
return render_template("logout.html")

# ========================
# RUN APP
# ========================
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8080)
Binary file added docs/uml/class_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions docs/uml/class_diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@startuml
class User {
-username: str
-password: str
+login(): bool
}

class Item {
-name: str
-description: str
+create(): void
}

User "1" --> "*" Item : creates
@enduml
Binary file added docs/uml/classes_class_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/uml/classes_simple_webapp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/uml/sequence_create_item.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions docs/uml/sequence_create_item.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@startuml
actor Admin
participant WebBrowser
participant FlaskApp
participant ItemService
participant Database

Admin -> WebBrowser : buka halaman create item
WebBrowser -> FlaskApp : GET /item/create
FlaskApp -> WebBrowser : tampilkan form

Admin -> WebBrowser : submit data item
WebBrowser -> FlaskApp : POST /item/create
FlaskApp -> ItemService : validasi data
ItemService -> Database : simpan item
Database --> ItemService : sukses
ItemService --> FlaskApp : status OK
FlaskApp -> WebBrowser : tampilkan pesan sukses
@enduml
Binary file added docs/uml/sequence_login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions docs/uml/sequence_login.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@startuml
actor User
participant WebBrowser
participant FlaskApp
participant AuthService
participant Database

User -> WebBrowser : buka halaman login
WebBrowser -> FlaskApp : GET /login
FlaskApp -> WebBrowser : tampilkan form

User -> WebBrowser : isi username dan password
WebBrowser -> FlaskApp : POST /validateLogin
FlaskApp -> AuthService : validasi login
AuthService -> Database : ambil data user
Database --> AuthService : data user
AuthService --> FlaskApp : hasil validasi
FlaskApp -> WebBrowser : redirect ke dashboard / error
@enduml
Binary file added evaluasi/SUS/Analisis Ringkas SUS.pdf
Binary file not shown.
Binary file added evaluasi/SUS/GRAFIK SUS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading