summaryrefslogtreecommitdiffstats
path: root/install/static/service.js
blob: 467e56a81fafe57d87d08c867fef94e8502084d1 (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
function setupService(facet) {
    serviceForms.setup(facet);
}

var serviceForms = new ServiceForms();

function ServiceForms() {

    this.obj = "service";

    this.facets = ['details', 'hosts', 'assignhosts'];

    this.setup = function(facet) {
        if (this[facet]) {
            this[facet].setup();
        } else {
            this.unspecified.setup();
        }
    };

    this.hostListColumns = [ {title:"host",column:"managedby_host"} ];

    this.hosts = new AssociationList(
        this.obj,
        "hosts",
        "assignhosts",
        this.hostListColumns,
        this.facets
    );

    this.assignhosts = new AssociationForm(
        this.obj,
        "host",
        "assignhosts",
        this.facets,
        "fqdn",
        function() {
            return 'Add Hosts to service : ' + qs['pkey'];
        },
        BulkAssociator,
        "add_host"
    );

    this.detailsList = [
        ['identity', 'Service Details', [
            ['krbprincipalname', 'Kerberos Principal']
        ]]
    ];

    this.details = new DetailsForm(
        "service",
        this.detailsList,
        "krbprincipalname",
        this.facets
    );

    this.addProperties = [
        {title: 'Principal', id: 'pkey', type: 'text'}
    ];

    this.addOptionsFunction = function() {
        var options = {
            name: $('#pkey').val()
        };
        return options;
    };

    this.add = new EntityBuilder(
        "service",
        this.addProperties,
        this.addOptionsFunction
    );

    this.searchColumns = [
        {
            title: "Service",
            column: "krbprincipalname",
            render: function (current, cell) {
                renderPkeyColumn2('service', 'krbprincipalname', current, cell);
            }
        },
        {
            title: "Has Keytab",
            column: "has_keytab",
            render: renderSimpleColumn
        }
    ];

    this.search = new SearchForm(
        "service",
        "find",
        this.searchColumns
    );

    this.unspecified = this.search;
}