Commit 293364c8 authored by Phil Hughes's avatar Phil Hughes

updated styling

changed to include new files
added getter spec
parent c4201f10
<script> <script>
import { mapActions, mapGetters } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
import skeletonLoadingContainer from '~/vue_shared/components/skeleton_loading_container.vue'; import SkeletonLoadingContainer from '~/vue_shared/components/skeleton_loading_container.vue';
import fileIcon from '~/vue_shared/components/file_icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import FileIcon from '~/vue_shared/components/file_icon.vue';
import router from '../ide_router'; import router from '../ide_router';
import newDropdown from './new_dropdown/index.vue'; import NewDropdown from './new_dropdown/index.vue';
import fileStatusIcon from './repo_file_status_icon.vue'; import FileStatusIcon from './repo_file_status_icon.vue';
import changedFileIcon from './changed_file_icon.vue'; import ChangedFileIcon from './changed_file_icon.vue';
import mrFileIcon from './mr_file_icon.vue'; import MrFileIcon from './mr_file_icon.vue';
export default { export default {
name: 'RepoFile', name: 'RepoFile',
components: { components: {
skeletonLoadingContainer, SkeletonLoadingContainer,
newDropdown, NewDropdown,
fileStatusIcon, FileStatusIcon,
fileIcon, FileIcon,
changedFileIcon, ChangedFileIcon,
mrFileIcon, MrFileIcon,
Icon,
}, },
props: { props: {
file: { file: {
...@@ -107,8 +109,14 @@ export default { ...@@ -107,8 +109,14 @@ export default {
/> />
<span <span
v-if="isTree && folderChangedCount > 0" v-if="isTree && folderChangedCount > 0"
class="ide-tree-changes"
> >
{{ folderChangedCount }} {{ folderChangedCount }}
<icon
name="file-modified"
:size="12"
css-classes="prepend-left-5 multi-file-modified"
/>
</span> </span>
<changed-file-icon <changed-file-icon
v-else-if="file.changed || file.tempFile" v-else-if="file.changed || file.tempFile"
......
...@@ -37,4 +37,4 @@ export const hasChanges = state => !!state.changedFiles.length; ...@@ -37,4 +37,4 @@ export const hasChanges = state => !!state.changedFiles.length;
export const hasMergeRequest = state => !!state.currentMergeRequestId; export const hasMergeRequest = state => !!state.currentMergeRequestId;
export const getChangesInFolder = state => path => export const getChangesInFolder = state => path =>
state.changedFiles.filter(f => f.path.indexOf(path) === 0 && !f.tempFile).length; state.changedFiles.filter(f => f.path.replace(new RegExp(`/${f.name}$`), '') === path).length;
...@@ -66,10 +66,6 @@ ...@@ -66,10 +66,6 @@
} }
} }
.ide-file-changed-icon {
margin-left: auto;
}
.ide-new-btn { .ide-new-btn {
display: none; display: none;
margin-bottom: -4px; margin-bottom: -4px;
...@@ -909,3 +905,9 @@ ...@@ -909,3 +905,9 @@
background: transparent; background: transparent;
resize: none; resize: none;
} }
.ide-tree-changes {
display: flex;
align-items: center;
font-size: 12px;
}
...@@ -72,4 +72,37 @@ describe('IDE store getters', () => { ...@@ -72,4 +72,37 @@ describe('IDE store getters', () => {
expect(getters.currentMergeRequest(localState)).toBeNull(); expect(getters.currentMergeRequest(localState)).toBeNull();
}); });
}); });
describe('getChangesInFolder', () => {
it('returns length of changed files for a path', () => {
localState.changedFiles.push(
{
path: 'test/index',
name: 'index',
},
{
path: 'testing/123',
name: '123',
},
);
expect(getters.getChangesInFolder(localState)('test')).toBe(1);
});
it('returns length of changed & tempFiles files for a path', () => {
localState.changedFiles.push(
{
path: 'test/index',
name: 'index',
},
{
path: 'test/newfile',
name: 'newfile',
tempFile: true,
},
);
expect(getters.getChangesInFolder(localState)('test')).toBe(2);
});
});
}); });
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