From baaba882e5d1b2c49f3397833e4f933924ed8f72 Mon Sep 17 00:00:00 2001 From: booboosui Date: Sat, 2 Sep 2023 13:31:04 +0800 Subject: [PATCH 1/2] chore(ui): Optimize page styles and fix known bugs --- backend/app/controllers/app.py | 6 +- backend/app/controllers/requirement.py | 26 ++++++-- backend/app/controllers/setting.py | 14 ++--- backend/app/controllers/user.py | 6 +- backend/app/models/application.py | 4 +- backend/app/models/requirement.py | 34 +++------- backend/app/pkgs/tools/i18b.py | 3 + backend/run.py | 51 ++++++--------- db/database.db | Bin 53248 -> 53248 bytes frontend/app.html | 82 ++++++++----------------- frontend/index.html | 8 +-- frontend/requirement.html | 35 +++++------ frontend/setting.html | 31 +++++++--- frontend/static/css/style.css | 60 +++++++++++++++++- frontend/static/js/app.js | 70 ++++++++++----------- frontend/static/js/coder.js | 9 ++- frontend/static/js/requirement.js | 40 +++++++++--- frontend/static/js/setting.js | 9 ++- frontend/static/js/tenant.js | 14 +---- frontend/tenant.html | 27 ++++---- frontend/tenant_detail.html | 10 +-- frontend/tenant_new.html | 12 ++-- frontend/user_login.html | 11 +--- frontend/user_register.html | 13 ++-- i18n/en/LC_MESSAGES/frontend.mo | Bin 774 -> 948 bytes i18n/en_frontend.po | 28 +++++++-- i18n/en_frontend.po~ | 32 +++++++++- i18n/frontend.pot | 14 ++++- i18n/zh/LC_MESSAGES/frontend.mo | Bin 8302 -> 8549 bytes i18n/zh_frontend.po | 14 ++++- i18n/zh_frontend.po~ | 26 +++++++- 31 files changed, 425 insertions(+), 264 deletions(-) diff --git a/backend/app/controllers/app.py b/backend/app/controllers/app.py index cc8e133a..c32dad83 100644 --- a/backend/app/controllers/app.py +++ b/backend/app/controllers/app.py @@ -15,7 +15,7 @@ def add(): _ = getI18n("controllers") name = request.json.get('app_name') - tenant_id = request.json.get('app_tenant_id') + tenant_id = session['tenant_id'] app_id = request.json.get('app_id') default_source_branch = request.json.get('app_default_source_branch') default_target_branch = request.json.get('app_default_target_branch') @@ -50,11 +50,11 @@ def add(): @json_response def getAll(): _ = getI18n("controllers") - owner = session['username'] + tenantID = session['tenant_id'] appID = request.args.get('app_id') try: - apps = Application.get_all_application(owner, appID) + apps = Application.get_all_application(tenantID, appID) return {'apps': apps} except Exception as e: diff --git a/backend/app/controllers/requirement.py b/backend/app/controllers/requirement.py index 8305799c..fe8e10a8 100644 --- a/backend/app/controllers/requirement.py +++ b/backend/app/controllers/requirement.py @@ -1,4 +1,4 @@ -from flask import Blueprint, request, session +from flask import Blueprint, request, session, json from app.controllers.common import json_response from app.models.task import getEmptyTaskInfo from app.pkgs.tools.i18b import getI18n @@ -18,10 +18,11 @@ def clear_up(): print("clear_up failed:"+str(e)) session[session["username"]] = getEmptyTaskInfo() - tenant_name = "DevOpsGPT" + tenant_name = "-" if GRADE != "base": tenant = Tenant.get_tenant_baseinfo_by_id(session["tenant_id"]) - tenant_name = tenant["name"] + if tenant: + tenant_name = tenant["name"] return {"username": session["username"], "tenant_name": tenant_name, "tenant_id": session["tenant_id"], "info": session[session["username"]]} @@ -40,7 +41,7 @@ def setup_app(): if GRADE != "base" and not Tenant.check_quota(tenantID): raise Exception(_("You have exceeded your quota limit, please check your business bill.")) - requirement = Requirement.create_requirement(tenantID, "New requirement", "New", appID, 1, sourceBranch, featureBranch, REQUIREMENT_STATUS_NotStarted, 0, 0) + requirement = Requirement.create_requirement(tenantID, "New requirement", "New", appID, username, sourceBranch, featureBranch, REQUIREMENT_STATUS_NotStarted, 0, 0) session[username]['memory']['task_info'] = { "app_id": appID, @@ -86,4 +87,19 @@ def get_one(): if GRADE != "base": requirement["memory"] = RequirementMemory.get_all_requirement_memories(requirementID, 1) - return requirement \ No newline at end of file + return requirement + +@bp.route('/update', methods=['POST']) +@json_response +def update(): + _ = getI18n("controllers") + data = request.json + requirement_id = data['requirement_id'] + update_data = data['data'] + + requirement = Requirement.update_requirement(requirement_id, **update_data) + + if requirement.requirement_id: + return Requirement.get_requirement_by_id(requirement.requirement_id) + else: + raise Exception(_("Failed to set up app.")) \ No newline at end of file diff --git a/backend/app/controllers/setting.py b/backend/app/controllers/setting.py index 600126d4..6df83b7b 100644 --- a/backend/app/controllers/setting.py +++ b/backend/app/controllers/setting.py @@ -13,7 +13,7 @@ @json_response def get_git_config_list(): _ = getI18n("controllers") - tenantID = session['tenant_id'] + tenantID = request.args.get('tenant_id') gitList, success = getGitConfigList(tenantID, 0) if not success: @@ -25,7 +25,7 @@ def get_git_config_list(): @json_response def get_ci_config_list(): _ = getI18n("controllers") - tenantID = session['tenant_id'] + tenantID = request.args.get('tenant_id') gitList, success = getCIConfigList(tenantID, 0) if not success: @@ -37,7 +37,7 @@ def get_ci_config_list(): @json_response def get_cd_config_list(): _ = getI18n("controllers") - tenantID = session['tenant_id'] + tenantID = request.args.get('tenant_id') gitList, success = getCDConfigList(tenantID, 0) if not success: @@ -50,7 +50,7 @@ def get_cd_config_list(): def get_llm_config_list(): _ = getI18n("controllers") raise Exception(_("Failed to get git config list.")) - tenantID = session['tenant_id'] + tenantID = request.args.get('tenant_id') gitList, success = getLLMConfigList(tenantID, 0) if not success: @@ -70,7 +70,7 @@ def edit_git(): git_config_id = request.json.get('git_config_id') name = request.json.get('git_name') creater = session['username'] - tenant_id = session['tenant_id'] + tenant_id = request.json.get('tenant_id') try: if git_config_id: @@ -94,7 +94,7 @@ def edit_ci(): ci_config_id = request.json.get('ci_config_id') name = request.json.get('ci_name') creater = session['username'] - tenant_id = session['tenant_id'] + tenant_id = request.json.get('tenant_id') try: if ci_config_id: @@ -118,7 +118,7 @@ def edit_cd(): cd_provider = request.json.get('cd_provider') name = request.json.get('cd_name') creater = session['username'] - tenant_id = session['tenant_id'] + tenant_id = request.json.get('tenant_id') try: if cd_config_id: diff --git a/backend/app/controllers/user.py b/backend/app/controllers/user.py index d2448356..1ba1fa51 100644 --- a/backend/app/controllers/user.py +++ b/backend/app/controllers/user.py @@ -49,15 +49,19 @@ def login(): if GRADE == "base": ok = User.checkPassword(username, password) session['tenant_id'] = 0 + session['user_id'] = 1 + session['username'] = username else: ok = UserPro.checkPassword(username, password) if ok: userinfo = UserPro.get_user_by_name(username) session['language'] = userinfo["zone_language"] + session['tenant_id'] = userinfo["current_tenant"] + session['user_id'] = userinfo["user_id"] + session['username'] = username if ok: - session['username'] = username return {'message': _('Login successful.')} else: raise Exception(_("Invalid username or password")) diff --git a/backend/app/models/application.py b/backend/app/models/application.py index 3dac8a4e..9890a845 100644 --- a/backend/app/models/application.py +++ b/backend/app/models/application.py @@ -33,10 +33,12 @@ def create(tenant_id, creater, name, description, default_source_branch, default return app @staticmethod - def get_all_application(owner, appID): + def get_all_application(tenant_id, appID): applications = Application.query.order_by(Application.app_id.desc()).all() if appID: applications = Application.query.filter_by(app_id=appID).all() + if tenant_id: + applications = Application.query.filter_by(tenant_id=tenant_id).all() application_list = [] diff --git a/backend/app/models/requirement.py b/backend/app/models/requirement.py index c5011a9e..56fe8729 100644 --- a/backend/app/models/requirement.py +++ b/backend/app/models/requirement.py @@ -1,3 +1,4 @@ +from datetime import datetime from app.extensions import db from app.models.application import Application @@ -7,7 +8,7 @@ class Requirement(db.Model): requirement_name = db.Column(db.String(255), nullable=False) original_requirement = db.Column(db.String(1000)) app_id = db.Column(db.Integer, nullable=False) - user_id = db.Column(db.Integer, nullable=False) + username = db.Column(db.String(100)) default_source_branch = db.Column(db.String(255)) default_target_branch = db.Column(db.String(255)) status = db.Column(db.String(20)) @@ -17,13 +18,13 @@ class Requirement(db.Model): updated_at = db.Column(db.TIMESTAMP, default=db.func.current_timestamp(), onupdate=db.func.current_timestamp()) @staticmethod - def create_requirement(tenant_id, requirement_name, original_requirement, app_id, user_id, default_source_branch, default_target_branch, status, satisfaction_rating=None, completion_rating=None): + def create_requirement(tenant_id, requirement_name, original_requirement, app_id, username, default_source_branch, default_target_branch, status, satisfaction_rating=None, completion_rating=None): requirement = Requirement( tenant_id=tenant_id, requirement_name=requirement_name, original_requirement=original_requirement, app_id=app_id, - user_id=user_id, + username=username, status=status, default_source_branch=default_source_branch, default_target_branch=default_target_branch, @@ -45,7 +46,7 @@ def get_all_requirements(tenantID=None): 'requirement_name': req.requirement_name, 'original_requirement': req.original_requirement, 'app_id': req.app_id, - 'user_id': req.user_id, + 'username': req.username, 'default_source_branch': req.default_source_branch, 'default_target_branch': req.default_target_branch, 'status': req.status, @@ -67,7 +68,7 @@ def get_requirement_by_id(requirement_id): 'requirement_name': req.requirement_name, 'original_requirement': req.original_requirement, 'app_id': req.app_id, - 'user_id': req.user_id, + 'username': req.username, 'default_source_branch': req.default_source_branch, 'default_target_branch': req.default_target_branch, 'status': req.status, @@ -81,31 +82,16 @@ def get_requirement_by_id(requirement_id): return None @staticmethod - def update_requirement(requirement_id, requirement_name=None, original_requirement=None, app_id=None, user_id=None, status=None, satisfaction_rating=None, completion_rating=None): + def update_requirement(requirement_id, **kwargs): requirement = Requirement.query.get(requirement_id) - if requirement: - if requirement_name is not None: - requirement.requirement_name = requirement_name - if original_requirement is not None: - requirement.original_requirement = original_requirement - if app_id is not None: - requirement.app_id = app_id - if user_id is not None: - requirement.user_id = user_id - if status is not None: - requirement.status = status - if satisfaction_rating is not None: - requirement.satisfaction_rating = satisfaction_rating - if completion_rating is not None: - requirement.completion_rating = completion_rating - + for key, value in kwargs.items(): + setattr(requirement, key, value) + requirement.updated_at = datetime.utcnow() db.session.commit() return requirement - return None - @staticmethod def delete_requirement(requirement_id): requirement = Requirement.query.get(requirement_id) diff --git a/backend/app/pkgs/tools/i18b.py b/backend/app/pkgs/tools/i18b.py index 2aa9c600..1a0665cc 100644 --- a/backend/app/pkgs/tools/i18b.py +++ b/backend/app/pkgs/tools/i18b.py @@ -166,4 +166,7 @@ def getFrontendText(): "app_cd_config": _("Associated CD Config"), "app_ci_config": _("Associated CI Config"), "app_git_config": _("Associated Git Config"), + "my_role": _("My Role"), + "others_1": _("The tenant does not exist or is abnormal"), + "others_2": _("Insufficient authority."), } \ No newline at end of file diff --git a/backend/run.py b/backend/run.py index d53aff4d..2d90fe41 100644 --- a/backend/run.py +++ b/backend/run.py @@ -1,12 +1,11 @@ from app.extensions import db import datetime from app.controllers import register_controllers -from flask import Flask, request, session, abort +from flask import Flask, request, session from flask_cors import CORS from app.models.task import getEmptyTaskInfo from app.models.tenant_pro import Tenant from app.models.tenant_user_pro import TenantUser -from app.models.user_pro import UserPro from config import APP_SECRET_KEY, BACKEND_DEBUG, BACKEND_HOST, BACKEND_PORT, AICODER_ALLOWED_ORIGIN, AUTO_LOGIN, GRADE app = Flask(__name__) @@ -16,13 +15,14 @@ @app.before_request def require_login(): - if AUTO_LOGIN: + if AUTO_LOGIN and GRADE == "base": if "username" not in session: session['username'] = "demo_user" + session['user_id'] = 1 session['tenant_id'] = 0 session[session["username"]] = getEmptyTaskInfo() - path = request.path + path = request.path if path == '/user/language' or path == '/user/login' or path == '/user/logout' or path == '/user/change_language' or path == '/user/register': pass elif 'username' not in session: @@ -35,35 +35,24 @@ def require_login(): print(f"req_user: {user}") print(f"req_path: {path}") print(f"req_args: {args}") + if GRADE != "base": - current_path = request.args.get('url_path') - if (current_path == "/tenant.html" or current_path == "/tenant_new.html") and path=="/requirement/clear_up": - pass - elif path =="/tenant/create" or path=="/tenant/get_all" or path=="/tenant/use_tenant": - pass - else: - success, msg, code = check_tenant_membership_and_permissions() - if not success: - return {'success': False, 'error': msg, 'code': code} - -def check_tenant_membership_and_permissions(): - username = session["username"] - user = UserPro.get_user_by_name(username) - tenant_id = session['tenant_id'] - success, msg = Tenant.check_tenant(tenant_id) - print("check_tenant_membership_and_permissions:") - print(tenant_id) - print(msg) - print(success) - if not success: - return success, msg, 404 - - success, msg = TenantUser.check_role(user["user_id"], tenant_id, request.path) - if not success: - return success, msg, 403 - - return success, msg, 200 + try: + tenant_id = session['tenant_id'] + if not tenant_id: + tenant_id = request.args.get('tenant_id') + except Exception as e: + tenant_id = 0 + # If not on the company management page, determine the company status + if not path.startswith("/tenant/") and path != "/requirement/clear_up": + success, msg = Tenant.check_tenant(tenant_id) + if not success: + return {'success': False, 'error': msg, 'code': 404} + # authority check + success, msg = TenantUser.check_role(session['user_id'], tenant_id, path) + if not success: + return {'success': False, 'error': msg, 'code': 403} @app.after_request def after_request(response): diff --git a/db/database.db b/db/database.db index 39991dee8ee34162d6f497f97906705c49546067..432107d7e1d082b81809ac6f023e752824dc779d 100644 GIT binary patch delta 459 zcmZozz}&Ead4jZHDFXuoFBCHZX_bjO#*C#K6Bg?819>c5HyHS4@lN33=DM+2z~BTI zcas5^07GMSV>KiH{wX5tiJX!33HW#r$?W97*R6b`jE6k_K9sts-o zX5^RW;4n7kU|^VBV3s^N*FFWP;G(@gcT+MuP@is-E>PbDYfX^8oi>I-y!^)*SowPx z_*e1I<$un9jlXBJpgQcFOW_X|}Nlvx^%W zGj{7wu4j>$Y{PE0c~7U083!Vi4xHc;X)<6DU<8K}ry|tnT$BCn%7J)=NHY_&03$fC x;F6r1MXZV#h1r>axH-B7r#vGgI562a&#(?+1OSKYbSD4+ delta 480 zcmZozz}&Ead4jZH2?GNIFBCHZX@!Y8#*8H!6Bg?8^SokU;bLUqZsq&V#mIYfvw*<~ zuE`cwHIw7d8VMz_3otb4Ht8~Q$}=(=8*?x)Y+iRRh|vsa#BB!N#%e}RMGg+IxJznT zYEFKELZU))PGWI!X0k$~2@gL*W3Vtxjil`40<&a3ztnOz&%A)5{Pd#K;^N6?Efv*F zOsq`Ja}$e8Qj5}36HD|fDk_@vxda#*tC4Nk{N|KABX<)U2T&roF_@8a@@(7lle5q1 z3-R(FXJF;;Vc=iIKbOCU|2hA)&4L0|{DSKsfDGPMX9-|c_loX=lW+Fh%_?r zhwzK?9cG=&Qp(iGnZhf~D?G8$b8~Wo9Mfhw#xIPUOIy;IC*Nkz6=D-*1A3K#p-E7L zUEJE5vDtERZbOWJVnIQCW{QHRUx*Huf - - - - - @@ -33,39 +28,36 @@ -
- +
+
+
- - - - - - - - - - - - - - - - -
+
+ +
+
+ +
+ @
-
-
+
+
@@ -119,28 +111,6 @@ - - -
- @
- diff --git a/frontend/index.html b/frontend/index.html index 491e4112..f663ad68 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -31,10 +31,10 @@ diff --git a/frontend/requirement.html b/frontend/requirement.html index 6a14dd44..c090c658 100644 --- a/frontend/requirement.html +++ b/frontend/requirement.html @@ -7,14 +7,8 @@ - - - - - - @@ -32,28 +26,33 @@ -
- - - - +
+
+
- +
- - diff --git a/frontend/setting.html b/frontend/setting.html index eb357f2f..1cf47974 100644 --- a/frontend/setting.html +++ b/frontend/setting.html @@ -32,10 +32,10 @@ @@ -60,13 +60,18 @@

LLM

-

Git

+
+

+ Git +

+ +
@@ -84,7 +89,12 @@

Git
-

CI

+
+

+ CI +

+ +

@@ -100,7 +110,12 @@

CI
-

CD

+
+

+ CD +

+ +

diff --git a/frontend/static/css/style.css b/frontend/static/css/style.css index 2616447f..3d433f26 100644 --- a/frontend/static/css/style.css +++ b/frontend/static/css/style.css @@ -88,6 +88,50 @@ pre { font-size: 13px !important; } +.font-size-20 { + font-size: 20px !important; +} + +.font-size-19 { + font-size: 19px !important; +} + +.font-size-16 { + font-size: 16px !important; +} + +.font-size-15 { + font-size: 15px !important; +} + +.padding-right-16 { + padding-right: 16px; +} + +.padding-left-20 { + padding-left: 20px; +} + +.padding-bottom-0 { + padding-bottom: 0px !important; +} + +.padding-15-0 { + padding: 15px 0px !important; +} + +.line-height-24 { + line-height: 24px !important; +} + +.border-bottom-1 { + border-bottom: solid 1px #dddddd !important; +} + +.background-color-deep-green { + background-color: #1f883d !important; +} + .marigin-top-4 { margin-top: 4px; } @@ -112,10 +156,24 @@ pre { top: 50%; left: 50%; transform: translate(-50%, -50%); - opacity: 0.05; + opacity: 0.03; pointer-events: none; z-index: 9999; font-size: 36px; color: #000; background-repeat: repeat; +} + +.font-color-gray { + color: #767676 !important; +} + +.form-message { + color: #d83f3f; + text-align: right; + margin-bottom: 10px; +} + +.float-right{ + float: right !important; } \ No newline at end of file diff --git a/frontend/static/js/app.js b/frontend/static/js/app.js index 83c78833..33920ded 100644 --- a/frontend/static/js/app.js +++ b/frontend/static/js/app.js @@ -11,7 +11,7 @@ $(document).ready(function () { }); $("#add-application").click(function () { - cleanUp() + cleanUpApp() rendSelect() $('#app-edit').modal('show'); }); @@ -155,20 +155,8 @@ function removeSubservice(idx){ $("#subservice_"+idx).remove() } -function cleanUp() { - $('.subservice').remove(); - $("#app_id").val('') - $("#app_default_source_branch").val('') - $("#app_default_target_branch").val('') - $("#app_description").val('') - $("#app_name").val('') - $("#app_git_config").empty(); - $("#app_ci_config").empty(); - $("#app_cd_config").empty(); -} - function showApp(appID) { - cleanUp() + cleanUpApp() rendSelect() $('#app-edit').modal('show'); @@ -198,7 +186,10 @@ function showApp(appID) { }); libsStr = libsStr.replace(/,$/, ''); str = ` - - - - - ` + str+= ` +
+
+ `+app["name"]+` +
`+app["description"]+`
+
`+globalFrontendText['app_base_branch']+`: `+app["default_source_branch"]+` `+globalFrontendText['app_feat_branch']+`: `+app["default_target_branch"]+`
+ ` services.forEach(function (service, element_index, element_array) { - if (element_index==0) { - str += ` -
- - - - ` - } else { - str += ` - - - - - ` - } + str += ` +
+ `+service["name"]+` + `+service["language"]+` + `+service["framework"]+` + `+service["role"]+` +
+ ` }); + str += ` ` $("#app_list").html(str) }); } @@ -373,4 +359,16 @@ function rendSelect() { var newOption = $("").attr("value", gc.cd_config_id).text(gc.name); $("#app_cd_config").append(newOption); }) +} + +function cleanUpApp() { + $('.subservice').remove(); + $("#app_id").val('') + $("#app_default_source_branch").val('') + $("#app_default_target_branch").val('') + $("#app_description").val('') + $("#app_name").val('') + $("#app_git_config").empty(); + $("#app_ci_config").empty(); + $("#app_cd_config").empty(); } \ No newline at end of file diff --git a/frontend/static/js/coder.js b/frontend/static/js/coder.js index af192ffb..f98fe6fd 100644 --- a/frontend/static/js/coder.js +++ b/frontend/static/js/coder.js @@ -449,7 +449,7 @@ function language() { myAlertPure("Error 错误", "The back-end service interface cannot be accessed. Please check the terminal service log and browser console. (Usually the back-end service is not started, Or exists Cross-domain problem? )

无法访问后端服务接口,请检查终端服务日志以及浏览器控制台报错信息。(通常是后端服务没有启动,或存在 跨域问题?)") } - sendAjaxRequest('/user/language', 'GET', "", successCallback, errorCallback, true, false) + sendAjaxRequest('/user/language', 'GET', "", successCallback, errorCallback, false, false) } function openUrl(newurl){ @@ -1519,4 +1519,11 @@ function getTaskID() { var taskId = params.get('task_id'); return taskId +} + +function getTenantID() { + var queryString = window.location.search; + var params = new URLSearchParams(queryString); + var tenant_id = params.get('tenant_id'); + return tenant_id } \ No newline at end of file diff --git a/frontend/static/js/requirement.js b/frontend/static/js/requirement.js index 2c3dbbf8..202c1888 100644 --- a/frontend/static/js/requirement.js +++ b/frontend/static/js/requirement.js @@ -16,17 +16,31 @@ function getRequirementList() { var str = "" requirements.forEach(function (requirement, element_index, element_array) { - str += ` - - - - - - + str += ` + + + + ` $("#app_list").html(str) }); + + $('.ui.rating').rating({ + maxRating: 5, + onRate(newValue){ + rid = $(this).attr('rid') + rkey = $(this).attr('rkey') + data = {} + data[rkey] = newValue + updateRequirment(rid, data) + } + }); } sendAjaxRequest('/requirement/get', 'GET', requestData, successCallback, alertErrorCallback, true, false) @@ -34,4 +48,16 @@ function getRequirementList() { function showRequirement(requirement_id) { window.location.href = "/index.html?task_id="+requirement_id +} + +function updateRequirment(requirement_id, data) { + var requestData = JSON.stringify({ 'requirement_id': requirement_id, data }) + + successCallback = function(data) { + } + + errorCallback = function(data) { + } + + sendAjaxRequest('/requirement/update', 'POST', requestData, successCallback, errorCallback, true, false) } \ No newline at end of file diff --git a/frontend/static/js/setting.js b/frontend/static/js/setting.js index 2f27ee64..c217d5f7 100644 --- a/frontend/static/js/setting.js +++ b/frontend/static/js/setting.js @@ -20,6 +20,7 @@ function hideModal(md) { function editGit() { var requestData = { + 'tenant_id': getTenantID(), 'git_provider': $("#git_provider").val(), 'git_name': $("#git_name").val(), 'git_url': $("#git_url").val(), @@ -52,6 +53,7 @@ function showGitConfig(idx) { function editCI() { var requestData = { + 'tenant_id': getTenantID(), 'ci_name': $("#ci_name").val(), 'ci_provider': $("#ci_provider").val(), 'ci_api_url': $("#ci_api_url").val(), @@ -80,6 +82,7 @@ function showCIConfig(idx) { function editCD() { var requestData = { + 'tenant_id': getTenantID(), 'cd_name': $("#cd_name").val(), 'cd_provider': $("#cd_provider").val(), 'ACCESS_KEY': $("#ACCESS_KEY").val(), @@ -108,7 +111,7 @@ function showCDConfig(idx) { function getGitConfigList() { - requestData = '' + requestData = {'tenant_id': getTenantID()} successCallback = function(data) { gitconfigs = data.data @@ -132,7 +135,7 @@ function getGitConfigList() { } function getCIConfigList() { - requestData = '' + requestData = {'tenant_id': getTenantID()} successCallback = function(data) { ciconfigs = data.data @@ -154,7 +157,7 @@ function getCIConfigList() { } function getCDConfigList() { - requestData = '' + requestData = {'tenant_id': getTenantID()} successCallback = function(data) { cdconfigs = data.data diff --git a/frontend/static/js/tenant.js b/frontend/static/js/tenant.js index 54bdf304..f6dbb194 100644 --- a/frontend/static/js/tenant.js +++ b/frontend/static/js/tenant.js @@ -52,14 +52,13 @@ function getTenantList() { tenants.forEach(function (tenant, element_index, element_array) { str += ` + - - + - - + ` $("#tenant_list").html(str) }); @@ -155,13 +154,6 @@ function invite() { sendAjaxRequest('/tenant/invite', "POST", requestData, successCallback, errorCallback, true, false) } -function getTenantID() { - var queryString = window.location.search; - var params = new URLSearchParams(queryString); - var tenant_id = params.get('tenant_id'); - return tenant_id -} - function getBillings(tenant_id) { var requestData = { 'tenant_id': tenant_id } diff --git a/frontend/tenant.html b/frontend/tenant.html index 0d34d3ae..c06749ea 100644 --- a/frontend/tenant.html +++ b/frontend/tenant.html @@ -32,32 +32,37 @@ -
- - - - +
+
`+app["name"]+``+app["description"]+``+app["default_source_branch"]+``+app["default_target_branch"]+``+service["name"]+``+service["role"]+``+service["language"]+``+service["framework"]+`
`+service["name"]+``+service["role"]+``+service["language"]+``+service["framework"]+`
`+requirement["requirement_id"]+``+requirement["requirement_name"]+``+requirement["status"]+``+requirement["user_id"]+``+requirement["completion_rating"]+``+requirement["satisfaction_rating"]+`
`+requirement["requirement_name"]+``+requirement["status"]+` +
`+requirement["created_at"]+`
+
+ + `+requirement["username"]+` +
`+tenant["name"]+`
`+tenant["current_user_role"]+` `+tenant["status"]+``+tenant["member_count"]+` (`+tenant["current_user_role"]+`)`+tenant["description"]+``+tenant["member_count"]+` `+tenant["billing_type"]+` `+tenant["billing_quota"]+``+tenant["created_at"]+` `+tenant["billing_end"]+``+globalFrontendText["enter"]+` | `+globalFrontendText["show_tenant"]+` | `+globalFrontendText["configuration"]+``+globalFrontendText["enter"]+` | `+globalFrontendText["show_tenant"]+` | `+globalFrontendText["configuration"]+`
+ - - diff --git a/frontend/tenant_detail.html b/frontend/tenant_detail.html index fbe0be11..96e53ef5 100644 --- a/frontend/tenant_detail.html +++ b/frontend/tenant_detail.html @@ -32,10 +32,10 @@ @@ -43,7 +43,7 @@ diff --git a/frontend/tenant_new.html b/frontend/tenant_new.html index 850acdbd..98f65549 100644 --- a/frontend/tenant_new.html +++ b/frontend/tenant_new.html @@ -32,10 +32,10 @@ @@ -43,7 +43,7 @@ @@ -351,7 +351,7 @@
- +
diff --git a/frontend/user_login.html b/frontend/user_login.html index 095bbb14..b188b315 100644 --- a/frontend/user_login.html +++ b/frontend/user_login.html @@ -26,21 +26,16 @@ - - - -
+
@@ -54,7 +49,7 @@
- +
diff --git a/frontend/user_register.html b/frontend/user_register.html index c0bb1cf6..51fb6159 100644 --- a/frontend/user_register.html +++ b/frontend/user_register.html @@ -26,21 +26,16 @@
- - - -
+
@@ -62,8 +57,8 @@
- - +
+
diff --git a/i18n/en/LC_MESSAGES/frontend.mo b/i18n/en/LC_MESSAGES/frontend.mo index f6b3d5ccc2385829a1da7e18b8a00659dd0f105b..baacd75f2042eb7f6b3e1f87a909d211bb013483 100644 GIT binary patch delta 317 zcmZo;+rnOdPl#nI0}!wQu?!IV05LZZ*8njHtN>yWAYKWj_W@~9AifO50zmu{h&6!t z7Z58mLT~_(?asu&0HS9A=|CX;5=aXJX=`Q%h7=&}52S(0l^B3D11k`N8~{{<0$4!2 ziH(sOAsML(C8>Fdc_j)d`KiSUdHE#@sTG;UB?|dP3YolbTqZs$i3-kWrMHW~&adLocHwH%HyBI5j6VxkMomXjw*T5zI(E K8~sE(Jq7?ZB16gm delta 143 zcmdnO-o{pcPl#nI0}!wRu?!Hq05Lld=KwJXbO5mk5O+f9c|ckeh&KbV01%%9Vr51K zhFd^70Eqtq*&y1ViGd*yNG|}=!a({HkOoRIFat3NumCYoh>3x9;=;(y%8WWp0C5Em ADF6Tf diff --git a/i18n/en_frontend.po b/i18n/en_frontend.po index ea9f655f..8ba62dcf 100644 --- a/i18n/en_frontend.po +++ b/i18n/en_frontend.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-01 17:29+0800\n" +"POT-Creation-Date: 2023-09-02 12:45+0800\n" "PO-Revision-Date: 2023-07-17 18:37+0800\n" "Last-Translator: booboo \n" "Language-Team: Language i18n/en\n" @@ -569,12 +569,32 @@ msgstr "" #: backend/app/pkgs/tools/i18b.py:166 msgid "Associated CD Config" -msgstr "Associated CD Config (Company administrator Added in Company configuration page)" +msgstr "" +"Associated CD Config (Company administrator Added in Company configuration " +"page)" #: backend/app/pkgs/tools/i18b.py:167 msgid "Associated CI Config" -msgstr "Associated CI Config (Company administrator Added in Company configuration page)" +msgstr "" +"Associated CI Config (Company administrator Added in Company configuration " +"page)" #: backend/app/pkgs/tools/i18b.py:168 msgid "Associated Git Config" -msgstr "Associated Git Config (Company administrator Added in Company configuration page)" +msgstr "" +"Associated Git Config (Company administrator Added in Company configuration " +"page)" + +#: backend/app/pkgs/tools/i18b.py:169 +msgid "My Role" +msgstr "" + +#: backend/app/pkgs/tools/i18b.py:170 +msgid "The tenant does not exist or is abnormal" +msgstr "" +"The company does not exist or is abnormal. Please select another company.." + +#: backend/app/pkgs/tools/i18b.py:171 +msgid "Insufficient authority." +msgstr "" diff --git a/i18n/en_frontend.po~ b/i18n/en_frontend.po~ index 1e7b6ead..55a62b4e 100644 --- a/i18n/en_frontend.po~ +++ b/i18n/en_frontend.po~ @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-01 15:46+0800\n" +"POT-Creation-Date: 2023-09-02 11:45+0800\n" "PO-Revision-Date: 2023-07-17 18:37+0800\n" "Last-Translator: booboo \n" "Language-Team: Language i18n/en\n" @@ -562,3 +562,33 @@ msgstr "" #: backend/app/pkgs/tools/i18b.py:164 msgid "Configuration" msgstr "" + +#: backend/app/pkgs/tools/i18b.py:165 +msgid "Config name" +msgstr "" + +#: backend/app/pkgs/tools/i18b.py:166 +msgid "Associated CD Config" +msgstr "" +"Associated CD Config (Company administrator Added in Company configuration " +"page)" + +#: backend/app/pkgs/tools/i18b.py:167 +msgid "Associated CI Config" +msgstr "" +"Associated CI Config (Company administrator Added in Company configuration " +"page)" + +#: backend/app/pkgs/tools/i18b.py:168 +msgid "Associated Git Config" +msgstr "" +"Associated Git Config (Company administrator Added in Company configuration " +"page)" + +#: backend/app/pkgs/tools/i18b.py:169 +msgid "My Role" +msgstr "" + +#: backend/app/pkgs/tools/i18b.py:170 +msgid "The tenant does not exist or is abnormal" +msgstr "The company does not exist or is abnormal. Please select another company.." diff --git a/i18n/frontend.pot b/i18n/frontend.pot index 580eba16..ed5bfa15 100644 --- a/i18n/frontend.pot +++ b/i18n/frontend.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-01 17:29+0800\n" +"POT-Creation-Date: 2023-09-02 12:45+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -579,3 +579,15 @@ msgstr "" #: backend/app/pkgs/tools/i18b.py:168 msgid "Associated Git Config" msgstr "" + +#: backend/app/pkgs/tools/i18b.py:169 +msgid "My Role" +msgstr "" + +#: backend/app/pkgs/tools/i18b.py:170 +msgid "The tenant does not exist or is abnormal" +msgstr "" + +#: backend/app/pkgs/tools/i18b.py:171 +msgid "Insufficient authority." +msgstr "" diff --git a/i18n/zh/LC_MESSAGES/frontend.mo b/i18n/zh/LC_MESSAGES/frontend.mo index 28f29affadb655b24caf1b39d2c3f8a9fd258b39..9b03618b0693c1ddc3a907e8825faff7aae8f6c0 100644 GIT binary patch delta 2899 zcmYk-dr*{B7{~D=2r6jg1yRIUQ#4EQ)|e6(FQ_SEqE>{JtO~M*V6ZCQTGVPpqltEO zyrtt5nNv=Mgc3p6@ z<=av1KQfz80~CZ#sGb~vlP_9MNGn0)Dqo84G_zXRmTaa`b1Rw6x0d~My=2Y zZb>%xz1Mfv$;Q`b= zZ!(Xgo}nL69bZCC{HA#a)n5l1g;x@Ffr$YMI^hvihr>_#2!vG=r##??$aaquFGBgDi$Si!V4g%U!VpPxXqNkc*Ggpa9j;8qC5C z=69G)eh)Q3cJGLJs0kJZ+r{(=Fnd>LNA{SXnnzJRe{Y_%`t#;5R)5R#zs#uQ$ax8< z{(D+J#2kg1QARRLuA4B$4isQ`YG#?$*O&qGEmQ~fmhV6fv=_Bzhs~et_+?c4X4FH` zX7%@yx#byD#PXe*kK<7dKg1mT0>@&T)jz?PU&qIw2AqUip}FRK(}!xe)Ld)zn=Egz ze0RVq8c_o^*?}84f&5R)NAp%{pe$6!xt150g{YOBhm+BVdS5@c<0nz)owodf8MsVA zk8`s%xQV(2cPx+NnbwI(r~w9`j;Et0lxw!GN#MW)|ehx8Y4?^wk)vk}#C zlX=wYzctU97tK~w``hMStB>L{rHLe%Ddu3*-{g}iDm1GV(Cu^now4eui#kZdb2!5DqgGKoT~EDC0IOe%Pm z%tL58(};nDm!QXR*Mo5uaerH6g;La|yhM}{uMk6s)xpM&se$#BwDFd@k;F=39dUnS zEyCLZ_F90~h{fTW$Txd3WxXU%65|OTO*fC2LA*#zCG==KPrOPjBt{U=5tWgzE3Z0< zHa=y;@8_KQpEo%_I{HCE=` zaV5cmxTLg~A2_OqM_V<)_r&=KeZZ#&>*G?p_$lcRY7nvXgQIaViPg(WOMMG`B^7>; zcbUJevdZUQnI1fpkQE<5UfL|IEUETXRQf$7HNI-Ur?Sf9 ztM+*3S5#Il@s=MYI4Uglp?J}CQoZCz;d{+2fnHGjP|(hFl{4)bQG2XCjY`X5DD BOiKU& delta 2641 zcmYk-e@s?Y9LMn^zXXJM0)+S>KQu7S46Q$uh#wNfk5Hbl(C~Lknt_&S7}-<)!D`c5 zJ~NlaAC_z7Y%o}3OVU`nexUv#x>2r}D>h}Rn@#^H&EB8qe%ZKtzV~&$=iYP9z31L@ zpV39vN~?cQjM(qk0z@W}9O2wo7#Gcs?Ymg#d^murI%i(QaPmJbzx+XNQXqkfDN~%= zg&D{(_Yv}QhuLLdH%8%UOvWMeGEODGgKC!)=iI%Rg;co$jKLzDjFrgGEoK*wO>x|V zDmJlGgB|8>)PV0{B<{x~{22MUE_U}|KdPfaRQq2nA4OgG->88TI7t_nipr;BBF>Iy z4ps3u71OZ-XW&NEzc%diX66d&Ms8vW z{)6f#P{^CoN}&wHup8B|7r6#^40R_zqXs;W8sIlnyD`)N%ej3W-+-yuYIz5$zxPr7 z9YC76&vBaG;XVp#aKR2-MSku-cG>9TLFri)uv16ns5`Dj4eUqV*-F$iUT3zT-kCPk zfO}9E-f14e$y!5w6x87f)E%5cH8_jva0E5b7;4IHnRl!{f>HE{e5m$Ws0*EmS{)Cg zX0QU=aS1Z48^kRt)Uu{t#AB#|@@b`x=Hps?3^jF~n1x4?$L9ud#w6!1T7EahyWj+- zQx~3&y5Kz2ozF2Bnw1#fCR_uBMr^hN$IU^UP5m&cqwxD!DHv;3VKI3JYJgMbIn)J? zSbiPV{wtG{bTrF$dCquM81o{Jjifpngo=B$_s>9-TsqZ({Ry$x+v-+_hX zdvP89h&t~!mS8YZARPO-cm z7m+twe$YIG>hBB7zc%|(Gxt4K;u+MsOb)PYH9$V9;X{@enq{chx5|$DQB%Ik@>a7Q zHNZP|d>^XcPt7mQZqzt^mIqE+#h^KCj-ooeVfk${hDD=}Q_N|o4(~VTnZ;%;>ilKq zYO8Pd47hDp@s_z4^}l$~@-BRdydP_ER<`#jwqpf(7wQ6TqAoZrhpz<2p$0BOmWnG! zP5BCBorktvZl+hzm!jA!y3MFhSP}88)h!FQM5p@e$a08kqKe2TRuj2|x}HVU6XV+k zE38L-lb$1*i50{gVrTF|basG3Xk*d1`NV6)o1q$S_lA|%qTazR#73**s~4JtHTWn| zO7LpAmBdp-Bk?4mSLPLB6QPAOk7yuTysxMCQj)u8v}4o%c1ft@eJ1^s^;Gl(v_0(+ z+HYfDMy#4p*G_o>p=JImv6xs&EGM=ST0CJyybIolNvvz5sBJsJhu0Ml;e<9l{MSPz zZ&wIBYxl&2y78ix%95ZzHZ`q$yb8ysm{-_6AACDDHLq#HQN29cUM5)f?gc_0>YCuU uvDxuED24uju=TSmv5~<^zOvpL-`vRFLsJh&1)DN!dV4ZQ!h?V1?ED|wIO}f! diff --git a/i18n/zh_frontend.po b/i18n/zh_frontend.po index ec56ac6b..0e5002e4 100644 --- a/i18n/zh_frontend.po +++ b/i18n/zh_frontend.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-01 17:29+0800\n" +"POT-Creation-Date: 2023-09-02 12:45+0800\n" "PO-Revision-Date: 2023-07-17 18:36+0800\n" "Last-Translator: booboo \n" "Language-Team: Language i18n/zh\n" @@ -580,5 +580,17 @@ msgstr "关联 CI 配置(企业管理员在企业配置中添加)" msgid "Associated Git Config" msgstr "关联 Git 配置(企业管理员在企业配置中添加)" +#: backend/app/pkgs/tools/i18b.py:169 +msgid "My Role" +msgstr "我的角色" + +#: backend/app/pkgs/tools/i18b.py:170 +msgid "The tenant does not exist or is abnormal" +msgstr "当前企业不存在或状态异常,请选择其他企业。." + +#: backend/app/pkgs/tools/i18b.py:171 +msgid "Insufficient authority." +msgstr "没有操作权限。" + #~ msgid "Phone" #~ msgstr "手机号" diff --git a/i18n/zh_frontend.po~ b/i18n/zh_frontend.po~ index 499b604f..1be598df 100644 --- a/i18n/zh_frontend.po~ +++ b/i18n/zh_frontend.po~ @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-01 15:46+0800\n" +"POT-Creation-Date: 2023-09-02 11:45+0800\n" "PO-Revision-Date: 2023-07-17 18:36+0800\n" "Last-Translator: booboo \n" "Language-Team: Language i18n/zh\n" @@ -564,5 +564,29 @@ msgstr "" msgid "Configuration" msgstr "配置" +#: backend/app/pkgs/tools/i18b.py:165 +msgid "Config name" +msgstr "配置名称" + +#: backend/app/pkgs/tools/i18b.py:166 +msgid "Associated CD Config" +msgstr "关联 CD 配置(企业管理员在企业配置中添加)" + +#: backend/app/pkgs/tools/i18b.py:167 +msgid "Associated CI Config" +msgstr "关联 CI 配置(企业管理员在企业配置中添加)" + +#: backend/app/pkgs/tools/i18b.py:168 +msgid "Associated Git Config" +msgstr "关联 Git 配置(企业管理员在企业配置中添加)" + +#: backend/app/pkgs/tools/i18b.py:169 +msgid "My Role" +msgstr "我的角色" + +#: backend/app/pkgs/tools/i18b.py:170 +msgid "The tenant does not exist or is abnormal" +msgstr "当前企业不存在或状态异常,请选择其他企业。." + #~ msgid "Phone" #~ msgstr "手机号" From 61b813de017263ccf32599b89cbf86ca34d9f13e Mon Sep 17 00:00:00 2001 From: booboosui Date: Sat, 2 Sep 2023 13:46:13 +0800 Subject: [PATCH 2/2] fix(ui): fix ui bug --- db/database.db | Bin 53248 -> 53248 bytes frontend/requirement.html | 2 +- frontend/static/js/requirement.js | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/database.db b/db/database.db index 432107d7e1d082b81809ac6f023e752824dc779d..154f2d625c4221e28d3ae396228a69d1b228297c 100644 GIT binary patch delta 348 zcmZY4Jx;?g0ES_^Nkx+Yam5G{?E#$nH?fVX@-uhpj+nVZQPr3W6!`*y10bP_BUFeE zofr_}2q44_FrrJt`VEiXZ(0S@DwyrV$<4tToIG6I_R{zjgwX=*x@fV}OrGb6JVwZ( z76Rp{9KrMuLVn_^{tFL6Mi|FLVU~BOFkBd-|0azI>kw(UGE!z*3dt1!;M={M&poSS zkB!SQOuN5W3jp`A{Bmzc$)M5LGzB$+)=X_kk>$Kly0}gv1nkfb*OY6UC#TGnJMV9w zhP6I#(R!b^cqXZqxwMyC-oh5IKl-fs{i+MyY7qCr=4Kb?Mu>l1lxB+gTy=Lm`vIo7 BQVIY7 delta 238 zcmZozz}&Ead4e=!=|mZ4#?p-m3-$RK7#LW%ZZPo8;+??5&2?k5fWcNy|NPv7oYa!k z6e9y8V_gGFT?0b}LqjVQ6Dw0AR3TFXD-*-q#Nv|FqO{b+68(ybie^Sm0fr{uCSOKQ zMGg*QV-5y}$?|88urwKP2~56Y^>*?u8=1*jX9XvJJ1s5^2=Bje;qJ8qy7 z4M7e8hQ{E=U`Bp
-
+
diff --git a/frontend/static/js/requirement.js b/frontend/static/js/requirement.js index 202c1888..d6000c79 100644 --- a/frontend/static/js/requirement.js +++ b/frontend/static/js/requirement.js @@ -20,7 +20,7 @@ function getRequirementList() { -
`+requirement["requirement_name"]+``+requirement["status"]+`
`+requirement["created_at"]+`
+ `+requirement["username"]+`