Skip to content

Commit 3b17adc

Browse files
committed
Show unentitled app store plugins with disabled install button
1 parent ba5953b commit 3b17adc

File tree

6 files changed

+49
-16
lines changed

6 files changed

+49
-16
lines changed

openc3-cosmos-cmd-tlm-api/app/controllers/plugins_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def check_localhost_reachability(gem_url, store_plugin_id)
3838
api_key_setting = OpenC3::SettingModel.get(name: 'store_api_key', scope: 'DEFAULT')
3939
api_key = api_key_setting['data'] if api_key_setting
4040

41-
test_url = "http://#{uri.host}:#{uri.port}/api/v1.1/cosmos_plugins/#{store_plugin_id}"
41+
test_url = "http://#{uri.host}:#{uri.port}/api/v1.2/cosmos_plugins/#{store_plugin_id}"
4242
begin
4343
uri_obj = URI(test_url)
4444
req = Net::HTTP::Get.new(uri_obj)

openc3-cosmos-init/plugins/packages/openc3-vue-common/src/plugins/plugin-store/PluginCard.vue

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,20 @@
5555
</v-card-text>
5656
<v-spacer />
5757
<v-card-actions class="flex-wrap">
58-
<v-btn
59-
text="Install"
60-
append-icon="mdi-puzzle-plus"
61-
variant="elevated"
62-
@click.stop="install"
63-
/>
58+
<v-tooltip :open-delay="600" location="top">
59+
<template #activator="{ props }">
60+
<span v-bind="entitled ? null : props">
61+
<v-btn
62+
text="Install"
63+
append-icon="mdi-puzzle-plus"
64+
variant="elevated"
65+
:disabled="!entitled"
66+
@click.stop="install"
67+
/>
68+
</span>
69+
</template>
70+
<span> {{accessTooltip}} </span>
71+
</v-tooltip>
6472
</v-card-actions>
6573
</v-card>
6674
<plugin-details-dialog

openc3-cosmos-init/plugins/packages/openc3-vue-common/src/plugins/plugin-store/PluginDetailsDialog.vue

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
density="compact"
6565
variant="outlined"
6666
hide-details
67-
class="version-select"
67+
class="mt-1 version-select"
6868
/>
6969
</v-card-subtitle>
7070
<!--
@@ -191,13 +191,20 @@
191191
color="red"
192192
@click="uninstall"
193193
/>
194-
<v-btn
195-
v-else
196-
text="Install"
197-
append-icon="mdi-puzzle-plus"
198-
variant="elevated"
199-
@click="install"
200-
/>
194+
<v-tooltip v-else :open-delay="600" location="top">
195+
<template #activator="{ props }">
196+
<span v-bind="entitled ? null : props">
197+
<v-btn
198+
text="Install"
199+
append-icon="mdi-puzzle-plus"
200+
variant="elevated"
201+
:disabled="!entitled"
202+
@click="install"
203+
/>
204+
</span>
205+
</template>
206+
<span> {{accessTooltip}} </span>
207+
</v-tooltip>
201208
<v-btn
202209
v-if="versionRepository"
203210
text="Repository"

openc3-cosmos-init/plugins/packages/openc3-vue-common/src/plugins/plugin-store/PluginProps.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export default {
3939
checksum: String,
4040
versions: Array,
4141
current_version_id: Number,
42+
access: String,
43+
entitled: Boolean,
4244
},
4345
data: function () {
4446
return {
@@ -71,6 +73,8 @@ export default {
7173
checksum: this.checksum,
7274
versions: this.versions,
7375
current_version_id: this.current_version_id,
76+
access: this.access,
77+
entitled: this.entitled,
7478
}
7579
},
7680
imageContentsWithMimeType: function () {
@@ -116,6 +120,19 @@ export default {
116120
isPluginInstalled: function () {
117121
return !!this.name // Plugins only have a title, not a name, from the store
118122
},
123+
accessTooltip: function () {
124+
if (this.entitled) {
125+
return null
126+
}
127+
if (localStorage.getItem('pluginStore.isApiKeySet') !== "true") {
128+
return "Please add your App Store API key using the settings cog icon."
129+
}
130+
if (this.access === "enterprise") {
131+
return "A COSMOS Enterprise license is required for this plugin."
132+
} else {
133+
return "Please contact sales@openc3.com for access to this plugin."
134+
}
135+
},
119136
},
120137
created: async function () {
121138
try {

openc3-cosmos-init/plugins/packages/openc3-vue-common/src/plugins/plugin-store/PluginStoreSettingsDialog.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export default {
125125
watch: {
126126
apiKey: function (val) {
127127
this.checkEnterpriseKey()
128+
localStorage.setItem('pluginStore.isApiKeySet', !!val)
128129
},
129130
isEnterprise: function (val) {
130131
this.checkEnterpriseKey()

openc3/lib/openc3/models/plugin_store_model.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module OpenC3
1818
class PluginStoreModel < Model
1919
PRIMARY_KEY = 'openc3_plugin_store'
2020
DEFAULT_STORE_URL = 'https://store.openc3.com'
21-
JSON_ENDPOINT = '/api/v1.1/cosmos_plugins'
21+
JSON_ENDPOINT = '/api/v1.2/cosmos_plugins'
2222

2323
def self.set(plugin_store_data)
2424
Store.set(PRIMARY_KEY, plugin_store_data)

0 commit comments

Comments
 (0)