Skip to content

Commit

Permalink
feat(ui)!: add live session on active session recordings
Browse files Browse the repository at this point in the history
This commit adds a live session functionality to the terminal session
recording.
  • Loading branch information
luannmoreira committed Apr 19, 2024
1 parent 606156b commit df7cde5
Show file tree
Hide file tree
Showing 6 changed files with 575 additions and 534 deletions.
91 changes: 41 additions & 50 deletions ui/src/components/Sessions/SessionClose.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
</div>
</template>

<script lang="ts">
import { defineComponent, PropType, ref } from "vue";
<script setup lang="ts">
import { PropType, ref } from "vue";
import {
INotificationsError,
INotificationsSuccess,
Expand All @@ -57,55 +57,46 @@ import { IDevice } from "../../interfaces/IDevice";
import { useStore } from "../../store";
import handleError from "../../utils/handleError";
export default defineComponent({
props: {
uid: {
type: String,
required: true,
},
device: {
type: Object as PropType<IDevice>,
required: true,
},
notHasAuthorization: {
type: Boolean,
default: false,
},
style: {
type: [String, Object],
default: undefined,
},
const props = defineProps({
uid: {
type: String,
required: true,
},
emits: ["update"],
setup(props, ctx) {
const showDialog = ref(false);
const store = useStore();
const closeSession = async () => {
try {
await store.dispatch("sessions/close", {
uid: props.uid,
device_uid: props.device.uid,
});
showDialog.value = false;
store.dispatch(
"snackbar/showSnackbarSuccessAction",
INotificationsSuccess.sessionClose,
);
ctx.emit("update");
} catch (error: unknown) {
store.dispatch(
"snackbar/showSnackbarErrorAction",
INotificationsError.sessionClose,
);
handleError(error);
}
};
return {
showDialog,
closeSession,
};
device: {
type: Object as PropType<IDevice>,
required: true,
},
notHasAuthorization: {
type: Boolean,
required: true,
},
style: {
type: [String, Object],
default: undefined,
},
});
const emit = defineEmits(["update"]);
const showDialog = ref(false);
const store = useStore();
const closeSession = async () => {
try {
await store.dispatch("sessions/close", {
uid: props.uid,
device_uid: props.device.uid,
});
showDialog.value = false;
store.dispatch(
"snackbar/showSnackbarSuccessAction",
INotificationsSuccess.sessionClose,
);
emit("update");
} catch (error: unknown) {
store.dispatch(
"snackbar/showSnackbarErrorAction",
INotificationsError.sessionClose,
);
handleError(error);
}
};
</script>
80 changes: 36 additions & 44 deletions ui/src/components/Sessions/SessionDelete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<v-list-item
@click="showDialog = true"
:disabled="notHasAuthorization"
:disabled="props.notHasAuthorization"
>
<div class="d-flex align-center">
<div class="mr-2">
Expand Down Expand Up @@ -46,57 +46,49 @@
</div>
</template>

<script lang="ts">
import { defineComponent, ref } from "vue";
<script setup lang="ts">
import { PropType, ref } from "vue";
import {
INotificationsError,
INotificationsSuccess,
} from "../../interfaces/INotifications";
import { useStore } from "../../store";
import handleError from "../../utils/handleError";
export default defineComponent({
props: {
uid: {
type: String,
required: true,
},
notHasAuthorization: {
type: Boolean,
default: false,
},
style: {
type: [String, Object],
default: undefined,
},
const props = defineProps({
uid: {
type: String,
required: true,
},
emits: ["update"],
setup(props, ctx) {
const showDialog = ref(false);
const store = useStore();
const deleteRecord = async () => {
try {
await store.dispatch("sessions/deleteSessionLogs", props.uid);
showDialog.value = false;
store.dispatch(
"snackbar/showSnackbarSuccessAction",
INotificationsSuccess.sessionRemoveRecord,
);
ctx.emit("update");
} catch (error: unknown) {
store.dispatch(
"snackbar/showSnackbarErrorAction",
INotificationsError.sessionRemoveRecord,
);
handleError(error);
}
};
return {
showDialog,
deleteRecord,
};
notHasAuthorization: {
type: Boolean,
required: true,
},
style: {
type: [String, Object] as PropType<string | object>,
default: undefined,
},
});
const emit = defineEmits(["update"]);
const showDialog = ref(false);
const store = useStore();
const deleteRecord = async () => {
try {
await store.dispatch("sessions/deleteSessionLogs", props.uid);
showDialog.value = false;
store.dispatch(
"snackbar/showSnackbarSuccessAction",
INotificationsSuccess.sessionRemoveRecord,
);
emit("update");
} catch (error: unknown) {
store.dispatch(
"snackbar/showSnackbarErrorAction",
INotificationsError.sessionRemoveRecord,
);
handleError(error);
}
};
</script>
Loading

0 comments on commit df7cde5

Please sign in to comment.