File size: 3,436 Bytes
4d70170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<script lang="ts">
import EmptyPane from '@front/features/layout/EmptyPane.vue'
import SplitPane from '@front/features/layout/SplitPane.vue'
import { computed, defineComponent } from 'vue'
import PluginPermission from './PluginPermission.vue'
import PluginSettings from './PluginSettings.vue'

import { usePlugins } from '.'

export default defineComponent({
  components: {
    EmptyPane,
    SplitPane,
    PluginPermission,
    PluginSettings,
  },

  props: {
    pluginId: {
      type: [String, Number],
      required: true,
    },
  },

  setup(props) {
    const { plugins } = usePlugins()
    const plugin = computed(() => plugins.value.find(p => p.id === props.pluginId))

    return {
      plugin,
    }
  },
})
</script>

<template>
  <SplitPane
    v-if="plugin"
    :key="plugin.id"
    save-id="plugin-details"
    class="h-full"
  >
    <template #left>
      <div class="h-full overflow-y-auto">
        <div class="px-6 py-4 flex space-x-6">
          <div class="flex items-center justify-center w-16 h-16 bg-gray-200 dark:bg-gray-900 rounded">
            <img
              v-if="plugin.logo"
              :src="plugin.logo"
              alt="Plugin logo"
              class="logo"
            >
            <VueIcon
              v-else
              icon="extension"
              class="big text-gray-500"
            />
          </div>
          <div>
            <div class="font-bold">
              {{ plugin.label }}
            </div>
            <div v-if="plugin.homepage">
              <a
                :href="plugin.homepage"
                target="_blank"
                class="flex items-center text-green-600 dark:text-green-400 space-x-1"
              >
                <span>Homepage</span>
                <VueIcon
                  icon="launch"
                />
              </a>
            </div>
            <div>
              ID: <span class="font-mono text-sm px-1 bg-gray-200 dark:bg-gray-900 rounded">{{ plugin.id }}</span>
            </div>
            <div v-if="plugin.packageName">
              Package: <span class="font-mono text-sm px-1 bg-gray-200 dark:bg-gray-900 rounded">{{ plugin.packageName }}</span>
            </div>
          </div>
        </div>

        <div>
          <PluginPermission
            :plugin-id="plugin.id"
            permission="enabled"
            label="Enabled"
            class="px-6 py-4"
          />
        </div>

        <div>
          <h2 class="px-6 py-2 text-gray-500">
            Permissions
          </h2>

          <PluginPermission
            :plugin-id="plugin.id"
            permission="components"
            label="Components"
            class="px-6 py-2"
          />
          <PluginPermission
            :plugin-id="plugin.id"
            permission="custom-inspector"
            label="Custom inspectors"
            class="px-6 py-2"
          />
          <PluginPermission
            :plugin-id="plugin.id"
            permission="timeline"
            label="Timeline"
            class="px-6 py-2"
          />
        </div>
      </div>
    </template>

    <template #right>
      <PluginSettings
        :plugin="plugin"
        class="h-full overflow-y-auto"
      />
    </template>
  </SplitPane>

  <EmptyPane
    v-else
    icon="error"
  >
    Plugin not found
  </EmptyPane>
</template>

<style lang="postcss" scoped>
.logo {
  max-width: 48px;
  max-height: 48px;
}
</style>