forked from FoundKeyGang/FoundKey
Merge branch 'main' into refactor/page.textarea.vue
This commit is contained in:
commit
d96baf1672
2 changed files with 155 additions and 182 deletions
|
@ -23,6 +23,7 @@ export const paramDef = {
|
|||
description: { type: 'string' },
|
||||
permission: { type: 'array', uniqueItems: true, items: {
|
||||
type: 'string',
|
||||
// FIXME: add enum of possible permissions
|
||||
} },
|
||||
callbackUrl: { type: 'string', nullable: true },
|
||||
},
|
||||
|
@ -34,9 +35,6 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||
// Generate secret
|
||||
const secret = secureRndstr(32, true);
|
||||
|
||||
// for backward compatibility
|
||||
const permission = unique(ps.permission.map(v => v.replace(/^(.+)(\/|-)(read|write)$/, '$3:$1')));
|
||||
|
||||
// Create account
|
||||
const app = await Apps.insert({
|
||||
id: genId(),
|
||||
|
@ -44,7 +42,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||
userId: user ? user.id : null,
|
||||
name: ps.name,
|
||||
description: ps.description,
|
||||
permission,
|
||||
permission: ps.permission,
|
||||
callbackUrl: ps.callbackUrl,
|
||||
secret: secret,
|
||||
}).then(x => Apps.findOneByOrFail(x.identifiers[0]));
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<canvas ref="chartEl"></canvas>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, onUnmounted, ref } from 'vue';
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import {
|
||||
Chart,
|
||||
ArcElement,
|
||||
|
@ -42,26 +42,11 @@ Chart.register(
|
|||
Filler,
|
||||
);
|
||||
|
||||
const alpha = (hex, a) => {
|
||||
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)!;
|
||||
const r = parseInt(result[1], 16);
|
||||
const g = parseInt(result[2], 16);
|
||||
const b = parseInt(result[3], 16);
|
||||
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
||||
};
|
||||
const props = defineProps<{
|
||||
domain: string,
|
||||
connection: any,
|
||||
}>();
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
domain: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
connection: {
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
setup(props) {
|
||||
const chartEl = ref<HTMLCanvasElement>(null);
|
||||
|
||||
const gridColor = defaultStore.state.darkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)';
|
||||
|
@ -81,7 +66,7 @@ export default defineComponent({
|
|||
borderWidth: 2,
|
||||
borderJoinStyle: 'round',
|
||||
borderColor: '#00E396',
|
||||
backgroundColor: alpha('#00E396', 0.1),
|
||||
backgroundColor: '#00E3961A',
|
||||
data: []
|
||||
}, {
|
||||
label: 'Active',
|
||||
|
@ -90,7 +75,7 @@ export default defineComponent({
|
|||
borderWidth: 2,
|
||||
borderJoinStyle: 'round',
|
||||
borderColor: '#00BCD4',
|
||||
backgroundColor: alpha('#00BCD4', 0.1),
|
||||
backgroundColor: '#00BCD41A',
|
||||
data: []
|
||||
}, {
|
||||
label: 'Waiting',
|
||||
|
@ -99,7 +84,7 @@ export default defineComponent({
|
|||
borderWidth: 2,
|
||||
borderJoinStyle: 'round',
|
||||
borderColor: '#FFB300',
|
||||
backgroundColor: alpha('#FFB300', 0.1),
|
||||
backgroundColor: '#FFB3001A',
|
||||
yAxisID: 'y2',
|
||||
data: []
|
||||
}, {
|
||||
|
@ -130,7 +115,7 @@ export default defineComponent({
|
|||
grid: {
|
||||
display: true,
|
||||
color: gridColor,
|
||||
borderColor: 'rgb(0, 0, 0, 0)',
|
||||
borderColor: '#0000',
|
||||
},
|
||||
ticks: {
|
||||
display: false,
|
||||
|
@ -143,7 +128,7 @@ export default defineComponent({
|
|||
stackWeight: 2,
|
||||
grid: {
|
||||
color: gridColor,
|
||||
borderColor: 'rgb(0, 0, 0, 0)',
|
||||
borderColor: '#0000',
|
||||
},
|
||||
},
|
||||
y2: {
|
||||
|
@ -153,7 +138,7 @@ export default defineComponent({
|
|||
stackWeight: 1,
|
||||
grid: {
|
||||
color: gridColor,
|
||||
borderColor: 'rgb(0, 0, 0, 0)',
|
||||
borderColor: '#0000',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -219,14 +204,4 @@ export default defineComponent({
|
|||
props.connection.off('statsLog', onStatsLog);
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
chartEl,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
|
|
Loading…
Reference in a new issue