Skip to content

Commit c658223

Browse files
author
Guillaume Chau
committed
feat(ui): refresh plugin API button
1 parent 22b92ba commit c658223

File tree

6 files changed

+28
-3
lines changed

6 files changed

+28
-3
lines changed

packages/@vue/cli-ui/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@
112112
},
113113
"report-bug": "Report bug",
114114
"translate": "Help translate",
115-
"dark-mode": "Toggle dark mode"
115+
"dark-mode": "Toggle dark mode",
116+
"reset-plugin-api": "Refresh plugins API"
116117
},
117118
"suggestion-bar": {
118119
"suggestion": "Suggestion",

packages/@vue/cli-ui/src/components/StatusBar.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@
7070
>
7171
<VueIcon icon="g_translate"/>
7272
</div>
73+
<div
74+
class="section action reset-plugin-api"
75+
v-tooltip="$t('components.status-bar.reset-plugin-api')"
76+
@click="resetPluginApi()"
77+
>
78+
<VueIcon icon="cached"/>
79+
</div>
7380
</div>
7481
</div>
7582
</template>
@@ -79,6 +86,8 @@ import PROJECT_CURRENT from '../graphql/projectCurrent.gql'
7986
import CONSOLE_LOG_LAST from '../graphql/consoleLogLast.gql'
8087
import CONSOLE_LOG_ADDED from '../graphql/consoleLogAdded.gql'
8188
import DARK_MODE_SET from '../graphql/darkModeSet.gql'
89+
import PLUGIN_RESET_API from '../graphql/pluginResetApi.gql'
90+
import { resetApollo } from '../vue-apollo'
8291
8392
let lastRoute
8493
@@ -174,6 +183,14 @@ export default {
174183
175184
toggleDarkMode () {
176185
this.applyDarkMode(!this.darkMode)
186+
},
187+
188+
async resetPluginApi () {
189+
await this.$apollo.mutate({
190+
mutation: PLUGIN_RESET_API
191+
})
192+
193+
await resetApollo()
177194
}
178195
}
179196
}

packages/@vue/cli-ui/src/components/TopBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default {
6969
}
7070
})
7171
72-
resetApollo()
72+
await resetApollo()
7373
}
7474
}
7575
}

packages/@vue/cli-ui/src/graphql-api/connectors/plugins.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ function resetPluginApi (context) {
132132
if (currentView) views.open(currentView.id)
133133
}
134134
})
135+
136+
return true
135137
}
136138

137139
function runPluginApi (id, context, fileName = 'ui') {

packages/@vue/cli-ui/src/graphql-api/schema/plugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extend type Mutation {
1818
pluginUpdate (id: ID!): Plugin
1919
pluginActionCall (id: ID!, params: JSON): PluginActionResult
2020
pluginsUpdate: [Plugin]
21+
pluginResetApi: Boolean
2122
}
2223
2324
extend type Subscription {
@@ -82,7 +83,8 @@ exports.resolvers = {
8283
pluginFinishInstall: (root, args, context) => plugins.finishInstall(context),
8384
pluginUpdate: (root, { id }, context) => plugins.update(id, context),
8485
pluginActionCall: (root, args, context) => plugins.callAction(args, context),
85-
pluginsUpdate: (root, args, context) => plugins.updateAll(context)
86+
pluginsUpdate: (root, args, context) => plugins.updateAll(context),
87+
pluginResetApi: (root, args, context) => plugins.resetPluginApi(context)
8688
},
8789

8890
Subscription: {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mutation pluginResetApi {
2+
pluginResetApi
3+
}

0 commit comments

Comments
 (0)