from django.conf.urls import url
from . import views
from .views import *
from Api import commonApi, change_agv_count, desc_pod

urlpatterns = [
    # Matches any html file - to be used for gentella
    # Avoid using your .html in your resources.
    # Or create a separate django app.
    url(r'^.*\.html', views.gentella_html, name='gentella'),
    url(r'^login', views.login_auth, name='login'),
    url(r'^cas_test', views.login_auth, name='cas_test'),
    url(r'^logout', views.log_out, name='log_out'),
    url(r'^reset_password', views.reset_password, name='reset_password'),
    # url(r'^search',views.search,name='search'),
    # The home page
    url(r'^my_deploy/$', commonApi.myDeploy,name='my_deploy'),
    url(r'^dataSet_default/$', commonApi.dataSetDefault,name='dataSet_default'),
    url(r'^change_basic_debug', commonApi.change_basic_debug, name='change_basic_debug'),
    url(r'^dataset/$', DataSetList.as_view(), name='dataset_list'),
    url(r'^dataset/add/$', DataSetCreate.as_view(), name='dataset_add'),
    url(r'^dataset/increUpdate/(?P<pk>[0-9]+)/$', DataSetIncreUpdate.as_view(), name='dataset_increUpdate'),
    url(r'^dataset/(?P<pk>[0-9]+)/$', DataSetUpdate.as_view(), name='dataset_update'),
    url(r'^dataset/delete/(?P<pk>[0-9]+)/$', DataSetDelete.as_view(), name='dataset_delete'),
    url(r'^dataset/download/(?P<pk>[0-9]+)/$', views.DataSetDownload, name='dataset_download'),
    url(r'^dataset_image/$', DataSetImageList.as_view(), name='dataset_image_list'),
    url(r'^dataset_image/add/$', DataSetImageCreate.as_view(), name='dataset_image_add'),
    # url(r'^dataset/(?P<pk>[0-9]+)/$', DataSetUpdate.as_view(), name='dataset_update'),
    url(r'^dataset_image/(?P<pk>[0-9]+)/delete/$', DataSetImageDelete.as_view(), name='dataset_image_delete'),

    url(r'^$', ProjectList.as_view(), name='project_list'),
    url(r'^project/$', ProjectList.as_view(), name='project_list'),
    url(r'^project/detail/(?P<pk>[0-9]+)$', ProjectDetail.as_view(), name='project_detail'),
    url(r'^project/add/$', ProjectCreate.as_view(), name='project_add'),
    url(r'^project/(?P<pk>[0-9]+)/$', ProjectUpdate.as_view(), name='project_update'),
    url(r'^project/(?P<pk>[0-9]+)/delete/$', ProjectDelete.as_view(), name='project_delete'),
    # url(r'^app/$', AppList.as_view(),name='app_list'),
    # url(r'^app/(?P<project_id>[0-9]+)$', AppList.as_view(),name='app_list'),
    url(r'^app/add/(?P<project_id>[0-9]+)$', AppCreate.as_view(), name='app_add'),
    # url(r'^app/detail/(?P<pk>[0-9]+)$', AppDetail.as_view(),name='app_detail'),
    url(r'^app/(?P<pk>[0-9]+)/$', AppUpdate.as_view(), name='app_update'),
    url(r'^app/(?P<pk>[0-9]+)/delete/$', AppDelete.as_view(), name='app_delete'),

    url(r'^user/$', UserList.as_view(), name='user_list'),
    url(r'^user/add/$', UserCreate.as_view(), name='user_add'),
    url(r'^user/(?P<pk>[0-9]+)/$', UserUpdate.as_view(), name='user_update'),
    url(r'^user/(?P<pk>[0-9]+)/delete/$', UserDelete.as_view(), name='user_delete'),

    url(r'^group/$', GroupList.as_view(), name='group_list'),
    url(r'^group/add/$', GroupCreate.as_view(), name='group_add'),
    url(r'^group/(?P<pk>[0-9]+)/$', GroupUpdate.as_view(), name='group_update'),
    url(r'^group/(?P<pk>[0-9]+)/delete/$', GroupDelete.as_view(), name='group_delete'),

    url(r'^branch/add/feature/(?P<project_id>[0-9]+)$', BranchCreate.as_view(), {"type": "feature"},
        name='branch_add_feature'),
    url(r'^branch/add/release/(?P<project_id>[0-9]+)$', BranchCreate.as_view(), {"type": "release"},
        name='branch_add_release'),
    url(r'^branch/add/hotfix/(?P<project_id>[0-9]+)$', BranchCreate.as_view(), {"type": "hotfix"},
        name='branch_add_hotfix'),
    url(r'^branch/add/tag/(?P<project_id>[0-9]+)$', BranchCreate.as_view(), {"type": "tag"}, name='branch_add_tag'),
    url(r'^branch/(?P<project_id>[0-9]+)/(?P<pk>[0-9]+)/delete/$', BranchDelete.as_view(), name='branch_delete'),

    url(r'^deploy/$', DeployList.as_view(), name='deploy_list'),
    url(r'^deploy/add/(?P<project_id>[0-9]+)', DeployCreate.as_view(), name='deploy_add'),
    url(r'^get_last_pod_log$', commonApi.get_last_pod_log, name='get_last_pod_log'),
    url(r'^get_pod_last_status$', commonApi.get_pod_last_status, name='get_pod_last_status'),
    url(r'^get_namespace_time$', commonApi.get_namespace_time, name='get_namespace_time'),

    # url(r'^deploy/(?P<pk>[0-9]+)/$', UserUpdate.as_view(),name='deploy_update'),
    url(r'^deploy/(?P<pk>[0-9]+)/delete/$', DeployDelete.as_view(), name='deploy_delete'),
    url(r'^deploy/detail/(?P<pk>[0-9]+)/$', views.deployDetail, name='deploy_detail'),
    url(r'^desc-pod$', desc_pod.desc_pod, name='desc-pod'),
    # url(r'^pro_deploy/add/$', ProDeployCreate.as_view(),name='pro_deploy_add'),
    # url(r'^envTemplate/$', EnvTemplateList.as_view(),name='envTemplate_list')
    url(r'^envTemplate/add/(?P<project_id>[0-9]+)$', EnvTemplateCreate.as_view(), name='envTemplate_add'),
    url(r'^envTemplate/(?P<pk>[0-9]+)/$', UserUpdate.as_view(), name='envTemplate_update'),
    url(r'^envTemplate/(?P<pk>[0-9]+)/delete/$', EnvTemplateDelete.as_view(), name='envTemplate_delete'),
    url(r'^project/envedit/(?P<pid>[0-9]+)/(?P<eid>[0-9]+)$', views.EnvEdit,name='env_edit'),
    url(r'^release/sys$', views.sys_release_list, name='sys_release_list'),
    url(r'^release/deploy$', views.deploy_release_list, name='deploy_release_list'),
    url(r'^release/download$', views.deploy_release_download, name='deploy_release_download'),
    url(r'^preserverlist$', views.preserverlist, name='preserverlist'),
    url(r'^memoryconfig$', views.memoryconfig, name='memoryconfig'),

    url(r'^projectUser/delete/(?P<pk>[0-9]+)$', ProjectuserDelete.as_view(), name='projectuser_delete'),
    url(r'^projectUser/add/(?P<pk>[0-9]+)$', ProjectuserAdd.as_view(), name='projectuser_add'),


    url(r'^permission$', PermissionList.as_view(), name='user_permission_list'),
    url(r'^permissionadd$', PermissionCreate.as_view(), name='user_permission_add'),

    ### role
    url(r'^role$', RoleList.as_view(), name='user_role_list'),
    url(r'^roleadd$', RoleCreate.as_view(), name='user_role_add'),
    url(r'^roledelete/(?P<pk>[0-9]+)$$', RoleDelete.as_view(), name='user_role_delete'),
    url(r'^roleuser/list/(?P<pk>[0-9]+)$', RoleUserList.as_view(), name='role_user_list'),
    url(r'^roleuser/add/(?P<pk>[0-9]+)$', RoleUserCreate.as_view(), name='role_user_add'),
    url(r'^roleuser/delete/(?P<rid>[0-9]+)/(?P<uid>[0-9]+)$', RoleUserDelete.as_view(), name='role_user_delete'),
    url(r'^roleperm/list/(?P<pk>[0-9]+)$', RolePermList.as_view(), name='role_perm_list'),
    url(r'^roleperm/add/(?P<pk>[0-9]+)$', RolePermCreate.as_view(), name='role_perm_add'),
    url(r'^roleperm/delete/(?P<rid>[0-9]+)/(?P<pid>[0-9]+)$', RolePermDelete.as_view(), name='role_perm_delete'),
    url(r'^fpermission/list$', FpermisssionList.as_view(), name='fpermission_list'),
    url(r'^fpermission/add$', FpermisssionCreate.as_view(), name='fpermission_add'),
    url(r'^fpermission/delete/(?P<pk>[0-9]+)$', FpermisssionDelete.as_view(), name='fpermission_delete'),


    #url(r'^roleuserlist$', RoleUserList.as_view(), name='role_user_list'),
    #url(r'^roleuseradd$', RoleUserCreate.as_view(), name='role_user_add'),
    #url(r'^rolepermlist$', RolePermList.as_view(), name='role_perm_list'),
    #url(r'^rolepermadd$', RolePermCreate.as_view(), name='role_perm_add'),


    url(r'^group/quota/(?P<pk>[0-9]+)$', groupQuotaDetail.as_view(), name='group_quota_detail'),
    url(r'^deploy-(?P<pk>[0-9]+)$', views.deployDetailRedirect),
    # api
    url(r'^detail_image_add$', commonApi.detailImageAdd),
    url(r'^detail_image_list$', commonApi.detailImageAddList),
    url(r'^create_deploy$', commonApi.DeployCreateApi),
    url(r'^test_api$', commonApi.test_api),
    url(r'^delete_deploy$', commonApi.DeployDeteleApi),
    url(r'^detail_deploy$', commonApi.DeployDetailApi),
    url(r'^get_nodeport$', commonApi.get_nodeport),
    url(r'^get_exclude_group_user/$', commonApi.getExcludeGroupUsers, name='get_exclude_group_user'),
    url(r'^get_group_user/$', commonApi.getGroupUsers, name='get_group_users'),
    url(r'^group_add_users/$', commonApi.groupAddUsers, name='group_add_users'),
    url(r'^get_app_name/$', commonApi.getAppName, name='get_app_name'),
    url(r'^get_evo_apps/$', commonApi.getEvoApp, name='get_evo_apps'),
    url(r'^get_app_version_by_envtemplate_id/$', commonApi.getAppVersionByEnvtemplateId,
        name='get_app_version_by_envtemplate'),
    url(r'^get_baseapp_version_by_envtemplate_id/$', commonApi.getBaseAppVersionByEnvtemplateId,
        name='get_baseapp_version_by_envtemplate_id'),
    url(r'^push_image_version$', commonApi.pushImageVersion, name='push_image_version'),
    url(r'^get_image_config$', commonApi.getImageConfig, name='get_image_config'),
    url(r'^get_baseapp$', commonApi.getBaseApp, name='get_baseapp'),
    url(r'^get_baseapp_bygroup$', commonApi.getBaseAppByGroup, name='get_baseapp_bygroup'),
    url(r'^get_baseapp_branches$', commonApi.get_baseapp_branches, name='get_baseapp_branches'),
    url(r'^get_chart_version$', commonApi.getChartVersion, name='get_chart_version'),
    url(r'^get_dataset$', commonApi.getDataset, name='get_dataset'),
    url(r'^install_dataset$', commonApi.installDataset, name='install_dataset'),
    url(r'^get_deploy_log$', commonApi.getDeployLog, name='get_deploy_log'),
    url(r'^get_deploy_info$', commonApi.getDeployInfo, name='get_deploy_info'),
    url(r'^get_deploy_history$', commonApi.getDeployHistory, name='get_deploy_history'),
    url(r'^image_upgrade_get_branch$', commonApi.imageUpgradeGetBranch, name='image_upgrade_get_branch'),
    url(r'^image_upgrade_select$', commonApi.imageUpgradeSelect, name='image_upgrade_select'),
    url(r'^dataset_upgrade_select$', commonApi.datasetUpgradeSelect, name='dataset_upgrade_select'),
    url(r'^image_upgrade$', commonApi.imageUpgrade, name='image_upgrade'),
    url(r'^oneClick_upgrade$', commonApi.oneClickUpgrade, name='oneClick_upgrade'),
    url(r'^dataset_upgrade$', commonApi.datasetUpgrade, name='dataset_upgrade'),
    url(r'^image_delete$', commonApi.imageDelete, name='image_delete'),
    url(r'^alter_deploy_num$', commonApi.alterDeployNum, name='alter_deploy_num'),
    url(r'^compare_deploy_num$', commonApi.compareDeployNum, name='compare_deploy_num'),
    url(r'^upload_app_tree$', commonApi.uploadAppTree, name='upload_app_tree'),
    url(r'^get_app_tree$', commonApi.getBaseAppTree, name='get_baseapp_tree'),
    # url(r'^branch_trigger/(?P<pk>[0-9]+)$', commonApi.branchTrigger, name='branch_trigger'),
    url(r'^branch_trigger/(?P<pk>.+)$', commonApi.branchTrigger, name='branch_trigger'),
    url(r'^get_pod_log$', commonApi.get_pod_log, name='get_pod_log'),
    url(r'^get_console_url$', commonApi.get_console_url, name='get_console_url'),
    url(r'^get_dataset_list$', commonApi.get_dataset_list, name='get_dataset_list'),
    url(r'^delete_pod$', commonApi.delete_pod, name='delete_pod'),
    url(r'^change_agv_count$', change_agv_count.change_agv_count, name='change_agv_count'),
    url(r'^get_project_branch$', commonApi.get_project_branch, name='get_project_branch'),
    url(r'^package_deploy$', commonApi.package_deploy, name='package_deploy'),
    url(r'^get_project_monitor_resource$', commonApi.get_project_monitor_resource, name='get_project_monitor_resource'),
    url(r'^get_pod_monitor_resource$', commonApi.get_pod_monitor_resource, name='get_pod_monitor_resource'),
    url(r'^get_gitlab_tag_name$', commonApi.getGitlabTagNameNew, name='get_gitlab_tag_name'),
    url(r'^set_app_tag$', commonApi.setappTag, name='set_app_tag'),
    url(r'^get_app_tag$', commonApi.getappTag, name='get_app_tag'),
    url(r'^get_gitlab_helm_tag_name$', commonApi.getHelmGitlabTagNameNew, name='get_gitlab_helm_tag_name'),

]
