Feat: disable update prompt in connectors (#56)
* Do not check for updates if it explicitly disabled by someone * fix order of ops * remove unused function * check function in binding is implemented * remove console logging * sort logic finally * fix mocked binding
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<CommonAlert
|
||||
v-if="!store.isConnectorUpToDate && !hasDismissedAlert"
|
||||
v-if="
|
||||
!store.isConnectorUpToDate &&
|
||||
!hasDismissedAlert &&
|
||||
!store.isUpdateNotificationDisabled
|
||||
"
|
||||
v-tippy="
|
||||
'Version: ' + store.latestAvailableVersion?.Number + ', released ' + createdAgo
|
||||
"
|
||||
|
||||
@@ -14,6 +14,7 @@ export const IConfigBindingKey = 'configBinding'
|
||||
export interface IConfigBinding extends IBinding<IConfigBindingEvents> {
|
||||
getIsDevMode: () => Promise<boolean>
|
||||
getConfig: () => Promise<ConnectorConfig>
|
||||
getGlobalConfig: () => Promise<GlobalConfig>
|
||||
updateConfig: (config: ConnectorConfig) => void
|
||||
setUserSelectedAccountId: (accountId: string) => void
|
||||
getUserSelectedAccountId: () => Promise<AccountsConfig>
|
||||
@@ -24,6 +25,10 @@ export interface IConfigBinding extends IBinding<IConfigBindingEvents> {
|
||||
|
||||
export interface IConfigBindingEvents extends IBindingSharedEvents {}
|
||||
|
||||
export type GlobalConfig = {
|
||||
isUpdateNotificationDisabled: boolean
|
||||
}
|
||||
|
||||
export type ConnectorConfig = {
|
||||
darkTheme: boolean
|
||||
}
|
||||
@@ -46,6 +51,10 @@ export class MockedConfigBinding implements IConfigBinding {
|
||||
return await { darkTheme: false }
|
||||
}
|
||||
|
||||
public async getGlobalConfig() {
|
||||
return await { isUpdateNotificationDisabled: true }
|
||||
}
|
||||
|
||||
public async updateConfig() {
|
||||
return await console.log('')
|
||||
}
|
||||
|
||||
@@ -134,6 +134,11 @@ export type AddDomainToWorkspaceInput = {
|
||||
workspaceId: Scalars['ID']['input'];
|
||||
};
|
||||
|
||||
export type AdminAccessToWorkspaceFeatureInput = {
|
||||
featureFlagName: WorkspaceFeatureFlagName;
|
||||
workspaceId: Scalars['ID']['input'];
|
||||
};
|
||||
|
||||
export type AdminInviteList = {
|
||||
__typename?: 'AdminInviteList';
|
||||
cursor?: Maybe<Scalars['String']['output']>;
|
||||
@@ -143,10 +148,22 @@ export type AdminInviteList = {
|
||||
|
||||
export type AdminMutations = {
|
||||
__typename?: 'AdminMutations';
|
||||
giveAccessToWorkspaceFeature: Scalars['Boolean']['output'];
|
||||
removeAccessToWorkspaceFeature: Scalars['Boolean']['output'];
|
||||
updateWorkspacePlan: Scalars['Boolean']['output'];
|
||||
};
|
||||
|
||||
|
||||
export type AdminMutationsGiveAccessToWorkspaceFeatureArgs = {
|
||||
input: AdminAccessToWorkspaceFeatureInput;
|
||||
};
|
||||
|
||||
|
||||
export type AdminMutationsRemoveAccessToWorkspaceFeatureArgs = {
|
||||
input: AdminAccessToWorkspaceFeatureInput;
|
||||
};
|
||||
|
||||
|
||||
export type AdminMutationsUpdateWorkspacePlanArgs = {
|
||||
input: AdminUpdateWorkspacePlanInput;
|
||||
};
|
||||
@@ -5244,8 +5261,14 @@ export type WorkspaceEmbedOptions = {
|
||||
hideSpeckleBranding: Scalars['Boolean']['output'];
|
||||
};
|
||||
|
||||
export enum WorkspaceFeatureFlagName {
|
||||
AccIntegration = 'accIntegration',
|
||||
Dashboards = 'dashboards'
|
||||
}
|
||||
|
||||
export enum WorkspaceFeatureName {
|
||||
AccIntegration = 'accIntegration',
|
||||
Dashboards = 'dashboards',
|
||||
DomainBasedSecurityPolicies = 'domainBasedSecurityPolicies',
|
||||
ExclusiveMembership = 'exclusiveMembership',
|
||||
HideSpeckleBranding = 'hideSpeckleBranding',
|
||||
|
||||
+17
-1
@@ -27,6 +27,7 @@ import {
|
||||
} from '~/lib/core/composables/updateConnector'
|
||||
import { provideApolloClient, useMutation } from '@vue/apollo-composable'
|
||||
import { createVersionMutation } from '~/lib/graphql/mutationsAndQueries'
|
||||
import type { BaseBridge } from '~/lib/bridge/base'
|
||||
|
||||
export type ProjectModelGroup = {
|
||||
projectId: string
|
||||
@@ -59,6 +60,8 @@ export const useHostAppStore = defineStore('hostAppStore', () => {
|
||||
const availableViews = ref<string[]>() // TODO: later we can align views with -> const revitAvailableViews = ref<ISendFilterSelectItem[]>()
|
||||
const navisworksAvailableSavedSets = ref<ISendFilterSelectItem[]>()
|
||||
|
||||
const isUpdateNotificationDisabled = ref(false)
|
||||
|
||||
// Different host apps can have different kind of ISendFilterSelect send filters, and we collect them here to generalize the component we use in `ListSelect`
|
||||
const availableSelectSendFilters = ref<Record<string, SendFilterSelect>>({})
|
||||
|
||||
@@ -535,8 +538,20 @@ export const useHostAppStore = defineStore('hostAppStore', () => {
|
||||
|
||||
const getConnectorVersion = async () => {
|
||||
connectorVersion.value = await app.$baseBinding.getConnectorVersion()
|
||||
|
||||
const canGetGlobalConfig = ['getGlobalConfig', 'GetGlobalConfig'].some((name) =>
|
||||
(app.$configBinding as unknown as BaseBridge).availableMethodNames.includes(name)
|
||||
)
|
||||
|
||||
if (canGetGlobalConfig) {
|
||||
const globalConfig = await app.$configBinding.getGlobalConfig()
|
||||
if ('isUpdateNotificationDisabled' in globalConfig)
|
||||
// because if the value is false, we do not get it from bridge
|
||||
isUpdateNotificationDisabled.value = globalConfig.isUpdateNotificationDisabled
|
||||
}
|
||||
|
||||
// Checks whether new version available for the connector or not and throws a toast notification if any.
|
||||
if (app.$isRunningOnConnector) {
|
||||
if (app.$isRunningOnConnector && !isUpdateNotificationDisabled) {
|
||||
await checkUpdate()
|
||||
}
|
||||
}
|
||||
@@ -750,6 +765,7 @@ export const useHostAppStore = defineStore('hostAppStore', () => {
|
||||
navisworksAvailableSavedSets,
|
||||
availableSelectSendFilters,
|
||||
isDistributedBySpeckle,
|
||||
isUpdateNotificationDisabled,
|
||||
setIsDistributedBySpeckle,
|
||||
setNotification,
|
||||
setModelError,
|
||||
|
||||
Reference in New Issue
Block a user