Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fbc17354
Commit
fbc17354
authored
Mar 07, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ee into ce-upstream
parents
dd0fe672
58d23076
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
95 additions
and
90 deletions
+95
-90
app/assets/javascripts/geo/components/geo_clone_dialog.js
app/assets/javascripts/geo/components/geo_clone_dialog.js
+0
-38
app/assets/javascripts/geo/geo_bundle.js
app/assets/javascripts/geo/geo_bundle.js
+0
-19
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-1
app/helpers/preferences_helper.rb
app/helpers/preferences_helper.rb
+1
-1
app/models/concerns/elastic/application_search.rb
app/models/concerns/elastic/application_search.rb
+10
-0
app/models/concerns/elastic/issues_search.rb
app/models/concerns/elastic/issues_search.rb
+1
-1
app/models/concerns/elastic/merge_requests_search.rb
app/models/concerns/elastic/merge_requests_search.rb
+1
-1
app/models/concerns/elastic/milestones_search.rb
app/models/concerns/elastic/milestones_search.rb
+9
-3
app/models/concerns/elastic/notes_search.rb
app/models/concerns/elastic/notes_search.rb
+1
-1
app/models/concerns/elastic/projects_search.rb
app/models/concerns/elastic/projects_search.rb
+1
-1
app/models/concerns/elastic/snippets_search.rb
app/models/concerns/elastic/snippets_search.rb
+19
-14
app/views/shared/_clone_panel.html.haml
app/views/shared/_clone_panel.html.haml
+4
-4
app/views/shared/_geo_info_modal.html.haml
app/views/shared/_geo_info_modal.html.haml
+44
-6
changelogs/unreleased-ee/1840-robustify-es-db-indexing.yml
changelogs/unreleased-ee/1840-robustify-es-db-indexing.yml
+4
-0
No files found.
app/assets/javascripts/geo/components/geo_clone_dialog.js
deleted
100644 → 0
View file @
dd0fe672
/* global Vue */
(()
=>
{
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
geo
=
window
.
gl
.
geo
||
{};
window
.
gl
.
geo
.
CloneDialog
=
Vue
.
extend
({
props
:
[
'
title
'
,
'
id
'
],
data
()
{
return
this
.
$parent
.
$data
;
},
mounted
()
{
$
(
`#
${
this
.
id
}
`
).
appendTo
(
'
body
'
).
modal
({
modal
:
true
,
show
:
false
});
},
template
:
`
<div class="modal in" tabindex="-1" :id="id">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<a href="#" data-dismiss="modal" class="close">×</a>
<h3>{{title}}</h3>
</div>
<div class="modal-body">
<p><strong>Step 1.</strong> Clone the repository from your secondary node:</p>
<slot name="clipboard-1"></slot>
<pre class="dark" id="geo-info-1">git clone {{cloneUrlSecondary}}</pre>
<p><strong>Step 2.</strong> Go to the new directory and define <strong>primary node's</strong> repository URL as the <strong>push</strong> remote:</p>
<slot name="clipboard-2"></slot>
<pre class="dark" id="geo-info-2">git remote set-url --push origin {{cloneUrlPrimary || '<clone url for primary repository>'}}</pre>
<p><strong>Done.</strong> You can now commit and push code as you normally do, but with increased speed.</p>
</div>
</div>
</div>
</div>
`
,
});
})();
app/assets/javascripts/geo/geo_bundle.js
deleted
100644 → 0
View file @
dd0fe672
/* global Vue */
window
.
Vue
=
require
(
'
vue
'
);
require
(
'
./components/geo_clone_dialog
'
);
$
(
document
).
ready
(()
=>
{
window
.
gl
=
window
.
gl
||
{};
const
$geoClone
=
document
.
getElementById
(
'
geo-clone
'
);
if
(
$geoClone
)
{
gl
.
GeoClone
=
new
Vue
({
el
:
$geoClone
,
components
:
{
'
geo-clone-dialog
'
:
gl
.
geo
.
CloneDialog
,
},
data
:
Object
.
assign
({},
$geoClone
.
dataset
),
});
}
});
app/assets/javascripts/main.js
View file @
fbc17354
...
...
@@ -207,7 +207,6 @@ require('./wikis');
require
(
'
./zen_mode
'
);
// EE-only scripts
require
(
'
./geo/geo_bundle
'
);
require
(
'
./admin_email_select
'
);
require
(
'
./application_settings
'
);
require
(
'
./approvals
'
);
...
...
app/helpers/preferences_helper.rb
View file @
fbc17354
...
...
@@ -65,4 +65,4 @@ module PreferencesHelper
def
anonymous_project_view
@project
.
empty_repo?
||
!
can?
(
current_user
,
:download_code
,
@project
)
?
'activity'
:
'readme'
end
end
\ No newline at end of file
end
app/models/concerns/elastic/application_search.rb
View file @
fbc17354
...
...
@@ -74,6 +74,16 @@ module Elastic
def
es_parent
project_id
if
respond_to?
(
:project_id
)
end
# Some attributes are actually complicated methods. Bad data can cause
# them to raise exceptions. When this happens, we still want the remainder
# of the object to be saved, so silently swallow the errors
def
safely_read_attribute_for_elasticsearch
(
attr_name
)
send
(
attr_name
)
rescue
=>
err
logger
.
warn
(
"Elasticsearch failed to read
#{
attr_name
}
for
#{
self
.
class
}
#{
self
.
id
}
:
#{
err
}
"
)
nil
end
end
module
ClassMethods
...
...
app/models/concerns/elastic/issues_search.rb
View file @
fbc17354
...
...
@@ -27,7 +27,7 @@ module Elastic
# We don't use as_json(only: ...) because it calls all virtual and serialized attributtes
# https://gitlab.com/gitlab-org/gitlab-ee/issues/349
[
:id
,
:iid
,
:title
,
:description
,
:created_at
,
:updated_at
,
:state
,
:project_id
,
:author_id
,
:assignee_id
,
:confidential
].
each
do
|
attr
|
data
[
attr
.
to_s
]
=
s
elf
.
send
(
attr
)
data
[
attr
.
to_s
]
=
s
afely_read_attribute_for_elasticsearch
(
attr
)
end
data
...
...
app/models/concerns/elastic/merge_requests_search.rb
View file @
fbc17354
...
...
@@ -45,7 +45,7 @@ module Elastic
:target_project_id
,
:author_id
].
each
do
|
attr
|
data
[
attr
.
to_s
]
=
s
elf
.
send
(
attr
)
data
[
attr
.
to_s
]
=
s
afely_read_attribute_for_elasticsearch
(
attr
)
end
data
...
...
app/models/concerns/elastic/milestones_search.rb
View file @
fbc17354
...
...
@@ -17,9 +17,15 @@ module Elastic
end
def
as_indexed_json
(
options
=
{})
as_json
(
only:
[
:id
,
:title
,
:description
,
:project_id
,
:created_at
,
:updated_at
]
)
# We don't use as_json(only: ...) because it calls all virtual and serialized attributtes
# https://gitlab.com/gitlab-org/gitlab-ee/issues/349
data
=
{}
[
:id
,
:title
,
:description
,
:project_id
,
:created_at
,
:updated_at
].
each
do
|
attr
|
data
[
attr
.
to_s
]
=
safely_read_attribute_for_elasticsearch
(
attr
)
end
data
end
def
self
.
nested?
...
...
app/models/concerns/elastic/notes_search.rb
View file @
fbc17354
...
...
@@ -26,7 +26,7 @@ module Elastic
# We don't use as_json(only: ...) because it calls all virtual and serialized attributtes
# https://gitlab.com/gitlab-org/gitlab-ee/issues/349
[
:id
,
:note
,
:project_id
,
:created_at
,
:updated_at
].
each
do
|
attr
|
data
[
attr
.
to_s
]
=
s
elf
.
send
(
attr
)
data
[
attr
.
to_s
]
=
s
afely_read_attribute_for_elasticsearch
(
attr
)
end
if
noteable
.
is_a?
(
Issue
)
...
...
app/models/concerns/elastic/projects_search.rb
View file @
fbc17354
...
...
@@ -46,7 +46,7 @@ module Elastic
:name_with_namespace
,
:path_with_namespace
].
each
do
|
attr
|
data
[
attr
.
to_s
]
=
s
elf
.
send
(
attr
)
data
[
attr
.
to_s
]
=
s
afely_read_attribute_for_elasticsearch
(
attr
)
end
data
...
...
app/models/concerns/elastic/snippets_search.rb
View file @
fbc17354
...
...
@@ -22,20 +22,25 @@ module Elastic
end
def
as_indexed_json
(
options
=
{})
as_json
({
only:
[
:id
,
:title
,
:file_name
,
:content
,
:created_at
,
:updated_at
,
:state
,
:project_id
,
:author_id
,
:visibility_level
]
})
# We don't use as_json(only: ...) because it calls all virtual and serialized attributtes
# https://gitlab.com/gitlab-org/gitlab-ee/issues/349
data
=
{}
[
:id
,
:title
,
:file_name
,
:content
,
:created_at
,
:updated_at
,
:project_id
,
:author_id
,
:visibility_level
].
each
do
|
attr
|
data
[
attr
.
to_s
]
=
safely_read_attribute_for_elasticsearch
(
attr
)
end
data
end
def
self
.
elastic_search
(
query
,
options:
{})
...
...
app/views/shared/_clone_panel.html.haml
View file @
fbc17354
...
...
@@ -38,10 +38,10 @@
e
.
preventDefault
();
var
$this
=
$
(
this
);
if
(
gl
.
GeoClone
)
{
gl
.
GeoClone
.
cloneUrlSecondary
=
$this
.
attr
(
'
href
'
);
gl
.
GeoClone
.
cloneUrlPrimary
=
$this
.
data
(
'
primaryUrl
'
);
}
$
(
'
#modal-geo-info
'
).
data
(
{
cloneUrlSecondary
:
$this
.
attr
(
'
href
'
),
cloneUrlPrimary
:
$this
.
data
(
'
primaryUrl
'
)
||
''
}
);
});
=
render
'shared/geo_info_modal'
,
project:
project
if
Gitlab
::
Geo
.
secondary?
app/views/shared/_geo_info_modal.html.haml
View file @
fbc17354
#geo-clone
{
data:
{
clone_url_secondary:
h
(
default_url_to_repo
(
project
)),
clone_url_primary:
h
(
geo_primary_default_url_to_repo
(
project
))
}
}
%geo-clone-dialog
{
id:
'modal-geo-info'
,
title:
'How to work faster with Geo'
}
%span
{
slot:
'clipboard-1'
}
=
clipboard_button
(
clipboard_target:
'pre#geo-info-1'
)
%span
{
slot:
'clipboard-2'
}
=
clipboard_button
(
clipboard_target:
'pre#geo-info-2'
)
#modal-geo-info
.modal.in
{
tabindex:
'-1'
,
data:
{
clone_url_secondary:
h
(
default_url_to_repo
(
project
)),
clone_url_primary:
h
(
geo_primary_default_url_to_repo
(
project
))
}
}
.modal-dialog
.modal-content
.modal-header
%a
.close
{
href:
'#'
,
data:
{
dismiss:
'modal'
}
}
%h3
=
'How to work faster with Geo'
.modal-body
%p
%strong
=
'Step 1.'
Clone the repository from your secondary node:
=
clipboard_button
(
clipboard_target:
'pre#geo-info-1'
)
%pre
#geo-info-1
.dark
git clone
=
default_url_to_repo
()
%p
%strong
=
'Step 2.'
Go to the new directory and define
%strong
=
"primary node's"
repository URL as the
%strong
=
'push'
remote:
=
clipboard_button
(
clipboard_target:
'pre#geo-info-2'
)
%pre
#geo-info-2
.dark
git remote set-url --push origin
<
clone url for primary repository
>
%p
%strong
=
'Done.'
You can now commit and push code as you normally do, but with increased speed.
:javascript
$
(
'
#modal-geo-info
'
)
.
appendTo
(
'
body
'
)
.
modal
({
modal
:
true
,
show
:
false
})
.
on
(
'
show.bs.modal
'
,
function
()
{
var
data
=
$
(
this
).
data
();
$
(
'
#geo-info-1
'
).
text
(
'
git clone
'
+
(
data
.
cloneUrlSecondary
||
'
<clone url for secondary repository>
'
)
);
$
(
'
geo-info-2
'
).
text
(
'
git remote set-url --push origin
'
+
(
data
.
cloneUrlPrimary
||
'
<clone url for primary repository>
'
)
);
});
changelogs/unreleased-ee/1840-robustify-es-db-indexing.yml
0 → 100644
View file @
fbc17354
---
title
:
Robustify reading attributes for elasticsearch
merge_request
:
1365
author
:
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