2020-05-24 23:13:21 +05:30
|
|
|
import { __, sprintf } from '~/locale';
|
|
|
|
import { numberToHumanSize } from '~/lib/utils/number_utils';
|
2020-03-09 13:42:32 +05:30
|
|
|
|
|
|
|
export const BTN_COPY_CONTENTS_TITLE = __('Copy file contents');
|
|
|
|
export const BTN_RAW_TITLE = __('Open raw');
|
|
|
|
export const BTN_DOWNLOAD_TITLE = __('Download');
|
|
|
|
|
|
|
|
export const SIMPLE_BLOB_VIEWER = 'simple';
|
|
|
|
export const SIMPLE_BLOB_VIEWER_TITLE = __('Display source');
|
|
|
|
|
|
|
|
export const RICH_BLOB_VIEWER = 'rich';
|
|
|
|
export const RICH_BLOB_VIEWER_TITLE = __('Display rendered file');
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
export const BLOB_RENDER_EVENT_LOAD = 'force-content-fetch';
|
|
|
|
export const BLOB_RENDER_EVENT_SHOW_SOURCE = 'force-switch-viewer';
|
|
|
|
|
|
|
|
export const BLOB_RENDER_ERRORS = {
|
|
|
|
REASONS: {
|
|
|
|
COLLAPSED: {
|
|
|
|
id: 'collapsed',
|
|
|
|
text: sprintf(__('it is larger than %{limit}'), {
|
|
|
|
limit: numberToHumanSize(1048576), // 1MB in bytes
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
TOO_LARGE: {
|
|
|
|
id: 'too_large',
|
|
|
|
text: sprintf(__('it is larger than %{limit}'), {
|
2020-07-28 23:09:34 +05:30
|
|
|
limit: numberToHumanSize(10485760), // 10MB in bytes
|
2020-05-24 23:13:21 +05:30
|
|
|
}),
|
|
|
|
},
|
|
|
|
EXTERNAL: {
|
|
|
|
id: 'server_side_but_stored_externally',
|
|
|
|
text: {
|
|
|
|
lfs: __('it is stored in LFS'),
|
|
|
|
build_artifact: __('it is stored as a job artifact'),
|
|
|
|
default: __('it is stored externally'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
OPTIONS: {
|
|
|
|
LOAD: {
|
|
|
|
id: 'load',
|
|
|
|
text: __('load it anyway'),
|
|
|
|
conjunction: __('or'),
|
|
|
|
href: '#',
|
|
|
|
target: '',
|
|
|
|
event: BLOB_RENDER_EVENT_LOAD,
|
|
|
|
},
|
|
|
|
SHOW_SOURCE: {
|
|
|
|
id: 'show_source',
|
|
|
|
text: __('view the source'),
|
|
|
|
conjunction: __('or'),
|
|
|
|
href: '#',
|
|
|
|
target: '',
|
|
|
|
event: BLOB_RENDER_EVENT_SHOW_SOURCE,
|
|
|
|
},
|
|
|
|
DOWNLOAD: {
|
|
|
|
id: 'download',
|
|
|
|
text: __('download it'),
|
|
|
|
conjunction: '',
|
|
|
|
target: '_blank',
|
|
|
|
condition: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|