Skip to content

Commit

Permalink
🔀 Merge pull request gchq#416 from Lissy93/FIX/add-edit-item
Browse files Browse the repository at this point in the history
[FIX] Minor UI editor fixes
Fixes gchq#389
Fixes gchq#390
Fixes gchq#415
  • Loading branch information
Lissy93 committed Jan 9, 2022
2 parents fd8a454 + 3d2051b commit c5bbceb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 🐛 1.9.7 - Minor UI Editor Bug fixes [PR #416](https://github.com/Lissy93/dashy/pull/416)
- Fixes unable to edit item bug (#415)
- Fixes unable to add new app bug (#390)
- Fixes nav links visibility (#389)

## ⚡️ 1.9.6 - Adds Proxy Support for Widget Requests [PR #392](https://github.com/Lissy93/dashy/pull/392)
- Refactors widget mixin to include data requests, so that code can be shared between widgets
- Adds a Node endpoint for proxying requests server-side, used for APIs that are not CORS enabled
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dashy",
"version": "1.9.6",
"version": "1.9.7",
"license": "MIT",
"main": "server",
"author": "Alicia Sykes <alicia@omg.lol> (https://aliciasykes.com)",
Expand Down Expand Up @@ -96,4 +96,4 @@
"> 1%",
"last 2 versions"
]
}
}
20 changes: 12 additions & 8 deletions src/components/LinkItems/Section.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
@openContextMenu="openContextMenu"
>
<!-- If no items, show message -->
<div v-if="sectionType === 'empty'" class="no-items">
<div v-if="isEmpty" class="no-items">
{{ $t('home.no-items-section') }}
</div>
<!-- Item Container -->
<div v-else-if="sectionType === 'item'"
<div v-if="hasItems"
:class="`there-are-items ${isGridLayout? 'item-group-grid': ''} inner-size-${itemSize}`"
:style="gridStyle" :id="`section-${groupId}`"
> <!-- Show for each item -->
Expand Down Expand Up @@ -58,7 +58,7 @@
/>
</div>
<div
v-else-if="sectionType === 'widget'"
v-if="hasWidgets"
:class="`widget-list ${isWide? 'wide' : ''}`">
<WidgetBase
v-for="(widget, widgetIndx) in widgets"
Expand Down Expand Up @@ -154,11 +154,15 @@ export default {
sortOrder() {
return this.displayData.sortBy || defaultSortOrder;
},
/* A section can contain either items or widgets */
sectionType() {
if (this.widgets && this.widgets.length > 0) return 'widget';
if (this.items && this.items.length > 0) return 'item';
return 'empty';
hasItems() {
if (this.isEditMode) return true;
return this.items && this.items.length > 0;
},
hasWidgets() {
return this.widgets && this.widgets.length > 0;
},
isEmpty() {
return !this.hasItems && !this.hasWidgets;
},
/* If the sortBy attribute is specified, then return sorted data */
sortedItems() {
Expand Down
3 changes: 2 additions & 1 deletion src/utils/SectionHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export const shouldBeVisible = (routeName) => !hideFurnitureOn.includes(routeNam
/* Based on section title, item name and index, return a string value for ID */
const makeItemId = (sectionStr, itemStr, index) => {
const charSum = sectionStr.split('').map((a) => a.charCodeAt(0)).reduce((x, y) => x + y);
const itemTitleStr = itemStr.replace(/\s+/g, '-').replace(/[^a-zA-Z ]/g, '').toLowerCase();
const newItemStr = itemStr || `unknown_${Math.random()}`;
const itemTitleStr = newItemStr.replace(/\s+/g, '-').replace(/[^a-zA-Z ]/g, '').toLowerCase();
return `${index}_${charSum}_${itemTitleStr}`;
};

Expand Down
5 changes: 1 addition & 4 deletions src/utils/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ module.exports = {
pageInfo: {
title: 'Dashy',
description: '',
navLinks: [
{ title: 'Home', path: '/' },
{ title: 'Source', path: 'https://github.com/Lissy93/dashy' },
],
navLinks: [],
footerText: '',
},
/* Default appConfig to be used, if user does not specify their own */
Expand Down

0 comments on commit c5bbceb

Please sign in to comment.