3 Commits 3c8caf17f8 ... 2fd4345740

Author SHA1 Message Date
  Owen Diffey 2fd4345740 fix(AdvancedTable): Reordering table headers ineffective 1 month ago
  Owen Diffey cd727a79a2 refactor: Hide oidc sub from users list if oidc disabled 1 month ago
  Owen Diffey 9f6110dcd2 fix(musare.sh): Pull images used in builds 1 month ago
3 changed files with 56 additions and 22 deletions
  1. 26 5
      frontend/src/components/AdvancedTable.vue
  2. 29 16
      frontend/src/pages/Admin/Users/index.vue
  3. 1 1
      musare.sh

+ 26 - 5
frontend/src/components/AdvancedTable.vue

@@ -182,11 +182,32 @@ const bulkPopup = ref();
 const rowElements = ref([]);
 
 const lastPage = computed(() => Math.ceil(count.value / pageSize.value));
-const sortedFilteredColumns = computed(() =>
-	orderedColumns.value.filter(
-		column => shownColumns.value.indexOf(column.name) !== -1
-	)
-);
+const sortedFilteredColumns = computed({
+	get: () =>
+		orderedColumns.value.filter(
+			column => shownColumns.value.indexOf(column.name) !== -1
+		),
+	set: newValue =>
+		orderedColumns.value.sort((columnA, columnB) => {
+			// Always places updatedPlaceholder column in the first position
+			if (columnA.name === "updatedPlaceholder") return -1;
+			if (columnB.name === "updatedPlaceholder") return 1;
+			// Always places select column in the second position
+			if (columnA.name === "select") return -1;
+			if (columnB.name === "select") return 1;
+			// Always places placeholder column in the last position
+			if (columnA.name === "placeholder") return 1;
+			if (columnB.name === "placeholder") return -1;
+
+			const indexA = newValue.indexOf(columnA);
+			const indexB = newValue.indexOf(columnB);
+
+			// If either of the columns is not visible, use default ordering
+			if (indexA === -1 || indexB === -1) return 0;
+
+			return indexA - indexB;
+		})
+});
 const hidableSortedColumns = computed(() =>
 	orderedColumns.value.filter(column => column.hidable)
 );

+ 29 - 16
frontend/src/pages/Admin/Users/index.vue

@@ -1,9 +1,11 @@
 <script setup lang="ts">
 import { defineAsyncComponent, ref, onMounted } from "vue";
 import { useRoute } from "vue-router";
+import { storeToRefs } from "pinia";
 import { useModalsStore } from "@/stores/modals";
 import { useUserAuthStore } from "@/stores/userAuth";
 import { TableColumn, TableFilter, TableEvents } from "@/types/advancedTable";
+import { useConfigStore } from "@/stores/config";
 
 const AdvancedTable = defineAsyncComponent(
 	() => import("@/components/AdvancedTable.vue")
@@ -12,6 +14,9 @@ const ProfilePicture = defineAsyncComponent(
 	() => import("@/components/ProfilePicture.vue")
 );
 
+const configStore = useConfigStore();
+const { oidcAuthentication } = storeToRefs(configStore);
+
 const route = useRoute();
 
 const columnDefault = ref<TableColumn>({
@@ -63,14 +68,18 @@ const columns = ref<TableColumn[]>([
 		minWidth: 230,
 		defaultWidth: 230
 	},
-	{
-		name: "oidcSub",
-		displayName: "OIDC sub",
-		properties: ["services.oidc.sub"],
-		sortProperty: "services.oidc.sub",
-		minWidth: 115,
-		defaultWidth: 115
-	},
+	...(oidcAuthentication.value
+		? [
+				{
+					name: "oidcSub",
+					displayName: "OIDC sub",
+					properties: ["services.oidc.sub"],
+					sortProperty: "services.oidc.sub",
+					minWidth: 115,
+					defaultWidth: 115
+				}
+			]
+		: []),
 	{
 		name: "role",
 		displayName: "Role",
@@ -126,13 +135,17 @@ const filters = ref<TableFilter[]>([
 		filterTypes: ["contains", "exact", "regex"],
 		defaultFilterType: "contains"
 	},
-	{
-		name: "oidcSub",
-		displayName: "OIDC sub",
-		property: "services.oidc.sub",
-		filterTypes: ["contains", "exact", "regex"],
-		defaultFilterType: "contains"
-	},
+	...(oidcAuthentication.value
+		? [
+				{
+					name: "oidcSub",
+					displayName: "OIDC sub",
+					property: "services.oidc.sub",
+					filterTypes: ["contains", "exact", "regex"],
+					defaultFilterType: "contains"
+				}
+			]
+		: []),
 	{
 		name: "role",
 		displayName: "Role",
@@ -266,7 +279,7 @@ onMounted(() => {
 					slotProps.item._id
 				}}</span>
 			</template>
-			<template #column-oidcSub="slotProps">
+			<template v-if="oidcAuthentication" #column-oidcSub="slotProps">
 				<span
 					v-if="slotProps.item.services.oidc"
 					:title="slotProps.item.services.oidc.sub"

+ 1 - 1
musare.sh

@@ -173,7 +173,7 @@ runDockerCommand()
 
     if [[ ${2} == "build" && ${buildServices} != "" ]]; then
         # shellcheck disable=SC2086
-        ${dockerCompose} build ${buildServices}
+        ${dockerCompose} build --pull ${buildServices}
     fi
 
     if [[ ${2} == "ps" || ${2} == "logs" ]]; then