fix: env filters + properties (#5642)
* fix: env filters * fix: server * fix: lint * fix: properties
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<div class="relative h-full w-full select-none overflow-y-auto">
|
<div class="relative h-full w-full select-none overflow-y-auto">
|
||||||
<div v-if="propsData" class="flex h-full w-full flex-col justify-between gap-4 overflow-y-auto">
|
<div v-if="propsData" class="flex h-full w-full flex-col justify-between gap-4 overflow-y-auto">
|
||||||
<Admonition
|
<Admonition
|
||||||
v-if="missingKnownProperties.length > 0"
|
v-if="hasNoProperties"
|
||||||
type="warning"
|
type="warning"
|
||||||
body="Some expected properties are missing from your server.properties - this usually means the server hasn't completed its first startup yet."
|
body="Some expected properties are missing from your server.properties - this usually means the server hasn't completed its first startup yet."
|
||||||
/>
|
/>
|
||||||
@@ -199,10 +199,18 @@ function syncFormFromData() {
|
|||||||
originalProperties.value = { ...flat }
|
originalProperties.value = { ...flat }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hasNoProperties = computed(() => Object.keys(liveProperties.value).length === 0)
|
||||||
|
|
||||||
|
const hasUnsavedChanges = computed(() =>
|
||||||
|
Object.keys(liveProperties.value).some(
|
||||||
|
(key) => liveProperties.value[key] !== originalProperties.value[key],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
propsData,
|
propsData,
|
||||||
(newData, oldData) => {
|
(newData) => {
|
||||||
if (newData && !oldData) {
|
if (newData && !hasUnsavedChanges.value) {
|
||||||
syncFormFromData()
|
syncFormFromData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -213,16 +221,6 @@ watch(powerState, () => {
|
|||||||
queryClient.invalidateQueries({ queryKey: queryKey.value })
|
queryClient.invalidateQueries({ queryKey: queryKey.value })
|
||||||
})
|
})
|
||||||
|
|
||||||
const missingKnownProperties = computed(() =>
|
|
||||||
Object.keys(KNOWN_PROPERTIES).filter((key) => !(key in liveProperties.value)),
|
|
||||||
)
|
|
||||||
|
|
||||||
const hasUnsavedChanges = computed(() =>
|
|
||||||
Object.keys(liveProperties.value).some(
|
|
||||||
(key) => liveProperties.value[key] !== originalProperties.value[key],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
function buildPatch(): Archon.Content.v1.PatchPropertiesFields {
|
function buildPatch(): Archon.Content.v1.PatchPropertiesFields {
|
||||||
const known: Record<string, string> = {}
|
const known: Record<string, string> = {}
|
||||||
const custom: Record<string, string> = {}
|
const custom: Record<string, string> = {}
|
||||||
|
|||||||
@@ -766,17 +766,17 @@ function mapProjectTypeToSearch(projectType: ProjectType): string {
|
|||||||
function getEnvironmentFilterGroups(client: boolean, server: boolean): string[][] {
|
function getEnvironmentFilterGroups(client: boolean, server: boolean): string[][] {
|
||||||
const groups: string[][] = []
|
const groups: string[][] = []
|
||||||
if (client && server) {
|
if (client && server) {
|
||||||
groups.push(['client_side:required'], ['server_side:required'])
|
groups.push(
|
||||||
|
['client_side:required', 'client_side:optional', 'client_side:unsupported'],
|
||||||
|
['server_side:required', 'server_side:optional'],
|
||||||
|
)
|
||||||
} else if (client) {
|
} else if (client) {
|
||||||
groups.push(
|
groups.push(
|
||||||
['client_side:optional', 'client_side:required'],
|
['client_side:optional', 'client_side:required'],
|
||||||
['server_side:optional', 'server_side:unsupported'],
|
['server_side:optional', 'server_side:unsupported'],
|
||||||
)
|
)
|
||||||
} else if (server) {
|
} else if (server) {
|
||||||
groups.push(
|
groups.push(['server_side:optional', 'server_side:required'])
|
||||||
['client_side:optional', 'client_side:unsupported'],
|
|
||||||
['server_side:optional', 'server_side:required'],
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
return groups
|
return groups
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user