summaryrefslogtreecommitdiffstats
path: root/tools/pharos-dashboard/dashboard/models.py
blob: 973066b872da6d69204769f4e3fc9a8d03fe4f62 (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
from django.contrib.auth.models import User
from django.db import models


class Resource(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=100, unique=True)
    slavename = models.CharField(max_length=50, blank=True, null=True)
    description = models.CharField(max_length=300, blank=True, null=True)
    url = models.CharField(max_length=100, blank=True, null=True)
    owners = models.ManyToManyField(User)

    class Meta:
        db_table = 'resource'

    def __str__(self):
        return self.name

class ResourceUtilization(models.Model):
    POD_STATUS = {
        'online': 1,
        'idle': 2,
        'offline': 3
    }

    id = models.AutoField(primary_key=True)
    timestamp = models.DateTimeField(auto_created=True)
    pod_status = models.IntegerField()