Skip to content

Commit

Permalink
Merge pull request #40465 from nextcloud/fix/customElementRendered
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv committed Sep 18, 2023
2 parents 9ea9743 + cdc2529 commit e0c778f
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 15 deletions.
9 changes: 3 additions & 6 deletions apps/files/src/components/CustomElementRender.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,11 @@ export default {
},
methods: {
async updateRootElement() {
const span = document.createElement('span') as HTMLSpanElement
this.$el.replaceWith(span)
this.$el = span
const element = await this.render(this.source, this.currentView)
if (element) {
this.$el.replaceWith(element)
this.$el = element
this.$el.replaceChildren(element)
} else {
this.$el.replaceChildren()
}
},
},
Expand Down
2 changes: 1 addition & 1 deletion apps/files/src/components/FileEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
data-cy-files-list-row
:data-cy-files-list-row-fileid="fileid"
:data-cy-files-list-row-name="source.basename"
class="list__row"
class="files-list__row"
@contextmenu="onRightClick">
<!-- Failed indicator -->
<span v-if="source.attributes.failed" class="files-list__row--failed" />
Expand Down
5 changes: 4 additions & 1 deletion apps/files/src/components/FilesListVirtual.vue
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,12 @@ export default Vue.extend({
}
}
.files-list__row{
.files-list__row {
&:hover, &:focus, &:active, &--active {
background-color: var(--color-background-dark);
> * {
--color-border: var(--color-border-dark);
}
// Hover state of the row should also change the favorite markers background
.favorite-marker-icon svg path {
stroke: var(--color-background-dark);
Expand Down
20 changes: 19 additions & 1 deletion apps/systemtags/src/actions/inlineSystemTagsAction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,26 @@ describe('Inline system tags action conditions tests', () => {
expect(action.displayName([file], view)).toBe('')
expect(action.iconSvgInline([], view)).toBe('')
expect(action.default).toBeUndefined()
expect(action.enabled).toBeUndefined()
expect(action.enabled).toBeDefined()
expect(action.order).toBe(0)
expect(action.enabled!([file], view)).toBe(false)
})

test('Enabled with valid system tags', () => {
const file = new File({
id: 1,
source: 'https://cloud.domain.com/remote.php/dav/files/admin/foobar.txt',
owner: 'admin',
mime: 'text/plain',
permissions: Permission.ALL,
attributes: {
'system-tags': {
'system-tag': 'Confidential',
},
},
})

expect(action.enabled!([file], view)).toBe(true)
})
})

Expand Down
18 changes: 18 additions & 0 deletions apps/systemtags/src/actions/inlineSystemTagsAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@ export const action = new FileAction({
id: 'system-tags',
displayName: () => '',
iconSvgInline: () => '',

enabled(nodes: Node[]) {
// Only show the action on single nodes
if (nodes.length !== 1) {
return false
}

const node = nodes[0]
const tags = getNodeSystemTags(node)

// Only show the action if the node has system tags
if (tags.length === 0) {
return false
}

return true
},

exec: async () => null,

async renderInline(node: Node) {
Expand Down
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/systemtags-systemtags.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/systemtags-systemtags.js.map

Large diffs are not rendered by default.

0 comments on commit e0c778f

Please sign in to comment.