1
1
<!--
2
2
Copyright 2025 Google Inc. All rights reserved.
3
-
4
3
Licensed under the Apache License, Version 2.0 (the "License");
5
4
you may not use this file except in compliance with the License.
6
5
You may obtain a copy of the License at
7
-
8
6
http://www.apache .org /licenses/LICENSE-2.0
9
-
10
7
Unless required by applicable law or agreed to in writing, software
11
8
distributed under the License is distributed on an "AS IS" BASIS,
12
9
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +17,11 @@ limitations under the License.
20
17
<v-subheader>Layout</v-subheader>
21
18
<v-list-item>
22
19
<v-list-item-action>
23
- <v-switch v-model="settings.showLeftPanel" color="primary" @change="saveSettings()"></v-switch>
20
+ <v-switch
21
+ v-model="settings.showLeftPanel"
22
+ color="primary"
23
+ @change="saveSettings()"
24
+ ></v-switch>
24
25
</v-list-item-action>
25
26
<v-list-item-content>
26
27
<v-list-item-title>Show side panel</v-list-item-title>
@@ -31,9 +32,21 @@ limitations under the License.
31
32
</v-list-item>
32
33
33
34
<!-- AI Powered Features Main Setting -->
34
- <v-list-item v-if="systemSettings.LLM_PROVIDER" >
35
+ <v-list-item>
35
36
<v-list-item-action>
36
- <v-switch v-model="settings.aiPoweredFeaturesMain" color="primary" @change="updateAiFeatures" ></v-switch>
37
+ <v-tooltip bottom>
38
+ <template v-slot:activator="{ on, attrs }">
39
+ <div v-on="isAnyFeatureAvailable ? {} : on" v-bind="attrs">
40
+ <v-switch
41
+ v-model="settings.aiPoweredFeaturesMain"
42
+ color="primary"
43
+ @change="updateAiFeatures"
44
+ :disabled="!isAnyFeatureAvailable"
45
+ ></v-switch>
46
+ </div>
47
+ </template>
48
+ <span>This feature requires an LLM provider to be configured. Please contact your administrator.</span>
49
+ </v-tooltip>
37
50
</v-list-item-action>
38
51
<v-list-item-content>
39
52
<v-list-item-title>AI powered features (experimental)</v-list-item-title>
@@ -42,14 +55,21 @@ limitations under the License.
42
55
</v-list-item>
43
56
44
57
<!-- Child Setting: Event Summarization -->
45
- <v-list-item v-if="systemSettings.LLM_PROVIDER" >
58
+ <v-list-item>
46
59
<v-list-item-action class="ml-8">
47
- <v-switch
48
- v-model="settings.eventSummarization"
49
- color="primary"
50
- @change="saveSettings()"
51
- :disabled="!settings.aiPoweredFeaturesMain"
52
- ></v-switch>
60
+ <v-tooltip bottom>
61
+ <template v-slot:activator="{ on, attrs }">
62
+ <div v-on="isFeatureAvailable('llm_summarize') ? {} : on" v-bind="attrs">
63
+ <v-switch
64
+ v-model="settings.eventSummarization"
65
+ color="primary"
66
+ @change="saveSettings()"
67
+ :disabled="!settings.aiPoweredFeaturesMain || !isFeatureAvailable('llm_summarize')"
68
+ ></v-switch>
69
+ </div>
70
+ </template>
71
+ <span>Event summarization requires an LLM provider to be configured. Please contact your administrator.</span>
72
+ </v-tooltip>
53
73
</v-list-item-action>
54
74
<v-list-item-content class="ml-8">
55
75
<v-list-item-title>Event summarization</v-list-item-title>
@@ -60,14 +80,21 @@ limitations under the License.
60
80
</v-list-item>
61
81
62
82
<!-- Child Setting: AI Generated Queries -->
63
- <v-list-item v-if="systemSettings.LLM_PROVIDER" >
83
+ <v-list-item>
64
84
<v-list-item-action class="ml-8">
65
- <v-switch
66
- v-model="settings.generateQuery"
67
- color="primary"
68
- @change="saveSettings()"
69
- :disabled="!settings.aiPoweredFeaturesMain"
70
- ></v-switch>
85
+ <v-tooltip bottom>
86
+ <template v-slot:activator="{ on, attrs }">
87
+ <div v-on="isFeatureAvailable('nl2q') ? {} : on" v-bind="attrs">
88
+ <v-switch
89
+ v-model="settings.generateQuery"
90
+ color="primary"
91
+ @change="saveSettings()"
92
+ :disabled="!settings.aiPoweredFeaturesMain || !isFeatureAvailable('nl2q')"
93
+ ></v-switch>
94
+ </div>
95
+ </template>
96
+ <span>AI query generation requires an LLM provider to be configured. Please contact your administrator.</span>
97
+ </v-tooltip>
71
98
</v-list-item-action>
72
99
<v-list-item-content class="ml-8">
73
100
<v-list-item-title>AI generated queries</v-list-item-title>
@@ -76,9 +103,15 @@ limitations under the License.
76
103
>
77
104
</v-list-item-content>
78
105
</v-list-item>
106
+
107
+ <!-- Setting: Searching processing timelines -->
79
108
<v-list-item v-if="systemSettings.SEARCH_PROCESSING_TIMELINES">
80
109
<v-list-item-action>
81
- <v-switch v-model="settings.showProcessingTimelineEvents" color="primary" @change="saveSettings()"></v-switch>
110
+ <v-switch
111
+ v-model="settings.showProcessingTimelineEvents"
112
+ color="primary"
113
+ @change="saveSettings()"
114
+ ></v-switch>
82
115
</v-list-item-action>
83
116
<v-list-item-content>
84
117
<v-list-item-title>Include Processing Events</v-list-item-title>
@@ -90,18 +123,15 @@ limitations under the License.
90
123
</v-list>
91
124
</v-card>
92
125
</template>
93
-
94
126
<script>
95
127
import ApiClient from '../utils/RestApiClient'
96
-
97
128
const DEFAULT_SETTINGS = {
98
129
showLeftPanel: true,
99
130
aiPoweredFeaturesMain: false,
100
131
eventSummarization: false,
101
132
generateQuery: false,
102
133
showProcessingTimelineEvents: false,
103
134
}
104
-
105
135
export default {
106
136
data() {
107
137
return {
@@ -124,37 +154,41 @@ export default {
124
154
userSettings() {
125
155
return this.$store.state.settings
126
156
},
157
+ llmFeatures() {
158
+ return this.systemSettings.LLM_FEATURES_AVAILABLE || {}
159
+ },
160
+ isAnyFeatureAvailable() {
161
+ return Object.values(this.llmFeatures).some(available => available === true)
162
+ },
127
163
},
128
164
methods: {
129
165
saveSettings() {
130
166
ApiClient.saveUserSettings(this.settings)
131
- .then(() => this.$store.dispatch('updateUserSettings'))
167
+ .then(() => {
168
+ return this.$store.dispatch('updateUserSettings')
169
+ })
170
+ .then(() => {
171
+ this.settings = { ...this.userSettings }
172
+ })
132
173
.catch((error) => {
133
174
console.log(error)
134
175
})
135
176
},
136
177
updateAiFeatures() {
137
178
if (!this.settings.aiPoweredFeaturesMain) {
138
- this.settings.eventSummarization = false;
139
- this.settings.generateQuery = false;
179
+ this.settings.eventSummarization = false
180
+ this.settings.generateQuery = false
140
181
}
141
- this.saveSettings();
182
+ this.saveSettings()
183
+ },
184
+ isFeatureAvailable(featureName) {
185
+ return this.llmFeatures[featureName] === true
142
186
},
143
187
},
144
188
mounted() {
145
- this.settings = { ...this.userSettings }
146
-
147
- // Set default values when a user don't have any settings saved.
148
- if (!this.settings || !Object.keys(this.settings).length) {
149
- this.settings = { ...DEFAULT_SETTINGS }
150
- this.saveSettings()
151
- } else {
152
- // Ensure default values for new settings are applied if user settings are older
153
- this.settings.aiPoweredFeaturesMain = this.settings.aiPoweredFeaturesMain !== undefined ? this.settings.aiPoweredFeaturesMain : DEFAULT_SETTINGS.aiPoweredFeaturesMain;
154
- this.settings.eventSummarization = this.settings.eventSummarization !== undefined ? this.settings.eventSummarization : DEFAULT_SETTINGS.eventSummarization;
155
- this.settings.generateQuery = this.settings.generateQuery !== undefined ? this.settings.generateQuery : DEFAULT_SETTINGS.generateQuery;
156
- this.settings.showProcessingTimelineEvents = this.settings.showProcessingTimelineEvents !== undefined ? this.settings.showProcessingTimelineEvents : DEFAULT_SETTINGS.showProcessingTimelineEvents;
157
- }
189
+ // Set default settings if no user settings are defined.
190
+ this.settings = { ...DEFAULT_SETTINGS, ...this.userSettings };
191
+ this.saveSettings();
158
192
},
159
193
}
160
194
</script>
0 commit comments