mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 19:11:33 +03:00
Remove 'Open' from context menu's (#3350)
Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>
This commit is contained in:
parent
59bed26d6e
commit
7c48095b75
@ -968,27 +968,6 @@ export function createModel (builder: Builder): void {
|
||||
|
||||
classPresenter(builder, core.class.EnumOf, view.component.EnumPresenter, view.component.EnumEditor)
|
||||
|
||||
// createAction(
|
||||
// builder,
|
||||
// {
|
||||
// action: view.actionImpl.ShowPopup,
|
||||
// actionProps: {
|
||||
// component: view.component.IndexedDocumentPreview,
|
||||
// fillProps: {
|
||||
// _id: 'objectId'
|
||||
// }
|
||||
// },
|
||||
// label: presenation.string.DocumentPreview,
|
||||
// keyBinding: [''],
|
||||
// input: 'focus',
|
||||
// icon: view.icon.Open,
|
||||
// category: view.category.GeneralNavigation,
|
||||
// target: core.class.Doc,
|
||||
// context: { mode: ['context', 'browser', 'editor'] }
|
||||
// },
|
||||
// view.action.Preview
|
||||
// )
|
||||
|
||||
createAction(
|
||||
builder,
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import tags from '@hcengineering/tags'
|
||||
import { CollaborationDiffViewer } from '@hcengineering/text-editor'
|
||||
import view from '@hcengineering/view'
|
||||
|
||||
import {
|
||||
Button,
|
||||
@ -136,7 +137,11 @@
|
||||
|
||||
function showMenu (ev?: Event): void {
|
||||
if (documentObject) {
|
||||
showPopup(ContextMenu, { object: documentObject }, (ev as MouseEvent).target as HTMLElement)
|
||||
showPopup(
|
||||
ContextMenu,
|
||||
{ object: documentObject, excludedActions: [view.action.Open] },
|
||||
(ev as MouseEvent).target as HTMLElement
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
import presentation, { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { Vacancy } from '@hcengineering/recruit'
|
||||
import tracker from '@hcengineering/tracker'
|
||||
import view from '@hcengineering/view'
|
||||
import { Button, Component, EditBox, IconMixin, IconMoreH, Label, LinkWrapper, showPopup } from '@hcengineering/ui'
|
||||
import { ContextMenu, DocAttributeBar } from '@hcengineering/view-resources'
|
||||
import { createEventDispatcher, onDestroy } from 'svelte'
|
||||
@ -72,7 +73,7 @@
|
||||
|
||||
function showMenu (ev?: Event): void {
|
||||
if (object !== undefined) {
|
||||
showPopup(ContextMenu, { object }, (ev as MouseEvent).target as HTMLElement)
|
||||
showPopup(ContextMenu, { object, excludedActions: [view.action.Open] }, (ev as MouseEvent).target as HTMLElement)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
showPopup
|
||||
} from '@hcengineering/ui'
|
||||
import { ContextMenu, DocNavLink, ParentsNavigator, UpDownNavigator } from '@hcengineering/view-resources'
|
||||
import view from '@hcengineering/view'
|
||||
import { createEventDispatcher, onDestroy } from 'svelte'
|
||||
import { generateIssueShortLink, getIssueId } from '../../../issues'
|
||||
import tracker from '../../../plugin'
|
||||
@ -115,7 +116,11 @@
|
||||
|
||||
function showMenu (ev?: Event): void {
|
||||
if (issue) {
|
||||
showPopup(ContextMenu, { object: issue }, (ev as MouseEvent).target as HTMLElement)
|
||||
showPopup(
|
||||
ContextMenu,
|
||||
{ object: issue, excludedActions: [view.action.Open] },
|
||||
(ev as MouseEvent).target as HTMLElement
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import setting, { settingId } from '@hcengineering/setting'
|
||||
import tags from '@hcengineering/tags'
|
||||
import type { IssueTemplate, IssueTemplateChild, Project } from '@hcengineering/tracker'
|
||||
import { IssueTemplate, IssueTemplateChild, Project } from '@hcengineering/tracker'
|
||||
import {
|
||||
Button,
|
||||
EditBox,
|
||||
@ -33,6 +33,7 @@
|
||||
showPopup
|
||||
} from '@hcengineering/ui'
|
||||
import { ContextMenu, ParentsNavigator, UpDownNavigator } from '@hcengineering/view-resources'
|
||||
import view from '@hcengineering/view'
|
||||
import { createEventDispatcher, onDestroy, onMount } from 'svelte'
|
||||
import tracker from '../../plugin'
|
||||
|
||||
@ -104,7 +105,11 @@
|
||||
|
||||
function showMenu (ev?: Event): void {
|
||||
if (template) {
|
||||
showPopup(ContextMenu, { object: template }, (ev as MouseEvent).target as HTMLElement)
|
||||
showPopup(
|
||||
ContextMenu,
|
||||
{ object: template, excludedActions: [view.action.Open] },
|
||||
(ev as MouseEvent).target as HTMLElement
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,35 +237,3 @@
|
||||
</svelte:fragment>
|
||||
</Panel>
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
.title {
|
||||
font-weight: 500;
|
||||
font-size: 1.125rem;
|
||||
color: var(--caption-color);
|
||||
}
|
||||
|
||||
.content {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.description-preview {
|
||||
color: var(--content-color);
|
||||
line-height: 150%;
|
||||
|
||||
.placeholder {
|
||||
color: var(--dark-color);
|
||||
}
|
||||
}
|
||||
|
||||
.tool {
|
||||
align-self: start;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
opacity: 0.3;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -258,7 +258,7 @@
|
||||
|
||||
function showMenu (ev?: Event): void {
|
||||
if (object !== undefined) {
|
||||
showPopup(ContextMenu, { object }, (ev as MouseEvent).target as HTMLElement)
|
||||
showPopup(ContextMenu, { object, excludedActions: [view.action.Open] }, (ev as MouseEvent).target as HTMLElement)
|
||||
}
|
||||
}
|
||||
function handleOpen (ev: CustomEvent): void {
|
||||
|
@ -13,16 +13,17 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import type { Class, Doc, Ref } from '@hcengineering/core'
|
||||
import type { Asset } from '@hcengineering/platform'
|
||||
import { Class, Doc, Ref } from '@hcengineering/core'
|
||||
import { Asset } from '@hcengineering/platform'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { Action, Menu } from '@hcengineering/ui'
|
||||
import type { ActionGroup, ViewContextType } from '@hcengineering/view'
|
||||
import { ActionGroup, ViewContextType } from '@hcengineering/view'
|
||||
import { getActions, invokeAction } from '../actions'
|
||||
|
||||
export let object: Doc | Doc[]
|
||||
export let baseMenuClass: Ref<Class<Doc>> | undefined = undefined
|
||||
export let actions: Action[] = []
|
||||
export let excludedActions: string[] = []
|
||||
export let mode: ViewContextType | undefined = undefined
|
||||
let resActions = actions
|
||||
|
||||
@ -40,7 +41,16 @@
|
||||
}
|
||||
|
||||
getActions(client, object, baseMenuClass, mode).then((result) => {
|
||||
const newActions: Action[] = result.map((a) => ({
|
||||
const filtered = result.filter((a) => {
|
||||
if (excludedActions.includes(a._id)) {
|
||||
return false
|
||||
}
|
||||
if (a.override && a.override.filter((o) => excludedActions.includes(o)).length > 0) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
const newActions: Action[] = filtered.map((a) => ({
|
||||
label: a.label,
|
||||
icon: a.icon as Asset,
|
||||
inline: a.inline,
|
||||
|
Loading…
Reference in New Issue
Block a user