| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- export default {
- created () {
- this.singleActions = [
- {
- label: this.$t('compute.repo.terminal'),
- action: async (obj) => {
- const connectRes = await this.fetchConnectUrl(obj)
- this.openWebConsole(connectRes)
- },
- meta: (obj) => {
- const ret = { validate: true }
- if (obj.status !== 'running' && obj.status !== 'probing') {
- ret.tooltip = this.$t('compute.repo.helper.terminal', [this.$t('dictionary.container')])
- ret.validate = false
- }
- return ret
- },
- },
- {
- label: this.$t('common.more'),
- actions: (obj) => {
- return [
- // 同步状态
- {
- label: this.$t('compute.perform_sync_status'),
- permission: 'containers_perform_syncstatus',
- action: () => {
- this.onManager('performAction', {
- steadyStatus: ['running', 'ready'],
- id: obj.id,
- managerArgs: {
- action: 'syncstatus',
- },
- })
- },
- },
- {
- label: this.$t('compute.repo.start'),
- action: () => {
- this.onManager('performAction', {
- steadyStatus: 'running',
- id: obj.id,
- managerArgs: {
- action: 'start',
- },
- })
- },
- meta: () => {
- return {
- validate: obj.status === 'exited',
- }
- },
- },
- {
- label: this.$t('compute.repo.stop'),
- action: () => {
- this.createDialog('ContainerShutDownDialog', {
- data: [obj],
- columns: this.columns,
- onManager: this.onManager,
- })
- },
- meta: () => {
- return {
- validate: obj.status === 'running',
- }
- },
- },
- {
- label: this.$t('table.action.modify'),
- action: (obj) => {
- this.createDialog('ContainerUpdateDialog', {
- data: [obj],
- columns: this.columns,
- onManager: this.onManager,
- })
- },
- meta: (obj) => {
- const ret = { validate: true }
- if (obj.status !== 'exited') {
- ret.tooltip = this.$t('compute.repo.helper.modify')
- ret.validate = false
- }
- return ret
- },
- },
- ]
- },
- },
- ]
- },
- methods: {
- openWebConsole (data) {
- this.$openWebConsole(data)
- },
- async fetchConnectUrl (obj) {
- const { data } = await new this.$Manager('webconsole', 'v1').objectRpc({
- methodname: 'DoContainerExec',
- params: {
- container_id: obj.id,
- },
- })
- return Promise.resolve(data)
- },
- },
- }
|