Merge pull request #42 from vivekshresta/master
Changes to GatewayResourceProfile
diff --git a/airavata/model/appcatalog/gatewayprofile/ttypes.py b/airavata/model/appcatalog/gatewayprofile/ttypes.py
index 6908a39..1866336 100644
--- a/airavata/model/appcatalog/gatewayprofile/ttypes.py
+++ b/airavata/model/appcatalog/gatewayprofile/ttypes.py
@@ -322,6 +322,7 @@
- loginUserName
- fileSystemRootLocation
- resourceSpecificCredentialStoreToken
+ - userStorageQuota
"""
thrift_spec = (
@@ -330,13 +331,15 @@
(2, TType.STRING, 'loginUserName', 'UTF8', None, ), # 2
(3, TType.STRING, 'fileSystemRootLocation', 'UTF8', None, ), # 3
(4, TType.STRING, 'resourceSpecificCredentialStoreToken', 'UTF8', None, ), # 4
+ (5, TType.I64, 'userStorageQuota', None, None, ), # 5
)
- def __init__(self, storageResourceId=None, loginUserName=None, fileSystemRootLocation=None, resourceSpecificCredentialStoreToken=None,):
+ def __init__(self, storageResourceId=None, loginUserName=None, fileSystemRootLocation=None, resourceSpecificCredentialStoreToken=None, userStorageQuota=None,):
self.storageResourceId = storageResourceId
self.loginUserName = loginUserName
self.fileSystemRootLocation = fileSystemRootLocation
self.resourceSpecificCredentialStoreToken = resourceSpecificCredentialStoreToken
+ self.userStorageQuota = userStorageQuota
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
@@ -367,6 +370,11 @@
self.resourceSpecificCredentialStoreToken = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
+ elif fid == 5:
+ if ftype == TType.I64:
+ self.userStorageQuota = iprot.readI64()
+ else:
+ iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
@@ -393,6 +401,10 @@
oprot.writeFieldBegin('resourceSpecificCredentialStoreToken', TType.STRING, 4)
oprot.writeString(self.resourceSpecificCredentialStoreToken.encode('utf-8') if sys.version_info[0] == 2 else self.resourceSpecificCredentialStoreToken)
oprot.writeFieldEnd()
+ if self.userStorageQuota is not None:
+ oprot.writeFieldBegin('userStorageQuota', TType.I64, 5)
+ oprot.writeI64(self.userStorageQuota)
+ oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceEditor.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceEditor.vue
index f3a79ae..b94509e 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceEditor.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceEditor.vue
@@ -3,6 +3,9 @@
<b-form-group label="Login username" label-for="login-username">
<b-form-input id="login-username" v-model="data.loginUserName" type="text" />
</b-form-group>
+ <b-form-group label="User Storage Quota (in KB)" label-for="user-storage-quota">
+ <b-form-input id="user-storage-quota" v-model="data.userStorageQuota" type="number" v-on:keypress = "handleTypedInput" v-on:paste= "handlePastedInput" />
+ </b-form-group>
<b-form-group label="File System Root Location" label-for="filesystem-root-location">
<b-form-input id="filesystem-root-location" v-model="data.fileSystemRootLocation" type="text" />
</b-form-group>
@@ -38,6 +41,19 @@
required: true
}
},
+ methods: {
+ handleTypedInput(event) {
+ const charCode = event.which || event.keyCode;
+ if ((charCode >= 48 && charCode <= 57) || charCode === 46)
+ return true;
+ event.preventDefault();
+ },
+ handlePastedInput(event) {
+ const num = Number(event.clipboardData.getData('text/plain'));
+ if (num >= 0)
+ return true;
+ event.preventDefault();
+ },
+ }
};
</script>
-
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue
index b1480f6..f26221c 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue
@@ -80,7 +80,8 @@
showNewItemEditor: false,
newStoragePreference: null,
storageResourceNames: null,
- credentials: null
+ credentials: null,
+ defaultUserStorageQuota: "N/A"
};
},
computed: {
@@ -102,6 +103,11 @@
formatter: value => this.getCredentialName(value)
},
{
+ label: "User Storage Quota (In KB)",
+ key: "userStorageQuota",
+ formatter: value => this.getUserStorageQuota(value)
+ },
+ {
label: "File System Location",
key: "fileSystemRootLocation"
},
@@ -177,6 +183,12 @@
}
return "...";
},
+ getUserStorageQuota(value) {
+ if(value === null || value === 0)
+ return this.defaultUserStorageQuota;
+ else
+ return value;
+ },
updatedStoragePreference(newValue) {
this.$emit("updated", newValue);
},
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/StoragePreference.js b/django_airavata/apps/api/static/django_airavata_api/js/models/StoragePreference.js
index 82087b7..6df10fa 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/StoragePreference.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/StoragePreference.js
@@ -3,6 +3,7 @@
const FIELDS = [
"storageResourceId",
"loginUserName",
+ "userStorageQuota",
"fileSystemRootLocation",
"resourceSpecificCredentialStoreToken"
];