Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
162f34f6
Commit
162f34f6
authored
Jan 22, 2020
by
Gladys Forte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added branches endpoint as reference to environments
parent
7a52582f
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
113 additions
and
30 deletions
+113
-30
app/applicationlayer/cms/cms_settings/views.py
app/applicationlayer/cms/cms_settings/views.py
+1
-3
app/applicationlayer/cms/form/approver/serializers.py
app/applicationlayer/cms/form/approver/serializers.py
+2
-4
app/applicationlayer/cms/form/header/views.py
app/applicationlayer/cms/form/header/views.py
+3
-10
app/applicationlayer/cms/master/template/account/views.py
app/applicationlayer/cms/master/template/account/views.py
+0
-1
app/applicationlayer/cms/utils_cr.py
app/applicationlayer/cms/utils_cr.py
+0
-4
app/applicationlayer/download/accounts/views.py
app/applicationlayer/download/accounts/views.py
+0
-1
app/applicationlayer/master/branch/serializer.py
app/applicationlayer/master/branch/serializer.py
+8
-0
app/applicationlayer/master/branch/views.py
app/applicationlayer/master/branch/views.py
+34
-0
app/applicationlayer/master/urls.py
app/applicationlayer/master/urls.py
+2
-0
app/datalayer/serializer_handler.py
app/datalayer/serializer_handler.py
+0
-2
app/entities/migrations/0006_branch.py
app/entities/migrations/0006_branch.py
+27
-0
app/entities/models.py
app/entities/models.py
+23
-5
branches.txt
branches.txt
+13
-0
No files found.
app/applicationlayer/cms/cms_settings/views.py
View file @
162f34f6
...
...
@@ -68,9 +68,7 @@ class CMSSettingsViewSet(viewsets.ModelViewSet):
logged_user
=
self
.
request
.
user
.
name
new_instance
=
model_to_dict
(
instance
)
# behalf = ChangeRequestSettings.objects.filter(code=str(instance)).first()
# print(behalf)
behalf_name
=
instance
.
behalf_user
.
name
behalf_email
=
instance
.
behalf_user
.
email
...
...
app/applicationlayer/cms/form/approver/serializers.py
View file @
162f34f6
...
...
@@ -8,7 +8,7 @@ class ChangeRequestFormApproversSerializer(
):
def
to_representation
(
self
,
instance
):
ret
=
super
()
.
to_representation
(
instance
)
print
(
instance
)
try
:
ret
[
'company'
]
=
{
"id"
:
instance
.
user
.
department
.
company
.
id
,
...
...
@@ -58,7 +58,6 @@ class ChangeRequestFormApproversSerializer(
else
:
ret
[
'editable_deleg'
]
=
True
# print(instance.tmp_approver.delegation.name)
# comment
# if instance.tmp_approver.delegation.name.lower() == 'requestor':
# ret['editable_user'] = False
...
...
@@ -124,8 +123,7 @@ class ChangeRequestFormApproversSerializer(
else
:
ret
[
'delegation'
]
=
None
ret
[
'editable_deleg'
]
=
True
# print(instance.tmp_approver.delegation.name)
# if instance.tmp_approver.delegation.name.lower() == 'requestor':
# ret['editable_user'] = False
# ret['editable_comp'] = False
...
...
app/applicationlayer/cms/form/header/views.py
View file @
162f34f6
...
...
@@ -527,10 +527,7 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
form_code
=
str
(
form_code
)
)
.
values
(
'file_upload__url'
)
attch_list
=
[
data
[
'file_upload__url'
]
.
split
(
'/'
)[
1
]
for
data
in
attch
]
# print(attch.query)
# print(attch)
# print(attch_list)
if
os
.
path
.
isdir
(
my_folder
):
shutil
.
rmtree
(
my_folder
)
...
...
@@ -555,17 +552,13 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
# full_file_name = os.path.join(my_folder, file_name)
# if os.path.isfile(full_file_name):
# shutil.copy(full_file_name, dest)
print
(
attch
)
for
file_name
in
attch
:
print
(
file_name
[
'file_upload__url'
])
a
=
os
.
path
.
join
(
settings
.
MEDIA_ROOT
,
file_name
[
'file_upload__url'
])
# full_file_name = os.path.join(my_folder, file_name['file_upload__url'])
# print(full_file_name)
if
os
.
path
.
isfile
(
a
):
print
(
'ddd'
)
print
(
a
)
# print(type(a))
b
=
open
(
a
,
'r'
)
shutil
.
copy
(
b
,
my_folder
)
else
:
...
...
app/applicationlayer/cms/master/template/account/views.py
View file @
162f34f6
...
...
@@ -26,7 +26,6 @@ class UserListTemplate(APIView):
user_list
=
models
.
User
.
objects
.
filter
(
code__in
=
verified_users
)
print
(
user_list
)
page
=
self
.
paginate_queryset
(
user_list
)
...
...
app/applicationlayer/cms/utils_cr.py
View file @
162f34f6
...
...
@@ -396,11 +396,9 @@ def next_approver_email(form_code, next_level):
level
=
str
(
next_level
),
form_code
=
form_code
)
# print(next_approver.values())
# LOOP on next approver for sending email
for
n_approver
in
next_approver
:
# print(n_approver.delegation)
# NOTIF MSG FOR NEXT APPROVER
msg
=
APPROVER_MESSAGE
.
split
(
';'
)[
0
]
...
...
@@ -564,7 +562,6 @@ def crhistory_log_bulk_delete_masterattach(queryset, entity, tbl, form_code,
try
:
for
data
in
queryset
:
test
=
model_to_dict
(
data
)
# print(test)
crhistory_save
(
batch_no
,
main_action
,
enums
.
CREnum
.
DELETED
.
value
,
...
...
@@ -835,7 +832,6 @@ def send_email_onbehalf(active_user, behalf_usernext_level):
# LOOP on next approver for sending email
for
n_approver
in
next_approver
:
# print(n_approver.delegation)
# NOTIF MSG FOR NEXT APPROVER
msg
=
APPROVER_MESSAGE
.
split
(
';'
)[
0
]
...
...
app/applicationlayer/download/accounts/views.py
View file @
162f34f6
...
...
@@ -28,7 +28,6 @@ class UserDownloadRequest(XLSXFileMixin, ReadOnlyModelViewSet):
data
=
User
.
objects
.
all
()
serializer
=
headers
(
data
=
data
,
many
=
True
)
serializer
.
is_valid
(
raise_exception
=
False
)
print
(
serializer
.
data
)
return
Response
(
serializer
.
data
)
column_header
=
{
...
...
app/applicationlayer/master/branch/serializer.py
0 → 100644
View file @
162f34f6
from
rest_framework
import
serializers
from
app.entities.models
import
Branch
class
BranchSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
Branch
fields
=
'__all__'
app/applicationlayer/master/branch/views.py
0 → 100644
View file @
162f34f6
from
app.entities.models
import
Branch
from
rest_framework
import
viewsets
,
status
from
rest_framework.response
import
Response
from
django_filters
import
rest_framework
as
filters
from
app.applicationlayer.master.branch.serializer
import
BranchSerializer
from
app.applicationlayer.utils
import
(
CustomPagination
,
status_message_response
)
class
BranchViewSet
(
viewsets
.
ModelViewSet
):
queryset
=
Branch
.
objects
.
all
()
serializer_class
=
BranchSerializer
pagination_class
=
CustomPagination
lookup_field
=
'id'
# http_method_names = ['get']
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
page
=
self
.
paginate_queryset
(
queryset
)
if
page
is
not
None
:
serializer
=
self
.
get_serializer
(
page
,
many
=
True
)
message
=
status_message_response
(
200
,
'success'
,
'list of branches found'
,
serializer
.
data
)
return
self
.
get_paginated_response
(
message
)
serializer
=
self
.
get_serializer
(
queryset
,
many
=
True
)
return
Response
(
serializer
.
data
)
app/applicationlayer/master/urls.py
View file @
162f34f6
...
...
@@ -7,12 +7,14 @@ from app.applicationlayer.master.department.views import AdminDepartmentViewSet
from
app.applicationlayer.master.user_type.views
import
UserTypeViewSet
from
app.applicationlayer.master.attachment.views
import
MasterAttachmentViewSet
from
app.applicationlayer.master.dashboard.views
import
RMSDashBoardViewSet
from
app.applicationlayer.master.branch.views
import
BranchViewSet
router
=
routers
.
DefaultRouter
()
router
.
register
(
r'users'
,
AdminAccountViewSet
)
router
.
register
(
r'companies'
,
AdminCompanyViewSet
)
router
.
register
(
r'departments'
,
AdminDepartmentViewSet
)
router
.
register
(
r'attachments'
,
MasterAttachmentViewSet
)
router
.
register
(
r'branches'
,
BranchViewSet
)
urlpatterns
=
[
path
(
''
,
include
(
router
.
urls
)),
...
...
app/datalayer/serializer_handler.py
View file @
162f34f6
...
...
@@ -13,11 +13,9 @@ def custom_exception_handler(exc, context):
# Update the structure of the response data.
if
response
is
not
None
:
print
(
'dd'
)
error_message
=
{}
for
key
,
value
in
response
.
data
.
items
():
print
(
value
)
if
type
(
value
)
==
list
and
value
[
0
]
.
code
==
'blank'
:
value
=
value
[
0
]
.
replace
(
'This field'
,
key
)
# elif type(value) == dict:
...
...
app/entities/migrations/0006_branch.py
0 → 100644
View file @
162f34f6
# Generated by Django 2.2 on 2020-01-22 11:41
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0005_auto_20200115_1950'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Branch'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'enviroment'
,
models
.
CharField
(
max_length
=
255
)),
(
'branch_name'
,
models
.
CharField
(
max_length
=
255
)),
(
'repo_type'
,
models
.
CharField
(
max_length
=
50
)),
(
'repository'
,
models
.
CharField
(
max_length
=
255
,
unique
=
True
)),
(
'created'
,
models
.
DateTimeField
(
auto_now_add
=
True
)),
],
options
=
{
'db_table'
:
'branches'
,
},
),
]
app/entities/models.py
View file @
162f34f6
...
...
@@ -266,9 +266,7 @@ class ExtractTransformLoad(AuditClass):
def
save
(
self
,
*
args
,
**
kwargs
):
super
(
ExtractTransformLoad
,
self
)
.
save
(
*
args
,
**
kwargs
)
code
=
number_generator
(
enums
.
GenerateCode
.
ETL
.
value
,
self
.
id
)
print
(
type
(
self
.
code
))
if
self
.
code
==
''
or
self
.
code
==
None
:
self
.
code
=
code
self
.
save
()
...
...
@@ -521,7 +519,6 @@ class MasterAttachment(models.Model):
attch_ref
=
models
.
TextField
()
def
delete
(
self
,
*
args
,
**
kwargs
):
# print(self.url.name)
if
os
.
path
.
isfile
(
self
.
url
.
path
):
os
.
remove
(
self
.
url
.
path
)
...
...
@@ -1275,4 +1272,25 @@ class ChangeRequestSettings(models.Model):
if
self
.
code
==
''
:
self
.
code
=
code
self
.
created
=
datetime
.
now
()
self
.
save
()
\ No newline at end of file
self
.
save
()
# branches info
class
Branch
(
models
.
Model
):
enviroment
=
models
.
CharField
(
max_length
=
255
)
branch_name
=
models
.
CharField
(
max_length
=
255
)
repo_type
=
models
.
CharField
(
max_length
=
50
)
repository
=
models
.
CharField
(
unique
=
True
,
max_length
=
255
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
class
Meta
:
db_table
=
'branches'
def
__str__
(
self
):
return
f
'{self.branch_name}'
\ No newline at end of file
branches.txt
View file @
162f34f6
...
...
@@ -9,3 +9,16 @@ http://administrator@42.61.118.105:7990/scm/rms/api-main-service.git -b jtc-dev
http://administrator@42.61.118.105:7990/scm/rms/api-main-service.git -b jtc-sit
http://administrator@42.61.118.105:7990/scm/rms/api-main-service.git -b jtc-staging
http://administrator@42.61.118.105:7990/scm/rms/api-main-service.git -b jtc-demo
Product Environment:
http://Administrator@52.76.133.252:7990/scm/rms/web.git -b product-dev
http://Administrator@52.76.133.252:7990/scm/rms/web.git -b product-sit
http://Administrator@52.76.133.252:7990/scm/rms/web.git -b product-staging
http://Administrator@52.76.133.252:7990/scm/rms/web.git -b product-demo
JTC Environment:
http://Administrator@52.76.133.252:7990/scm/rms/web.git -b jtc-dev
http://Administrator@52.76.133.252:7990/scm/rms/web.git -b jtc-sit
http://Administrator@52.76.133.252:7990/scm/rms/web.git -b jtc-staging
http://Administrator@52.76.133.252:7990/scm/rms/web.git -b jtc-demo
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment