Skip to content
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

Feat/style #105

Merged
merged 2 commits into from
Sep 11, 2023
Merged
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
5 changes: 4 additions & 1 deletion backend/app/controllers/requirement.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from app.models.requirement import Requirement
from app.models.requirement_memory_pro import RequirementMemory
from app.models.tenant_pro import Tenant
from app.models.tenant_bill_pro import TenantBill
from config import REQUIREMENT_STATUS_NotStarted, GRADE

bp = Blueprint('requirement', __name__, url_prefix='/requirement')
Expand All @@ -19,12 +20,14 @@ def clear_up():

session[session["username"]] = getEmptyTaskInfo()
tenant_name = "-"
code_power = '0'
if GRADE != "base":
tenant = Tenant.get_tenant_baseinfo_by_id(session["tenant_id"])
if tenant:
tenant_name = tenant["name"]
code_power = TenantBill.get_total_codepower(session["tenant_id"])

return {"username": session["username"], "tenant_name": tenant_name, "tenant_id": session["tenant_id"], "info": session[session["username"]]}
return {"username": session["username"], "tenant_name": tenant_name, "tenant_id": session["tenant_id"], "info": session[session["username"]], "code_power": code_power}


@bp.route('/setup_app', methods=['POST'])
Expand Down
3 changes: 2 additions & 1 deletion frontend/static/js/coder.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,10 @@ function logincheck() {
successCallback = function(data) {
var username = data.data.username
var tenant = data.data.tenant_name
var code_power = data.data.code_power
globalTenantID = data.data.tenant_id
$("#current-username").html(username)
$("#current-tenant").html(tenant)
$("#current-tenant").html(tenant+' ('+globalFrontendText['code_power']+':'+code_power+')')
$("#watermark-username").html(username)
}

Expand Down
20 changes: 12 additions & 8 deletions frontend/static/js/tenant.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,13 @@ function getTenantList() {

tenants.forEach(function (tenant, element_index, element_array) {
str += `<tr>
<td>`+tenant["name"]+`<br /></td>
<td><a href="#" onClick="useTenant(`+tenant["tenant_id"]+`)">`+tenant["name"]+`</a></td>
<td>`+tenant["current_user_role"]+`</td>
<td>`+tenant["status"]+`</td>
<td>`+tenant["status_name"]+`</td>
<td>`+tenant["member_count"]+`</td>
<td>`+tenant["billing_type"]+`</td>
<td>`+tenant["billing_type_name"]+`<br><span style="color:#5b5b5b9e">`+globalFrontendText["tenant_billing_end"]+`: `+tenant["billing_end"]+`</span></td>
<td>`+tenant["billing_quota"]+`</td>
<td>`+tenant["billing_end"]+`</td>
<td><a href="#" onClick="useTenant(`+tenant["tenant_id"]+`)">`+globalFrontendText["enter"]+`</a> | <a href="#" onClick="showTenant(`+tenant["tenant_id"]+`)">`+globalFrontendText["show_tenant"]+`</a> | <a href="setting.html?tenant_id=`+tenant["tenant_id"]+`">`+globalFrontendText["configuration"]+`</a></td>
<td><a href="#" onClick="showTenant(`+tenant["tenant_id"]+`)">`+globalFrontendText["show_tenant"]+`</a> | <a href="setting.html?tenant_id=`+tenant["tenant_id"]+`">`+globalFrontendText["configuration"]+`</a></td>
</tr>`
$("#tenant_list").html(str)
});
Expand Down Expand Up @@ -92,7 +91,7 @@ function getTenant(tenant_id) {
$("#tenant_description").val(tenants.description)
$("#tenant_employee_count").val(tenants.employee_count)
$("#tenant_industry_type").val(tenants.industry_type)
$("#tenant_status").val(tenants.status)
$("#tenant_status").val(tenants.status_name)
$("#tenant_created_at").val(tenants.created_at)
$("#tenant_billing_end").val(tenants.billing_end + " - " + tenants.plus_name)
$("#members_count").text(tenants.member_count)
Expand All @@ -101,6 +100,7 @@ function getTenant(tenant_id) {
$("#recharge_company").text(tenants.name)

$("#billing_info").text(globalFrontendText["task_limit_msg"] + tenants.billing_quota)
$("#codepower_info").text(globalFrontendText["code_power"] + tenants.code_power)
}

sendAjaxRequest('/tenant/get_one', 'GET', requestData, successCallback, alertErrorCallback, true, false)
Expand Down Expand Up @@ -175,13 +175,17 @@ function getBillings(tenant_id) {

users.forEach(function (user, element_index, element_array) {
expired_at = ""
code_power = 0
if (user["bill_type"].startsWith("Income_")) {
expired_at = "<br /><span style='color:#5b5b5b9e'>"+globalFrontendText["expired_at"]+user["expired_at"]+"</span>"
code_power = '+' + user["amount"] + '('+user['amount_left']+')' + expired_at
} else {
code_power = '-' + user["amount_used"]
}
str += `<tr>
<td>`+user["bill_type"]+`<br /></td>
<td>`+user["bill_type_name"]+`<br /></td>
<td>`+user["bill_user"]+`</td>
<td>`+user["amount"]+expired_at+`</td>
<td>`+code_power+`</td>
<td>`+user["created_at"]+`</td>
<td><a href="/?task_id=`+user["external_info"]+`">`+user["remarks"]+`</a></td>
</tr>`
Expand Down
3 changes: 1 addition & 2 deletions frontend/tenant.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</div>
</div>
<div class="ui container">
<table class="ui celled striped table">
<table class="ui table font-size-15">
<thead>
<tr>
<th><span class="f_tenant_name"></span></th>
Expand All @@ -63,7 +63,6 @@
<th><span class="f_tenant_member_count"></span></th>
<th><span class="f_tenant_billing_type"></span></th>
<th><span class="f_tenant_billing_quota"></span></th>
<th><span class="f_tenant_billing_end"></span></th>
<th><span class="f_operate"></span></th>
</tr>
</thead>
Expand Down
2 changes: 1 addition & 1 deletion frontend/tenant_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

<div class="field">
<label>
<span class="f_billing" ></span> (<span id="billing_info" ></span>)
<span class="f_billing" ></span> (<span id="billing_info" ></span> | <span id="codepower_info" ></span>)
<button class="ui button purple tiny" onClick="Recharge()" type="submit"><i class="wifi icon"></i><span class="f_recharge"></span></button>

</label>
Expand Down
Binary file modified i18n/en/LC_MESSAGES/frontend.mo
Binary file not shown.
8 changes: 4 additions & 4 deletions i18n/en_frontend.po
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ msgstr ""

#: backend/app/pkgs/tools/i18b.py:93
msgid "Requirement List"
msgstr "Requirement History"
msgstr "Task History"

#: backend/app/pkgs/tools/i18b.py:94
msgid "APP List"
Expand Down Expand Up @@ -417,11 +417,11 @@ msgstr ""

#: backend/app/pkgs/tools/i18b.py:129
msgid "Billing type"
msgstr ""
msgstr "Plus type"

#: backend/app/pkgs/tools/i18b.py:130
msgid "Billing quota"
msgstr ""
msgstr "Daily task limit"

#: backend/app/pkgs/tools/i18b.py:131
msgid "Created"
Expand Down Expand Up @@ -631,7 +631,7 @@ msgid "CodePower"
msgstr ""

#: backend/app/pkgs/tools/i18b.py:179
msgid "Weekly development task limit: "
msgid "Daily development task limit: "
msgstr ""

#: backend/app/pkgs/tools/i18b.py:180
Expand Down
8 changes: 4 additions & 4 deletions i18n/en_frontend.po~
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ msgstr ""

#: backend/app/pkgs/tools/i18b.py:93
msgid "Requirement List"
msgstr "Requirement History"
msgstr "Task History"

#: backend/app/pkgs/tools/i18b.py:94
msgid "APP List"
Expand Down Expand Up @@ -417,11 +417,11 @@ msgstr ""

#: backend/app/pkgs/tools/i18b.py:129
msgid "Billing type"
msgstr ""
msgstr "Plus type"

#: backend/app/pkgs/tools/i18b.py:130
msgid "Billing quota"
msgstr ""
msgstr "Daily task limit"

#: backend/app/pkgs/tools/i18b.py:131
msgid "Created"
Expand Down Expand Up @@ -631,7 +631,7 @@ msgid "CodePower"
msgstr ""

#: backend/app/pkgs/tools/i18b.py:179
msgid "Weekly development task limit: "
msgid "Daily development task limit: "
msgstr ""

#: backend/app/pkgs/tools/i18b.py:180
Expand Down
Binary file modified i18n/zh/LC_MESSAGES/frontend.mo
Binary file not shown.
12 changes: 6 additions & 6 deletions i18n/zh_frontend.po
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ msgstr "开始部署"

#: backend/app/pkgs/tools/i18b.py:92
msgid "Start task"
msgstr "开发需求"
msgstr "开始任务"

#: backend/app/pkgs/tools/i18b.py:93
msgid "Requirement List"
msgstr "历史需求"
msgstr "历史任务"

#: backend/app/pkgs/tools/i18b.py:94
msgid "APP List"
Expand Down Expand Up @@ -382,7 +382,7 @@ msgstr "满意度评分"
msgid ""
"Historical requirement recovery is not supported at this time, please visit "
"workspace to obtain the code results"
msgstr "当前版本暂不支持历史需求恢复,您可以访问 workspace 获取之前的代码结果"
msgstr "当前版本暂不支持历史任务恢复,您可以访问 workspace 获取之前的代码结果"

#: backend/app/pkgs/tools/i18b.py:121
msgid "Notice"
Expand Down Expand Up @@ -418,11 +418,11 @@ msgstr "企业简介"

#: backend/app/pkgs/tools/i18b.py:129
msgid "Billing type"
msgstr "账单类型"
msgstr "会员类型"

#: backend/app/pkgs/tools/i18b.py:130
msgid "Billing quota"
msgstr "账单周期内限额"
msgstr "每日任务限额"

#: backend/app/pkgs/tools/i18b.py:131
msgid "Created"
Expand Down Expand Up @@ -627,7 +627,7 @@ msgstr "码力"

#: backend/app/pkgs/tools/i18b.py:179
msgid "Weekly development task limit: "
msgstr "每周开发任务限制:"
msgstr "每日开发任务限制:"

#: backend/app/pkgs/tools/i18b.py:180
msgid "Expired: "
Expand Down
12 changes: 6 additions & 6 deletions i18n/zh_frontend.po~
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ msgstr "开始部署"

#: backend/app/pkgs/tools/i18b.py:92
msgid "Start task"
msgstr "开发需求"
msgstr "开始任务"

#: backend/app/pkgs/tools/i18b.py:93
msgid "Requirement List"
msgstr "历史需求"
msgstr "历史任务"

#: backend/app/pkgs/tools/i18b.py:94
msgid "APP List"
Expand Down Expand Up @@ -382,7 +382,7 @@ msgstr "满意度评分"
msgid ""
"Historical requirement recovery is not supported at this time, please visit "
"workspace to obtain the code results"
msgstr "当前版本暂不支持历史需求恢复,您可以访问 workspace 获取之前的代码结果"
msgstr "当前版本暂不支持历史任务恢复,您可以访问 workspace 获取之前的代码结果"

#: backend/app/pkgs/tools/i18b.py:121
msgid "Notice"
Expand Down Expand Up @@ -418,11 +418,11 @@ msgstr "企业简介"

#: backend/app/pkgs/tools/i18b.py:129
msgid "Billing type"
msgstr "账单类型"
msgstr "会员类型"

#: backend/app/pkgs/tools/i18b.py:130
msgid "Billing quota"
msgstr "账单周期内限额"
msgstr "每日任务限额"

#: backend/app/pkgs/tools/i18b.py:131
msgid "Created"
Expand Down Expand Up @@ -625,7 +625,7 @@ msgstr "码力"

#: backend/app/pkgs/tools/i18b.py:179
msgid "Weekly development task limit: "
msgstr "每周开发任务限制:"
msgstr "每日开发任务限制:"

#: backend/app/pkgs/tools/i18b.py:180
msgid "Expired: "
Expand Down