Skip to content

Commit 5f6f8c7

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/postcss-8.4.31
2 parents 24d1e0a + c39a951 commit 5f6f8c7

File tree

6 files changed

+224
-805
lines changed

6 files changed

+224
-805
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
"direct-vuex": "^0.10.4",
3030
"eslint-import-resolver-alias": "^1.1.2",
3131
"lodash": "^4.17.21",
32-
"multinet": "0.23.1",
32+
"multinet": "0.24.0",
3333
"multinet-components": "^0.0.4",
3434
"papaparse": "^5.3.0",
35-
"unplugin-vue-components": "^0.23.0",
35+
"unplugin-vue-components": "^28.5.0",
3636
"vite": "^4.1.5",
3737
"vue": "^2.7.0",
3838
"vue-gtag": "^1.2.1",

src/components/PermissionsDialog.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ import type {
215215
import {
216216
RoleLevel,
217217
} from '@/utils/permissions';
218+
import { useRoute } from 'vue-router/composables';
218219
219220
export interface UserPermissionSpec {
220221
role: Role;
@@ -237,7 +238,10 @@ export default defineComponent({
237238
},
238239
},
239240
setup(props) {
240-
const permDialog = ref(false);
241+
const workspacePermissionsEditable = computed(() => store.getters.permissionLevel >= RoleLevel.maintainer);
242+
243+
const route = useRoute();
244+
const permDialog = ref(workspacePermissionsEditable.value && route.query.permissions === 'true');
241245
const mutablePermissions: Ref<WorkspacePermissionsSpec | null> = ref(null);
242246
const userSearchString: Ref<string | null> = ref(null);
243247
const userSearchResults: Ref<UserSearchResult[]> = ref([]);
@@ -308,8 +312,6 @@ export default defineComponent({
308312
}
309313
const throttledUserSearch = debounce(searchUsers, 200);
310314
311-
const workspacePermissionsEditable = computed(() => store.getters.permissionLevel >= RoleLevel.maintainer);
312-
313315
function initMutableData(permissions: WorkspacePermissionsSpec) {
314316
mutablePermissions.value = cloneDeep(permissions);
315317
publicToggle.value = permissions.public;

src/components/SessionPanel.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ function openSession(session: Session) {
171171
}
172172
173173
async function deleteClicked(session: Session) {
174+
if (session.starred) {
175+
return;
176+
}
177+
174178
const type = session.network !== undefined ? 'network' : 'table';
175179
store.commit.deleteSessionFromStore(session.id);
176180
await deleteSession(props.workspace, session.id, type);

src/components/WorkspaceOptionMenu.vue

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
offset-y
66
origin="center center"
77
transition="scale-transition"
8+
eager
89
>
910
<template #activator="{ on }">
1011
<v-btn
@@ -21,6 +22,17 @@
2122
>
2223
<!-- Each listing here should contain a v-list-item -->
2324
<PermissionsDialog :workspace="workspace" />
25+
26+
<!-- Add fork button -->
27+
<v-list-item @click="forkWorkspace(workspace)">
28+
<v-list-item-icon class="mr-3">
29+
<v-icon>mdi-source-branch</v-icon>
30+
</v-list-item-icon>
31+
<v-list-item-content>
32+
Fork Workspace
33+
</v-list-item-content>
34+
</v-list-item>
35+
2436
<v-list-item :to="{ name: 'aqlWizard' }">
2537
<v-list-item-icon class="mr-3">
2638
<v-icon>mdi-magnify</v-icon>
@@ -37,7 +49,11 @@
3749
<script lang="ts">
3850
import type { PropType } from 'vue';
3951
import { defineComponent, ref } from 'vue';
52+
import { useRouter } from 'vue-router/composables';
53+
import type { Workspace } from 'multinet';
4054
import PermissionsDialog from '@/components/PermissionsDialog.vue';
55+
import api from '@/api';
56+
import store from '@/store';
4157
4258
export default defineComponent({
4359
components: {
@@ -51,11 +67,35 @@ export default defineComponent({
5167
},
5268
},
5369
54-
setup() {
70+
emits: ['loading'],
71+
72+
setup(_, { emit }) {
5573
const actionsMenu = ref(false);
74+
const router = useRouter();
75+
76+
// Fork the workspace, navigate to the new workspace, and refresh the workspace list
77+
// Emits loading event to parent component listener
78+
const forkWorkspace = async (workspace: string) => {
79+
try {
80+
emit('loading', true);
81+
const newWorkspace: Workspace = await api.forkWorkspace(workspace);
82+
emit('loading', false);
83+
84+
// Close the actions menu
85+
actionsMenu.value = false;
86+
87+
// Navigate to the new workspace and refresh the workspace list
88+
router.push(`/workspaces/${newWorkspace.name}`);
89+
store.dispatch.fetchWorkspaces();
90+
} catch (error) {
91+
// eslint-disable-next-line no-console
92+
console.error('Error forking workspace:', error);
93+
}
94+
};
5695
5796
return {
5897
actionsMenu,
98+
forkWorkspace,
5999
};
60100
},
61101
});

src/views/WorkspaceDetail.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@
7373
</v-toolbar-title>
7474
</v-hover>
7575
<v-progress-linear
76-
v-if="loading"
76+
v-if="loading || childLoading"
7777
indeterminate
7878
absolute
7979
bottom
8080
/>
8181
<v-spacer />
8282

8383
<create-modify-dialog :workspace="workspace" @success="startChecking" />
84-
<workspace-option-menu :workspace="workspace" />
84+
<workspace-option-menu :workspace="workspace" @loading="handleLoading" />
8585
</v-app-bar>
8686

8787
<!-- Display upload status -->
@@ -147,7 +147,7 @@
147147
</v-row>
148148
</v-alert>
149149

150-
<session-panel :apps="apps" :workspace="workspace" :loading="loading" />
150+
<session-panel :apps="apps" :workspace="workspace" :loading="loading || childLoading" />
151151

152152
<v-row class="ma-0">
153153
<v-col
@@ -162,7 +162,7 @@
162162
<network-panel
163163
:workspace="workspace"
164164
:items="networks"
165-
:loading="loading"
165+
:loading="loading || childLoading"
166166
:apps="apps"
167167
/>
168168
</v-card>
@@ -180,7 +180,7 @@
180180
<table-panel
181181
:workspace="workspace"
182182
:items="tables"
183-
:loading="loading"
183+
:loading="loading || childLoading"
184184
:apps="apps"
185185
/>
186186
</v-card>
@@ -195,14 +195,14 @@ import {
195195
ref, computed, watch,
196196
} from 'vue';
197197
198+
import { useRouter } from 'vue-router/composables';
198199
import api from '@/api';
199200
import TablePanel from '@/components/TablePanel.vue';
200201
import NetworkPanel from '@/components/NetworkPanel.vue';
201202
import SessionPanel from '@/components/SessionPanel.vue';
202203
import store from '@/store';
203204
import WorkspaceOptionMenu from '@/components/WorkspaceOptionMenu.vue';
204205
import type { App } from '@/types';
205-
import { useRouter } from 'vue-router/composables';
206206
207207
const surroundingWhitespace = /^\s+|\s+$/;
208208
const workspaceNameRules: Array<(x: string) => string|boolean> = [
@@ -221,6 +221,7 @@ const localWorkspace = ref<string | null>(null);
221221
const editing = ref(false);
222222
const requestError = ref<string | null>(null);
223223
const loading = ref(false);
224+
const childLoading = ref(false);
224225
const tables = computed(() => store.getters.tables);
225226
const networks = computed(() => store.getters.networks);
226227
const uploads = computed(() => store.state.uploads.filter(
@@ -282,6 +283,11 @@ async function update(this: any) {
282283
loading.value = false;
283284
}
284285
286+
// handle the loading state from child emits function
287+
function handleLoading(newLoading: boolean) {
288+
childLoading.value = newLoading;
289+
}
290+
285291
watch(() => props.workspace, () => update());
286292
watch(localWorkspace, () => { requestError.value = null; });
287293

0 commit comments

Comments
 (0)