Commit eca17ef7 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch '212418-address-boolean-attributes-when-passing-them-to-the-store' into 'master'

Code-climate on container registry code

See merge request gitlab-org/gitlab!34387
parents c8677d48 76e52341
import * as types from './mutation_types';
import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils';
import { parseIntPagination, normalizeHeaders, parseBoolean } from '~/lib/utils/common_utils';
import { IMAGE_DELETE_SCHEDULED_STATUS, IMAGE_FAILED_DELETED_STATUS } from '../constants/index';
export default {
......@@ -7,8 +7,8 @@ export default {
state.config = {
...config,
expirationPolicy: config.expirationPolicy ? JSON.parse(config.expirationPolicy) : undefined,
isGroupPage: config.isGroupPage !== undefined,
isAdmin: config.isAdmin !== undefined,
isGroupPage: parseBoolean(config.isGroupPage),
isAdmin: parseBoolean(config.isAdmin),
};
},
......
......@@ -12,6 +12,6 @@
"containers_error_image" => image_path('illustrations/docker-error-state.svg'),
"registry_host_url_with_port" => escape_once(registry_config.host_port),
"garbage_collection_help_page_path" => help_page_path('administration/packages/container_registry', anchor: 'container-registry-garbage-collection'),
"is_admin": current_user&.admin,
is_group_page: true,
"is_admin": current_user&.admin.to_s,
is_group_page: "true",
character_error: @character_error.to_s } }
%tr.tag
%td
= escape_once(tag.name)
= clipboard_button(text: "#{tag.location}")
%td
- if tag.revision
%span.has-tooltip{ title: "#{tag.revision}" }
= tag.short_revision
- else
\-
%td
- if tag.total_size
= number_to_human_size(tag.total_size)
·
= pluralize(tag.layers.size, "layer")
- else
.light
\-
%td
- if tag.created_at
= time_ago_with_tooltip tag.created_at
- else
.light
\-
- if can?(current_user, :update_container_image, @project)
%td.content
.controls.d-none.d-sm-block.float-right
= link_to project_registry_repository_tag_path(@project, tag.repository, tag.name),
method: :delete,
class: 'btn btn-remove has-tooltip',
title: 'Remove tag',
data: { confirm: 'Are you sure you want to delete this tag?' } do
= icon('trash cred')
......@@ -15,5 +15,5 @@
"registry_host_url_with_port" => escape_once(registry_config.host_port),
"expiration_policy_help_page_path" => help_page_path('user/packages/container_registry/index', anchor: 'expiration-policy'),
"garbage_collection_help_page_path" => help_page_path('administration/packages/container_registry', anchor: 'container-registry-garbage-collection'),
"is_admin": current_user&.admin,
"is_admin": current_user&.admin.to_s,
character_error: @character_error.to_s } }
......@@ -12,11 +12,14 @@ describe('Mutations Registry Explorer Store', () => {
it('should set the initial state', () => {
const payload = {
endpoint: 'foo',
isGroupPage: true,
isGroupPage: '',
expirationPolicy: { foo: 'bar' },
isAdmin: true,
isAdmin: '',
};
const expectedState = {
...mockState,
config: { ...payload, isGroupPage: false, isAdmin: false },
};
const expectedState = { ...mockState, config: payload };
mutations[types.SET_INITIAL_STATE](mockState, {
...payload,
expirationPolicy: JSON.stringify(payload.expirationPolicy),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment