This repository has been archived by the owner on Nov 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
prefs.js
62 lines (49 loc) · 2.06 KB
/
prefs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import Gio from 'gi://Gio';
import Adw from 'gi://Adw';
import Gtk from 'gi://Gtk';
import { ExtensionPreferences, gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
export default class KubeConfigExtensionPreferences extends ExtensionPreferences {
fillPreferencesWindow(window) {
// Create a settings object
window._settings = this.getSettings();
// Create a preferences page, with a single group
const page = new Adw.PreferencesPage({
title: _('General'),
icon_name: 'dialog-information-symbolic',
});
window.add(page);
const group = new Adw.PreferencesGroup({
title: _('Appearance'),
description: _('Configure the appearance of the extension'),
});
page.add(group);
// Create a new preferences row
const row = new Adw.SwitchRow({
title: _('Show current context'),
subtitle: _('Whether to show the current kubernetes context'),
});
group.add(row);
// Bind the row to the `show-current-context` key
window._settings.bind('show-current-context', row, 'active',
Gio.SettingsBindFlags.DEFAULT);
const groupInstrumentation = new Adw.PreferencesGroup({
title: _('Instrumentation'),
description: _('Configure extension tools'),
});
page.add(groupInstrumentation);
// Create a new preferences row
const clusterReachability = new Adw.SpinRow({
title: _('Poll context cluster every (sec)'),
subtitle: _('Cluster context reachability poll interval'),
adjustment: new Gtk.Adjustment({
lower: 5,
upper: 60,
step_increment: 1
})
});
groupInstrumentation.add(clusterReachability);
// Bind the row to the `cluster-poll-interval-seconds` key
window._settings.bind('cluster-poll-interval-seconds', clusterReachability,
'value', Gio.SettingsBindFlags.DEFAULT);
}
}