Commit 8fba385e authored by Phil Hughes's avatar Phil Hughes

updated icons

fixed bug where unstaged file when discarded would not take staged file
changes
parent 3af57c3c
...@@ -21,13 +21,22 @@ export default { ...@@ -21,13 +21,22 @@ export default {
required: false, required: false,
default: false, default: false,
}, },
showStagedIcon: {
type: Boolean,
required: false,
default: false,
},
}, },
computed: { computed: {
changedIcon() { changedIcon() {
return this.file.tempFile ? 'file-addition' : 'file-modified'; const prefix = this.file.staged && !this.showStagedIcon ? '-solid' : '';
return this.file.tempFile ? `file-additions${prefix}` : `file-modified${prefix}`;
},
stagedIcon() {
return `${this.changedIcon}-solid`;
}, },
changedIconClass() { changedIconClass() {
return `multi-${this.changedIcon}`; return `multi-${this.changedIcon} prepend-left-5 pull-left`;
}, },
tooltipTitle() { tooltipTitle() {
if (!this.showTooltip) return undefined; if (!this.showTooltip) return undefined;
...@@ -63,6 +72,13 @@ export default { ...@@ -63,6 +72,13 @@ export default {
class="ide-file-changed-icon" class="ide-file-changed-icon"
> >
<icon <icon
v-if="file.staged && showStagedIcon"
:name="stagedIcon"
:size="12"
:css-classes="changedIconClass"
/>
<icon
v-if="file.changed || file.tempFile || (file.staged && !showStagedIcon)"
:name="changedIcon" :name="changedIcon"
:size="12" :size="12"
:css-classes="changedIconClass" :css-classes="changedIconClass"
......
...@@ -45,6 +45,11 @@ export default { ...@@ -45,6 +45,11 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
stagedList: {
type: Boolean,
required: false,
default: false,
},
}, },
computed: { computed: {
...mapState(['rightPanelCollapsed']), ...mapState(['rightPanelCollapsed']),
...@@ -134,6 +139,7 @@ export default { ...@@ -134,6 +139,7 @@ export default {
:file="file" :file="file"
:action-component="itemActionComponent" :action-component="itemActionComponent"
:key-prefix="title" :key-prefix="title"
:staged-list="stagedList"
/> />
</li> </li>
</ul> </ul>
......
...@@ -51,6 +51,12 @@ export default { ...@@ -51,6 +51,12 @@ export default {
titleTooltip() { titleTooltip() {
return sprintf(__('%{title} changes'), { title: this.title }); return sprintf(__('%{title} changes'), { title: this.title });
}, },
additionIconName() {
return this.title.toLowerCase() === 'staged' ? 'file-additions-solid' : 'file-additions';
},
modifiedIconName() {
return this.title.toLowerCase() === 'staged' ? 'file-modified-solid' : 'file-modified';
},
}, },
}; };
</script> </script>
...@@ -80,7 +86,7 @@ export default { ...@@ -80,7 +86,7 @@ export default {
class="append-bottom-10" class="append-bottom-10"
> >
<icon <icon
name="file-addition" :name="additionIconName"
:size="18" :size="18"
:css-classes="addedFilesIconClass" :css-classes="addedFilesIconClass"
/> />
...@@ -94,7 +100,7 @@ export default { ...@@ -94,7 +100,7 @@ export default {
class="prepend-top-10 append-bottom-10" class="prepend-top-10 append-bottom-10"
> >
<icon <icon
name="file-modified" :name="modifiedIconName"
:size="18" :size="18"
:css-classes="modifiedFilesClass" :css-classes="modifiedFilesClass"
/> />
......
...@@ -24,13 +24,19 @@ export default { ...@@ -24,13 +24,19 @@ export default {
required: false, required: false,
default: '', default: '',
}, },
stagedList: {
type: Boolean,
required: false,
default: false,
},
}, },
computed: { computed: {
iconName() { iconName() {
return this.file.tempFile ? 'file-addition' : 'file-modified'; const prefix = this.stagedList ? '-solid' : '';
return this.file.tempFile ? `file-additions${prefix}` : `file-modified${prefix}`;
}, },
iconClass() { iconClass() {
return `multi-file-${this.file.tempFile ? 'addition' : 'modified'} append-right-8`; return `multi-file-${this.file.tempFile ? 'additions' : 'modified'} append-right-8`;
}, },
}, },
methods: { methods: {
......
...@@ -85,6 +85,7 @@ export default { ...@@ -85,6 +85,7 @@ export default {
:action-btn-text="__('Unstage all')" :action-btn-text="__('Unstage all')"
item-action-component="unstage-button" item-action-component="unstage-button"
:show-toggle="false" :show-toggle="false"
:staged-list="true"
/> />
<form <form
class="form-horizontal multi-file-commit-form" class="form-horizontal multi-file-commit-form"
......
...@@ -105,6 +105,7 @@ export default { ...@@ -105,6 +105,7 @@ export default {
v-if="file.changed || file.tempFile || file.staged" v-if="file.changed || file.tempFile || file.staged"
:file="file" :file="file"
:show-tooltip="true" :show-tooltip="true"
:show-staged-icon="true"
class="prepend-top-5 pull-right" class="prepend-top-5 pull-right"
/> />
</span> </span>
......
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
return `Close ${this.tab.name}`; return `Close ${this.tab.name}`;
}, },
showChangedIcon() { showChangedIcon() {
return this.tab.changed ? !this.tabMouseOver : false; return this.fileHasChanged ? !this.tabMouseOver : false;
}, },
fileHasChanged() { fileHasChanged() {
return this.tab.changed || this.tab.tempFile || this.tab.staged; return this.tab.changed || this.tab.tempFile || this.tab.staged;
......
...@@ -166,10 +166,7 @@ export const discardFileChanges = ({ state, commit }, path) => { ...@@ -166,10 +166,7 @@ export const discardFileChanges = ({ state, commit }, path) => {
commit(types.TOGGLE_FILE_OPEN, path); commit(types.TOGGLE_FILE_OPEN, path);
} }
eventHub.$emit(`editor.update.model.content.${file.key}`, { eventHub.$emit(`editor.update.model.new.content.${file.key}`, file.content);
content: file.raw,
changed: false,
});
}; };
export const stageChange = ({ commit, state }, path) => { export const stageChange = ({ commit, state }, path) => {
......
...@@ -57,7 +57,9 @@ export default { ...@@ -57,7 +57,9 @@ export default {
}); });
}, },
[types.UPDATE_FILE_CONTENT](state, { path, content }) { [types.UPDATE_FILE_CONTENT](state, { path, content }) {
const changed = content !== state.entries[path].raw; const stagedFile = state.stagedFiles.find(f => f.path === path);
const rawContent = stagedFile ? stagedFile.content : state.entries[path].raw;
const changed = content !== rawContent;
Object.assign(state.entries[path], { Object.assign(state.entries[path], {
content, content,
...@@ -91,8 +93,10 @@ export default { ...@@ -91,8 +93,10 @@ export default {
}); });
}, },
[types.DISCARD_FILE_CHANGES](state, path) { [types.DISCARD_FILE_CHANGES](state, path) {
const stagedFile = state.stagedFiles.find(f => f.path === path);
Object.assign(state.entries[path], { Object.assign(state.entries[path], {
content: state.entries[path].raw, content: stagedFile ? stagedFile.content : state.entries[path].raw,
changed: false, changed: false,
}); });
}, },
......
...@@ -608,11 +608,13 @@ ...@@ -608,11 +608,13 @@
} }
} }
.multi-file-addition { .multi-file-additions,
.multi-file-additions-solid {
fill: $green-500; fill: $green-500;
} }
.multi-file-modified { .multi-file-modified,
.multi-file-modified-solid {
fill: $orange-500; fill: $orange-500;
} }
......
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