Skip to content

Commit

Permalink
Merge pull request #1251 from slntopp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
SazukinPavel authored Nov 17, 2023
2 parents 1433107 + 80d34ce commit d48c10e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
10 changes: 7 additions & 3 deletions admin-ui/src/components/search/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,13 @@ const setCurrentFieldsKeys = () => {
}
}
currentFieldsKeys.value = newCurrentFields.filter(
(key) => !!allFields.value?.find((f) => f.key === key)
);
currentFieldsKeys.value = [
...new Set(
newCurrentFields.filter(
(key) => !!allFields.value?.find((f) => f.key === key)
)
),
];
};
const changeFields = ({ key }, value) => {
if (value) {
Expand Down
21 changes: 17 additions & 4 deletions admin-ui/src/components/showcases_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,25 @@
</router-link>
</template>

<template v-slot:[`item.sorter`]="{ item }">
<v-skeleton-loader v-if="updatedShowcase === item.uuid" type="text" />
<v-text-field
v-else
style="max-width: 50px"
type="number"
:disabled="!!updatedShowcase"
:value="item.sorter"
@change="updateShowcase(item, { key: 'sorter', value: +$event })"
/>
</template>

<template v-slot:[`item.public`]="{ item }">
<v-skeleton-loader v-if="updatedShowcase === item.uuid" type="text" />
<v-switch
v-else
:readonly="!!updatedShowcase"
:input-value="item.public"
@change="changeEnabled(item, $event)"
@change="updateShowcase(item, { key: 'public', value: $event })"
/>
</template>
</nocloud-table>
Expand All @@ -51,17 +63,18 @@ const headers = ref([
{ text: "Title", value: "title" },
{ text: "Preview", value: "preview" },
{ text: "Enabled", value: "public" },
{ text: "Sorter", value: "sorter" },
]);
const changeEnabled = async (item, value) => {
const updateShowcase = async (item, { key, value }) => {
try {
updatedShowcase.value = item.uuid;
const data = { ...item, public: value };
const data = { ...item, [key]: value };
await api.showcases.update(data);
store.commit("showcases/replaceShowcase", data);
} catch {
store.commit("snackbar/showSnackbarError", {
message: "Error during update showcase enabled",
message: "Error during update showcase",
});
} finally {
updatedShowcase.value = "";
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1
github.com/rabbitmq/amqp091-go v1.9.0
github.com/rs/cors v1.10.1
github.com/slntopp/nocloud-proto v0.0.0-20231114150046-4971fd131496
github.com/slntopp/nocloud-proto v0.0.0-20231117131026-4eabeef236f4
github.com/spf13/viper v1.17.0
github.com/stoewer/go-strcase v1.3.0
github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/slntopp/nocloud-proto v0.0.0-20231114150046-4971fd131496 h1:syITq4mprAvQt8LSw2lOA1/GjLykVjeRgLlLiKtk+lE=
github.com/slntopp/nocloud-proto v0.0.0-20231114150046-4971fd131496/go.mod h1:CwJXNOt1iMCIskt/QA0Toyu2kdCmzYqEJ47e/G7Rg7E=
github.com/slntopp/nocloud-proto v0.0.0-20231117131026-4eabeef236f4 h1:ZHKPElCEb0zsQNXZtPv/OT9RRitT2bPKc9k7fsbeZIQ=
github.com/slntopp/nocloud-proto v0.0.0-20231117131026-4eabeef236f4/go.mod h1:CwJXNOt1iMCIskt/QA0Toyu2kdCmzYqEJ47e/G7Rg7E=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY=
Expand Down

0 comments on commit d48c10e

Please sign in to comment.