Skip to content

Commit

Permalink
feat(ui): refresh plugin API button
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Jun 15, 2018
1 parent 22b92ba commit c658223
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/@vue/cli-ui/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
},
"report-bug": "Report bug",
"translate": "Help translate",
"dark-mode": "Toggle dark mode"
"dark-mode": "Toggle dark mode",
"reset-plugin-api": "Refresh plugins API"
},
"suggestion-bar": {
"suggestion": "Suggestion",
Expand Down
17 changes: 17 additions & 0 deletions packages/@vue/cli-ui/src/components/StatusBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@
>
<VueIcon icon="g_translate"/>
</div>
<div
class="section action reset-plugin-api"
v-tooltip="$t('components.status-bar.reset-plugin-api')"
@click="resetPluginApi()"
>
<VueIcon icon="cached"/>
</div>
</div>
</div>
</template>
Expand All @@ -79,6 +86,8 @@ import PROJECT_CURRENT from '../graphql/projectCurrent.gql'
import CONSOLE_LOG_LAST from '../graphql/consoleLogLast.gql'
import CONSOLE_LOG_ADDED from '../graphql/consoleLogAdded.gql'
import DARK_MODE_SET from '../graphql/darkModeSet.gql'
import PLUGIN_RESET_API from '../graphql/pluginResetApi.gql'
import { resetApollo } from '../vue-apollo'
let lastRoute
Expand Down Expand Up @@ -174,6 +183,14 @@ export default {
toggleDarkMode () {
this.applyDarkMode(!this.darkMode)
},
async resetPluginApi () {
await this.$apollo.mutate({
mutation: PLUGIN_RESET_API
})
await resetApollo()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-ui/src/components/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default {
}
})
resetApollo()
await resetApollo()
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/@vue/cli-ui/src/graphql-api/connectors/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ function resetPluginApi (context) {
if (currentView) views.open(currentView.id)
}
})

return true
}

function runPluginApi (id, context, fileName = 'ui') {
Expand Down
4 changes: 3 additions & 1 deletion packages/@vue/cli-ui/src/graphql-api/schema/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extend type Mutation {
pluginUpdate (id: ID!): Plugin
pluginActionCall (id: ID!, params: JSON): PluginActionResult
pluginsUpdate: [Plugin]
pluginResetApi: Boolean
}
extend type Subscription {
Expand Down Expand Up @@ -82,7 +83,8 @@ exports.resolvers = {
pluginFinishInstall: (root, args, context) => plugins.finishInstall(context),
pluginUpdate: (root, { id }, context) => plugins.update(id, context),
pluginActionCall: (root, args, context) => plugins.callAction(args, context),
pluginsUpdate: (root, args, context) => plugins.updateAll(context)
pluginsUpdate: (root, args, context) => plugins.updateAll(context),
pluginResetApi: (root, args, context) => plugins.resetPluginApi(context)
},

Subscription: {
Expand Down
3 changes: 3 additions & 0 deletions packages/@vue/cli-ui/src/graphql/pluginResetApi.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mutation pluginResetApi {
pluginResetApi
}

0 comments on commit c658223

Please sign in to comment.