update for test

This commit is contained in:
LittleBoy 2024-08-29 14:25:42 +08:00
parent e18fa9f15f
commit cd839e923f
3 changed files with 58 additions and 10 deletions

44
Dockerfile-test Normal file
View File

@ -0,0 +1,44 @@
# Dockerfile for a React app build and run
FROM node:18.19.1-alpine AS builder
MAINTAINER yaclty2@gmail.com
WORKDIR /app
# envs 配置
# 应用部署后的URL
ENV APP_SITE_URL ""
# 应用接口前缀
ENV APP_API_URL ""
# Copy source code to the builder
COPY package.json yarn.lock* ./
COPY public ./public
COPY src ./src
COPY index.html ./
COPY *.ts .
COPY *.json .
# Install dependencies and build the app
RUN yarn install
RUN yarn build
# Step 2. Production image, copy all the files and run nginx
FROM nginx:1.26-alpine3.19 AS runner
WORKDIR /app
# envs 配置
ENV APP_API_URL localhost:50000
# nginx配置文件
#COPY nginx.conf /etc/nginx/conf.d/default.conf.template
# 编译文件
COPY --from=builder /app/dist ./
# RUN /bin/sh envsubst /etc/nginx/templates/*.template /etc/nginx/conf.d
#WORKDIR /etc/nginx/conf.d/
#ENTRYPOINT sed -i "s~<!--app_url-->~<script>const APP_SITE_URL='${APP_SITE_URL}';</script>~" /app/index.html && envsubst '$APP_API_URL' < default.conf.template > default.conf && cat default.conf && nginx -g 'daemon off;'
# 暴露80端口
EXPOSE 80
# 启动Nginx服务
CMD ["nginx", "-g", "daemon off;"]

View File

@ -27,7 +27,7 @@
<div class="ldio-yzaezf3dcmj"><div></div></div>
</div>
</div>
<div>Payment System resources loading ...</div>
<div>Payment System loading ...</div>
</div>
</div>
</div>

View File

@ -171,21 +171,24 @@ const Permission = () => {
return list.filter(it => (it.value == userRole));
}, [])
const buildPermission = (it: UserPermission)=>{
it.permission_edit = !!it.permission_edit
it.bill_page = !!it.bill_page
it.apply_page = !!it.apply_page
it.complete_button = !!it.complete_button
it.confirm_button = !!it.confirm_button
it.apply_button = !!it.apply_button
it.manual_payment = !!it.manual_payment
return it;
}
// load user permission list
const loadUserPermissionList = () => {
setState({loading: true})
getUserPermissionList().then(list => {
setState({allList:[...list]})
const userRole = user?.permissions?.role ?? 'staff';
list.forEach(it=>{
it.permission_edit = !!it.permission_edit
it.bill_page = !!it.bill_page
it.apply_page = !!it.apply_page
it.complete_button = !!it.complete_button
it.confirm_button = !!it.confirm_button
it.apply_button = !!it.apply_button
it.manual_payment = !!it.manual_payment
})
list.forEach(it=>buildPermission(it))
if(userRole != 'root') {
list = list.filter(it => (it.role == userRole));
}
@ -244,6 +247,7 @@ const Permission = () => {
await process(value).then((newValue) => {
Toast.success(t('base.save_success'))
const newList = [...state.list];
buildPermission(newValue)
newList[index] = {
...newValue
}