Commit aa52dc14 authored by Thomas Randolph's avatar Thomas Randolph

Display a symlink icon for repository file symlinks

parent 9e1df20a
<script>
import { GlLoadingIcon, GlIcon } from '@gitlab/ui';
import getIconForFile from './file_icon/file_icon_map';
import { FILE_SYMLINK_MODE } from '../constants';
/* This is a re-usable vue component for rendering a svg sprite
icon
......@@ -25,9 +26,9 @@ export default {
required: true,
},
fileMode: {
type: Number,
type: String,
required: false,
default: -1
default: '',
},
folder: {
......@@ -65,8 +66,12 @@ export default {
},
},
computed: {
isSymlink() {
return this.fileMode === FILE_SYMLINK_MODE;
},
spriteHref() {
const iconName = this.submodule ? 'folder-git' : getIconForFile(this.fileName) || 'file';
return `${gon.sprite_file_icons}#${iconName}`;
},
folderIconName() {
......@@ -80,13 +85,11 @@ export default {
</script>
<template>
<span>
<svg v-if="!loading && !folder" :class="[iconSizeClass, cssClasses]">
<use v-bind="{ 'xlink:href': spriteHref }" /></svg
><gl-icon
v-if="!loading && folder"
:name="folderIconName"
:size="size"
class="folder-icon"
/><gl-loading-icon v-if="loading" :inline="true" />
<gl-loading-icon v-if="loading" :inline="true" />
<gl-icon v-else-if="isSymlink" name="symlink" :size="size" />
<svg v-else-if="!folder" :class="[iconSizeClass, cssClasses]">
<use v-bind="{ 'xlink:href': spriteHref }" />
</svg>
<gl-icon v-else :name="folderIconName" :size="size" class="folder-icon" />
</span>
</template>
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