Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sub-title for downloading and/or installing python packages #339

Merged
merged 6 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions web/src/api/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,21 @@ export function isPublishRestorePythonEnvProgress(arg: Events):
return arg.type === 'publish/restorePythonEnv/progress';
}

type packageRuntime = 'r' | 'python';
type packageStatus = 'download+install' | 'download' | 'install';

export interface PublishRestorePythonEnvStatus extends EventStreamMessage {
type: 'publish/restorePythonEnv/status',
// structured data not guaranteed, use selective or generic queries
// from data map
data: {
level: 'INFO',
localId: string,
message: string,
name: string,
runtime: packageRuntime,
source: 'serverp.log',
status: packageStatus,
version: string
}
}
export type OnPublishRestorePythonEnvStatusCallback = (
msg: PublishRestorePythonEnvStatus
Expand Down
2 changes: 2 additions & 0 deletions web/src/components/publishProcess/PublishStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<q-step
:name="name"
title="This is a step"
:caption="caption"
:icon="icon"
:active-icon="hasError ? 'warning' : icon"
:active-color="hasError ? 'red' : undefined"
Expand Down Expand Up @@ -48,6 +49,7 @@ const colorStore = useColorStore();

const props = defineProps({
name: { type: [String, Number], required: true },
caption: { type: String, required: false, default: undefined },
icon: { type: String, required: true },
summary: { type: String, required: true },
messages: { type: Array as PropType<EventStreamMessage[]>, required: false, default: () => [] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
summary="Installing the dependent python packages on the server in order to reproduce your runtime environment."
:done="done"
:messages="messages"
:caption="caption"
/>
</template>

Expand All @@ -27,6 +28,7 @@ const $eventStream = useEventStream();

const done = ref(false);
const messages = ref<EventStreamMessage[]>([]);
const caption = ref<string | undefined>();

const startCb = $eventStream.addEventMonitorCallback('publish/restorePythonEnv/start', (msg) => {
messages.value.push(msg);
Expand All @@ -35,11 +37,30 @@ const startCb = $eventStream.addEventMonitorCallback('publish/restorePythonEnv/s
const logCb = $eventStream.addEventMonitorCallback('publish/restorePythonEnv/log', (msg) => {
messages.value.push(msg);
});
const progressCb = $eventStream.addEventMonitorCallback('publish/restorePythonEnv/progress', (msg) => {
messages.value.push(msg);
const statusCb = $eventStream.addEventMonitorCallback('publish/restorePythonEnv/status', (msg) => {
let newCaption: string;

const { status: packageStatus, name: packageName, version } = msg.data;
switch (packageStatus) {
case 'download+install':
newCaption = `Downloading and installing package: `;
break;
case 'download':
newCaption = `Downloading package: `;
break;
case 'install':
newCaption = `Installing package: `;
break;
}
newCaption += packageName;
if (version) {
newCaption += ` (${version})`;
}
caption.value = newCaption;
});
const successCb = $eventStream.addEventMonitorCallback('publish/restorePythonEnv/success', (msg) => {
messages.value.push(msg);
caption.value = undefined;
done.value = true;
emit('start');
});
Expand All @@ -50,7 +71,7 @@ const failureCb = $eventStream.addEventMonitorCallback('publish/restorePythonEnv
onBeforeUnmount(() => {
$eventStream.delEventFilterCallback(startCb);
$eventStream.delEventFilterCallback(logCb);
$eventStream.delEventFilterCallback(progressCb);
$eventStream.delEventFilterCallback(statusCb);
$eventStream.delEventFilterCallback(successCb);
$eventStream.delEventFilterCallback(failureCb);
});
Expand Down