##// END OF EJS Templates
artifacts: added metadata table to store various extra data for artifact
marcink -
r3991:1f06bac1 default
parent child Browse files
Show More

The requested changes are too big and content was truncated. Show full diff

1 NO CONTENT: new file 100644
The requested commit or file is too big and content was truncated. Show full diff
@@ -0,0 +1,32 b''
1 # -*- coding: utf-8 -*-
2
3 import logging
4
5 from sqlalchemy import *
6
7 from rhodecode.model import meta
8 from rhodecode.lib.dbmigrate.versions import _reset_base, notify
9
10 log = logging.getLogger(__name__)
11
12
13 def upgrade(migrate_engine):
14 """
15 Upgrade operations go here.
16 Don't create your own engine; bind migrate_engine to your metadata
17 """
18 _reset_base(migrate_engine)
19 from rhodecode.lib.dbmigrate.schema import db_4_18_0_1 as db
20
21 db.FileStoreMetadata.__table__.create()
22
23 fixups(db, meta.Session)
24
25
26 def downgrade(migrate_engine):
27 meta = MetaData()
28 meta.bind = migrate_engine
29
30
31 def fixups(models, _SESSION):
32 pass
@@ -1,57 +1,57 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2010-2019 RhodeCode GmbH
4 4 #
5 5 # This program is free software: you can redistribute it and/or modify
6 6 # it under the terms of the GNU Affero General Public License, version 3
7 7 # (only), as published by the Free Software Foundation.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU Affero General Public License
15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16 #
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import os
22 22 import sys
23 23 import platform
24 24
25 25 VERSION = tuple(open(os.path.join(
26 26 os.path.dirname(__file__), 'VERSION')).read().split('.'))
27 27
28 28 BACKENDS = {
29 29 'hg': 'Mercurial repository',
30 30 'git': 'Git repository',
31 31 'svn': 'Subversion repository',
32 32 }
33 33
34 34 CELERY_ENABLED = False
35 35 CELERY_EAGER = False
36 36
37 37 # link to config for pyramid
38 38 CONFIG = {}
39 39
40 40 # Populated with the settings dictionary from application init in
41 41 # rhodecode.conf.environment.load_pyramid_environment
42 42 PYRAMID_SETTINGS = {}
43 43
44 44 # Linked module for extensions
45 45 EXTENSIONS = {}
46 46
47 47 __version__ = ('.'.join((str(each) for each in VERSION[:3])))
48 __dbversion__ = 100 # defines current db version for migrations
48 __dbversion__ = 101 # defines current db version for migrations
49 49 __platform__ = platform.system()
50 50 __license__ = 'AGPLv3, and Commercial License'
51 51 __author__ = 'RhodeCode GmbH'
52 52 __url__ = 'https://code.rhodecode.com'
53 53
54 54 is_windows = __platform__ in ['Windows']
55 55 is_unix = not is_windows
56 56 is_test = False
57 57 disable_error_handler = False
1 NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,465 +1,462 b''
1 1 ## DATA TABLE RE USABLE ELEMENTS
2 2 ## usage:
3 3 ## <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
4 4 <%namespace name="base" file="/base/base.mako"/>
5 5
6 6 <%def name="metatags_help()">
7 7 <table>
8 8 <%
9 9 example_tags = [
10 10 ('state','[stable]'),
11 11 ('state','[stale]'),
12 12 ('state','[featured]'),
13 13 ('state','[dev]'),
14 14 ('state','[dead]'),
15 15 ('state','[deprecated]'),
16 16
17 17 ('label','[personal]'),
18 18 ('generic','[v2.0.0]'),
19 19
20 20 ('lang','[lang =&gt; JavaScript]'),
21 21 ('license','[license =&gt; LicenseName]'),
22 22
23 23 ('ref','[requires =&gt; RepoName]'),
24 24 ('ref','[recommends =&gt; GroupName]'),
25 25 ('ref','[conflicts =&gt; SomeName]'),
26 26 ('ref','[base =&gt; SomeName]'),
27 27 ('url','[url =&gt; [linkName](https://rhodecode.com)]'),
28 28 ('see','[see =&gt; http://rhodecode.com]'),
29 29 ]
30 30 %>
31 31 % for tag_type, tag in example_tags:
32 32 <tr>
33 33 <td>${tag|n}</td>
34 34 <td>${h.style_metatag(tag_type, tag)|n}</td>
35 35 </tr>
36 36 % endfor
37 37 </table>
38 38 </%def>
39 39
40 40 ## REPOSITORY RENDERERS
41 41 <%def name="quick_menu(repo_name)">
42 42 <i class="icon-more"></i>
43 43 <div class="menu_items_container hidden">
44 44 <ul class="menu_items">
45 45 <li>
46 46 <a title="${_('Summary')}" href="${h.route_path('repo_summary',repo_name=repo_name)}">
47 47 <span>${_('Summary')}</span>
48 48 </a>
49 49 </li>
50 50 <li>
51 51 <a title="${_('Commits')}" href="${h.route_path('repo_commits',repo_name=repo_name)}">
52 52 <span>${_('Commits')}</span>
53 53 </a>
54 54 </li>
55 55 <li>
56 56 <a title="${_('Files')}" href="${h.route_path('repo_files:default_commit',repo_name=repo_name)}">
57 57 <span>${_('Files')}</span>
58 58 </a>
59 59 </li>
60 60 <li>
61 61 <a title="${_('Fork')}" href="${h.route_path('repo_fork_new',repo_name=repo_name)}">
62 62 <span>${_('Fork')}</span>
63 63 </a>
64 64 </li>
65 65 </ul>
66 66 </div>
67 67 </%def>
68 68
69 69 <%def name="repo_name(name,rtype,rstate,private,archived,fork_of,short_name=False,admin=False)">
70 70 <%
71 71 def get_name(name,short_name=short_name):
72 72 if short_name:
73 73 return name.split('/')[-1]
74 74 else:
75 75 return name
76 76 %>
77 77 <div class="${'repo_state_pending' if rstate == 'repo_state_pending' else ''} truncate">
78 78 ##NAME
79 79 <a href="${h.route_path('edit_repo',repo_name=name) if admin else h.route_path('repo_summary',repo_name=name)}">
80 80
81 81 ##TYPE OF REPO
82 82 %if h.is_hg(rtype):
83 83 <span title="${_('Mercurial repository')}"><i class="icon-hg" style="font-size: 14px;"></i></span>
84 84 %elif h.is_git(rtype):
85 85 <span title="${_('Git repository')}"><i class="icon-git" style="font-size: 14px"></i></span>
86 86 %elif h.is_svn(rtype):
87 87 <span title="${_('Subversion repository')}"><i class="icon-svn" style="font-size: 14px"></i></span>
88 88 %endif
89 89
90 90 ##PRIVATE/PUBLIC
91 91 %if private is True and c.visual.show_private_icon:
92 92 <i class="icon-lock" title="${_('Private repository')}"></i>
93 93 %elif private is False and c.visual.show_public_icon:
94 94 <i class="icon-unlock-alt" title="${_('Public repository')}"></i>
95 95 %else:
96 96 <span></span>
97 97 %endif
98 98 ${get_name(name)}
99 99 </a>
100 100 %if fork_of:
101 101 <a href="${h.route_path('repo_summary',repo_name=fork_of.repo_name)}"><i class="icon-code-fork"></i></a>
102 102 %endif
103 103 %if rstate == 'repo_state_pending':
104 104 <span class="creation_in_progress tooltip" title="${_('This repository is being created in a background task')}">
105 105 (${_('creating...')})
106 106 </span>
107 107 %endif
108 108
109 109 </div>
110 110 </%def>
111 111
112 112 <%def name="repo_desc(description, stylify_metatags)">
113 113 <%
114 114 tags, description = h.extract_metatags(description)
115 115 %>
116 116
117 117 <div class="truncate-wrap">
118 118 % if stylify_metatags:
119 119 % for tag_type, tag in tags:
120 120 ${h.style_metatag(tag_type, tag)|n}
121 121 % endfor
122 122 % endif
123 123 ${description}
124 124 </div>
125 125
126 126 </%def>
127 127
128 128 <%def name="last_change(last_change)">
129 129 ${h.age_component(last_change, time_is_local=True)}
130 130 </%def>
131 131
132 132 <%def name="revision(name,rev,tip,author,last_msg, commit_date)">
133 133 <div>
134 134 %if rev >= 0:
135 135 <code><a title="${h.tooltip('%s\n%s\n\n%s' % (author, commit_date, last_msg))}" class="tooltip" href="${h.route_path('repo_commit',repo_name=name,commit_id=tip)}">${'r%s:%s' % (rev,h.short_id(tip))}</a></code>
136 136 %else:
137 137 ${_('No commits yet')}
138 138 %endif
139 139 </div>
140 140 </%def>
141 141
142 142 <%def name="rss(name)">
143 143 %if c.rhodecode_user.username != h.DEFAULT_USER:
144 144 <a title="${h.tooltip(_('Subscribe to %s rss feed')% name)}" href="${h.route_path('rss_feed_home', repo_name=name, _query=dict(auth_token=c.rhodecode_user.feed_token))}"><i class="icon-rss-sign"></i></a>
145 145 %else:
146 146 <a title="${h.tooltip(_('Subscribe to %s rss feed')% name)}" href="${h.route_path('rss_feed_home', repo_name=name)}"><i class="icon-rss-sign"></i></a>
147 147 %endif
148 148 </%def>
149 149
150 150 <%def name="atom(name)">
151 151 %if c.rhodecode_user.username != h.DEFAULT_USER:
152 152 <a title="${h.tooltip(_('Subscribe to %s atom feed')% name)}" href="${h.route_path('atom_feed_home', repo_name=name, _query=dict(auth_token=c.rhodecode_user.feed_token))}"><i class="icon-rss-sign"></i></a>
153 153 %else:
154 154 <a title="${h.tooltip(_('Subscribe to %s atom feed')% name)}" href="${h.route_path('atom_feed_home', repo_name=name)}"><i class="icon-rss-sign"></i></a>
155 155 %endif
156 156 </%def>
157 157
158 158 <%def name="user_gravatar(email, size=16)">
159 159 <div class="rc-user tooltip" title="${h.tooltip(h.author_string(email))}">
160 160 ${base.gravatar(email, 16)}
161 161 </div>
162 162 </%def>
163 163
164 164 <%def name="repo_actions(repo_name, super_user=True)">
165 165 <div>
166 166 <div class="grid_edit">
167 167 <a href="${h.route_path('edit_repo',repo_name=repo_name)}" title="${_('Edit')}">
168 168 Edit
169 169 </a>
170 170 </div>
171 171 <div class="grid_delete">
172 172 ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=repo_name), request=request)}
173 173 ${h.submit('remove_%s' % repo_name,_('Delete'),class_="btn btn-link btn-danger",
174 174 onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")}
175 175 ${h.end_form()}
176 176 </div>
177 177 </div>
178 178 </%def>
179 179
180 180 <%def name="repo_state(repo_state)">
181 181 <div>
182 182 %if repo_state == 'repo_state_pending':
183 183 <div class="tag tag4">${_('Creating')}</div>
184 184 %elif repo_state == 'repo_state_created':
185 185 <div class="tag tag1">${_('Created')}</div>
186 186 %else:
187 187 <div class="tag alert2" title="${h.tooltip(repo_state)}">invalid</div>
188 188 %endif
189 189 </div>
190 190 </%def>
191 191
192 192
193 193 ## REPO GROUP RENDERERS
194 194 <%def name="quick_repo_group_menu(repo_group_name)">
195 195 <i class="icon-more"></i>
196 196 <div class="menu_items_container hidden">
197 197 <ul class="menu_items">
198 198 <li>
199 199 <a href="${h.route_path('repo_group_home', repo_group_name=repo_group_name)}">${_('Summary')}</a>
200 200 </li>
201 201
202 202 </ul>
203 203 </div>
204 204 </%def>
205 205
206 206 <%def name="repo_group_name(repo_group_name, children_groups=None)">
207 207 <div>
208 208 <a href="${h.route_path('repo_group_home', repo_group_name=repo_group_name)}">
209 209 <i class="icon-repo-group" title="${_('Repository group')}" style="font-size: 14px"></i>
210 210 %if children_groups:
211 211 ${h.literal(' &raquo; '.join(children_groups))}
212 212 %else:
213 213 ${repo_group_name}
214 214 %endif
215 215 </a>
216 216 </div>
217 217 </%def>
218 218
219 219 <%def name="repo_group_desc(description, personal, stylify_metatags)">
220 220
221 221 <%
222 222 tags, description = h.extract_metatags(description)
223 223 %>
224 224
225 225 <div class="truncate-wrap">
226 226 % if personal:
227 227 <div class="metatag" tag="personal">${_('personal')}</div>
228 228 % endif
229 229
230 230 % if stylify_metatags:
231 231 % for tag_type, tag in tags:
232 232 ${h.style_metatag(tag_type, tag)|n}
233 233 % endfor
234 234 % endif
235 235 ${description}
236 236 </div>
237 237
238 238 </%def>
239 239
240 240 <%def name="repo_group_actions(repo_group_id, repo_group_name, gr_count)">
241 241 <div class="grid_edit">
242 242 <a href="${h.route_path('edit_repo_group',repo_group_name=repo_group_name)}" title="${_('Edit')}">Edit</a>
243 243 </div>
244 244 <div class="grid_delete">
245 245 ${h.secure_form(h.route_path('edit_repo_group_advanced_delete', repo_group_name=repo_group_name), request=request)}
246 246 ${h.submit('remove_%s' % repo_group_name,_('Delete'),class_="btn btn-link btn-danger",
247 247 onclick="return confirm('"+_ungettext('Confirm to delete this group: %s with %s repository','Confirm to delete this group: %s with %s repositories',gr_count) % (repo_group_name, gr_count)+"');")}
248 248 ${h.end_form()}
249 249 </div>
250 250 </%def>
251 251
252 252
253 253 <%def name="user_actions(user_id, username)">
254 254 <div class="grid_edit">
255 255 <a href="${h.route_path('user_edit',user_id=user_id)}" title="${_('Edit')}">
256 256 ${_('Edit')}
257 257 </a>
258 258 </div>
259 259 <div class="grid_delete">
260 260 ${h.secure_form(h.route_path('user_delete', user_id=user_id), request=request)}
261 261 ${h.submit('remove_',_('Delete'),id="remove_user_%s" % user_id, class_="btn btn-link btn-danger",
262 262 onclick="return confirm('"+_('Confirm to delete this user: %s') % username+"');")}
263 263 ${h.end_form()}
264 264 </div>
265 265 </%def>
266 266
267 267 <%def name="user_group_actions(user_group_id, user_group_name)">
268 268 <div class="grid_edit">
269 269 <a href="${h.route_path('edit_user_group', user_group_id=user_group_id)}" title="${_('Edit')}">Edit</a>
270 270 </div>
271 271 <div class="grid_delete">
272 272 ${h.secure_form(h.route_path('user_groups_delete', user_group_id=user_group_id), request=request)}
273 273 ${h.submit('remove_',_('Delete'),id="remove_group_%s" % user_group_id, class_="btn btn-link btn-danger",
274 274 onclick="return confirm('"+_('Confirm to delete this user group: %s') % user_group_name+"');")}
275 275 ${h.end_form()}
276 276 </div>
277 277 </%def>
278 278
279 279
280 280 <%def name="user_name(user_id, username)">
281 281 ${h.link_to(h.person(username, 'username_or_name_or_email'), h.route_path('user_edit', user_id=user_id))}
282 282 </%def>
283 283
284 284 <%def name="user_profile(username)">
285 285 ${base.gravatar_with_user(username, 16)}
286 286 </%def>
287 287
288 288 <%def name="user_group_name(user_group_name)">
289 289 <div>
290 290 <i class="icon-user-group" title="${_('User group')}"></i>
291 291 ${h.link_to_group(user_group_name)}
292 292 </div>
293 293 </%def>
294 294
295 295
296 296 ## GISTS
297 297
298 298 <%def name="gist_gravatar(full_contact)">
299 299 <div class="gist_gravatar">
300 300 ${base.gravatar(full_contact, 30)}
301 301 </div>
302 302 </%def>
303 303
304 304 <%def name="gist_access_id(gist_access_id, full_contact)">
305 305 <div>
306 306 <b>
307 307 <a href="${h.route_path('gist_show', gist_id=gist_access_id)}">gist: ${gist_access_id}</a>
308 308 </b>
309 309 </div>
310 310 </%def>
311 311
312 312 <%def name="gist_author(full_contact, created_on, expires)">
313 313 ${base.gravatar_with_user(full_contact, 16)}
314 314 </%def>
315 315
316 316
317 317 <%def name="gist_created(created_on)">
318 318 <div class="created">
319 319 ${h.age_component(created_on, time_is_local=True)}
320 320 </div>
321 321 </%def>
322 322
323 323 <%def name="gist_expires(expires)">
324 324 <div class="created">
325 325 %if expires == -1:
326 326 ${_('never')}
327 327 %else:
328 328 ${h.age_component(h.time_to_utcdatetime(expires))}
329 329 %endif
330 330 </div>
331 331 </%def>
332 332
333 333 <%def name="gist_type(gist_type)">
334 334 %if gist_type != 'public':
335 335 <div class="tag">${_('Private')}</div>
336 336 %endif
337 337 </%def>
338 338
339 339 <%def name="gist_description(gist_description)">
340 340 ${gist_description}
341 341 </%def>
342 342
343 343
344 344 ## PULL REQUESTS GRID RENDERERS
345 345
346 346 <%def name="pullrequest_target_repo(repo_name)">
347 347 <div class="truncate">
348 348 ${h.link_to(repo_name,h.route_path('repo_summary',repo_name=repo_name))}
349 349 </div>
350 350 </%def>
351 351
352 352 <%def name="pullrequest_status(status)">
353 353 <i class="icon-circle review-status-${status}"></i>
354 354 </%def>
355 355
356 356 <%def name="pullrequest_title(title, description)">
357 357 ${title}
358 358 </%def>
359 359
360 360 <%def name="pullrequest_comments(comments_nr)">
361 361 <i class="icon-comment"></i> ${comments_nr}
362 362 </%def>
363 363
364 364 <%def name="pullrequest_name(pull_request_id, target_repo_name, short=False)">
365 365 <a href="${h.route_path('pullrequest_show',repo_name=target_repo_name,pull_request_id=pull_request_id)}">
366 366 % if short:
367 367 #${pull_request_id}
368 368 % else:
369 369 ${_('Pull request #%(pr_number)s') % {'pr_number': pull_request_id,}}
370 370 % endif
371 371 </a>
372 372 </%def>
373 373
374 374 <%def name="pullrequest_updated_on(updated_on)">
375 375 ${h.age_component(h.time_to_utcdatetime(updated_on))}
376 376 </%def>
377 377
378 378 <%def name="pullrequest_author(full_contact)">
379 379 ${base.gravatar_with_user(full_contact, 16)}
380 380 </%def>
381 381
382 382
383 383 ## ARTIFACT RENDERERS
384 384 <%def name="repo_artifact_name(repo_name, file_uid, artifact_display_name)">
385 385 <a href="${h.route_path('repo_artifacts_get', repo_name=repo_name, uid=file_uid)}">
386 ${artifact_display_name or 'EMPTY NAME'}
386 ${artifact_display_name or '_EMPTY_NAME_'}
387 387 </a>
388 388 </%def>
389 389
390 390 <%def name="repo_artifact_uid(repo_name, file_uid)">
391 <code>${h.shorter(file_uid, size=12, prefix=True)}</code>
392 </%def>
393
394 <%def name="repo_artifact_uid_action(repo_name, file_uid)">
391 <code>${h.shorter(file_uid, size=24, prefix=True)}</code>
395 392 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${h.route_url('repo_artifacts_get', repo_name=repo_name, uid=file_uid)}" title="${_('Copy the full url')}"></i>
396 393 </%def>
397 394
398 395 <%def name="repo_artifact_sha256(artifact_sha256)">
399 396 <div class="code">${h.shorter(artifact_sha256, 12)}<i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${artifact_sha256}" title="${_('Copy the sha256 ({})').format(artifact_sha256)}"></i></div>
400 397 </%def>
401 398
402 399 <%def name="repo_artifact_actions(repo_name, file_store_id, file_uid)">
403 400 ## <div class="grid_edit">
404 401 ## <a href="#Edit" title="${_('Edit')}">${_('Edit')}</a>
405 402 ## </div>
406 403 <div class="grid_edit">
407 404 <a href="${h.route_path('repo_artifacts_info', repo_name=repo_name, uid=file_store_id)}" title="${_('Info')}">${_('Info')}</a>
408 405 </div>
409 406 % if h.HasRepoPermissionAny('repository.admin')(c.repo_name):
410 407 <div class="grid_delete">
411 408 ${h.secure_form(h.route_path('repo_artifacts_delete', repo_name=repo_name, uid=file_store_id), request=request)}
412 409 ${h.submit('remove_',_('Delete'),id="remove_artifact_%s" % file_store_id, class_="btn btn-link btn-danger",
413 410 onclick="return confirm('"+_('Confirm to delete this artifact: %s') % file_uid+"');")}
414 411 ${h.end_form()}
415 412 </div>
416 413 % endif
417 414 </%def>
418 415
419 416 <%def name="markup_form(form_id, form_text='', help_text=None)">
420 417
421 418 <div class="markup-form">
422 419 <div class="markup-form-area">
423 420 <div class="markup-form-area-header">
424 421 <ul class="nav-links clearfix">
425 422 <li class="active">
426 423 <a href="#edit-text" tabindex="-1" id="edit-btn_${form_id}">${_('Write')}</a>
427 424 </li>
428 425 <li class="">
429 426 <a href="#preview-text" tabindex="-1" id="preview-btn_${form_id}">${_('Preview')}</a>
430 427 </li>
431 428 </ul>
432 429 </div>
433 430
434 431 <div class="markup-form-area-write" style="display: block;">
435 432 <div id="edit-container_${form_id}">
436 433 <textarea id="${form_id}" name="${form_id}" class="comment-block-ta ac-input">${form_text if form_text else ''}</textarea>
437 434 </div>
438 435 <div id="preview-container_${form_id}" class="clearfix" style="display: none;">
439 436 <div id="preview-box_${form_id}" class="preview-box"></div>
440 437 </div>
441 438 </div>
442 439
443 440 <div class="markup-form-area-footer">
444 441 <div class="toolbar">
445 442 <div class="toolbar-text">
446 443 ${(_('Parsed using %s syntax') % (
447 444 ('<a href="%s">%s</a>' % (h.route_url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
448 445 )
449 446 )|n}
450 447 </div>
451 448 </div>
452 449 </div>
453 450 </div>
454 451
455 452 <div class="markup-form-footer">
456 453 % if help_text:
457 454 <span class="help-block">${help_text}</span>
458 455 % endif
459 456 </div>
460 457 </div>
461 458 <script type="text/javascript">
462 459 new MarkupForm('${form_id}');
463 460 </script>
464 461
465 462 </%def>
General Comments 0
You need to be logged in to leave comments. Login now