diff --git a/.gitignore b/.gitignore index 6ccfd4e..7dc5ca6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,13 +5,15 @@ __pycache__/ *.pyc dist/ -# CRUD generated directories (auto-generated by xls2ui) -wwwroot/sd_project/ -wwwroot/sd_iteration/ -wwwroot/sd_test_plan/ -wwwroot/sd_test_case/ -wwwroot/sd_bug/ -wwwroot/sd_deploy_env/ +# CRUD generated directories (auto-generated by xls2ui, NOT in repo) +wwwroot/sd_projects/ +wwwroot/sd_iterations/ +wwwroot/sd_test_plans/ +wwwroot/sd_test_cases/ +wwwroot/sd_bugs/ +wwwroot/sd_deploy_envs/ +wwwroot/sd_org_settings/ +wwwroot/sd_project_repos/ # venv py3/ diff --git a/wwwroot/sd_bugs/add_sd_bugs.dspy b/wwwroot/sd_bugs/add_sd_bugs.dspy deleted file mode 100644 index cd1dd5f..0000000 --- a/wwwroot/sd_bugs/add_sd_bugs.dspy +++ /dev/null @@ -1,37 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None -id = params_kw.id -if not id or len(id) > 32: - id = uuid() -ns['id'] = id - - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.C('sd_bugs', ns.copy()) - return { - "widgettype":"Message", - "options":{ - "cwidth":16, - "cheight":9, - "title":"Add Success", - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Add Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_bugs/delete_sd_bugs.dspy b/wwwroot/sd_bugs/delete_sd_bugs.dspy deleted file mode 100644 index e347ea5..0000000 --- a/wwwroot/sd_bugs/delete_sd_bugs.dspy +++ /dev/null @@ -1,33 +0,0 @@ - -ns = { - 'id':params_kw['id'], -} - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.D('sd_bugs', ns) - debug('delete success'); - return { - "widgettype":"Message", - "options":{ - "title":"Delete Success", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"ok" - } - } - -debug('Delete failed'); -return { - "widgettype":"Error", - "options":{ - "title":"Delete Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_bugs/get_sd_bugs.dspy b/wwwroot/sd_bugs/get_sd_bugs.dspy deleted file mode 100644 index 940a017..0000000 --- a/wwwroot/sd_bugs/get_sd_bugs.dspy +++ /dev/null @@ -1,177 +0,0 @@ - -ns = params_kw.copy() - - -debug(f'get_sd_bugs.dspy:{ns=}') -if not ns.get('page'): - ns['page'] = 1 -if not ns.get('sort'): - - - ns['sort'] = ["created_at desc"] - - - -sql = '''select a.*, b.iteration_id_text, c.severity_text, d.priority_text, e.status_text, f.reporter_type_text -from (select * from sd_bugs where 1=1 [[filterstr]]) a left join (select id as iteration_id, - iteration_name as iteration_id_text from sd_iterations where 1 = 1) b on a.iteration_id = b.iteration_id left join (select k as severity, - v as severity_text from appcodes_kv where parentid='sd_bug_severity') c on a.severity = c.severity left join (select k as priority, - v as priority_text from appcodes_kv where parentid='sd_priority') d on a.priority = d.priority left join (select k as status, - v as status_text from appcodes_kv where parentid='sd_bug_status') e on a.status = e.status left join (select k as reporter_type, - v as reporter_type_text from appcodes_kv where parentid='sd_reporter_type') f on a.reporter_type = f.reporter_type''' - -filterjson = params_kw.get('data_filter') -if filterjson and isinstance(filterjson, str): - try: - filterjson = json.loads(filterjson) - except (json.JSONDecodeError, TypeError): - filterjson = None -fields_str=r'''[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "iteration_id", - "title": "迭代ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "case_id", - "title": "关联用例ID", - "type": "str", - "length": 32 - }, - { - "name": "step_name", - "title": "发现步骤名", - "type": "str", - "length": 100 - }, - { - "name": "title", - "title": "Bug标题", - "type": "str", - "length": 300, - "nullable": "no" - }, - { - "name": "description", - "title": "详细描述", - "type": "text" - }, - { - "name": "severity", - "title": "严重程度", - "type": "str", - "length": 10, - "nullable": "no", - "default": "'major'" - }, - { - "name": "priority", - "title": "优先级", - "type": "str", - "length": 10, - "nullable": "no", - "default": "'P1'" - }, - { - "name": "status", - "title": "Bug状态", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'open'" - }, - { - "name": "reporter_type", - "title": "提交人类型", - "type": "str", - "length": 10, - "nullable": "no" - }, - { - "name": "reporter_id", - "title": "提交人ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "assignee_id", - "title": "处理人ID", - "type": "str", - "length": 32 - }, - { - "name": "fix_description", - "title": "修复说明", - "type": "text" - }, - { - "name": "fix_commit", - "title": "修复Commit", - "type": "str", - "length": 100 - }, - { - "name": "verified_by", - "title": "验证人", - "type": "str", - "length": 32 - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp" - }, - { - "name": "closed_at", - "title": "关闭时间", - "type": "timestamp" - } -]''' -ori_fields = json.loads(fields_str) -if not filterjson: - fields = [ f['name'] for f in ori_fields ] - filterjson = default_filterjson(fields, ns) - -filterdic = ns.copy() -filterdic['filterstr'] = '' -filterdic['userorgid'] = '${userorgid}$' -filterdic['userid'] = '${userid}$' -if filterjson: - dbf = DBFilter(filterjson) - conds = dbf.gen(ns) - if conds: - ns.update(dbf.consts) - conds = f' and {conds}' - filterdic['filterstr'] = conds -ac = ArgsConvert('[[', ']]') -vars = ac.findAllVariables(sql) -NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' } -filterdic.update(NameSpace) -sql = ac.convert(sql, filterdic) - -debug(f'{sql=}') -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.sqlPaging(sql, ns) - return r -return { - "total":0, - "rows":[] -} \ No newline at end of file diff --git a/wwwroot/sd_bugs/index.ui b/wwwroot/sd_bugs/index.ui deleted file mode 100644 index b14ba7d..0000000 --- a/wwwroot/sd_bugs/index.ui +++ /dev/null @@ -1,365 +0,0 @@ - -{ - "widgettype":"VBox", - "options":{"cheight":40,"width":"100%"}, - "subwidgets":[{ - "id":"sd_bugs_tbl", - "widgettype":"Tabular", - "options":{ - "width":"100%", - "height":"100%", - - - "title":"Bug管理表", - - - - - "css":"card", - - - "editable":{ - - "new_data_url":"{{entire_url('add_sd_bugs.dspy')}}", - - - "delete_data_url":"{{entire_url('delete_sd_bugs.dspy')}}", - - - "update_data_url":"{{entire_url('update_sd_bugs.dspy')}}" - - }, - - - "data_url":"{{entire_url('./get_sd_bugs.dspy')}}", - - "data_method":"GET", - "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}}, - "row_options":{ - - - - "browserfields": { - "alters": { - "iteration_id": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_iteration_options.dspy')}}", - "valueField": "iteration_id", - "textField": "iteration_id_text" - }, - "severity": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_severity.dspy')}}", - "valueField": "value", - "textField": "text" - }, - "priority": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_priority.dspy')}}", - "valueField": "value", - "textField": "text" - }, - "status": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_bug_status.dspy')}}", - "valueField": "value", - "textField": "text" - }, - "reporter_type": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_reporter_type.dspy')}}", - "valueField": "value", - "textField": "text" - } - } -}, - - - "editexclouded":[ - "id", - "created_at", - "updated_at", - "closed_at", - "verified_by", - "fix_commit" -], - - "fields":[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "主键ID" - }, - { - "name": "iteration_id", - "title": "迭代ID", - "type": "str", - "length": 32, - "nullable": "no", - "label": "迭代ID", - "uitype": "code", - "valueField": "iteration_id", - "textField": "iteration_id_text", - "params": { - "dbname": "{{'sage'}}", - "table": "sd_iterations", - "tblvalue": "id", - "tbltext": "iteration_name", - "valueField": "iteration_id", - "textField": "iteration_id_text" - }, - "dataurl": "{{entire_url('../api/get_iteration_options.dspy')}}" - }, - { - "name": "case_id", - "title": "关联用例ID", - "type": "str", - "length": 32, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "关联用例ID" - }, - { - "name": "step_name", - "title": "发现步骤名", - "type": "str", - "length": 100, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "发现步骤名" - }, - { - "name": "title", - "title": "Bug标题", - "type": "str", - "length": 300, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "Bug标题" - }, - { - "name": "description", - "title": "详细描述", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "详细描述" - }, - { - "name": "severity", - "title": "严重程度", - "type": "str", - "length": 10, - "nullable": "no", - "default": "'major'", - "label": "严重程度", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_bug_severity'" - }, - "dataurl": "{{entire_url('../api/get_search_severity.dspy')}}" - }, - { - "name": "priority", - "title": "优先级", - "type": "str", - "length": 10, - "nullable": "no", - "default": "'P1'", - "label": "优先级", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_priority'" - }, - "dataurl": "{{entire_url('../api/get_search_priority.dspy')}}" - }, - { - "name": "status", - "title": "Bug状态", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'open'", - "label": "Bug状态", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_bug_status'" - }, - "dataurl": "{{entire_url('../api/get_search_bug_status.dspy')}}" - }, - { - "name": "reporter_type", - "title": "提交人类型", - "type": "str", - "length": 10, - "nullable": "no", - "label": "提交人类型", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_reporter_type'" - }, - "dataurl": "{{entire_url('../api/get_search_reporter_type.dspy')}}" - }, - { - "name": "reporter_id", - "title": "提交人ID", - "type": "str", - "length": 32, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "提交人ID" - }, - { - "name": "assignee_id", - "title": "处理人ID", - "type": "str", - "length": 32, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "处理人ID" - }, - { - "name": "fix_description", - "title": "修复说明", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "修复说明" - }, - { - "name": "fix_commit", - "title": "修复Commit", - "type": "str", - "length": 100, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "修复Commit" - }, - { - "name": "verified_by", - "title": "验证人", - "type": "str", - "length": 32, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "验证人" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "创建时间" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "更新时间" - }, - { - "name": "closed_at", - "title": "关闭时间", - "type": "timestamp", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "关闭时间" - } -] - }, - - - - "data_filter":{ - "AND": [ - { - "field": "iteration_id", - "op": "=", - "var": "iteration_input" - }, - { - "field": "severity", - "op": "=", - "var": "severity_input" - }, - { - "field": "status", - "op": "=", - "var": "status_input" - }, - { - "field": "title", - "op": "LIKE", - "var": "title_input" - } - ] -}, - - - - - - "page_rows":160, - "cache_limit":5 - } - - ,"binds":[] - -}] -} \ No newline at end of file diff --git a/wwwroot/sd_bugs/update_sd_bugs.dspy b/wwwroot/sd_bugs/update_sd_bugs.dspy deleted file mode 100644 index f710ca0..0000000 --- a/wwwroot/sd_bugs/update_sd_bugs.dspy +++ /dev/null @@ -1,36 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None - - - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - - r = await sor.U('sd_bugs', ns) - debug('update success'); - return { - "widgettype":"Message", - "options":{ - "title":"Update Success", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Update Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_deploy_envs/add_sd_deploy_envs.dspy b/wwwroot/sd_deploy_envs/add_sd_deploy_envs.dspy deleted file mode 100644 index 9dd71ba..0000000 --- a/wwwroot/sd_deploy_envs/add_sd_deploy_envs.dspy +++ /dev/null @@ -1,43 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None -id = params_kw.id -if not id or len(id) > 32: - id = uuid() -ns['id'] = id - -if params_kw.get('db_password'): - ns['db_password'] = password_encode(params_kw.get('db_password')) - -if params_kw.get('ssh_key_path'): - ns['ssh_key_path'] = password_encode(params_kw.get('ssh_key_path')) - - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.C('sd_deploy_envs', ns.copy()) - return { - "widgettype":"Message", - "options":{ - "cwidth":16, - "cheight":9, - "title":"Add Success", - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Add Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_deploy_envs/delete_sd_deploy_envs.dspy b/wwwroot/sd_deploy_envs/delete_sd_deploy_envs.dspy deleted file mode 100644 index 9dbd74a..0000000 --- a/wwwroot/sd_deploy_envs/delete_sd_deploy_envs.dspy +++ /dev/null @@ -1,33 +0,0 @@ - -ns = { - 'id':params_kw['id'], -} - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.D('sd_deploy_envs', ns) - debug('delete success'); - return { - "widgettype":"Message", - "options":{ - "title":"Delete Success", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"ok" - } - } - -debug('Delete failed'); -return { - "widgettype":"Error", - "options":{ - "title":"Delete Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_deploy_envs/get_sd_deploy_envs.dspy b/wwwroot/sd_deploy_envs/get_sd_deploy_envs.dspy deleted file mode 100644 index fd3d70a..0000000 --- a/wwwroot/sd_deploy_envs/get_sd_deploy_envs.dspy +++ /dev/null @@ -1,183 +0,0 @@ - -ns = params_kw.copy() - - -debug(f'get_sd_deploy_envs.dspy:{ns=}') -if not ns.get('page'): - ns['page'] = 1 -if not ns.get('sort'): - - - ns['sort'] = ["env_type"] - - - -sql = '''select a.*, b.project_id_text, c.env_type_text, d.status_text -from (select * from sd_deploy_envs where 1=1 [[filterstr]]) a left join (select id as project_id, - name as project_id_text from sd_projects where 1 = 1) b on a.project_id = b.project_id left join (select k as env_type, - v as env_type_text from appcodes_kv where parentid='sd_env_type') c on a.env_type = c.env_type left join (select k as status, - v as status_text from appcodes_kv where parentid='sd_env_status') d on a.status = d.status''' - -filterjson = params_kw.get('data_filter') -if filterjson and isinstance(filterjson, str): - try: - filterjson = json.loads(filterjson) - except (json.JSONDecodeError, TypeError): - filterjson = None -fields_str=r'''[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "project_id", - "title": "项目ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "env_type", - "title": "环境类型", - "type": "str", - "length": 20, - "nullable": "no" - }, - { - "name": "host", - "title": "SSH主机地址", - "type": "str", - "length": 200, - "nullable": "no" - }, - { - "name": "port", - "title": "SSH端口", - "type": "int", - "nullable": "no", - "default": "22" - }, - { - "name": "user", - "title": "SSH用户", - "type": "str", - "length": 100, - "nullable": "no" - }, - { - "name": "ssh_key_path", - "title": "SSH密钥路径", - "type": "str", - "length": 500 - }, - { - "name": "sudo_enabled", - "title": "免密Sudo", - "type": "str", - "length": 1, - "nullable": "no", - "default": "'N'" - }, - { - "name": "deploy_path", - "title": "部署目录", - "type": "str", - "length": 500, - "nullable": "no" - }, - { - "name": "python_path", - "title": "Python路径", - "type": "str", - "length": 500 - }, - { - "name": "db_host", - "title": "数据库地址", - "type": "str", - "length": 200 - }, - { - "name": "db_port", - "title": "数据库端口", - "type": "int", - "default": "3306" - }, - { - "name": "db_name", - "title": "数据库名", - "type": "str", - "length": 100 - }, - { - "name": "db_user", - "title": "数据库用户", - "type": "str", - "length": 100 - }, - { - "name": "db_password", - "title": "数据库密码(加密)", - "type": "str", - "length": 500 - }, - { - "name": "status", - "title": "环境状态", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'configured'" - }, - { - "name": "verified_at", - "title": "最近验证时间", - "type": "timestamp" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp" - } -]''' -ori_fields = json.loads(fields_str) -if not filterjson: - fields = [ f['name'] for f in ori_fields ] - filterjson = default_filterjson(fields, ns) - -filterdic = ns.copy() -filterdic['filterstr'] = '' -filterdic['userorgid'] = '${userorgid}$' -filterdic['userid'] = '${userid}$' -if filterjson: - dbf = DBFilter(filterjson) - conds = dbf.gen(ns) - if conds: - ns.update(dbf.consts) - conds = f' and {conds}' - filterdic['filterstr'] = conds -ac = ArgsConvert('[[', ']]') -vars = ac.findAllVariables(sql) -NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' } -filterdic.update(NameSpace) -sql = ac.convert(sql, filterdic) - -debug(f'{sql=}') -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.sqlPaging(sql, ns) - return r -return { - "total":0, - "rows":[] -} \ No newline at end of file diff --git a/wwwroot/sd_deploy_envs/index.ui b/wwwroot/sd_deploy_envs/index.ui deleted file mode 100644 index 0b48546..0000000 --- a/wwwroot/sd_deploy_envs/index.ui +++ /dev/null @@ -1,322 +0,0 @@ - -{ - "widgettype":"VBox", - "options":{"cheight":40,"width":"100%"}, - "subwidgets":[{ - "id":"sd_deploy_envs_tbl", - "widgettype":"Tabular", - "options":{ - "width":"100%", - "height":"100%", - - - "title":"部署环境表", - - - - - "css":"card", - - - "editable":{ - - "new_data_url":"{{entire_url('add_sd_deploy_envs.dspy')}}", - - - "delete_data_url":"{{entire_url('delete_sd_deploy_envs.dspy')}}", - - - "update_data_url":"{{entire_url('update_sd_deploy_envs.dspy')}}" - - }, - - - "data_url":"{{entire_url('./get_sd_deploy_envs.dspy')}}", - - "data_method":"GET", - "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}}, - "row_options":{ - - - - "browserfields": { - "exclouded": [ - "db_password", - "ssh_key_path" - ], - "alters": { - "project_id": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_project_options.dspy')}}", - "valueField": "project_id", - "textField": "project_id_text" - }, - "env_type": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_env_type.dspy')}}", - "valueField": "value", - "textField": "text" - }, - "status": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_env_status.dspy')}}", - "valueField": "value", - "textField": "text" - } - } -}, - - - "editexclouded":[ - "id", - "verified_at", - "created_at", - "updated_at" -], - - "fields":[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "主键ID" - }, - { - "name": "project_id", - "title": "项目ID", - "type": "str", - "length": 32, - "nullable": "no", - "label": "项目ID", - "uitype": "code", - "valueField": "project_id", - "textField": "project_id_text", - "params": { - "dbname": "{{'sage'}}", - "table": "sd_projects", - "tblvalue": "id", - "tbltext": "name", - "valueField": "project_id", - "textField": "project_id_text" - }, - "dataurl": "{{entire_url('../api/get_project_options.dspy')}}" - }, - { - "name": "env_type", - "title": "环境类型", - "type": "str", - "length": 20, - "nullable": "no", - "label": "环境类型", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_env_type'" - }, - "dataurl": "{{entire_url('../api/get_search_env_type.dspy')}}" - }, - { - "name": "host", - "title": "SSH主机地址", - "type": "str", - "length": 200, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "SSH主机地址" - }, - { - "name": "port", - "title": "SSH端口", - "type": "int", - "nullable": "no", - "default": "22", - "length": 0, - "uitype": "int", - "datatype": "int", - "label": "SSH端口" - }, - { - "name": "user", - "title": "SSH用户", - "type": "str", - "length": 100, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "SSH用户" - }, - { - "name": "ssh_key_path", - "title": "SSH密钥路径", - "type": "str", - "length": 500, - "cwidth": 18, - "uitype": "password", - "datatype": "str", - "label": "SSH密钥路径" - }, - { - "name": "sudo_enabled", - "title": "免密Sudo", - "type": "str", - "length": 1, - "nullable": "no", - "default": "'N'", - "cwidth": 4, - "uitype": "str", - "datatype": "str", - "label": "免密Sudo" - }, - { - "name": "deploy_path", - "title": "部署目录", - "type": "str", - "length": 500, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "部署目录" - }, - { - "name": "python_path", - "title": "Python路径", - "type": "str", - "length": 500, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "Python路径" - }, - { - "name": "db_host", - "title": "数据库地址", - "type": "str", - "length": 200, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "数据库地址" - }, - { - "name": "db_port", - "title": "数据库端口", - "type": "int", - "default": "3306", - "length": 0, - "uitype": "int", - "datatype": "int", - "label": "数据库端口" - }, - { - "name": "db_name", - "title": "数据库名", - "type": "str", - "length": 100, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "数据库名" - }, - { - "name": "db_user", - "title": "数据库用户", - "type": "str", - "length": 100, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "数据库用户" - }, - { - "name": "db_password", - "title": "数据库密码(加密)", - "type": "str", - "length": 500, - "cwidth": 18, - "uitype": "password", - "datatype": "str", - "label": "数据库密码(加密)" - }, - { - "name": "status", - "title": "环境状态", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'configured'", - "label": "环境状态", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_env_status'" - }, - "dataurl": "{{entire_url('../api/get_search_env_status.dspy')}}" - }, - { - "name": "verified_at", - "title": "最近验证时间", - "type": "timestamp", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "最近验证时间" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "创建时间" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "更新时间" - } -] - }, - - - - - - - - "page_rows":160, - "cache_limit":5 - } - - ,"binds":[] - -}] -} \ No newline at end of file diff --git a/wwwroot/sd_deploy_envs/update_sd_deploy_envs.dspy b/wwwroot/sd_deploy_envs/update_sd_deploy_envs.dspy deleted file mode 100644 index 2cd0502..0000000 --- a/wwwroot/sd_deploy_envs/update_sd_deploy_envs.dspy +++ /dev/null @@ -1,42 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None - - - -if params_kw.get('db_password'): - ns['db_password'] = password_encode(params_kw.get('db_password')) - -if params_kw.get('ssh_key_path'): - ns['ssh_key_path'] = password_encode(params_kw.get('ssh_key_path')) - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - - r = await sor.U('sd_deploy_envs', ns) - debug('update success'); - return { - "widgettype":"Message", - "options":{ - "title":"Update Success", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Update Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_iterations/add_sd_iterations.dspy b/wwwroot/sd_iterations/add_sd_iterations.dspy deleted file mode 100644 index 3680219..0000000 --- a/wwwroot/sd_iterations/add_sd_iterations.dspy +++ /dev/null @@ -1,37 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None -id = params_kw.id -if not id or len(id) > 32: - id = uuid() -ns['id'] = id - - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.C('sd_iterations', ns.copy()) - return { - "widgettype":"Message", - "options":{ - "cwidth":16, - "cheight":9, - "title":"Add Success", - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Add Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_iterations/delete_sd_iterations.dspy b/wwwroot/sd_iterations/delete_sd_iterations.dspy deleted file mode 100644 index ea87496..0000000 --- a/wwwroot/sd_iterations/delete_sd_iterations.dspy +++ /dev/null @@ -1,33 +0,0 @@ - -ns = { - 'id':params_kw['id'], -} - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.D('sd_iterations', ns) - debug('delete success'); - return { - "widgettype":"Message", - "options":{ - "title":"Delete Success", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"ok" - } - } - -debug('Delete failed'); -return { - "widgettype":"Error", - "options":{ - "title":"Delete Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_iterations/get_sd_iterations.dspy b/wwwroot/sd_iterations/get_sd_iterations.dspy deleted file mode 100644 index 3cec235..0000000 --- a/wwwroot/sd_iterations/get_sd_iterations.dspy +++ /dev/null @@ -1,142 +0,0 @@ - -ns = params_kw.copy() - - -debug(f'get_sd_iterations.dspy:{ns=}') -if not ns.get('page'): - ns['page'] = 1 -if not ns.get('sort'): - - - ns['sort'] = ["created_at desc"] - - - -sql = '''select a.*, b.project_id_text, c.iteration_type_text, d.status_text -from (select * from sd_iterations where 1=1 [[filterstr]]) a left join (select id as project_id, - name as project_id_text from sd_projects where 1 = 1) b on a.project_id = b.project_id left join (select k as iteration_type, - v as iteration_type_text from appcodes_kv where parentid='sd_iteration_type') c on a.iteration_type = c.iteration_type left join (select k as status, - v as status_text from appcodes_kv where parentid='sd_iteration_status') d on a.status = d.status''' - -filterjson = params_kw.get('data_filter') -if filterjson and isinstance(filterjson, str): - try: - filterjson = json.loads(filterjson) - except (json.JSONDecodeError, TypeError): - filterjson = None -fields_str=r'''[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "project_id", - "title": "项目ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "iteration_name", - "title": "迭代名称", - "type": "str", - "length": 200, - "nullable": "no" - }, - { - "name": "iteration_type", - "title": "迭代类型", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'new_feature'" - }, - { - "name": "scope", - "title": "迭代范围(JSON)", - "type": "text" - }, - { - "name": "task_id", - "title": "关联Pipeline任务ID", - "type": "str", - "length": 32 - }, - { - "name": "status", - "title": "迭代状态", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'planning'" - }, - { - "name": "priority", - "title": "优先级", - "type": "int", - "nullable": "no", - "default": "5" - }, - { - "name": "started_at", - "title": "开始时间", - "type": "timestamp" - }, - { - "name": "completed_at", - "title": "完成时间", - "type": "timestamp" - }, - { - "name": "created_by", - "title": "创建人", - "type": "str", - "length": 32 - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp" - } -]''' -ori_fields = json.loads(fields_str) -if not filterjson: - fields = [ f['name'] for f in ori_fields ] - filterjson = default_filterjson(fields, ns) - -filterdic = ns.copy() -filterdic['filterstr'] = '' -filterdic['userorgid'] = '${userorgid}$' -filterdic['userid'] = '${userid}$' -if filterjson: - dbf = DBFilter(filterjson) - conds = dbf.gen(ns) - if conds: - ns.update(dbf.consts) - conds = f' and {conds}' - filterdic['filterstr'] = conds -ac = ArgsConvert('[[', ']]') -vars = ac.findAllVariables(sql) -NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' } -filterdic.update(NameSpace) -sql = ac.convert(sql, filterdic) - -debug(f'{sql=}') -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.sqlPaging(sql, ns) - return r -return { - "total":0, - "rows":[] -} \ No newline at end of file diff --git a/wwwroot/sd_iterations/index.ui b/wwwroot/sd_iterations/index.ui deleted file mode 100644 index 9f69dce..0000000 --- a/wwwroot/sd_iterations/index.ui +++ /dev/null @@ -1,346 +0,0 @@ - -{ - "widgettype":"VBox", - "options":{"cheight":40,"width":"100%"}, - "subwidgets":[{ - "id":"sd_iterations_tbl", - "widgettype":"Tabular", - "options":{ - "width":"100%", - "height":"100%", - - - "title":"SDLC迭代表", - - - - - "toolbar":{ - "tools": [ - { - "selected_row": true, - "name": "sd_bugs", - "icon": "{{entire_url('/imgs/sd_bugs.svg')}}", - "label": "Bug列表" - }, - { - "selected_row": true, - "name": "sd_test_plans", - "icon": "{{entire_url('/imgs/sd_test_plans.svg')}}", - "label": "测试方案" - } - ] -}, - - "css":"card", - - - "editable":{ - - "new_data_url":"{{entire_url('add_sd_iterations.dspy')}}", - - - "delete_data_url":"{{entire_url('delete_sd_iterations.dspy')}}", - - - "update_data_url":"{{entire_url('update_sd_iterations.dspy')}}" - - }, - - - "data_url":"{{entire_url('./get_sd_iterations.dspy')}}", - - "data_method":"GET", - "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}}, - "row_options":{ - - - - "browserfields": { - "exclouded": [ - "scope" - ], - "alters": { - "project_id": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_project_options.dspy')}}", - "valueField": "project_id", - "textField": "project_id_text" - }, - "iteration_type": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_iteration_type.dspy')}}", - "valueField": "value", - "textField": "text" - }, - "status": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_iteration_status.dspy')}}", - "valueField": "value", - "textField": "text" - } - } -}, - - - "editexclouded":[ - "id", - "task_id", - "started_at", - "completed_at", - "created_at", - "updated_at" -], - - "fields":[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "主键ID" - }, - { - "name": "project_id", - "title": "项目ID", - "type": "str", - "length": 32, - "nullable": "no", - "label": "项目ID", - "uitype": "code", - "valueField": "project_id", - "textField": "project_id_text", - "params": { - "dbname": "{{'sage'}}", - "table": "sd_projects", - "tblvalue": "id", - "tbltext": "name", - "valueField": "project_id", - "textField": "project_id_text" - }, - "dataurl": "{{entire_url('../api/get_project_options.dspy')}}" - }, - { - "name": "iteration_name", - "title": "迭代名称", - "type": "str", - "length": 200, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "迭代名称" - }, - { - "name": "iteration_type", - "title": "迭代类型", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'new_feature'", - "label": "迭代类型", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_iteration_type'" - }, - "dataurl": "{{entire_url('../api/get_search_iteration_type.dspy')}}" - }, - { - "name": "scope", - "title": "迭代范围(JSON)", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "迭代范围(JSON)" - }, - { - "name": "task_id", - "title": "关联Pipeline任务ID", - "type": "str", - "length": 32, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "关联Pipeline任务ID" - }, - { - "name": "status", - "title": "迭代状态", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'planning'", - "label": "迭代状态", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_iteration_status'" - }, - "dataurl": "{{entire_url('../api/get_search_iteration_status.dspy')}}" - }, - { - "name": "priority", - "title": "优先级", - "type": "int", - "nullable": "no", - "default": "5", - "length": 0, - "uitype": "int", - "datatype": "int", - "label": "优先级" - }, - { - "name": "started_at", - "title": "开始时间", - "type": "timestamp", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "开始时间" - }, - { - "name": "completed_at", - "title": "完成时间", - "type": "timestamp", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "完成时间" - }, - { - "name": "created_by", - "title": "创建人", - "type": "str", - "length": 32, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "创建人" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "创建时间" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "更新时间" - } -] - }, - - - - "data_filter":{ - "AND": [ - { - "field": "project_id", - "op": "=", - "var": "project_input" - }, - { - "field": "iteration_name", - "op": "LIKE", - "var": "name_input" - }, - { - "field": "status", - "op": "=", - "var": "status_input" - } - ] -}, - - - - - - "page_rows":160, - "cache_limit":5 - } - - ,"binds":[ - { - "wid": "self", - "event": "sd_bugs", - "actiontype": "urlwidget", - "target": "PopupWindow", - "popup_options": { - "title": "Bug列表", - "icon": "{{entire_url('/appbase/get_icon.dspy')}}?id=sd_bugs", - "resizable": true, - "height": "70%", - "width": "70%" - }, - "params_mapping": { - "mapping": { - "id": "iteration_id", - "referer_widget": "referer_widget" - }, - "need_other": false - }, - "options": { - "method": "POST", - "params": {}, - "url": "{{entire_url('../sd_bug_list?iteration_id=${id}')}}" - } - }, - { - "wid": "self", - "event": "sd_test_plans", - "actiontype": "urlwidget", - "target": "PopupWindow", - "popup_options": { - "title": "测试方案", - "icon": "{{entire_url('/appbase/get_icon.dspy')}}?id=sd_test_plans", - "resizable": true, - "height": "70%", - "width": "70%" - }, - "params_mapping": { - "mapping": { - "id": "iteration_id", - "referer_widget": "referer_widget" - }, - "need_other": false - }, - "options": { - "method": "POST", - "params": {}, - "url": "{{entire_url('../sd_test_plan_list?iteration_id=${id}')}}" - } - } -] - -}] -} \ No newline at end of file diff --git a/wwwroot/sd_iterations/update_sd_iterations.dspy b/wwwroot/sd_iterations/update_sd_iterations.dspy deleted file mode 100644 index 03d0b99..0000000 --- a/wwwroot/sd_iterations/update_sd_iterations.dspy +++ /dev/null @@ -1,36 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None - - - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - - r = await sor.U('sd_iterations', ns) - debug('update success'); - return { - "widgettype":"Message", - "options":{ - "title":"Update Success", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Update Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_org_settings/add_sd_org_settings.dspy b/wwwroot/sd_org_settings/add_sd_org_settings.dspy deleted file mode 100644 index 66078a8..0000000 --- a/wwwroot/sd_org_settings/add_sd_org_settings.dspy +++ /dev/null @@ -1,55 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None -id = params_kw.id -if not id or len(id) > 32: - id = uuid() -ns['id'] = id - - - -userorgid = await get_userorgid() -if not userorgid: - return { - "widgettype":"Error", - "options":{ - "title":"Authorization Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"Please login" - } - } -ns['org_id'] = userorgid - - -db = DBPools() -dbname = get_module_dbname('pipeline-sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.C('sd_org_settings', ns.copy()) - _new_rows = await sor.sqlExe("SELECT * FROM sd_org_settings WHERE None = ${id}$", {'id': id}) - _user_data = _new_rows[0] if _new_rows else ns - return { - "widgettype":"Message", - "options":{ - "cwidth":16, - "cheight":9, - "title":"Add Success", - "timeout":3, - "message":"ok", - "user_data": _user_data - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Add Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_org_settings/delete_sd_org_settings.dspy b/wwwroot/sd_org_settings/delete_sd_org_settings.dspy deleted file mode 100644 index 88148f7..0000000 --- a/wwwroot/sd_org_settings/delete_sd_org_settings.dspy +++ /dev/null @@ -1,47 +0,0 @@ - -ns = { - 'id':params_kw['id'], -} - - -userorgid = await get_userorgid() -if not userorgid: - return { - "widgettype":"Error", - "options":{ - "title":"Authorization Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"Please login" - } - } -ns['org_id'] = userorgid - -db = DBPools() -dbname = get_module_dbname('pipeline-sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.D('sd_org_settings', ns) - debug('delete success'); - return { - "widgettype":"Message", - "options":{ - "title":"Delete Success", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"ok" - } - } - -debug('Delete failed'); -return { - "widgettype":"Error", - "options":{ - "title":"Delete Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_org_settings/get_sd_org_settings.dspy b/wwwroot/sd_org_settings/get_sd_org_settings.dspy deleted file mode 100644 index 40a7253..0000000 --- a/wwwroot/sd_org_settings/get_sd_org_settings.dspy +++ /dev/null @@ -1,115 +0,0 @@ - -ns = params_kw.copy() - - -userorgid = await get_userorgid() -if not userorgid: - return { - "widgettype":"Error", - "options":{ - "title":"Authorization Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"Please login" - } - } -ns['org_id'] = userorgid -ns['userorgid'] = userorgid - -debug(f'get_sd_org_settings.dspy:{ns=}') -if not ns.get('page'): - ns['page'] = 1 -if not ns.get('sort'): - - - ns['sort'] = ["created_at desc"] - - - -sql = '''select * from sd_org_settings where 1=1 [[filterstr]]''' - - -filterjson = None -fields_str=r'''[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "org_id", - "title": "组织ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "workspace_root", - "title": "工作空间根路径", - "type": "str", - "length": 500, - "nullable": "no" - }, - { - "name": "skills_dir", - "title": "企业Skills目录", - "type": "str", - "length": 500 - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp" - } -]''' -ori_fields = json.loads(fields_str) -fields = [ f['name'] for f in ori_fields ] -filterjson = default_filterjson(fields, ns) - - -# 确保 logined 过滤条件始终生效 -if filterjson: - if not isinstance(filterjson, dict) or 'AND' not in filterjson: - filterjson = {'AND': [filterjson] if filterjson else []} - - filterjson['AND'].append({'field': 'org_id', 'op': '=', 'var': '__logined_orgid__'}) - ns['__logined_orgid__'] = userorgid - - - -filterdic = ns.copy() -filterdic['filterstr'] = '' -filterdic['userorgid'] = '${userorgid}$' -filterdic['userid'] = '${userid}$' -if filterjson: - dbf = DBFilter(filterjson) - conds = dbf.gen(ns) - if conds: - ns.update(dbf.consts) - conds = f' and {conds}' - filterdic['filterstr'] = conds -ac = ArgsConvert('[[', ']]') -vars = ac.findAllVariables(sql) -NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' } -filterdic.update(NameSpace) -sql = ac.convert(sql, filterdic) - -debug(f'{sql=}') -db = DBPools() -dbname = get_module_dbname('pipeline-sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.sqlPaging(sql, ns) - return r -return { - "total":0, - "rows":[] -} \ No newline at end of file diff --git a/wwwroot/sd_org_settings/index.ui b/wwwroot/sd_org_settings/index.ui deleted file mode 100644 index 9c51b75..0000000 --- a/wwwroot/sd_org_settings/index.ui +++ /dev/null @@ -1,135 +0,0 @@ - -{ - "widgettype":"VBox", - "options":{"height":"100%","width":"100%"}, - "subwidgets":[ -{ - "id":"sd_org_settings_tbl", - "widgettype":"Tabular", - "options":{ - "width":"100%", - "height":"100%", - - - "title":"组织SDLC设置", - - - - - "css":"card", - - - "editable":{ - - "new_data_url":"{{entire_url('add_sd_org_settings.dspy')}}", - - - "delete_data_url":"{{entire_url('delete_sd_org_settings.dspy')}}", - - - "update_data_url":"{{entire_url('update_sd_org_settings.dspy')}}" - - - }, - - - "data_url":"{{entire_url('./get_sd_org_settings.dspy')}}", - - "data_method":"GET", - "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}}, - "row_options":{ - - - - "browserfields": { - "exclouded": [] -}, - - - "editexclouded":[ - "id", - "created_at", - "updated_at", - "org_id" -], - - "fields":[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "主键ID" - }, - { - "name": "org_id", - "title": "组织ID", - "type": "str", - "length": 32, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "组织ID" - }, - { - "name": "workspace_root", - "title": "工作空间根路径", - "type": "str", - "length": 500, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "工作空间根路径" - }, - { - "name": "skills_dir", - "title": "企业Skills目录", - "type": "str", - "length": 500, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "企业Skills目录" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "创建时间" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "更新时间" - } -] - }, - - - - - - - - "page_rows":160, - "cache_limit":5 - } - - ,"binds":[] - -}] -} \ No newline at end of file diff --git a/wwwroot/sd_org_settings/update_sd_org_settings.dspy b/wwwroot/sd_org_settings/update_sd_org_settings.dspy deleted file mode 100644 index 4d2a30b..0000000 --- a/wwwroot/sd_org_settings/update_sd_org_settings.dspy +++ /dev/null @@ -1,78 +0,0 @@ - -ns = params_kw.copy() -for k,v in list(ns.items()): - if v == 'NaN' or v == 'null' or v == '' or v is None: - if k != 'id': - del ns[k] - else: - ns[k] = None if v in ('NaN', 'null') else v - - -userorgid = await get_userorgid() -if not userorgid: - return { - "widgettype":"Error", - "options":{ - "title":"Authorization Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"Please login" - } - } -ns['org_id'] = userorgid - - - - -db = DBPools() -dbname = get_module_dbname('pipeline-sdlc') -async with db.sqlorContext(dbname) as sor: - - ns1 = { - - "org_id": userorgid, - - - "id": params_kw.id - } - recs = await sor.R('sd_org_settings', ns1) - if len(recs) < 1: - return { - "widgettype":"Error", - "options":{ - "title":"Update Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"Record no exist or with wrong ownership" - } - } - - tblfields = [{"name":"id","title":"主键ID","type":"str","length":32,"nullable":"no"},{"name":"org_id","title":"组织ID","type":"str","length":32,"nullable":"no"},{"name":"workspace_root","title":"工作空间根路径","type":"str","length":500,"nullable":"no"},{"name":"skills_dir","title":"企业Skills目录","type":"str","length":500},{"name":"created_at","title":"创建时间","type":"timestamp","nullable":"no"},{"name":"updated_at","title":"更新时间","type":"timestamp"}] - tblfname = [ f['name'] for f in tblfields ] - other_keys = [ k for k in ns.keys() if k in tblfname and k != 'id' ] - if len(other_keys) > 0: - r = await sor.U('sd_org_settings', ns) - debug('update success'); - return { - "widgettype":"Message", - "options":{ - "title":"Update Success", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Update Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_project_repos/add_sd_project_repos.dspy b/wwwroot/sd_project_repos/add_sd_project_repos.dspy deleted file mode 100644 index a70a60d..0000000 --- a/wwwroot/sd_project_repos/add_sd_project_repos.dspy +++ /dev/null @@ -1,55 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None -id = params_kw.id -if not id or len(id) > 32: - id = uuid() -ns['id'] = id - - - -userorgid = await get_userorgid() -if not userorgid: - return { - "widgettype":"Error", - "options":{ - "title":"Authorization Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"Please login" - } - } -ns['org_id'] = userorgid - - -db = DBPools() -dbname = get_module_dbname('pipeline-sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.C('sd_project_repos', ns.copy()) - _new_rows = await sor.sqlExe("SELECT * FROM sd_project_repos WHERE None = ${id}$", {'id': id}) - _user_data = _new_rows[0] if _new_rows else ns - return { - "widgettype":"Message", - "options":{ - "cwidth":16, - "cheight":9, - "title":"Add Success", - "timeout":3, - "message":"ok", - "user_data": _user_data - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Add Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_project_repos/delete_sd_project_repos.dspy b/wwwroot/sd_project_repos/delete_sd_project_repos.dspy deleted file mode 100644 index 275c645..0000000 --- a/wwwroot/sd_project_repos/delete_sd_project_repos.dspy +++ /dev/null @@ -1,47 +0,0 @@ - -ns = { - 'id':params_kw['id'], -} - - -userorgid = await get_userorgid() -if not userorgid: - return { - "widgettype":"Error", - "options":{ - "title":"Authorization Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"Please login" - } - } -ns['org_id'] = userorgid - -db = DBPools() -dbname = get_module_dbname('pipeline-sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.D('sd_project_repos', ns) - debug('delete success'); - return { - "widgettype":"Message", - "options":{ - "title":"Delete Success", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"ok" - } - } - -debug('Delete failed'); -return { - "widgettype":"Error", - "options":{ - "title":"Delete Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_project_repos/get_sd_project_repos.dspy b/wwwroot/sd_project_repos/get_sd_project_repos.dspy deleted file mode 100644 index 1da1122..0000000 --- a/wwwroot/sd_project_repos/get_sd_project_repos.dspy +++ /dev/null @@ -1,133 +0,0 @@ - -ns = params_kw.copy() - - -userorgid = await get_userorgid() -if not userorgid: - return { - "widgettype":"Error", - "options":{ - "title":"Authorization Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"Please login" - } - } -ns['org_id'] = userorgid -ns['userorgid'] = userorgid - -debug(f'get_sd_project_repos.dspy:{ns=}') -if not ns.get('page'): - ns['page'] = 1 -if not ns.get('sort'): - - - ns['sort'] = ["created_at desc"] - - - -sql = '''select * from sd_project_repos where 1=1 [[filterstr]]''' - - -filterjson = None -fields_str=r'''[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "project_id", - "title": "项目ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "repo_name", - "title": "仓库别名", - "type": "str", - "length": 100, - "nullable": "no" - }, - { - "name": "repo_url", - "title": "Git地址", - "type": "str", - "length": 500, - "nullable": "no" - }, - { - "name": "default_branch", - "title": "默认分支", - "type": "str", - "length": 100, - "nullable": "no", - "default": "'main'" - }, - { - "name": "local_path", - "title": "本地相对路径", - "type": "str", - "length": 200 - }, - { - "name": "org_id", - "title": "组织ID", - "type": "str", - "length": 32, - "nullable": "no", - "default": "'0'" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no" - } -]''' -ori_fields = json.loads(fields_str) -fields = [ f['name'] for f in ori_fields ] -filterjson = default_filterjson(fields, ns) - - -# 确保 logined 过滤条件始终生效 -if filterjson: - if not isinstance(filterjson, dict) or 'AND' not in filterjson: - filterjson = {'AND': [filterjson] if filterjson else []} - - filterjson['AND'].append({'field': 'org_id', 'op': '=', 'var': '__logined_orgid__'}) - ns['__logined_orgid__'] = userorgid - - - -filterdic = ns.copy() -filterdic['filterstr'] = '' -filterdic['userorgid'] = '${userorgid}$' -filterdic['userid'] = '${userid}$' -if filterjson: - dbf = DBFilter(filterjson) - conds = dbf.gen(ns) - if conds: - ns.update(dbf.consts) - conds = f' and {conds}' - filterdic['filterstr'] = conds -ac = ArgsConvert('[[', ']]') -vars = ac.findAllVariables(sql) -NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' } -filterdic.update(NameSpace) -sql = ac.convert(sql, filterdic) - -debug(f'{sql=}') -db = DBPools() -dbname = get_module_dbname('pipeline-sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.sqlPaging(sql, ns) - return r -return { - "total":0, - "rows":[] -} \ No newline at end of file diff --git a/wwwroot/sd_project_repos/index.ui b/wwwroot/sd_project_repos/index.ui deleted file mode 100644 index bc593c6..0000000 --- a/wwwroot/sd_project_repos/index.ui +++ /dev/null @@ -1,162 +0,0 @@ - -{ - "widgettype":"VBox", - "options":{"height":"100%","width":"100%"}, - "subwidgets":[ -{ - "id":"sd_project_repos_tbl", - "widgettype":"Tabular", - "options":{ - "width":"100%", - "height":"100%", - - - "title":"项目代码仓库", - - - - - "css":"card", - - - "editable":{ - - "new_data_url":"{{entire_url('add_sd_project_repos.dspy')}}", - - - "delete_data_url":"{{entire_url('delete_sd_project_repos.dspy')}}", - - - "update_data_url":"{{entire_url('update_sd_project_repos.dspy')}}" - - - }, - - - "data_url":"{{entire_url('./get_sd_project_repos.dspy')}}", - - "data_method":"GET", - "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}}, - "row_options":{ - - - - "browserfields": { - "exclouded": [ - "org_id" - ] -}, - - - "editexclouded":[ - "id", - "created_at", - "org_id" -], - - "fields":[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "主键ID" - }, - { - "name": "project_id", - "title": "项目ID", - "type": "str", - "length": 32, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "项目ID" - }, - { - "name": "repo_name", - "title": "仓库别名", - "type": "str", - "length": 100, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "仓库别名" - }, - { - "name": "repo_url", - "title": "Git地址", - "type": "str", - "length": 500, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "Git地址" - }, - { - "name": "default_branch", - "title": "默认分支", - "type": "str", - "length": 100, - "nullable": "no", - "default": "'main'", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "默认分支" - }, - { - "name": "local_path", - "title": "本地相对路径", - "type": "str", - "length": 200, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "本地相对路径" - }, - { - "name": "org_id", - "title": "组织ID", - "type": "str", - "length": 32, - "nullable": "no", - "default": "'0'", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "组织ID" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "创建时间" - } -] - }, - - - - - - - - "page_rows":160, - "cache_limit":5 - } - - ,"binds":[] - -}] -} \ No newline at end of file diff --git a/wwwroot/sd_project_repos/update_sd_project_repos.dspy b/wwwroot/sd_project_repos/update_sd_project_repos.dspy deleted file mode 100644 index 4a406c3..0000000 --- a/wwwroot/sd_project_repos/update_sd_project_repos.dspy +++ /dev/null @@ -1,78 +0,0 @@ - -ns = params_kw.copy() -for k,v in list(ns.items()): - if v == 'NaN' or v == 'null' or v == '' or v is None: - if k != 'id': - del ns[k] - else: - ns[k] = None if v in ('NaN', 'null') else v - - -userorgid = await get_userorgid() -if not userorgid: - return { - "widgettype":"Error", - "options":{ - "title":"Authorization Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"Please login" - } - } -ns['org_id'] = userorgid - - - - -db = DBPools() -dbname = get_module_dbname('pipeline-sdlc') -async with db.sqlorContext(dbname) as sor: - - ns1 = { - - "org_id": userorgid, - - - "id": params_kw.id - } - recs = await sor.R('sd_project_repos', ns1) - if len(recs) < 1: - return { - "widgettype":"Error", - "options":{ - "title":"Update Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"Record no exist or with wrong ownership" - } - } - - tblfields = [{"name":"id","title":"主键ID","type":"str","length":32,"nullable":"no"},{"name":"project_id","title":"项目ID","type":"str","length":32,"nullable":"no"},{"name":"repo_name","title":"仓库别名","type":"str","length":100,"nullable":"no"},{"name":"repo_url","title":"Git地址","type":"str","length":500,"nullable":"no"},{"name":"default_branch","title":"默认分支","type":"str","length":100,"nullable":"no","default":"'main'"},{"name":"local_path","title":"本地相对路径","type":"str","length":200},{"name":"org_id","title":"组织ID","type":"str","length":32,"nullable":"no","default":"'0'"},{"name":"created_at","title":"创建时间","type":"timestamp","nullable":"no"}] - tblfname = [ f['name'] for f in tblfields ] - other_keys = [ k for k in ns.keys() if k in tblfname and k != 'id' ] - if len(other_keys) > 0: - r = await sor.U('sd_project_repos', ns) - debug('update success'); - return { - "widgettype":"Message", - "options":{ - "title":"Update Success", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Update Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_projects/add_sd_projects.dspy b/wwwroot/sd_projects/add_sd_projects.dspy deleted file mode 100644 index 4ea969b..0000000 --- a/wwwroot/sd_projects/add_sd_projects.dspy +++ /dev/null @@ -1,52 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None -id = params_kw.id -if not id or len(id) > 32: - id = uuid() -ns['id'] = id - - - -userorgid = await get_userorgid() -if not userorgid: - return { - "widgettype":"Error", - "options":{ - "title":"Authorization Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"Please login" - } - } -ns['org_id'] = userorgid -ns['created_by'] = userorgid - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.C('sd_projects', ns.copy()) - return { - "widgettype":"Message", - "options":{ - "cwidth":16, - "cheight":9, - "title":"Add Success", - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Add Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_projects/delete_sd_projects.dspy b/wwwroot/sd_projects/delete_sd_projects.dspy deleted file mode 100644 index 30cc1bd..0000000 --- a/wwwroot/sd_projects/delete_sd_projects.dspy +++ /dev/null @@ -1,47 +0,0 @@ - -ns = { - 'id':params_kw['id'], -} - - -userorgid = await get_userorgid() -if not userorgid: - return { - "widgettype":"Error", - "options":{ - "title":"Authorization Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"Please login" - } - } -ns['org_id'] = userorgid - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.D('sd_projects', ns) - debug('delete success'); - return { - "widgettype":"Message", - "options":{ - "title":"Delete Success", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"ok" - } - } - -debug('Delete failed'); -return { - "widgettype":"Error", - "options":{ - "title":"Delete Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_projects/get_sd_projects.dspy b/wwwroot/sd_projects/get_sd_projects.dspy deleted file mode 100644 index 940f85f..0000000 --- a/wwwroot/sd_projects/get_sd_projects.dspy +++ /dev/null @@ -1,161 +0,0 @@ - -ns = params_kw.copy() - - -userorgid = await get_userorgid() -if not userorgid: - return { - "widgettype":"Error", - "options":{ - "title":"Authorization Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"Please login" - } - } -ns['org_id'] = userorgid -ns['userorgid'] = userorgid - -debug(f'get_sd_projects.dspy:{ns=}') -if not ns.get('page'): - ns['page'] = 1 -if not ns.get('sort'): - - - ns['sort'] = ["created_at desc"] - - - -sql = '''select a.*, b.status_text, c.project_type_text -from (select * from sd_projects where 1=1 [[filterstr]]) a left join (select k as status, - v as status_text from appcodes_kv where parentid='sd_project_status') b on a.status = b.status left join (select k as project_type, - v as project_type_text from appcodes_kv where parentid='sd_project_type') c on a.project_type = c.project_type''' - -filterjson = params_kw.get('data_filter') -if filterjson and isinstance(filterjson, str): - try: - filterjson = json.loads(filterjson) - except (json.JSONDecodeError, TypeError): - filterjson = None -fields_str=r'''[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "name", - "title": "项目名称", - "type": "str", - "length": 200, - "nullable": "no" - }, - { - "name": "description", - "title": "项目描述", - "type": "text" - }, - { - "name": "project_type", - "title": "项目类型", - "type": "str", - "length": 50, - "nullable": "no", - "default": "'web_app'" - }, - { - "name": "tech_stack", - "title": "技术栈配置(JSON)", - "type": "text" - }, - { - "name": "repo_url", - "title": "代码仓库地址", - "type": "str", - "length": 500 - }, - { - "name": "pipeline_id", - "title": "关联Pipeline定义ID", - "type": "str", - "length": 32 - }, - { - "name": "status", - "title": "项目状态", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'draft'" - }, - { - "name": "org_id", - "title": "组织ID", - "type": "str", - "length": 32, - "nullable": "no", - "default": "'0'" - }, - { - "name": "created_by", - "title": "创建人", - "type": "str", - "length": 32 - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp" - } -]''' -ori_fields = json.loads(fields_str) -if not filterjson: - fields = [ f['name'] for f in ori_fields ] - filterjson = default_filterjson(fields, ns) - -# 确保 logined 过滤条件始终生效 -if filterjson: - if not isinstance(filterjson, dict) or 'AND' not in filterjson: - filterjson = {'AND': [filterjson] if filterjson else []} - - filterjson['AND'].append({'field': 'org_id', 'op': '=', 'var': '__logined_orgid__'}) - ns['__logined_orgid__'] = userorgid - - - -filterdic = ns.copy() -filterdic['filterstr'] = '' -filterdic['userorgid'] = '${userorgid}$' -filterdic['userid'] = '${userid}$' -if filterjson: - dbf = DBFilter(filterjson) - conds = dbf.gen(ns) - if conds: - ns.update(dbf.consts) - conds = f' and {conds}' - filterdic['filterstr'] = conds -ac = ArgsConvert('[[', ']]') -vars = ac.findAllVariables(sql) -NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' } -filterdic.update(NameSpace) -sql = ac.convert(sql, filterdic) - -debug(f'{sql=}') -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.sqlPaging(sql, ns) - return r -return { - "total":0, - "rows":[] -} \ No newline at end of file diff --git a/wwwroot/sd_projects/index.ui b/wwwroot/sd_projects/index.ui deleted file mode 100644 index 91a62a4..0000000 --- a/wwwroot/sd_projects/index.ui +++ /dev/null @@ -1,296 +0,0 @@ - -{ - "widgettype":"VBox", - "options":{"cheight":40,"width":"100%"}, - "subwidgets":[{ - "id":"sd_projects_tbl", - "widgettype":"Tabular", - "options":{ - "width":"100%", - "height":"100%", - - - "title":"SDLC项目表", - - - - - "toolbar":{ - "tools": [ - { - "selected_row": true, - "name": "sd_iterations", - "icon": "{{entire_url('/imgs/sd_iterations.svg')}}", - "label": "迭代列表" - } - ] -}, - - "css":"card", - - - "editable":{ - - "new_data_url":"{{entire_url('add_sd_projects.dspy')}}", - - - "delete_data_url":"{{entire_url('delete_sd_projects.dspy')}}", - - - "update_data_url":"{{entire_url('update_sd_projects.dspy')}}" - - }, - - - "data_url":"{{entire_url('./get_sd_projects.dspy')}}", - - "data_method":"GET", - "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}}, - "row_options":{ - - - - "browserfields": { - "exclouded": [ - "tech_stack" - ], - "alters": { - "status": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_status.dspy')}}", - "valueField": "value", - "textField": "text" - }, - "project_type": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_project_type.dspy')}}", - "valueField": "value", - "textField": "text" - } - } -}, - - - , - "pipeline_id": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_pipeline_options.dspy')}}", - "valueField": "value", - "textField": "text" - } - "editexclouded":[ - "id", - "created_at", - "updated_at", - "org_id" -], - - "fields":[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "主键ID" - }, - { - "name": "name", - "title": "项目名称", - "type": "str", - "length": 200, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "项目名称" - }, - { - "name": "description", - "title": "项目描述", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "项目描述" - }, - { - "name": "project_type", - "title": "项目类型", - "type": "str", - "length": 50, - "nullable": "no", - "default": "'web_app'", - "label": "项目类型", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_project_type'" - }, - "dataurl": "{{entire_url('../api/get_search_project_type.dspy')}}" - }, - { - "name": "tech_stack", - "title": "技术栈配置(JSON)", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "技术栈配置(JSON)" - }, - { - "name": "repo_url", - "title": "代码仓库地址", - "type": "str", - "length": 500, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "代码仓库地址" - }, - { - "name": "pipeline_id", - "title": "关联Pipeline定义ID", - "type": "str", - "length": 32, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "关联Pipeline定义ID" - }, - { - "name": "status", - "title": "项目状态", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'draft'", - "label": "项目状态", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_project_status'" - }, - "dataurl": "{{entire_url('../api/get_search_status.dspy')}}" - }, - { - "name": "org_id", - "title": "组织ID", - "type": "str", - "length": 32, - "nullable": "no", - "default": "'0'", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "组织ID" - }, - { - "name": "created_by", - "title": "创建人", - "type": "str", - "length": 32, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "创建人" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "创建时间" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "更新时间" - } -] - }, - - - - "data_filter":{ - "AND": [ - { - "field": "name", - "op": "LIKE", - "var": "name_input" - }, - { - "field": "status", - "op": "=", - "var": "status_input" - }, - { - "field": "project_type", - "op": "=", - "var": "type_input" - } - ] -}, - - - - - - "page_rows":160, - "cache_limit":5 - } - - ,"binds":[ - { - "wid": "self", - "event": "sd_iterations", - "actiontype": "urlwidget", - "target": "PopupWindow", - "popup_options": { - "title": "迭代列表", - "icon": "{{entire_url('/appbase/get_icon.dspy')}}?id=sd_iterations", - "resizable": true, - "height": "70%", - "width": "70%" - }, - "params_mapping": { - "mapping": { - "id": "project_id", - "referer_widget": "referer_widget" - }, - "need_other": false - }, - "options": { - "method": "POST", - "params": {}, - "url": "{{entire_url('../sd_iteration_list?project_id=${id}')}}" - } - } -] - -}] -} \ No newline at end of file diff --git a/wwwroot/sd_projects/update_sd_projects.dspy b/wwwroot/sd_projects/update_sd_projects.dspy deleted file mode 100644 index 93372fd..0000000 --- a/wwwroot/sd_projects/update_sd_projects.dspy +++ /dev/null @@ -1,71 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None - - -userorgid = await get_userorgid() -if not userorgid: - return { - "widgettype":"Error", - "options":{ - "title":"Authorization Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"Please login" - } - } -ns['org_id'] = userorgid -ns['created_by'] = userorgid - - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - - ns1 = { - - "org_id": userorgid, - - - "id": params_kw.id - } - recs = await sor.R('sd_projects', ns1) - if len(recs) < 1: - return { - "widgettype":"Error", - "options":{ - "title":"Update Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"Record no exist or with wrong ownership" - } - } - - r = await sor.U('sd_projects', ns) - debug('update success'); - return { - "widgettype":"Message", - "options":{ - "title":"Update Success", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Update Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_test_cases/add_sd_test_cases.dspy b/wwwroot/sd_test_cases/add_sd_test_cases.dspy deleted file mode 100644 index 0899c4d..0000000 --- a/wwwroot/sd_test_cases/add_sd_test_cases.dspy +++ /dev/null @@ -1,37 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None -id = params_kw.id -if not id or len(id) > 32: - id = uuid() -ns['id'] = id - - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.C('sd_test_cases', ns.copy()) - return { - "widgettype":"Message", - "options":{ - "cwidth":16, - "cheight":9, - "title":"Add Success", - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Add Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_test_cases/delete_sd_test_cases.dspy b/wwwroot/sd_test_cases/delete_sd_test_cases.dspy deleted file mode 100644 index 2f2db37..0000000 --- a/wwwroot/sd_test_cases/delete_sd_test_cases.dspy +++ /dev/null @@ -1,33 +0,0 @@ - -ns = { - 'id':params_kw['id'], -} - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.D('sd_test_cases', ns) - debug('delete success'); - return { - "widgettype":"Message", - "options":{ - "title":"Delete Success", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"ok" - } - } - -debug('Delete failed'); -return { - "widgettype":"Error", - "options":{ - "title":"Delete Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_test_cases/get_sd_test_cases.dspy b/wwwroot/sd_test_cases/get_sd_test_cases.dspy deleted file mode 100644 index ee3d5c7..0000000 --- a/wwwroot/sd_test_cases/get_sd_test_cases.dspy +++ /dev/null @@ -1,147 +0,0 @@ - -ns = params_kw.copy() - - -debug(f'get_sd_test_cases.dspy:{ns=}') -if not ns.get('page'): - ns['page'] = 1 -if not ns.get('sort'): - - - ns['sort'] = ["priority desc","created_at desc"] - - - -sql = '''select a.*, b.plan_id_text, c.case_type_text, d.status_text, e.priority_text -from (select * from sd_test_cases where 1=1 [[filterstr]]) a left join (select id as plan_id, - plan_name as plan_id_text from sd_test_plans where 1 = 1) b on a.plan_id = b.plan_id left join (select k as case_type, - v as case_type_text from appcodes_kv where parentid='sd_test_case_type') c on a.case_type = c.case_type left join (select k as status, - v as status_text from appcodes_kv where parentid='sd_test_case_status') d on a.status = d.status left join (select k as priority, - v as priority_text from appcodes_kv where parentid='sd_priority') e on a.priority = e.priority''' - -filterjson = params_kw.get('data_filter') -if filterjson and isinstance(filterjson, str): - try: - filterjson = json.loads(filterjson) - except (json.JSONDecodeError, TypeError): - filterjson = None -fields_str=r'''[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "plan_id", - "title": "方案ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "case_name", - "title": "用例名称", - "type": "str", - "length": 200, - "nullable": "no" - }, - { - "name": "case_type", - "title": "用例类型", - "type": "str", - "length": 20, - "nullable": "no" - }, - { - "name": "priority", - "title": "优先级", - "type": "str", - "length": 10, - "nullable": "no", - "default": "'P2'" - }, - { - "name": "precondition", - "title": "前置条件", - "type": "text" - }, - { - "name": "steps", - "title": "测试步骤(JSON数组)", - "type": "text" - }, - { - "name": "expected_result", - "title": "预期结果", - "type": "text" - }, - { - "name": "actual_result", - "title": "实际结果", - "type": "text" - }, - { - "name": "status", - "title": "用例状态", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'pending'" - }, - { - "name": "executed_by", - "title": "执行人", - "type": "str", - "length": 32 - }, - { - "name": "executed_at", - "title": "执行时间", - "type": "timestamp" - }, - { - "name": "duration_ms", - "title": "执行耗时(毫秒)", - "type": "int" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no" - } -]''' -ori_fields = json.loads(fields_str) -if not filterjson: - fields = [ f['name'] for f in ori_fields ] - filterjson = default_filterjson(fields, ns) - -filterdic = ns.copy() -filterdic['filterstr'] = '' -filterdic['userorgid'] = '${userorgid}$' -filterdic['userid'] = '${userid}$' -if filterjson: - dbf = DBFilter(filterjson) - conds = dbf.gen(ns) - if conds: - ns.update(dbf.consts) - conds = f' and {conds}' - filterdic['filterstr'] = conds -ac = ArgsConvert('[[', ']]') -vars = ac.findAllVariables(sql) -NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' } -filterdic.update(NameSpace) -sql = ac.convert(sql, filterdic) - -debug(f'{sql=}') -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.sqlPaging(sql, ns) - return r -return { - "total":0, - "rows":[] -} \ No newline at end of file diff --git a/wwwroot/sd_test_cases/index.ui b/wwwroot/sd_test_cases/index.ui deleted file mode 100644 index 47a505e..0000000 --- a/wwwroot/sd_test_cases/index.ui +++ /dev/null @@ -1,304 +0,0 @@ - -{ - "widgettype":"VBox", - "options":{"cheight":40,"width":"100%"}, - "subwidgets":[{ - "id":"sd_test_cases_tbl", - "widgettype":"Tabular", - "options":{ - "width":"100%", - "height":"100%", - - - "title":"测试用例表", - - - - - "css":"card", - - - "editable":{ - - "new_data_url":"{{entire_url('add_sd_test_cases.dspy')}}", - - - "delete_data_url":"{{entire_url('delete_sd_test_cases.dspy')}}", - - - "update_data_url":"{{entire_url('update_sd_test_cases.dspy')}}" - - }, - - - "data_url":"{{entire_url('./get_sd_test_cases.dspy')}}", - - "data_method":"GET", - "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}}, - "row_options":{ - - - - "browserfields": { - "alters": { - "plan_id": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_test_plan_options.dspy')}}", - "valueField": "plan_id", - "textField": "plan_id_text" - }, - "case_type": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_case_type.dspy')}}", - "valueField": "value", - "textField": "text" - }, - "status": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_case_status.dspy')}}", - "valueField": "value", - "textField": "text" - }, - "priority": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_priority.dspy')}}", - "valueField": "value", - "textField": "text" - } - } -}, - - - "editexclouded":[ - "id", - "actual_result", - "executed_by", - "executed_at", - "duration_ms", - "created_at" -], - - "fields":[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "主键ID" - }, - { - "name": "plan_id", - "title": "方案ID", - "type": "str", - "length": 32, - "nullable": "no", - "label": "方案ID", - "uitype": "code", - "valueField": "plan_id", - "textField": "plan_id_text", - "params": { - "dbname": "{{'sage'}}", - "table": "sd_test_plans", - "tblvalue": "id", - "tbltext": "plan_name", - "valueField": "plan_id", - "textField": "plan_id_text" - }, - "dataurl": "{{entire_url('../api/get_test_plan_options.dspy')}}" - }, - { - "name": "case_name", - "title": "用例名称", - "type": "str", - "length": 200, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "用例名称" - }, - { - "name": "case_type", - "title": "用例类型", - "type": "str", - "length": 20, - "nullable": "no", - "label": "用例类型", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_test_case_type'" - }, - "dataurl": "{{entire_url('../api/get_search_case_type.dspy')}}" - }, - { - "name": "priority", - "title": "优先级", - "type": "str", - "length": 10, - "nullable": "no", - "default": "'P2'", - "label": "优先级", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_priority'" - }, - "dataurl": "{{entire_url('../api/get_search_priority.dspy')}}" - }, - { - "name": "precondition", - "title": "前置条件", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "前置条件" - }, - { - "name": "steps", - "title": "测试步骤(JSON数组)", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "测试步骤(JSON数组)" - }, - { - "name": "expected_result", - "title": "预期结果", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "预期结果" - }, - { - "name": "actual_result", - "title": "实际结果", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "实际结果" - }, - { - "name": "status", - "title": "用例状态", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'pending'", - "label": "用例状态", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_test_case_status'" - }, - "dataurl": "{{entire_url('../api/get_search_case_status.dspy')}}" - }, - { - "name": "executed_by", - "title": "执行人", - "type": "str", - "length": 32, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "执行人" - }, - { - "name": "executed_at", - "title": "执行时间", - "type": "timestamp", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "执行时间" - }, - { - "name": "duration_ms", - "title": "执行耗时(毫秒)", - "type": "int", - "length": 0, - "uitype": "int", - "datatype": "int", - "label": "执行耗时(毫秒)" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "创建时间" - } -] - }, - - - - "data_filter":{ - "AND": [ - { - "field": "plan_id", - "op": "=", - "var": "plan_input" - }, - { - "field": "case_type", - "op": "=", - "var": "type_input" - }, - { - "field": "status", - "op": "=", - "var": "status_input" - }, - { - "field": "priority", - "op": "=", - "var": "priority_input" - } - ] -}, - - - - - - "page_rows":160, - "cache_limit":5 - } - - ,"binds":[] - -}] -} \ No newline at end of file diff --git a/wwwroot/sd_test_cases/update_sd_test_cases.dspy b/wwwroot/sd_test_cases/update_sd_test_cases.dspy deleted file mode 100644 index 4fb5433..0000000 --- a/wwwroot/sd_test_cases/update_sd_test_cases.dspy +++ /dev/null @@ -1,36 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None - - - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - - r = await sor.U('sd_test_cases', ns) - debug('update success'); - return { - "widgettype":"Message", - "options":{ - "title":"Update Success", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Update Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_test_plans/add_sd_test_plans.dspy b/wwwroot/sd_test_plans/add_sd_test_plans.dspy deleted file mode 100644 index ff4fd7d..0000000 --- a/wwwroot/sd_test_plans/add_sd_test_plans.dspy +++ /dev/null @@ -1,37 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None -id = params_kw.id -if not id or len(id) > 32: - id = uuid() -ns['id'] = id - - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.C('sd_test_plans', ns.copy()) - return { - "widgettype":"Message", - "options":{ - "cwidth":16, - "cheight":9, - "title":"Add Success", - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Add Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_test_plans/delete_sd_test_plans.dspy b/wwwroot/sd_test_plans/delete_sd_test_plans.dspy deleted file mode 100644 index 6a7b11b..0000000 --- a/wwwroot/sd_test_plans/delete_sd_test_plans.dspy +++ /dev/null @@ -1,33 +0,0 @@ - -ns = { - 'id':params_kw['id'], -} - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.D('sd_test_plans', ns) - debug('delete success'); - return { - "widgettype":"Message", - "options":{ - "title":"Delete Success", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"ok" - } - } - -debug('Delete failed'); -return { - "widgettype":"Error", - "options":{ - "title":"Delete Error", - "timeout":3, - "cwidth":16, - "cheight":9, - "message":"failed" - } -} \ No newline at end of file diff --git a/wwwroot/sd_test_plans/get_sd_test_plans.dspy b/wwwroot/sd_test_plans/get_sd_test_plans.dspy deleted file mode 100644 index a09d0ad..0000000 --- a/wwwroot/sd_test_plans/get_sd_test_plans.dspy +++ /dev/null @@ -1,133 +0,0 @@ - -ns = params_kw.copy() - - -debug(f'get_sd_test_plans.dspy:{ns=}') -if not ns.get('page'): - ns['page'] = 1 -if not ns.get('sort'): - - - ns['sort'] = ["created_at desc"] - - - -sql = '''select a.*, b.iteration_id_text, c.plan_type_text, d.status_text -from (select * from sd_test_plans where 1=1 [[filterstr]]) a left join (select id as iteration_id, - iteration_name as iteration_id_text from sd_iterations where 1 = 1) b on a.iteration_id = b.iteration_id left join (select k as plan_type, - v as plan_type_text from appcodes_kv where parentid='sd_test_plan_type') c on a.plan_type = c.plan_type left join (select k as status, - v as status_text from appcodes_kv where parentid='sd_test_plan_status') d on a.status = d.status''' - -filterjson = params_kw.get('data_filter') -if filterjson and isinstance(filterjson, str): - try: - filterjson = json.loads(filterjson) - except (json.JSONDecodeError, TypeError): - filterjson = None -fields_str=r'''[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "iteration_id", - "title": "迭代ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "plan_name", - "title": "方案名称", - "type": "str", - "length": 200, - "nullable": "no" - }, - { - "name": "plan_type", - "title": "方案类型", - "type": "str", - "length": 20, - "nullable": "no" - }, - { - "name": "scope", - "title": "测试范围", - "type": "text" - }, - { - "name": "environment", - "title": "测试环境要求(JSON)", - "type": "text" - }, - { - "name": "entry_criteria", - "title": "准入条件", - "type": "text" - }, - { - "name": "exit_criteria", - "title": "准出条件", - "type": "text" - }, - { - "name": "status", - "title": "方案状态", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'draft'" - }, - { - "name": "created_by", - "title": "创建人", - "type": "str", - "length": 32 - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp" - } -]''' -ori_fields = json.loads(fields_str) -if not filterjson: - fields = [ f['name'] for f in ori_fields ] - filterjson = default_filterjson(fields, ns) - -filterdic = ns.copy() -filterdic['filterstr'] = '' -filterdic['userorgid'] = '${userorgid}$' -filterdic['userid'] = '${userid}$' -if filterjson: - dbf = DBFilter(filterjson) - conds = dbf.gen(ns) - if conds: - ns.update(dbf.consts) - conds = f' and {conds}' - filterdic['filterstr'] = conds -ac = ArgsConvert('[[', ']]') -vars = ac.findAllVariables(sql) -NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' } -filterdic.update(NameSpace) -sql = ac.convert(sql, filterdic) - -debug(f'{sql=}') -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - r = await sor.sqlPaging(sql, ns) - return r -return { - "total":0, - "rows":[] -} \ No newline at end of file diff --git a/wwwroot/sd_test_plans/index.ui b/wwwroot/sd_test_plans/index.ui deleted file mode 100644 index 79a0af2..0000000 --- a/wwwroot/sd_test_plans/index.ui +++ /dev/null @@ -1,276 +0,0 @@ - -{ - "widgettype":"VBox", - "options":{"cheight":40,"width":"100%"}, - "subwidgets":[{ - "id":"sd_test_plans_tbl", - "widgettype":"Tabular", - "options":{ - "width":"100%", - "height":"100%", - - - "title":"测试方案表", - - - - - "toolbar":{ - "tools": [ - { - "selected_row": true, - "name": "sd_test_cases", - "icon": "{{entire_url('/imgs/sd_test_cases.svg')}}", - "label": "测试用例" - } - ] -}, - - "css":"card", - - - "editable":{ - - "new_data_url":"{{entire_url('add_sd_test_plans.dspy')}}", - - - "delete_data_url":"{{entire_url('delete_sd_test_plans.dspy')}}", - - - "update_data_url":"{{entire_url('update_sd_test_plans.dspy')}}" - - }, - - - "data_url":"{{entire_url('./get_sd_test_plans.dspy')}}", - - "data_method":"GET", - "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}}, - "row_options":{ - - - - "browserfields": { - "alters": { - "iteration_id": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_iteration_options.dspy')}}", - "valueField": "iteration_id", - "textField": "iteration_id_text" - }, - "plan_type": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_plan_type.dspy')}}", - "valueField": "value", - "textField": "text" - }, - "status": { - "uitype": "code", - "dataurl": "{{entire_url('../api/get_search_plan_status.dspy')}}", - "valueField": "value", - "textField": "text" - } - } -}, - - - "editexclouded":[ - "id", - "created_at", - "updated_at" -], - - "fields":[ - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "主键ID" - }, - { - "name": "iteration_id", - "title": "迭代ID", - "type": "str", - "length": 32, - "nullable": "no", - "label": "迭代ID", - "uitype": "code", - "valueField": "iteration_id", - "textField": "iteration_id_text", - "params": { - "dbname": "{{'sage'}}", - "table": "sd_iterations", - "tblvalue": "id", - "tbltext": "iteration_name", - "valueField": "iteration_id", - "textField": "iteration_id_text" - }, - "dataurl": "{{entire_url('../api/get_iteration_options.dspy')}}" - }, - { - "name": "plan_name", - "title": "方案名称", - "type": "str", - "length": 200, - "nullable": "no", - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "方案名称" - }, - { - "name": "plan_type", - "title": "方案类型", - "type": "str", - "length": 20, - "nullable": "no", - "label": "方案类型", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_test_plan_type'" - }, - "dataurl": "{{entire_url('../api/get_search_plan_type.dspy')}}" - }, - { - "name": "scope", - "title": "测试范围", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "测试范围" - }, - { - "name": "environment", - "title": "测试环境要求(JSON)", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "测试环境要求(JSON)" - }, - { - "name": "entry_criteria", - "title": "准入条件", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "准入条件" - }, - { - "name": "exit_criteria", - "title": "准出条件", - "type": "text", - "length": 0, - "uitype": "text", - "datatype": "text", - "label": "准出条件" - }, - { - "name": "status", - "title": "方案状态", - "type": "str", - "length": 20, - "nullable": "no", - "default": "'draft'", - "label": "方案状态", - "uitype": "code", - "valueField": "value", - "textField": "text", - "params": { - "dbname": "{{'sage'}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "value", - "textField": "text", - "cond": "parentid='sd_test_plan_status'" - }, - "dataurl": "{{entire_url('../api/get_search_plan_status.dspy')}}" - }, - { - "name": "created_by", - "title": "创建人", - "type": "str", - "length": 32, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "创建人" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "nullable": "no", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "创建时间" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp", - "length": 0, - "uitype": "str", - "datatype": "timestamp", - "label": "更新时间" - } -] - }, - - - - - - - - "page_rows":160, - "cache_limit":5 - } - - ,"binds":[ - { - "wid": "self", - "event": "sd_test_cases", - "actiontype": "urlwidget", - "target": "PopupWindow", - "popup_options": { - "title": "测试用例", - "icon": "{{entire_url('/appbase/get_icon.dspy')}}?id=sd_test_cases", - "resizable": true, - "height": "70%", - "width": "70%" - }, - "params_mapping": { - "mapping": { - "id": "plan_id", - "referer_widget": "referer_widget" - }, - "need_other": false - }, - "options": { - "method": "POST", - "params": {}, - "url": "{{entire_url('../sd_test_case_list?plan_id=${id}')}}" - } - } -] - -}] -} \ No newline at end of file diff --git a/wwwroot/sd_test_plans/update_sd_test_plans.dspy b/wwwroot/sd_test_plans/update_sd_test_plans.dspy deleted file mode 100644 index 279e020..0000000 --- a/wwwroot/sd_test_plans/update_sd_test_plans.dspy +++ /dev/null @@ -1,36 +0,0 @@ - -ns = params_kw.copy() -for k,v in ns.items(): - if v == 'NaN' or v == 'null': - ns[k] = None - - - - -db = DBPools() -dbname = get_module_dbname('pipeline_sdlc') -async with db.sqlorContext(dbname) as sor: - - r = await sor.U('sd_test_plans', ns) - debug('update success'); - return { - "widgettype":"Message", - "options":{ - "title":"Update Success", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"ok" - } - } - -return { - "widgettype":"Error", - "options":{ - "title":"Update Error", - "cwidth":16, - "cheight":9, - "timeout":3, - "message":"failed" - } -} \ No newline at end of file