-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d46f3ab
commit de1481c
Showing
13 changed files
with
555 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<script setup lang="ts"> | ||
import { toRefs } from 'vue' | ||
import { useNotification } from 'naive-ui' | ||
import { worker } from '../workerAPI' | ||
import { | ||
changeIME, | ||
deployed, | ||
selectOptions | ||
} from '../control' | ||
import type MyMenu from './MyMenu.vue' | ||
const props = defineProps<{ | ||
menu: InstanceType<typeof MyMenu> | undefined | ||
}>() | ||
const { menu } = toRefs(props) | ||
const notification = useNotification() | ||
worker.control('deployStatus', async (status: 'start' | 'failure' | 'success', schemas: string) => { | ||
const options = { | ||
duration: 5000, | ||
keepAliveOnHover: true | ||
} | ||
switch (status) { | ||
case 'start': | ||
notification.info({ | ||
content: 'Deployment started', | ||
...options | ||
}) | ||
menu.value?.setLoading(true) | ||
break | ||
case 'failure': | ||
notification.error({ | ||
content: 'Deployment failed', | ||
...options | ||
}) | ||
menu.value?.setLoading(false) | ||
break | ||
case 'success': | ||
notification.success({ | ||
content: 'Deployment succeeded', | ||
...options | ||
}) | ||
deployed.value = true | ||
selectOptions.value = [] | ||
{ | ||
const schemasJson = JSON.parse(schemas) as { | ||
id: string, | ||
name: string | ||
}[] | ||
for (const schema of schemasJson) { | ||
selectOptions.value.push({ | ||
label: schema.name, | ||
value: schema.id | ||
}) | ||
} | ||
const currentSchema = schemasJson[0].id | ||
await changeIME(currentSchema) | ||
menu.value?.displayIME(currentSchema) | ||
} | ||
menu.value?.setLoading(false) | ||
break | ||
} | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.